Make basic decomposition-library independend from ThirdParty-software (but load the 'default' libraries before the runtime-selection kicks in)

--HG--
branch : bgschaid/foam3FixesBranch
This commit is contained in:
Bernhard F.W. Gschaider 2013-12-30 18:55:02 +01:00
parent d073895315
commit 3e6bfe9aea
3 changed files with 29 additions and 5 deletions

View file

@ -1,8 +1,4 @@
EXE_INC =
LIB_LIBS = \
-L$(FOAM_LIBBIN)/dummy \
-L$(FOAM_MPI_LIBBIN) \
-lscotchDecomp \
-lmetisDecomp \
-lparMetisDecomp
-L$(FOAM_LIBBIN)/dummy

View file

@ -376,6 +376,8 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
const dictionary& decompositionDict
)
{
loadExternalLibraries();
word decompositionMethodTypeName(decompositionDict.lookup("method"));
Info<< "Selecting decompositionMethod "
@ -407,6 +409,8 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
const polyMesh& mesh
)
{
loadExternalLibraries();
word decompositionMethodTypeName(decompositionDict.lookup("method"));
Info<< "Selecting decompositionMethod "
@ -432,6 +436,28 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
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");
// Info << "Loading " << libName << endl;
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 * * * * * * * * * * * * * //

View file

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