Skip to content
Snippets Groups Projects
Commit 447c8509 authored by Henry Weller's avatar Henry Weller
Browse files

functionObjectList: Added support for 'libs' to load libraries for all functionObjects

e.g.

functions
{
    libs ("libfieldFunctionObjects.so");

    div
    {
        type            div;
        field           U;
        executeControl  writeTime;
        writeControl    writeTime;
    }

    Q
    {
        type            Q;
        executeControl  writeTime;
        writeControl    writeTime;
    }
}
parent af57fd2a
Branches
Tags
No related merge requests found
...@@ -50,7 +50,7 @@ Foam::functionObject::functionObject(const word& name) ...@@ -50,7 +50,7 @@ Foam::functionObject::functionObject(const word& name)
Foam::autoPtr<Foam::functionObject> Foam::functionObject::New Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
( (
const word& name, const word& name,
const Time& t, const Time& runTime,
const dictionary& dict const dictionary& dict
) )
{ {
...@@ -63,7 +63,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New ...@@ -63,7 +63,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
if (dict.found("functionObjectLibs")) if (dict.found("functionObjectLibs"))
{ {
const_cast<Time&>(t).libs().open const_cast<Time&>(runTime).libs().open
( (
dict, dict,
"functionObjectLibs", "functionObjectLibs",
...@@ -72,7 +72,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New ...@@ -72,7 +72,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
} }
else else
{ {
const_cast<Time&>(t).libs().open const_cast<Time&>(runTime).libs().open
( (
dict, dict,
"libs", "libs",
...@@ -102,7 +102,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New ...@@ -102,7 +102,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<functionObject>(cstrIter()(name, t, dict)); return autoPtr<functionObject>(cstrIter()(name, runTime, dict));
} }
......
...@@ -160,8 +160,8 @@ public: ...@@ -160,8 +160,8 @@ public:
autoPtr, autoPtr,
functionObject, functionObject,
dictionary, dictionary,
(const word& name, const Time& t, const dictionary& dict), (const word& name, const Time& runTime, const dictionary& dict),
(name, t, dict) (name, runTime, dict)
); );
......
...@@ -284,12 +284,19 @@ bool Foam::functionObjectList::read() ...@@ -284,12 +284,19 @@ bool Foam::functionObjectList::read()
<< exit(FatalIOError); << exit(FatalIOError);
} }
const dictionary& functionDicts = entryPtr->dict(); const dictionary& functionsDict = entryPtr->dict();
newPtrs.setSize(functionDicts.size()); const_cast<Time&>(time_).libs().open
newDigs.setSize(functionDicts.size()); (
functionsDict,
"libs",
functionObject::dictionaryConstructorTablePtr_
);
newPtrs.setSize(functionsDict.size());
newDigs.setSize(functionsDict.size());
forAllConstIter(dictionary, functionDicts, iter) forAllConstIter(dictionary, functionsDict, iter)
{ {
const word& key = iter().keyword(); const word& key = iter().keyword();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment