|
[Sponsors] |
OF-4.x: Multiple Inheritance of a functionObject |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 20, 2016, 11:08 |
OF-4.x: Multiple Inheritance of a functionObject
|
#1 |
Member
Join Date: Jul 2011
Posts: 54
Rep Power: 15 |
Hey all,
I am trying to write a new functionObject and adjust it a little bit so that it fits the coding style of the new functionObjects library better. Now, I am facing a problem since my functionObjectt is supposed to use both features of the writeFiles class and features of the fieldExpression class. These are both class where other functionObjects are derived from. I don't want to make more than one functionObject out of it, since its usability is very limited and special for my cases. So I was thinking to derive from both writeFiles and fieldExpression classes. The beginnings of my class files look like this: test.H: Code:
namespace Foam { namespace functionObjects { class test : public fieldExpression, public writeFiles { ... Code:
namespace Foam { namespace functionObjects { defineTypeNameAndDebug(cavEroCDef, 0); addToRunTimeSelectionTable(functionObject, cavEroCDef, dictionary); } } ... Code:
In file included from /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/token.H:49:0, from /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:35, from /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/functionObject.H:115, from /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/regionFunctionObject.H:42, from /local/OpenFOAM/OpenFOAM-4.x/src/finiteVolume/lnInclude/fvMeshFunctionObject.H:46, from /local/OpenFOAM/OpenFOAM-4.x/src/functionObjects/field/lnInclude/fieldExpression.H:43, from cavEroCDef/cavEroCDef.H:44, from cavEroCDef/cavEroCDef.C:26: /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/functionObject.H: In instantiation of ‘static Foam::autoPtr<Foam::functionObject> Foam::functionObject::adddictionaryConstructorToTable<functionObjectType>::New(const Foam::word&, const Foam::Time&, const Foam::dictionary&) [with functionObjectType = Foam::functionObjects::cavEroCDef]’: /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/functionObject.H:164:9: required from ‘Foam::functionObject::adddictionaryConstructorToTable<functionObjectType>::adddictionaryConstructorToTable(const Foam::word&) [with functionObjectType = Foam::functionObjects::cavEroCDef]’ cavEroCDef/cavEroCDef.C:43:5: required from here /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:72:64: error: ‘Foam::functionObject’ is an ambiguous base of ‘Foam::functionObjects::cavEroCDef’ return autoPtr<baseType>(new baseType##Type parList); \ ^ /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/functionObject.H:164:9: note: in expansion of macro ‘declareRunTimeSelectionTable’ declareRunTimeSelectionTable ^ /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/functionObject.H: In static member function ‘static Foam::autoPtr<Foam::functionObject> Foam::functionObject::adddictionaryConstructorToTable<functionObjectType>::New(const Foam::word&, const Foam::Time&, const Foam::dictionary&) [with functionObjectType = Foam::functionObjects::cavEroCDef]’: /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:73:9: warning: control reaches end of non-void function [-Wreturn-type] } \ ^ /local/OpenFOAM/OpenFOAM-4.x/src/OpenFOAM/lnInclude/functionObject.H:164:9: note: in expansion of macro ‘declareRunTimeSelectionTable’ declareRunTimeSelectionTable ^ /local/OpenFOAM/OpenFOAM-4.x/wmake/rules/General/transform:8: recipe for target '/local/OpenFOAM/OpenFOAM-4.x/platforms/linux64GccDPInt32Opt/src/functionObjects/cavErosion/cavEroCDef/cavEroCDef.o' failed make: *** [/local/OpenFOAM/OpenFOAM-4.x/platforms/linux64GccDPInt32Opt/src/functionObjects/cavErosion/cavEroCDef/cavEroCDef.o] Error 1 Does anybody have an idea how to solve this problem? It is really tempting for me to derive from both classes, since I use both their features. Thanks in advance, Andreas |
|
September 21, 2016, 11:01 |
|
#2 |
Member
Join Date: Jul 2011
Posts: 54
Rep Power: 15 |
Consider this problem as solved, since I inherited from writeFields only and got basically all I wanted.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to set periodic boundary conditions | Ganesh | FLUENT | 15 | November 18, 2020 07:09 |
[OpenFOAM.org] Install openFOAM 3.0.1 in Ubuntu 16.04 LTS from Deb packs | Pier84 | OpenFOAM Installation | 4 | June 18, 2016 17:22 |
Create registered object at runtime using a functionObject | CedricVH | OpenFOAM Programming & Development | 21 | November 28, 2012 06:04 |
OpenFOAM static build on Cray XT5 | asaijo | OpenFOAM Installation | 9 | April 6, 2011 13:21 |
Multiple inheritance, function pointers or? | ngj | OpenFOAM | 0 | March 20, 2009 11:36 |