Fix: Prevent erroneous warning about failed library loading if new dynamicMesh is constructed multiple times

This commit is contained in:
Pascal Beckstein 2016-02-10 18:38:26 +01:00
parent ac941215d5
commit 80aa1d588f

View file

@ -37,13 +37,29 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
forAll(libNames,i) {
const word libName("lib"+libNames[i]+".so");
bool ok=dlLibraryTable::open(libName);
if(!ok) {
WarningIn("dynamicFvMesh::New(const IOobject& io)")
<< "Loading of dynamic mesh library " << libName
bool libLoaded = false;
dlLibraryTable& ll = dlLibraryTable::loadedLibraries;
forAllConstIter(dlLibraryTable, ll, llI)
{
if (ll(llI.key()) == libName)
{
libLoaded = true;
break;
}
}
if (!libLoaded)
{
bool ok=dlLibraryTable::open(libName);
if(!ok) {
WarningIn("dynamicFvMesh::New(const IOobject& io)")
<< "Loading of dynamic mesh library " << libName
<< " unsuccesful. Some dynamic mesh methods may not be "
<< " available"
<< endl;
}
}
}