Merge branch 'feature/globalCtrlDictFromEnvVariable' into mixingPlane
This commit is contained in:
commit
b06f0fbc9a
4 changed files with 40 additions and 11 deletions
|
@ -208,6 +208,21 @@ void Foam::primitiveEntry::readEntry(const dictionary& dict, Istream& is)
|
|||
}
|
||||
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
|
||||
(
|
||||
"primitiveEntry::readEntry(const dictionary&, Istream&)",
|
||||
|
|
|
@ -311,6 +311,8 @@ Foam::argList::argList
|
|||
|
||||
string dateString = clock::date();
|
||||
string timeString = clock::clockTime();
|
||||
fileName ctrlDict = debug::controlDict().name();
|
||||
string ctrlDictString = ctrlDict.path()/ctrlDict.name();
|
||||
|
||||
// Print the banner once only for parallel runs
|
||||
if (Pstream::master() && bannerEnabled)
|
||||
|
@ -321,7 +323,9 @@ Foam::argList::argList
|
|||
<< "Date : " << dateString.c_str() << nl
|
||||
<< "Time : " << timeString.c_str() << nl
|
||||
<< "Host : " << hostName() << nl
|
||||
<< "PID : " << pid() << endl;
|
||||
<< "PID : " << pid() << nl
|
||||
<< "CtrlDict : " << ctrlDictString.c_str()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
jobInfo.add("startDate", dateString);
|
||||
|
|
|
@ -77,9 +77,19 @@ Foam::dictionary& Foam::debug::controlDict()
|
|||
{
|
||||
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
|
||||
(
|
||||
IFstream(findEtcFile("controlDict", true))()
|
||||
IFstream(globControlDictFileName)()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue