Merge branch 'feature/globalCtrlDictFromEnvVariable' into mixingPlane
This commit is contained in:
commit
b06f0fbc9a
4 changed files with 40 additions and 11 deletions
|
@ -192,7 +192,7 @@ void Foam::sigFpe::set(const bool verbose)
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
Info<< "SigFpe : Enabling floating point exception trapping"
|
Info<< "SigFpe : Enabling floating point exception trapping"
|
||||||
<< " (FOAM_SIGFPE)." << endl;
|
<< " (FOAM_SIGFPE)." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,21 @@ void Foam::primitiveEntry::readEntry(const dictionary& dict, Istream& is)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// When reading an invalid global controlDict file, the following call
|
||||||
|
// to FatalIOErrorIn will crash with a "Segmentation Fault", and will
|
||||||
|
// fail to generate any useful error message to the console.
|
||||||
|
// This additional error message will at least leave a minimal trace.
|
||||||
|
//
|
||||||
|
// The cause of the Seg. fault is still unknown, but seems to be related
|
||||||
|
// to the initialization of the string member attributes of the global
|
||||||
|
// object FatalIOError. (MB 05/2011)
|
||||||
|
//
|
||||||
|
std::cerr << "--> Error from: "
|
||||||
|
<< "primitiveEntry::readEntry(const dictionary&, Istream&)"
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << "--> Fatal error reading input from: "
|
||||||
|
<< is.name() << std::endl;
|
||||||
|
|
||||||
FatalIOErrorIn
|
FatalIOErrorIn
|
||||||
(
|
(
|
||||||
"primitiveEntry::readEntry(const dictionary&, Istream&)",
|
"primitiveEntry::readEntry(const dictionary&, Istream&)",
|
||||||
|
|
|
@ -311,17 +311,21 @@ Foam::argList::argList
|
||||||
|
|
||||||
string dateString = clock::date();
|
string dateString = clock::date();
|
||||||
string timeString = clock::clockTime();
|
string timeString = clock::clockTime();
|
||||||
|
fileName ctrlDict = debug::controlDict().name();
|
||||||
|
string ctrlDictString = ctrlDict.path()/ctrlDict.name();
|
||||||
|
|
||||||
// Print the banner once only for parallel runs
|
// Print the banner once only for parallel runs
|
||||||
if (Pstream::master() && bannerEnabled)
|
if (Pstream::master() && bannerEnabled)
|
||||||
{
|
{
|
||||||
IOobject::writeBanner(Info, true)
|
IOobject::writeBanner(Info, true)
|
||||||
<< "Build : " << Foam::FOAMbuild << nl
|
<< "Build : " << Foam::FOAMbuild << nl
|
||||||
<< "Exec : " << argListString.c_str() << nl
|
<< "Exec : " << argListString.c_str() << nl
|
||||||
<< "Date : " << dateString.c_str() << nl
|
<< "Date : " << dateString.c_str() << nl
|
||||||
<< "Time : " << timeString.c_str() << nl
|
<< "Time : " << timeString.c_str() << nl
|
||||||
<< "Host : " << hostName() << nl
|
<< "Host : " << hostName() << nl
|
||||||
<< "PID : " << pid() << endl;
|
<< "PID : " << pid() << nl
|
||||||
|
<< "CtrlDict : " << ctrlDictString.c_str()
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
jobInfo.add("startDate", dateString);
|
jobInfo.add("startDate", dateString);
|
||||||
|
@ -528,8 +532,8 @@ Foam::argList::argList
|
||||||
|
|
||||||
if (Pstream::master() && bannerEnabled)
|
if (Pstream::master() && bannerEnabled)
|
||||||
{
|
{
|
||||||
Info<< "Case : " << (rootPath_/globalCase_).c_str() << nl
|
Info<< "Case : " << (rootPath_/globalCase_).c_str() << nl
|
||||||
<< "nProcs : " << nProcs << endl;
|
<< "nProcs : " << nProcs << endl;
|
||||||
|
|
||||||
if (parRunControl_.parRun())
|
if (parRunControl_.parRun())
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,9 +77,19 @@ Foam::dictionary& Foam::debug::controlDict()
|
||||||
{
|
{
|
||||||
if (!controlDictPtr_)
|
if (!controlDictPtr_)
|
||||||
{
|
{
|
||||||
|
// Allow users to override the location of the global controlDict
|
||||||
|
// dictionary using an environment variable. Using this environment
|
||||||
|
// variable, one can assign a different global controlDict for each
|
||||||
|
// case, without having to modify the "default" ones.
|
||||||
|
fileName globControlDictFileName = getEnv("FOAM_GLOBAL_CONTROLDICT");
|
||||||
|
|
||||||
|
// Fallback to default locations if filename is empty or not valid
|
||||||
|
if( ! isFile(globControlDictFileName) )
|
||||||
|
globControlDictFileName = findEtcFile("controlDict", true);
|
||||||
|
|
||||||
controlDictPtr_ = new dictionary
|
controlDictPtr_ = new dictionary
|
||||||
(
|
(
|
||||||
IFstream(findEtcFile("controlDict", true))()
|
IFstream(globControlDictFileName)()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue