From aff00a2e7ed20b5746ff64d74021dfe17df35fb4 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 31 Jan 2020 08:18:10 +0000 Subject: [PATCH] dlLibraryTable: Simplified and rationalised the handling of dynamic library loading Rather than being tied to the Time class the dlLibraryTable libs is now a global variable in the Foam namespace which is accessable by any class needing to load dynamic libraries, in particular argList, Time and codeStream. --- src/OpenFOAM/db/Time/Time.C | 18 +- src/OpenFOAM/db/Time/Time.H | 18 +- .../functionEntries/codeStream/codeStream.C | 8 +- .../db/dynamicLibrary/codedBase/codedBase.C | 14 +- .../db/dynamicLibrary/codedBase/codedBase.H | 5 +- .../dlLibraryTable/dlLibraryTable.C | 160 ++++++++++-------- .../dlLibraryTable/dlLibraryTable.H | 25 ++- .../functionObject/functionObject.C | 6 +- .../functionObjectList/functionObjectList.C | 4 +- .../codedFixedValuePointPatchField.C | 9 +- .../codedFixedValuePointPatchField.H | 7 +- src/OpenFOAM/global/argList/argList.C | 75 ++++---- .../GAMGAgglomeration/GAMGAgglomeration.C | 8 +- .../dynamicFvMesh/dynamicFvMeshNew.C | 4 +- .../motionSolvers/motionSolver/motionSolver.C | 4 +- .../cfdTools/general/fvOptions/fvOption.C | 4 +- .../codedFixedValueFvPatchField.C | 9 +- .../codedFixedValueFvPatchField.H | 10 +- .../codedMixed/codedMixedFvPatchField.C | 9 +- .../codedMixed/codedMixedFvPatchField.H | 7 +- .../codedFunctionObject/codedFunctionObject.C | 10 +- .../codedFunctionObject/codedFunctionObject.H | 5 +- .../sources/general/codedSource/CodedSource.C | 9 +- .../sources/general/codedSource/CodedSource.H | 5 +- 24 files changed, 181 insertions(+), 252 deletions(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 89fc8fc00b..62a685e9b5 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -331,8 +331,6 @@ Foam::Time::Time objectRegistry(*this), - libs_(), - controlDict_ ( IOobject @@ -368,7 +366,7 @@ Foam::Time::Time functionObjects_(*this, enableFunctionObjects) { - libs_.open(controlDict_, "libs"); + libs.open(controlDict_, "libs"); // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). @@ -408,8 +406,6 @@ Foam::Time::Time objectRegistry(*this), - libs_(), - controlDict_ ( IOobject @@ -451,7 +447,7 @@ Foam::Time::Time : !args.optionFound("noFunctionObjects") ) { - libs_.open(controlDict_, "libs"); + libs.open(controlDict_, "libs"); // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). @@ -491,8 +487,6 @@ Foam::Time::Time objectRegistry(*this), - libs_(), - controlDict_ ( IOobject @@ -529,7 +523,7 @@ Foam::Time::Time functionObjects_(*this, enableFunctionObjects) { - libs_.open(controlDict_, "libs"); + libs.open(controlDict_, "libs"); // Explicitly set read flags on objectRegistry so anything constructed @@ -572,8 +566,6 @@ Foam::Time::Time objectRegistry(*this), - libs_(), - controlDict_ ( IOobject @@ -607,7 +599,7 @@ Foam::Time::Time functionObjects_(*this, enableFunctionObjects) { - libs_.open(controlDict_, "libs"); + libs.open(controlDict_, "libs"); } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index aff3a14040..def2899db3 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,10 +76,6 @@ class Time { // Private Data - //- Any loaded dynamic libraries. Make sure to construct before - // reading controlDict. - dlLibraryTable libs_; - //- The controlDict unwatchedIOdictionary controlDict_; @@ -416,18 +412,6 @@ public: return functionObjects_; } - //- External access to the loaded libraries - const dlLibraryTable& libs() const - { - return libs_; - } - - //- External access to the loaded libraries - dlLibraryTable& libs() - { - return libs_; - } - //- Return true if time currently being sub-cycled, otherwise false bool subCycling() const { diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index 84d5d8fe02..c38f14a1a7 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -70,11 +70,7 @@ Foam::dlLibraryTable& Foam::functionEntries::codeStream::libs const dictionary& dict ) { - const baseIOdictionary& d = static_cast - ( - dict.topDict() - ); - return const_cast(d.time()).libs(); + return Foam::libs; } diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C index a2aafb3a20..67f2c03206 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -54,9 +54,9 @@ void* Foam::codedBase::loadLibrary // avoid compilation by loading an existing library if (!libPath.empty()) { - if (libs().open(libPath, false)) + if (libs.open(libPath, false)) { - lib = libs().findLibrary(libPath); + lib = libs.findLibrary(libPath); // verify the loaded version and unload if needed if (lib) @@ -92,7 +92,7 @@ void* Foam::codedBase::loadLibrary << "from " << libPath << exit(FatalIOError); lib = 0; - if (!libs().close(libPath, false)) + if (!libs.close(libPath, false)) { FatalIOErrorInFunction ( @@ -124,7 +124,7 @@ void Foam::codedBase::unloadLibrary return; } - lib = libs().findLibrary(libPath); + lib = libs.findLibrary(libPath); if (!lib) { @@ -154,7 +154,7 @@ void Foam::codedBase::unloadLibrary } } - if (!libs().close(libPath, false)) + if (!libs.close(libPath, false)) { FatalIOErrorInFunction ( @@ -306,7 +306,7 @@ void Foam::codedBase::updateLibrary // the correct library was already loaded => we are done - if (libs().findLibrary(libPath)) + if (libs.findLibrary(libPath)) { return; } diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H index be5e2cf5d8..62888f1ed4 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,9 +88,6 @@ protected: //- Update library as required void updateLibrary(const word& name) const; - //- Get the loaded dynamic libraries - virtual dlLibraryTable& libs() const = 0; - //- Adapt the context for the current object virtual void prepare(dynamicCode&, const dynamicCodeContext&) const = 0; diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index a712f71365..ea047e0b8b 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,6 @@ License #include "dlLibraryTable.H" #include "OSspecific.H" -#include "int.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -34,6 +33,8 @@ namespace Foam defineTypeNameAndDebug(dlLibraryTable, 0); } +Foam::dlLibraryTable Foam::libs; + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -79,31 +80,31 @@ Foam::dlLibraryTable::~dlLibraryTable() bool Foam::dlLibraryTable::open ( - const fileName& functionLibName, + const fileName& libName, const bool verbose ) { - if (functionLibName.size()) + if (libName.size()) { - void* functionLibPtr = dlOpen + void* libPtr = dlOpen ( - fileName(functionLibName).expand(), + fileName(libName).expand(), verbose ); if (debug) { InfoInFunction - << "Opened " << functionLibName - << " resulting in handle " << uintptr_t(functionLibPtr) << endl; + << "Opened " << libName + << " resulting in handle " << uintptr_t(libPtr) << endl; } - if (!functionLibPtr) + if (!libPtr) { if (verbose) { WarningInFunction - << "could not load " << functionLibName + << "could not load " << libName << endl; } @@ -111,8 +112,8 @@ bool Foam::dlLibraryTable::open } else { - libPtrs_.append(functionLibPtr); - libNames_.append(functionLibName); + libPtrs_.append(libPtr); + libNames_.append(libName); return true; } } @@ -123,71 +124,20 @@ bool Foam::dlLibraryTable::open } -bool Foam::dlLibraryTable::close +bool Foam::dlLibraryTable::open ( - const fileName& functionLibName, + const fileNameList& libNames, const bool verbose ) { - label index = -1; - forAllReverse(libNames_, i) + bool allOpened = !libNames.empty(); + + forAll(libNames, i) { - if (libNames_[i] == functionLibName) - { - index = i; - break; - } + allOpened = open(libNames[i], verbose) && allOpened; } - if (index != -1) - { - if (debug) - { - InfoInFunction - << "Closing " << functionLibName - << " with handle " << uintptr_t(libPtrs_[index]) << endl; - } - - bool ok = dlClose(libPtrs_[index]); - - libPtrs_[index] = nullptr; - libNames_[index] = fileName::null; - - if (!ok) - { - if (verbose) - { - WarningInFunction - << "could not close " << functionLibName - << endl; - } - - return false; - } - - return true; - } - return false; -} - - -void* Foam::dlLibraryTable::findLibrary(const fileName& functionLibName) -{ - label index = -1; - forAllReverse(libNames_, i) - { - if (libNames_[i] == functionLibName) - { - index = i; - break; - } - } - - if (index != -1) - { - return libPtrs_[index]; - } - return nullptr; + return allOpened; } @@ -205,7 +155,7 @@ bool Foam::dlLibraryTable::open forAll(libNames, i) { - allOpened = dlLibraryTable::open(libNames[i]) && allOpened; + allOpened = open(libNames[i]) && allOpened; } return allOpened; @@ -217,4 +167,72 @@ bool Foam::dlLibraryTable::open } +bool Foam::dlLibraryTable::close +( + const fileName& libName, + const bool verbose +) +{ + label index = -1; + forAllReverse(libNames_, i) + { + if (libNames_[i] == libName) + { + index = i; + break; + } + } + + if (index != -1) + { + if (debug) + { + InfoInFunction + << "Closing " << libName + << " with handle " << uintptr_t(libPtrs_[index]) << endl; + } + + bool ok = dlClose(libPtrs_[index]); + + libPtrs_[index] = nullptr; + libNames_[index] = fileName::null; + + if (!ok) + { + if (verbose) + { + WarningInFunction + << "could not close " << libName + << endl; + } + + return false; + } + + return true; + } + return false; +} + + +void* Foam::dlLibraryTable::findLibrary(const fileName& libName) +{ + label index = -1; + forAllReverse(libNames_, i) + { + if (libNames_[i] == libName) + { + index = i; + break; + } + } + + if (index != -1) + { + return libPtrs_[index]; + } + return nullptr; +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H index c606a5b3a6..dbc5fc3c9d 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ SourceFiles #include "label.H" #include "DynamicList.H" +#include "fileNameList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,8 +52,10 @@ class dlLibraryTable { // Private Member Functions + //- List of pointers to the loaded dynamic libraries DynamicList libPtrs_; + //- List of names of the loaded dynamic libraries DynamicList libNames_; @@ -61,6 +64,7 @@ public: // Declare name of the class and its debug switch ClassName("dlLibraryTable"); + // Constructors //- Construct null @@ -81,13 +85,10 @@ public: // Member Functions //- Open the named library, optionally with warnings if problems occur - bool open(const fileName& name, const bool verbose = true); + bool open(const fileName& libName, const bool verbose = true); - //- Close the named library, optionally with warnings if problems occur - bool close(const fileName& name, const bool verbose = true); - - //- Find the handle of the named library - void* findLibrary(const fileName& name); + //- Open the named libraries, optionally with warnings if problems occur + bool open(const fileNameList& libNames, const bool verbose = true); //- Open all the libraries listed in the 'libsEntry' entry in the // given dictionary if present @@ -104,6 +105,12 @@ public: const TablePtr& tablePtr ); + //- Find the handle of the named library + void* findLibrary(const fileName& libName); + + //- Close the named library, optionally with warnings if problems occur + bool close(const fileName& name, const bool verbose = true); + // Member Operators @@ -112,6 +119,10 @@ public: }; +//- Table of loaded dynamic libraries +extern dlLibraryTable libs; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index 6d53322b4c..9c128a1ef9 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,7 +67,7 @@ Foam::autoPtr Foam::functionObject::New if (dict.found("functionObjectLibs")) { - const_cast(runTime).libs().open + libs.open ( dict, "functionObjectLibs", @@ -76,7 +76,7 @@ Foam::autoPtr Foam::functionObject::New } else { - const_cast(runTime).libs().open + libs.open ( dict, "libs", diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 3fabfc7b1e..8fa114daa9 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -748,7 +748,7 @@ bool Foam::functionObjectList::read() const dictionary& functionsDict = entryPtr->dict(); - const_cast(time_).libs().open + libs.open ( functionsDict, "libs", diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C index 3c2c3f8031..0307f3fec2 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,13 +100,6 @@ const } -template -Foam::dlLibraryTable& Foam::codedFixedValuePointPatchField::libs() const -{ - return const_cast(this->db().time().libs()); -} - - template void Foam::codedFixedValuePointPatchField::prepare ( diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H index d5e31938e8..83b847e6d3 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -91,8 +91,6 @@ namespace Foam { // Forward declaration of classes -class dynamicCode; -class dynamicCodeContext; class IOdictionary; /*---------------------------------------------------------------------------*\ @@ -128,9 +126,6 @@ class codedFixedValuePointPatchField //- Set the rewrite vars controlling the Type static void setFieldTemplates(dynamicCode& dynCode); - //- Get the loaded dynamic libraries - virtual dlLibraryTable& libs() const; - //- Adapt the context for the current object virtual void prepare(dynamicCode&, const dynamicCodeContext&) const; diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 9fe86e2f3c..0d51fe4439 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,6 +36,7 @@ License #include "fileOperation.H" #include "fileOperationInitialise.H" #include "stringListOps.H" +#include "dlLibraryTable.H" #include @@ -306,14 +307,14 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv) // Note: we also re-write directly into args_ // and use a second pass to sort out args/options - for (int argI = 0; argI < argc; ++argI) + for (int argi=0; argi= args_.size()) + ++argi; + if (argi >= args_.size()) { FatalError <<"Option '-" << optionName @@ -545,8 +534,8 @@ Foam::argList::argList } argListStr_ += ' '; - argListStr_ += args_[argI]; - options_.insert(optionName, args_[argI]); + argListStr_ += args_[argi]; + options_.insert(optionName, args_[argi]); } else { @@ -555,9 +544,9 @@ Foam::argList::argList } else { - if (nArgs != argI) + if (nArgs != argi) { - args_[nArgs] = args_[argI]; + args_[nArgs] = args_[argi]; } ++nArgs; } diff --git a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C index 6655a8d6a7..98a4b228ed 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -297,7 +297,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New controlDict.lookupOrDefault("agglomerator", "faceAreaPair") ); - const_cast(mesh.thisDb().time()).libs().open + libs.open ( controlDict, "geometricGAMGAgglomerationLibs", @@ -352,7 +352,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New controlDict.lookupOrDefault("agglomerator", "faceAreaPair") ); - const_cast(mesh.thisDb().time()).libs().open + libs.open ( controlDict, "algebraicGAMGAgglomerationLibs", @@ -398,7 +398,7 @@ Foam::autoPtr Foam::GAMGAgglomeration::New controlDict.lookupOrDefault("agglomerator", "faceAreaPair") ); - const_cast(mesh.thisDb().time()).libs().open + libs.open ( controlDict, "geometricGAMGAgglomerationLibs", diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C index 4f3a38f842..fa86056ea4 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,7 @@ Foam::autoPtr Foam::dynamicFvMesh::New(const IOobject& io) Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl; - const_cast(io.time()).libs().open + libs.open ( dict, "dynamicFvMeshLibs", diff --git a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C index 52e94b6b64..e87ff6bb35 100644 --- a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C +++ b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,7 +79,7 @@ Foam::autoPtr Foam::motionSolver::New Info<< "Selecting motion solver: " << solverTypeName << endl; - const_cast(mesh.time()).libs().open + libs.open ( solverDict, "motionSolverLibs", diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C index d206c60380..bd34ebed61 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,7 +75,7 @@ Foam::autoPtr Foam::fv::option::New Info<< indent << "Selecting finite volume options model type " << modelType << endl; - const_cast(mesh.time()).libs().open + libs.open ( coeffs, "libs", diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 952b8b3bd8..f3d8ba2e89 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,13 +99,6 @@ const Foam::IOdictionary& Foam::codedFixedValueFvPatchField::dict() const } -template -Foam::dlLibraryTable& Foam::codedFixedValueFvPatchField::libs() const -{ - return const_cast(this->db().time().libs()); -} - - template void Foam::codedFixedValueFvPatchField::prepare ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H index b9945b876e..cc65c39eaa 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -88,11 +88,6 @@ SourceFiles namespace Foam { -// Forward declaration of classes -class dynamicCode; -class dynamicCodeContext; -class IOdictionary; - /*---------------------------------------------------------------------------*\ Class codedFixedValueFvPatchField Declaration \*---------------------------------------------------------------------------*/ @@ -126,9 +121,6 @@ class codedFixedValueFvPatchField //- Set the rewrite vars controlling the Type static void setFieldTemplates(dynamicCode& dynCode); - //- Get the loaded dynamic libraries - virtual dlLibraryTable& libs() const; - //- Adapt the context for the current object virtual void prepare(dynamicCode&, const dynamicCodeContext&) const; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C index fd51473440..d24f297e4b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,13 +99,6 @@ const Foam::IOdictionary& Foam::codedMixedFvPatchField::dict() const } -template -Foam::dlLibraryTable& Foam::codedMixedFvPatchField::libs() const -{ - return const_cast(this->db().time().libs()); -} - - template void Foam::codedMixedFvPatchField::prepare ( diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H index e89f5a884f..77f00bbb72 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,8 +99,6 @@ namespace Foam { // Forward declaration of classes -class dynamicCode; -class dynamicCodeContext; class IOdictionary; /*---------------------------------------------------------------------------*\ @@ -136,9 +134,6 @@ class codedMixedFvPatchField //- Set the rewrite vars controlling the Type static void setFieldTemplates(dynamicCode& dynCode); - //- Get the loaded dynamic libraries - virtual dlLibraryTable& libs() const; - //- Adapt the context for the current object virtual void prepare(dynamicCode&, const dynamicCodeContext&) const; diff --git a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C index 7633e32e1a..5eec886e91 100644 --- a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C +++ b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,7 +78,7 @@ void Foam::codedFunctionObject::prepare // Copy filtered H template dynCode.addCopyFile("functionObjectTemplate.H"); - // Debugging: make BC verbose + // Debugging: make verbose // dynCode.setFilterVariable("verbose", "true"); // Info<<"compile " << name_ << " sha1: " // << context.sha1() << endl; @@ -99,12 +99,6 @@ void Foam::codedFunctionObject::prepare } -Foam::dlLibraryTable& Foam::codedFunctionObject::libs() const -{ - return const_cast(time_).libs(); -} - - Foam::string Foam::codedFunctionObject::description() const { return "functionObject " + name(); diff --git a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H index 156394cd07..8961022c1a 100644 --- a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H +++ b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -113,9 +113,6 @@ protected: // Protected Member Functions - //- Get the loaded dynamic libraries - virtual dlLibraryTable& libs() const; - //- Adapt the context for the current object virtual void prepare(dynamicCode&, const dynamicCodeContext&) const; diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.C b/src/fvOptions/sources/general/codedSource/CodedSource.C index b240ffee57..79cb60b554 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.C +++ b/src/fvOptions/sources/general/codedSource/CodedSource.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,13 +82,6 @@ void Foam::fv::CodedSource::prepare } -template -Foam::dlLibraryTable& Foam::fv::CodedSource::libs() const -{ - return const_cast(mesh_.time()).libs(); -} - - template Foam::string Foam::fv::CodedSource::description() const { diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.H b/src/fvOptions/sources/general/codedSource/CodedSource.H index 303b8157cd..23ab872254 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.H +++ b/src/fvOptions/sources/general/codedSource/CodedSource.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,9 +146,6 @@ protected: // Protected Member Functions - //- Get the loaded dynamic libraries - virtual dlLibraryTable& libs() const; - //- Adapt the context for the current object virtual void prepare(dynamicCode&, const dynamicCodeContext&) const;