diff --git a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C index c98ba120a416e9d4122c85a0c75c897d77f0697d..09537c8e73b6cb71fd232ec04f888b77b9df82bb 100644 --- a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.C @@ -62,7 +62,11 @@ Foam::dlLibraryTable::~dlLibraryTable() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::dlLibraryTable::open(const fileName& functionLibName) +bool Foam::dlLibraryTable::open +( + const fileName& functionLibName, + const bool verbose +) { if (functionLibName.size()) { @@ -70,11 +74,14 @@ bool Foam::dlLibraryTable::open(const fileName& functionLibName) if (!functionLibPtr) { - WarningIn - ( - "dlLibraryTable::open(const fileName& functionLibName)" - ) << "could not load " << functionLibName - << endl; + if (verbose) + { + WarningIn + ( + "dlLibraryTable::open(const fileName&)" + ) << "could not load " << functionLibName + << endl; + } return false; } @@ -97,7 +104,11 @@ bool Foam::dlLibraryTable::open(const fileName& functionLibName) } -bool Foam::dlLibraryTable::close(const fileName& functionLibName) +bool Foam::dlLibraryTable::close +( + const fileName& functionLibName, + const bool verbose +) { void* libPtr = findLibrary(functionLibName); if (libPtr) @@ -106,11 +117,14 @@ bool Foam::dlLibraryTable::close(const fileName& functionLibName) if (!dlClose(libPtr)) { - WarningIn - ( - "dlLibraryTable::close(const fileName& functionLibName)" - ) << "could not close " << functionLibName - << endl; + if (verbose) + { + WarningIn + ( + "dlLibraryTable::close(const fileName&)" + ) << "could not close " << functionLibName + << endl; + } return false; } @@ -144,7 +158,7 @@ bool Foam::dlLibraryTable::open { fileNameList libNames(dict.lookup(libsEntry)); - bool allOpened = (libNames.size() > 0); + bool allOpened = !libNames.empty(); forAll(libNames, i) { diff --git a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H index 1b64897dd032ac162e32bb893d38258cce4bc996..aaf472f67ebd3b997e892b3c21cce6b6c5f826f5 100644 --- a/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H +++ b/src/OpenFOAM/db/dlLibraryTable/dlLibraryTable.H @@ -94,11 +94,11 @@ public: // Member Functions - //- Open the named library - static bool open(const fileName& name); + //- Open the named library, optionally with warnings if problems occur + static bool open(const fileName& name, const bool verbose = true); - //- Close the named library - static bool close(const fileName& name); + //- Close the named library, optionally with warnings if problems occur + static bool close(const fileName& name, const bool verbose = true); //- Find the handle of the named library static void* findLibrary(const fileName& name); @@ -109,7 +109,7 @@ public: //- Open all the libraries listed in the 'libsEntry' entry in the // given dictionary if present and check the additions - // to the give constructor table + // to the given constructor table template<class TablePtr> static bool open (