CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Line of Code (https://www.cfd-online.com/Forums/openfoam/81264-line-code.html)

deji October 21, 2010 09:20

Line of Code
 
Good morning FOAMers. I have a question about a style of coding I have seen quite common in OpenFOAM and I do not quite comprehend it, and here it is:

1)mesh.boundary()[patchi].name()
2)mesh.magSf().boundaryField()[patchi]

Can someone kindly explain these two lines of coding ?:confused:

kathrin_kissling October 21, 2010 11:05

Hi deji,

it might has been answered before...

mesh.boundary()[patchi].name():

You are taking your mesh (guessing fvMesh) and take a reference to your boundary mesh. .boundary()
[patchI] gives you the ith patch. I imagine this line within a forAll loop. So you are looping over all boundary patches and patchI is the actual one.
.name() gives you the name of it.

Cool?

More cool you can get all this information from the doxygen. If you go to the fvMesh class you will find the member function boundary(). And from there its easy.

Perhaps you can now try to figure out the second one on your own.


Hope this helps!


All times are GMT -4. The time now is 20:32.