Lookup autoPtr from fvMesh
Dear openFOAM'ers
I am trying to access to the turbulence properties from a class where I have access to the mesh. That is, in createFields.H I have: singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::RASModel> turbulence ( incompressible::RASModel::New(U, phi, laminarTransport) ); And I would now like to access the pointer named "turbulence" from another class. I thought it would be possible to access it in the way a dictionary can be accessed in another class, where the mesh has been passed and named mesh_: dictionary transport = mesh_.lookupObject<IOdictionary>("transportPropert ies"); So what I need might be something like: autoPtr<incompressible::RASModel> turbulence = mesh_.lookupObject<incompressible::RASModel>("turb ulence"); The expression above is of course not consistent, so I would appreciate any help or comments on how to access such a pointer from the objectRegistry! Best regards Misha |
It appears that RASModel is derived from IOdictionary, which means that any turbulence model can be accessed by looking for it's typeName (like "kEpsilon", for instance). The (object).names() member function should give you a list of all objects currently registered with the mesh.
Also, any particular reason why you're looking for an autoPtr? Wouldn't a const reference to the object do the trick? |
Thank you for your answer!
I see that my pointer is not listed in mesh.names(), so I guess I cannot access it that way. I want to be able to solve my equations using a member function in my new class; Code:
My approach to the problem may be wrong - if so, I would really appreciate your comments! ~ Misha |
All times are GMT -4. The time now is 18:41. |