CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to initialize zero vectorField? (https://www.cfd-online.com/Forums/openfoam-programming-development/255457-how-initialize-zero-vectorfield.html)

S03r3n April 10, 2024 08:37

How to initialize zero vectorField?
 
Hello together,

how can I initialize a vectorField with only zero values?
The following command does not work for me:

const vectorField abc=vectorField::zero;

Thanks in advance!

Best regards

olesen April 11, 2024 02:46

Quote:

Originally Posted by S03r3n (Post 867501)
Hello together,

how can I initialize a vectorField with only zero values?
The following command does not work for me:

const vectorField abc=vectorField::zero;

Thanks in advance!

Best regards


Odd. How can you initialize a vectorField without any size????
The following would work, but this is also clear from the documentation:
Code:

label len = ...;

vectorField abc(len, Zero);



All times are GMT -4. The time now is 15:01.