MERGE: Remove loading of libs

This commit is contained in:
Hrvoje Jasak 2018-05-15 16:40:34 +01:00
parent 549ba4fab8
commit 9f04cc47e4
2 changed files with 8 additions and 41 deletions

View file

@ -431,15 +431,12 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
const dictionary& decompositionDict const dictionary& decompositionDict
) )
{ {
loadExternalLibraries(); word methodName(decompositionDict.lookup("method"));
word decompositionMethodTypeName(decompositionDict.lookup("method")); Info<< "Selecting decompositionMethod " << methodName << endl;
Info<< "Selecting decompositionMethod "
<< decompositionMethodTypeName << endl;
dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(decompositionMethodTypeName); dictionaryConstructorTablePtr_->find(methodName);
if (cstrIter == dictionaryConstructorTablePtr_->end()) if (cstrIter == dictionaryConstructorTablePtr_->end())
{ {
@ -448,7 +445,7 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
"decompositionMethod::New" "decompositionMethod::New"
"(const dictionary& decompositionDict)" "(const dictionary& decompositionDict)"
) << "Unknown decompositionMethod " ) << "Unknown decompositionMethod "
<< decompositionMethodTypeName << endl << endl << methodName << endl << endl
<< "Valid decompositionMethods are : " << endl << "Valid decompositionMethods are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
@ -464,15 +461,13 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
const polyMesh& mesh const polyMesh& mesh
) )
{ {
loadExternalLibraries(); word methodName(decompositionDict.lookup("method"));
word decompositionMethodTypeName(decompositionDict.lookup("method"));
Info<< "Selecting decompositionMethod " Info<< "Selecting decompositionMethod "
<< decompositionMethodTypeName << endl; << methodName << endl;
dictionaryMeshConstructorTable::iterator cstrIter = dictionaryMeshConstructorTable::iterator cstrIter =
dictionaryMeshConstructorTablePtr_->find(decompositionMethodTypeName); dictionaryMeshConstructorTablePtr_->find(methodName);
if (cstrIter == dictionaryMeshConstructorTablePtr_->end()) if (cstrIter == dictionaryMeshConstructorTablePtr_->end())
{ {
@ -482,7 +477,7 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
"(const dictionary& decompositionDict, " "(const dictionary& decompositionDict, "
"const polyMesh& mesh)" "const polyMesh& mesh)"
) << "Unknown decompositionMethod " ) << "Unknown decompositionMethod "
<< decompositionMethodTypeName << endl << endl << methodName << endl << endl
<< "Valid decompositionMethods are : " << endl << "Valid decompositionMethods are : " << endl
<< dictionaryMeshConstructorTablePtr_->sortedToc() << dictionaryMeshConstructorTablePtr_->sortedToc()
<< exit(FatalError); << exit(FatalError);
@ -491,30 +486,6 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
return autoPtr<decompositionMethod>(cstrIter()(decompositionDict, mesh)); return autoPtr<decompositionMethod>(cstrIter()(decompositionDict, mesh));
} }
void Foam::decompositionMethod::loadExternalLibraries()
{
wordList libNames(3);
libNames[0] = word("scotchDecomp");
libNames[1] = word("metisDecomp");
libNames[2] = word("parMetisDecomp");
forAll (libNames,i)
{
const word libName("lib"+libNames[i]+".so");
bool ok = dlLibraryTable::open(libName);
if (!ok)
{
WarningIn("decompositionMethod::loadExternalLibraries()")
<< "Loading of decomposition library " << libName
<< " unsuccesful. Some decomposition methods may not be "
<< "available"
<< endl;
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

View file

@ -113,10 +113,6 @@ private:
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const decompositionMethod&); void operator=(const decompositionMethod&);
//- Load missing libraries to avoid compile-time linking
// to external dependencies
static void loadExternalLibraries();
public: public: