How to go through every element of a field?
Hello Dear Foamers~!
In my project i want to define a complex source field. For example, I want solve the equation: Code:
volScalarField p; Quote:
1. one field of every cell center's position must be obtained, that can be achieved by: Code:
volVectorField centerPostions = mesh.C(); Code:
for(i = first_element_index, i <= last_element_index, i++) I am open for every advices! Thanks very much! |
One possible way?
As every field can be seen as UList<Type>, so it comes to me that if method inside the class template can help.
|
You are looking "forAll" (search the forum for this keyword).
|
Problem almost solved!
Thank you very much for your response!
After searching and studying the threads of the forum with key word "forAll". I have got the basic understanding of the macro "forAll". What's more, I have developed my own "manual" method in order to scan a field: Code:
Foam::vector * i; Quote:
Quote:
|
All times are GMT -4. The time now is 12:43. |