CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM

function objects and virtual inheritance

Register Blogs Members List Search Today's Posts Mark Forums Read

LinkBack Thread Tools Display Modes
Old   April 6, 2011, 05:17
Default function objects and virtual inheritance
New Member
Michael Buchmayr
Join Date: Mar 2010
Posts: 16
Rep Power: 7
MichiB is on a distinguished road
Hello Friends!

I'm having a little programming problem here, so hopefully one of you C++ experts can help me out of it!

I have programmed multiple function objects, using three 3 levels of inheritance.
1st) BaseLevel 2nd) MethodsLevel 3) CustomizedMethods- and OutputLevel

In order to overcome the diamond problem, I introduced virtual inheritances (e.g. class B :: virtual public A).

This however causes the following compilation error message:

/graz/home/openfoam/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude/IOOutputFilter.C: In constructor ‘Foam::IOOutputFilter<OutputFilter>::IOOutputFilte r(const Foam::word&, const Foam:bjectRegistry&, const Foam::fileName&, Foam::IOobject::readOption, bool) [with OutputFilter = Foam::TurboPressure]’:
/graz/home/openfoam/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude/OutputFilterFunctionObject.C:78: instantiated from ‘bool Foam::OutputFilterFunctionObject<OutputFilter>::st art() [with OutputFilter = Foam::TurboPressure]’
HierarchyLevel2/TurboPressure/TurboPressureFunctionObject.C:41: instantiated from here
/graz/home/openfoam/OpenFOAM/OpenFOAM-1.5-dev/src/sampling/lnInclude/IOOutputFilter.C:53: error: no matching function for call to ‘Foam::TurboBase::TurboBase()’
lnInclude/TurboBase.H:157: note: candidates are: Foam::TurboBase::TurboBase(const Foam::word&, const Foam:bjectRegistry&, const Foam::dictionary&, bool)
lnInclude/TurboBase.H:113: note: Foam::TurboBase::TurboBase(const Foam::TurboBase&)
make: *** [Make/linux64GccDPOpt/TurboPressureFunctionObject.o] Error 1

Apparently I'm calling the constructor Foam::TurboBase::TurboBase() on line 53 of file IOOutputFilter.C.
I don't know why the line's actual constructor Foam::TurboBase::TurboBase(const Foam::word&, const Foam:bjectRegistry&, const Foam::dictionary&, bool) is not called, but it certainly has to do with the virtual inheritance declaration.

Any hints ????
MichiB is offline   Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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