Merge branch 'feature/globalCtrlDictFromEnvVariable' into mixingPlane

This commit is contained in:
Martin Beaudoin 2011-06-04 12:15:56 -04:00
commit b06f0fbc9a
4 changed files with 40 additions and 11 deletions

View file

@ -192,7 +192,7 @@ void Foam::sigFpe::set(const bool verbose)
{
if (verbose)
{
Info<< "SigFpe : Enabling floating point exception trapping"
Info<< "SigFpe : Enabling floating point exception trapping"
<< " (FOAM_SIGFPE)." << endl;
}

View file

@ -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&)",

View file

@ -311,17 +311,21 @@ 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)
{
IOobject::writeBanner(Info, true)
<< "Build : " << Foam::FOAMbuild << nl
<< "Exec : " << argListString.c_str() << nl
<< "Date : " << dateString.c_str() << nl
<< "Time : " << timeString.c_str() << nl
<< "Host : " << hostName() << nl
<< "PID : " << pid() << endl;
<< "Build : " << Foam::FOAMbuild << nl
<< "Exec : " << argListString.c_str() << nl
<< "Date : " << dateString.c_str() << nl
<< "Time : " << timeString.c_str() << nl
<< "Host : " << hostName() << nl
<< "PID : " << pid() << nl
<< "CtrlDict : " << ctrlDictString.c_str()
<< endl;
}
jobInfo.add("startDate", dateString);
@ -528,8 +532,8 @@ Foam::argList::argList
if (Pstream::master() && bannerEnabled)
{
Info<< "Case : " << (rootPath_/globalCase_).c_str() << nl
<< "nProcs : " << nProcs << endl;
Info<< "Case : " << (rootPath_/globalCase_).c_str() << nl
<< "nProcs : " << nProcs << endl;
if (parRunControl_.parRun())
{

View file

@ -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)()
);
}