Bernhard |
December 13, 2012 06:20 |
runTimeSelectionTable for child class of probesFunctionObject
2 Attachment(s)
The reason I am working on this is already explained in this topic: http://www.cfd-online.com/Forums/ope...sed-probe.html
My starting point (amongst others ;)), is to start with a functionObject that is derived from the probesFunctionObject. I attached all files, but for convenience will copy the C and H file here. I also attached a minimal reproductive test case
Attachment 17605
Attachment 17606
probeFinishControlFunctionObject.C
Code:
#include "probeFinishControlFunctionObject.H"
#include "addToRunTimeSelectionTable.H"
namespace Foam
{
defineTypeNameAndDebug(probeFinishControlFunctionObject, 1);
addToRunTimeSelectionTable
(
functionObject,
probeFinishControlFunctionObject,
dictionary
);
// Constructor
probeFinishControlFunctionObject::probeFinishControlFunctionObject
(
const word &name,
const Time& t,
const dictionary& dict
)
:
probesFunctionObject(name,t,dict)
{
// Do nothing
}
bool probeFinishControlFunctionObject::start()
{
Info << "Executed this fancy functionObject!!" << endl;
return true;
}
} // namespace Foam
probeFinishControlFunctionObject.H
Code:
#ifndef probeFinishControlFunctionObject_H
#define probeFinishControlFunctionObject_H
//#include "functionObject.H"
#include "dictionary.H"
#include "OFstream.H"
#include "HashPtrTable.H"
#include "boolList.H"
#include "Field.H"
#include "probesFunctionObject.H"
namespace Foam
{
class probeFinishControlFunctionObject
:
public probesFunctionObject
{
// Private Member Functions
//- Disallow default bitwise copy construct
probeFinishControlFunctionObject(const probeFinishControlFunctionObject&);
//- Disallow default bitwise assignment
void operator=(const probeFinishControlFunctionObject&);
public:
TypeName("probeFinishControl");
probeFinishControlFunctionObject
(
const word &name,
const Time& t,
const dictionary& dict
);
bool start();
bool execute(bool execute);
bool read(const dictionary& dict);
};
} // namespace Foam
#endif
This compiles well into a library, but creates the following error-messages on running.
Quote:
...
Starting time loop
--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file POSIX.C at line 1175
dlopen error : .../platforms/linux64GccDPOpt/lib/libprobeFinishControl.so: undefined symbol: _ZN4Foam32probeFinishControlFunctionObject7execute Eb
--> FOAM Warning :
From function dlLibraryTable::open(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 96
could not load "libprobeFinishControl.so"
--> FOAM Warning :
From function dlLibraryTable::open(const dictionary&, const word&, const TablePtr&)
in file lnInclude/dlLibraryTableTemplates.C at line 67
Could not open library "libprobeFinishControl.so"
--> FOAM FATAL ERROR:
Unknown function type probeFinishControl
Table of functionObjects is empty
From function functionObject::New(const word& name, const Time&, const dictionary&)
in file db/functionObjects/functionObject/functionObject.C at line 74.
FOAM exiting
|
Where does the error with the library loading come from? With some simpler functionObjects that I compile myself (just copies of other functionObjects), I do not get these messages.
Apparently my functionObject does not appear properly in the runTime-selection tables. Probably because I inherit the class not directly from functionObject, but from probesFunctionObject (defined by typedef src/sampling/probes/probesFunctionObject ) in . But what is the correct way to do this (if any)? Am I conceptually missing something here? probesFunctionObject is already added to the runTimeSelectionTable, I am unsure whether it's child classes could be added again (probably not).
Any other hints in how this issue should be approach are welcome as well!
|