diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 4d080a48cd9b6e0e6ef5266938e3a9744dffce89..75f0a01eae6f5ad5dd1d9fdb23f4ff1be416ace6 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -130,14 +130,14 @@ public: private: - // Private data + // Private Data //- Profiling trigger for time-loop (for run, loop) mutable std::unique_ptr<profilingTrigger> loopProfiling_; - //- Any loaded dynamic libraries. Make sure to construct before - // reading controlDict. - dlLibraryTable libs_; + //- Any loaded dynamic libraries + // Construct before reading controlDict + mutable dlLibraryTable libs_; //- The controlDict unwatchedIOdictionary controlDict_; @@ -145,7 +145,7 @@ private: protected: - // Protected data + // Protected Data label startTimeIndex_; @@ -502,14 +502,8 @@ public: return functionObjects_; } - //- External access to the loaded libraries - const dlLibraryTable& libs() const - { - return libs_; - } - - //- External access to the loaded libraries - dlLibraryTable& libs() + //- Mutable access to the loaded dynamic libraries + dlLibraryTable& libs() const { return libs_; } diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index 2fd1c3c78b65adf79927f7838edb466accf2815a..0d877cb5f6066de1b74bf46bc56ac560d75f3cb8 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -73,7 +73,7 @@ Foam::dlLibraryTable& Foam::functionEntries::codeStream::libs ( dict.topDict() ); - return const_cast<Time&>(d.time()).libs(); + return d.time().libs(); } diff --git a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H index 8f276553b26e52b7f754855a15255b959db651f9..0892d7ed539e76b5874a309928e6418c28e0966e 100644 --- a/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H +++ b/src/OpenFOAM/db/dynamicLibrary/codedBase/codedBase.H @@ -49,6 +49,7 @@ SourceFiles #include "dictionary.H" #include "dynamicCodeContext.H" +#include "fileName.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -100,12 +101,6 @@ class codedBase const dynamicCodeContext& context ) const; - //- No copy construct - codedBase(const codedBase&) = delete; - - //- No copy assignment - void operator=(const codedBase&) = delete; - protected: @@ -141,7 +136,7 @@ protected: //- or use the codeDict() to generate one void updateLibrary(const word& name) const; - //- Get the loaded dynamic libraries + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const = 0; //- Adapt the context for the current object @@ -161,6 +156,13 @@ protected: virtual const dictionary& codeDict() const = 0; + //- No copy construct + codedBase(const codedBase&) = delete; + + //- No copy assignment + void operator=(const codedBase&) = delete; + + public: //- Runtime type information @@ -169,7 +171,7 @@ public: // Constructors - //- Construct null + //- Default construct codedBase() = default; diff --git a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C index d2d2098488e05e5090d6e7ae3ab71f34f7eb35a4..23941dc0e4184de35d58e70068785c699f3b32d9 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C +++ b/src/OpenFOAM/db/dynamicLibrary/dynamicCode/dynamicCode.C @@ -141,7 +141,7 @@ bool Foam::dynamicCode::resolveTemplates DynamicList<fileName>& badFiles ) { - // Try to get template from FOAM_CODESTREAM_TEMPLATES + // Try to get template from FOAM_CODE_TEMPLATES const fileName templateDir(Foam::getEnv(codeTemplateEnvName)); bool allOkay = true; diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index d4cd1c4e50bd17610bc874a7f42842717671c50d..edabdf8d0aa4aea604a123cdc0789a56de84ecad 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -83,7 +83,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New if (finder.found()) { - const_cast<Time&>(runTime).libs().open + runTime.libs().open ( dict, finder.ref().keyword(), @@ -93,7 +93,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New } // This is the simplified version without compatibility messages - // const_cast<Time&>(runTime).libs().open + // runTime.libs().open // ( // dict, // "libs", diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 1fe141879a0f0b7bb8e0acf36de4b2ee30a84a2e..1c3e75609889f39c10fa0357e9109f7701ae0bce 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -771,7 +771,7 @@ bool Foam::functionObjectList::read() addProfiling(fo, "functionObjects::read"); - const_cast<Time&>(time_).libs().open + time_.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 5c62d6a56b46365ee20676a1e4c2fc832817da10..d6e38e9f56e02b89b5e5cd591cec06098031ac01 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.C @@ -66,7 +66,7 @@ const template<class Type> Foam::dlLibraryTable& Foam::codedFixedValuePointPatchField<Type>::libs() const { - return const_cast<dlLibraryTable&>(this->db().time().libs()); + return this->db().time().libs(); } diff --git a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H index c65022127915b7bc84e62a79bff9bfea1a60329d..451361c6c1b0b77555ad1f1d9e42e678c69a1aa7 100644 --- a/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/derived/codedFixedValue/codedFixedValuePointPatchField.H @@ -106,7 +106,7 @@ class codedFixedValuePointPatchField public fixedValuePointPatchField<Type>, protected codedBase { - // Private data + // Private Data //- Dictionary contents for the boundary condition mutable dictionary dict_; @@ -120,7 +120,7 @@ class codedFixedValuePointPatchField const IOdictionary& dict() const; - //- Get the loaded dynamic libraries + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 1984b16c7f7aa713d4e53dbb0bf5621dc0944f58..eae90020674626c67c1d5fc645168ec3629dcaee 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -854,8 +854,8 @@ Foam::argList::argList if (strcmp(optName, "lib") == 0) { // The '-lib' option: - // Append name(s) to libs_ for later opening - libs_.append(this->getList<fileName>(argi)); + // Append name(s) to libs for later opening + libs().append(this->getList<fileName>(argi)); } else if (strcmp(optName, "debug-switch") == 0) { @@ -1066,8 +1066,8 @@ void Foam::argList::parse jobInfo.add("foamBuild", build); } - // Load additional libraries - libs_.open(bannerEnabled()); + // Load additional libraries (verbosity according to banner setting) + libs().open(bannerEnabled()); } @@ -1253,7 +1253,7 @@ void Foam::argList::parse // Disable any parallel comms happening inside the fileHandler // since we are on master. This can happen e.g. inside - // the masterUncollated/collated handler. + // the masterUncollated/collated handler. const bool oldParRun = Pstream::parRun(); Pstream::parRun() = false; diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index 38dd63fea7cabc9259f0f67685a254265a92226d..75ffd9dbef4e70546118aed061336b7fce0d642b 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -142,7 +142,7 @@ class argList HashTable<string> options_; //- Additional libraries - dlLibraryTable libs_; + mutable dlLibraryTable libs_; word executable_; fileName rootPath_; @@ -346,11 +346,8 @@ public: //- Return the ParRunControl inline const ParRunControl& parRunControl() const; - //- Access to the loaded libraries - inline const dlLibraryTable& libs() const; - - //- Access to the loaded libraries - inline dlLibraryTable& libs(); + //- Mutable access to the loaded dynamic libraries + inline dlLibraryTable& libs() const; //- The number of arguments inline label size() const noexcept; diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index 6e78c3afa4aacce31d3eb60554e056076a874d95..ed6f1fe59c5f9d8db2dce31ab4b2d0f18d1b13d1 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation - Copyright (C) 2017-2019 OpenCFD Ltd. + Copyright (C) 2017-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -112,13 +112,7 @@ inline const Foam::ParRunControl& Foam::argList::parRunControl() const } -inline const Foam::dlLibraryTable& Foam::argList::libs() const -{ - return libs_; -} - - -inline Foam::dlLibraryTable& Foam::argList::libs() +inline Foam::dlLibraryTable& Foam::argList::libs() const { return libs_; } 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 fcdea118cb5dd3cb38d95456a36b615b6b6d6ad6..28a7cf83497c44325b78a86128fa0e4d5812e412 100644 --- a/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C +++ b/src/OpenFOAM/matrices/lduMatrix/solvers/GAMG/GAMGAgglomerations/GAMGAgglomeration/GAMGAgglomeration.C @@ -308,7 +308,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New controlDict.getOrDefault<word>("agglomerator", "faceAreaPair") ); - const_cast<Time&>(mesh.thisDb().time()).libs().open + mesh.thisDb().time().libs().open ( controlDict, "geometricGAMGAgglomerationLibs", @@ -362,7 +362,7 @@ const Foam::GAMGAgglomeration& Foam::GAMGAgglomeration::New controlDict.getOrDefault<word>("agglomerator", "faceAreaPair") ); - const_cast<Time&>(mesh.thisDb().time()).libs().open + mesh.thisDb().time().libs().open ( controlDict, "algebraicGAMGAgglomerationLibs", @@ -408,7 +408,7 @@ Foam::autoPtr<Foam::GAMGAgglomeration> Foam::GAMGAgglomeration::New controlDict.getOrDefault<word>("agglomerator", "faceAreaPair") ); - const_cast<Time&>(mesh.thisDb().time()).libs().open + mesh.thisDb().time().libs().open ( controlDict, "geometricGAMGAgglomerationLibs", diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C index 8b85cbb172773e95a425ca68bde34cd093ec2d98..c1c8e7409dc8cde0e9d667670f2b5d268fd83b21 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C +++ b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C @@ -58,7 +58,7 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io) Info<< "Selecting dynamicFvMesh " << modelType << endl; - const_cast<Time&>(io.time()).libs().open + io.time().libs().open ( dict, "dynamicFvMeshLibs", diff --git a/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C index 00d7950235d484b9320234549ff4c7841cc41bdb..9f91588cde7fa8bdc425d402a331cc13c16bb31d 100644 --- a/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.C @@ -89,7 +89,7 @@ void Foam::codedPoints0MotionSolver::prepare Foam::dlLibraryTable& Foam::codedPoints0MotionSolver::libs() const { - return const_cast<Time&>(mesh().time()).libs(); + return mesh().time().libs(); } diff --git a/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.H index f5fcc800c3e782d890d4a1e9bb2dabfdf1a05b74..47afa827fdd83e048f38eeb021ad1152e1f37b5e 100644 --- a/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/codedPoints0/codedPoints0MotionSolver.H @@ -103,7 +103,7 @@ protected: // Protected Member Functions - //- Get the loaded dynamic libraries + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object diff --git a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C index aa45b6ec2abfe072d930ce51bf5f644b8520bbb5..3217fff6a111e3a7f517c253f3ea6e49066cf116 100644 --- a/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/displacement/displacementMotionSolver.C @@ -94,7 +94,7 @@ Foam::displacementMotionSolver::New { Info<< "Selecting motion solver: " << solverTypeName << endl; - const_cast<Time&>(mesh.time()).libs().open + mesh.time().libs().open ( solverDict, "motionSolverLibs", diff --git a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C index d255a3ada1b348e58b372cf4133f5cbbb1d2ad01..097f766100f71548a8431c789561b688ae0d231b 100644 --- a/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C +++ b/src/dynamicMesh/motionSolvers/motionSolver/motionSolver.C @@ -116,7 +116,7 @@ Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New Info<< "Selecting motion solver: " << solverName << nl; - const_cast<Time&>(mesh.time()).libs().open + mesh.time().libs().open ( solverDict, "motionSolverLibs", diff --git a/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C b/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C index a98f83db1fc165dd76030c31bdf59663d21ad248..e905a5ff520de9b503cfa33cf1174cf6bf96a336 100644 --- a/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C +++ b/src/finiteVolume/cfdTools/general/fvOptions/fvOption.C @@ -79,7 +79,7 @@ Foam::autoPtr<Foam::fv::option> Foam::fv::option::New Info<< indent << "Selecting finite volume options type " << modelType << endl; - const_cast<Time&>(mesh.time()).libs().open + mesh.time().libs().open ( coeffs, "libs", diff --git a/src/finiteVolume/expressions/base/fvExprDriver.C b/src/finiteVolume/expressions/base/fvExprDriver.C index 2cd6623292e5bc58dcfeaa56d2c0ed630b31e17d..b363296dc49df156fff1891ebac7a9bd6ddadf48 100644 --- a/src/finiteVolume/expressions/base/fvExprDriver.C +++ b/src/finiteVolume/expressions/base/fvExprDriver.C @@ -112,7 +112,6 @@ Foam::expressions::fvExprDriver::fvExprDriver storedVariables_(), specialVariablesIndex_(-1), otherMeshName_(), - libs_(), writer_(nullptr) {} @@ -128,7 +127,6 @@ Foam::expressions::fvExprDriver::fvExprDriver storedVariables_(rhs.storedVariables_), specialVariablesIndex_(rhs.specialVariablesIndex_), otherMeshName_(), - libs_(), writer_(nullptr) {} @@ -165,12 +163,15 @@ bool Foam::expressions::fvExprDriver::readDict { expressions::exprDriver::readDict(dict); - // wordList plugins; + // fileNameList plugins; // if (dict.readIfPresent("functionPlugins", plugins)) // { - // for (const word& plugin : plugins) + // for (const fileName& libName : plugins) // { - // libs_.open("libswak" + plugin + "FunctionPlugin.so"); + // this->runTime().libs().open + // ( + // "libswak" + libName + "FunctionPlugin" // verbose = true + // ); // } // } diff --git a/src/finiteVolume/expressions/base/fvExprDriver.H b/src/finiteVolume/expressions/base/fvExprDriver.H index dd1d5aec047d3eb3461f949b4e375dab3c99456d..e532636b2d8494f8cb0639857af3a92993a9f431 100644 --- a/src/finiteVolume/expressions/base/fvExprDriver.H +++ b/src/finiteVolume/expressions/base/fvExprDriver.H @@ -69,7 +69,6 @@ SourceFiles #include "pointMesh.H" #include "volFields.H" #include "topoSetSource.H" -#include "dlLibraryTable.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -118,9 +117,6 @@ class fvExprDriver //- The name of the other mesh (if it is to be required) word otherMeshName_; - //- Additional libraries - dlLibraryTable libs_; - //- Writing and restoring autoPtr<exprDriverWriter> writer_; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C index 09740bbbbd64bad30ffed8ba93922ba6c5a4dfc5..bf827222324a8bdf3a2cdab21b32ae357c6434a4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.C @@ -66,7 +66,7 @@ const Foam::IOdictionary& Foam::codedFixedValueFvPatchField<Type>::dict() const template<class Type> Foam::dlLibraryTable& Foam::codedFixedValueFvPatchField<Type>::libs() const { - return const_cast<dlLibraryTable&>(this->db().time().libs()); + return this->db().time().libs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H index 3e05751b7e5886479eeb11b5c3ce3bf38e39abbc..992cc77a08be5b77cefab24b90be2a4b8fb02dc8 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchField.H @@ -121,7 +121,7 @@ class codedFixedValueFvPatchField const IOdictionary& dict() const; - //- Get the loaded dynamic libraries + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C index 7b2c9e86072697b4846cc70aa23dbadcac594e62..ad721c0b37ed9c263f22a91493621b60c41c5ec2 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.C @@ -65,7 +65,7 @@ const Foam::IOdictionary& Foam::codedMixedFvPatchField<Type>::dict() const template<class Type> Foam::dlLibraryTable& Foam::codedMixedFvPatchField<Type>::libs() const { - return const_cast<dlLibraryTable&>(this->db().time().libs()); + return this->db().time().libs(); } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H index 07d8abdd64ed066766bf93b8af744a51b66d3b9a..cf941e0906b6fbb81efb09387056def2c94cccdb 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedMixed/codedMixedFvPatchField.H @@ -104,7 +104,7 @@ SourceFiles namespace Foam { -// Forward declaration of classes +// Forward Declarations class dynamicCode; class dynamicCodeContext; class IOdictionary; @@ -119,7 +119,7 @@ class codedMixedFvPatchField public mixedFvPatchField<Type>, public codedBase { - // Private data + // Private Data //- Dictionary contents for the boundary condition mutable dictionary dict_; @@ -133,7 +133,12 @@ class codedMixedFvPatchField const IOdictionary& dict() const; - //- Get the loaded dynamic libraries + +protected: + + // Protected Member Functions + + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object diff --git a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C index 8e2fe43451900c505f391477f0b78b60a07eb0d5..d96810f03b90b831562578e7f3e6eb2f17a61f84 100644 --- a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C +++ b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.C @@ -96,7 +96,7 @@ void Foam::functionObjects::codedFunctionObject::prepare Foam::dlLibraryTable& Foam::functionObjects::codedFunctionObject::libs() const { - return const_cast<Time&>(time_).libs(); + return time_.libs(); } diff --git a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H index c0914e20315071aa2325f20d507a54f585854f9f..8d10c295af5d73b112bde853a895d944ee67d764 100644 --- a/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H +++ b/src/functionObjects/utilities/codedFunctionObject/codedFunctionObject.H @@ -60,6 +60,7 @@ Usage #{ // Lookup U const volVectorField& U = mesh().lookupObject<volVectorField>("U"); + // Write mag(U)().write(); #}; @@ -99,7 +100,7 @@ class codedFunctionObject { protected: - // Protected data + // Protected Data //- Input dictionary dictionary dict_; @@ -118,7 +119,7 @@ protected: // Protected Member Functions - //- Get the loaded dynamic libraries + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.C b/src/fvOptions/sources/general/codedSource/CodedSource.C index 72f4137d84e94e2d085cce8576965d59423d6af4..9998e8a8b7572725fd564a534847df0dc51647a2 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.C +++ b/src/fvOptions/sources/general/codedSource/CodedSource.C @@ -87,7 +87,7 @@ void Foam::fv::CodedSource<Type>::prepare template<class Type> Foam::dlLibraryTable& Foam::fv::CodedSource<Type>::libs() const { - return const_cast<Time&>(mesh_.time()).libs(); + return mesh_.time().libs(); } diff --git a/src/fvOptions/sources/general/codedSource/CodedSource.H b/src/fvOptions/sources/general/codedSource/CodedSource.H index 592e1bc40af15b3682d3205182c3550a72d76545..2d488f9433d2fb05c5e487b55f57aaf3bbc55c9f 100644 --- a/src/fvOptions/sources/general/codedSource/CodedSource.H +++ b/src/fvOptions/sources/general/codedSource/CodedSource.H @@ -126,7 +126,6 @@ class CodedSource public cellSetOption, protected codedBase { - protected: // Protected Data @@ -143,7 +142,7 @@ protected: // Protected Member Functions - //- Get the loaded dynamic libraries + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object diff --git a/src/meshTools/PatchFunction1/CodedField/CodedField.C b/src/meshTools/PatchFunction1/CodedField/CodedField.C index 0ab0fc4b17b2add552efaea22104de85c7919901..d09455f7a06bb86fd87553d87a260db993495244 100644 --- a/src/meshTools/PatchFunction1/CodedField/CodedField.C +++ b/src/meshTools/PatchFunction1/CodedField/CodedField.C @@ -27,16 +27,13 @@ License #include "dynamicCode.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template<class Type> Foam::dlLibraryTable& Foam::PatchFunction1Types::CodedField<Type>::libs() const { - const dlLibraryTable& timeLibs = - this->patch_.boundaryMesh().mesh().time().libs(); - - return const_cast<dlLibraryTable&>(timeLibs); + return this->patch_.boundaryMesh().mesh().time().libs(); } diff --git a/src/meshTools/PatchFunction1/CodedField/CodedField.H b/src/meshTools/PatchFunction1/CodedField/CodedField.H index d79bfc605f84f988e3c3065bdec9417ec682dab8..27666ecdb6c9d76e323114a08efed6d0a41a7f96 100644 --- a/src/meshTools/PatchFunction1/CodedField/CodedField.H +++ b/src/meshTools/PatchFunction1/CodedField/CodedField.H @@ -88,7 +88,7 @@ namespace PatchFunction1Types { /*---------------------------------------------------------------------------*\ - Class CodedField Declaration + Class CodedField Declaration \*---------------------------------------------------------------------------*/ template<class Type> @@ -109,7 +109,15 @@ class CodedField // Private Member Functions - //- Get the loaded dynamic libraries + //- Get reference to the underlying Function1 + const PatchFunction1<Type>& redirectFunction() const; + + +protected: + + // Protected Member Functions + + //- Mutable access to the loaded dynamic libraries virtual dlLibraryTable& libs() const; //- Adapt the context for the current object @@ -121,9 +129,6 @@ class CodedField // Clear the ptr to the redirected object virtual void clearRedirect() const; - //- Get reference to the underlying Function1 - const PatchFunction1<Type>& redirectFunction() const; - // Get the (sub)dictionary to initialize the codeContext virtual const dictionary& codeDict(const dictionary& fullDict) const;