The type of dynamics

Dear all,

How can I know the type of dynamics. For example I’d like to check whether my cell is bounceback cell or not. I found that lattice.get(iX,iY).getdynamics() gives me the reference to dynamics, but not the type of object itself. Is there any possibility to know the type or just to add additional function member to the Dynamics object?

Thank you,
Alex

You can use the typeid operator in C++, by something akin to the following: if ( typeid(lattice.get(iX,iY).getDynamics() == typeid(BounceBack) ) . But this is plain ugly and will not work in parallel. Adding a new member to the Dynamics object is certainly more elegant, although it breaks the compatibility of your code with future OpenLB releases. What about keeping track of your cell types in a separate array? That is, instantiate a ScalarField of same extent as your lattice, and write unique identifiers for the cell type into this field?

Thank you Jonas!

Also it is interesting for me to know on which level I can add additional members or functions to have compatibility with parallalel calculations?

Hi Alex,
as long as you add classes which are derived of Dynamics or PostProcessors then if you do not something really weird then it should be compatible with the parallelization. If you want to add something else, then it depends on what you add.

Cheers,
Orestis

Thank you Orestis!