TEMPORARY: decomposition library load. Temporary fix, Henrik Rusche. To be reverted
This commit is contained in:
parent
000384c651
commit
63c9311177
2 changed files with 44 additions and 0 deletions
|
@ -431,6 +431,21 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
|
|||
const dictionary& decompositionDict
|
||||
)
|
||||
{
|
||||
// HR 11.02.18: Library table is member of runtime (like in
|
||||
// vanilla). Therefore need runtime here and we get it by
|
||||
// traversing to the top of the dict in the hope that it is
|
||||
// an IOdictionary.
|
||||
const dictionary& topDict = decompositionDict.topDict();
|
||||
if (isA<IOdictionary>(topDict))
|
||||
{
|
||||
Time& time = const_cast<Time&>
|
||||
(
|
||||
reinterpret_cast<const Time&>(topDict)
|
||||
);
|
||||
|
||||
loadExternalLibraries(time);
|
||||
}
|
||||
|
||||
word methodName(decompositionDict.lookup("method"));
|
||||
|
||||
Info<< "Selecting decompositionMethod " << methodName << endl;
|
||||
|
@ -461,6 +476,8 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
|
|||
const polyMesh& mesh
|
||||
)
|
||||
{
|
||||
loadExternalLibraries(const_cast<Time&>(mesh.time()));
|
||||
|
||||
word methodName(decompositionDict.lookup("method"));
|
||||
|
||||
Info<< "Selecting decompositionMethod "
|
||||
|
@ -487,6 +504,29 @@ Foam::autoPtr<Foam::decompositionMethod> Foam::decompositionMethod::New
|
|||
}
|
||||
|
||||
|
||||
void Foam::decompositionMethod::loadExternalLibraries(Time& time)
|
||||
{
|
||||
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");
|
||||
|
||||
if(!time.libs().open(libName))
|
||||
{
|
||||
WarningIn("decompositionMethod::loadExternalLibraries()")
|
||||
<< "Loading of decomposition library " << libName
|
||||
<< " unsuccesful. Some decomposition methods may not be "
|
||||
<< " available"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::labelList Foam::decompositionMethod::decompose
|
||||
|
|
|
@ -113,6 +113,10 @@ private:
|
|||
//- Disallow default bitwise assignment
|
||||
void operator=(const decompositionMethod&);
|
||||
|
||||
//- Load missing libraries to avoid compile-time linking to external dependencies
|
||||
// Temporary hack: to be resolved by Henrik Rusche. HJ, 15/May/2018
|
||||
static void loadExternalLibraries(Time& time);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
|
Reference in a new issue