CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   dynamic_cast and lookupObject (

kev4573 December 10, 2009 19:12

dynamic_cast and lookupObject
I am having trouble compiling a custon dynamicFvMesh library. I've taken what is essentially the mixerGgiFvMesh and added these lines to it


121    word field("p");
123    const volScalarField& p = lookupObject<volScalarField>(field);

And get a compiler error like this.. I've seen lookups like this in other classes derived from dynamicFvMesh and they compile just fine.

Any help is appreciated


/home/kevin/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/typeInfo.H: In function ‘bool Foam::isA(const Type&) [with TestType = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>, Type = Foam::regIOobject]’:
/home/kevin/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/objectRegistryTemplates.C:44:  instantiated from ‘Foam::wordList Foam::objectRegistry::names() const [with Type = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]’
/home/kevin/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/objectRegistryTemplates.C:139:  instantiated from ‘const Type& Foam::objectRegistry::lookupObject(const Foam::word&) const [with Type = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]’
freeRotatingGgiFvMesh/freeRotatingGgiFvMesh.C:123:  instantiated from here
/home/kevin/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude/typeInfo.H:126: error: cannot dynamic_cast ‘(const Foam::regIOobject*)t’ (of type ‘const class Foam::regIOobject*’) to type ‘const struct Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>*’ (target is not pointer or reference to complete type)

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