diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 16ef1e517b..46c0171e5a 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -1210,12 +1210,13 @@ int main(int argc, char *argv[]) << endl; label nSide = 0; + forAll(zoneSidePatch, zoneI) { if (oneD) { - // Always add empty patches, one per zone. - word patchName = faceZones[zoneI].name() + "_" + "side"; + // Reuse single empty patch. + word patchName = "oneDEmptPatch"; zoneSidePatch[zoneI] = addPatch ( diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index d276de95ce..8e509a738b 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -228,6 +228,8 @@ Foam::Time::Time objectRegistry(*this), + libs_(), + controlDict_ ( IOobject @@ -257,9 +259,10 @@ Foam::Time::Time graphFormat_("raw"), runTimeModifiable_(true), - libs_(controlDict_, "libs"), functionObjects_(*this) { + libs_.open(controlDict_, "libs"); + // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). readOpt() = IOobject::MUST_READ_IF_MODIFIED; @@ -313,6 +316,8 @@ Foam::Time::Time objectRegistry(*this), + libs_(), + controlDict_ ( IOobject @@ -343,9 +348,11 @@ Foam::Time::Time graphFormat_("raw"), runTimeModifiable_(true), - libs_(controlDict_, "libs"), functionObjects_(*this) { + libs_.open(controlDict_, "libs"); + + // Explicitly set read flags on objectRegistry so anything constructed // from it reads as well (e.g. fvSolution). readOpt() = IOobject::MUST_READ_IF_MODIFIED; @@ -401,6 +408,8 @@ Foam::Time::Time objectRegistry(*this), + libs_(), + controlDict_ ( IOobject @@ -430,9 +439,10 @@ Foam::Time::Time graphFormat_("raw"), runTimeModifiable_(true), - libs_(controlDict_, "libs"), functionObjects_(*this) -{} +{ + libs_.open(controlDict_, "libs"); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index 28ff775a68..b9da549895 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -75,6 +75,10 @@ class Time //- file-change monitor for all registered files mutable autoPtr monitorPtr_; + //- Any loaded dynamic libraries. Make sure to construct before + // reading controlDict. + dlLibraryTable libs_; + //- The controlDict IOdictionary controlDict_; @@ -166,9 +170,6 @@ private: //- Is runtime modification of dictionaries allowed? Switch runTimeModifiable_; - //- Any loaded dynamic libraries - dlLibraryTable libs_; - //- Function objects executed at start and on ++, += mutable functionObjectList functionObjects_; diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index e0a1bbbdd4..8eefcb86d9 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -131,11 +131,7 @@ bool Foam::functionEntries::codeStream::execute // see if library is loaded void* lib = NULL; - if - ( - isA(topDict(parentDict)) - && parentDict.dictName() != Time::controlDictName - ) + if (isA(topDict(parentDict))) { lib = libs(parentDict).findLibrary(libPath); } @@ -150,11 +146,7 @@ bool Foam::functionEntries::codeStream::execute // avoid compilation if possible by loading an existing library if (!lib) { - if - ( - isA(topDict(parentDict)) - && parentDict.dictName() != Time::controlDictName - ) + if (isA(topDict(parentDict))) { // Cached access to dl libs. Guarantees clean up upon destruction // of Time. @@ -223,11 +215,7 @@ bool Foam::functionEntries::codeStream::execute // all processes must wait for compile to finish reduce(create, orOp()); - if - ( - isA(topDict(parentDict)) - && parentDict.dictName() != Time::controlDictName - ) + if (isA(topDict(parentDict))) { // Cached access to dl libs. Guarantees clean up upon destruction // of Time. diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C index deca23890d..93d934a1b5 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C @@ -25,6 +25,12 @@ License #include "dlLibraryTable.H" #include "OSspecific.H" +#include "long.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(Foam::dlLibraryTable, 0); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -55,7 +61,11 @@ Foam::dlLibraryTable::~dlLibraryTable() // bug in dlclose - does not call static destructors of // loaded library when actually unloading the library. // See https://bugzilla.novell.com/show_bug.cgi?id=680125 and 657627. - // Seems related to using a non-system compiler! + if (debug) + { + Info<< "dlLibraryTable::~dlLibraryTable() : closing " << iter() + << " with handle " << long(iter.key()) << endl; + } dlClose(iter.key()); } } @@ -73,6 +83,12 @@ bool Foam::dlLibraryTable::open { void* functionLibPtr = dlOpen(functionLibName); + if (debug) + { + Info<< "dlLibraryTable::open : opened " << functionLibName + << " resulting in handle " << long(functionLibPtr) << endl; + } + if (!functionLibPtr) { if (verbose) @@ -107,6 +123,12 @@ bool Foam::dlLibraryTable::close void* libPtr = findLibrary(functionLibName); if (libPtr) { + if (debug) + { + Info<< "dlLibraryTable::close : closing " << functionLibName + << " with handle " << long(libPtr) << endl; + } + erase(libPtr); if (!dlClose(libPtr)) diff --git a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H index c3388907d1..f2925fe511 100644 --- a/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H +++ b/src/OpenFOAM/db/dynamicLibrary/dlLibraryTable/dlLibraryTable.H @@ -63,6 +63,9 @@ class dlLibraryTable public: + // Declare name of the class and its debug switch + ClassName("dlLibraryTable"); + // Constructors //- Construct null