includeFvModel: now searches the constant directory for local configuration files

This commit is contained in:
Henry Weller
2023-08-28 23:31:54 +01:00
parent 30940e0e1d
commit b9a8910739
6 changed files with 21 additions and 5 deletions

View File

@ -835,6 +835,7 @@ fileName findConfigFile
(
const word& configName,
const fileName& configFilesPath,
const word& configFilesDir,
const word& region = word::null
);
@ -862,6 +863,7 @@ bool readConfigFile
const string& argString,
dictionary& parentDict,
const fileName& configFilesPath,
const word& configFilesDir,
const Pair<string>& contextTypeAndValue,
const word& region = word::null
);

View File

@ -351,15 +351,17 @@ Foam::fileName Foam::findConfigFile
(
const word& configName,
const fileName& configFilesPath,
const word& configFilesDir,
const word& region
)
{
// First check if there is a configuration file in the
// region system directory
// region configFilesDir directory
{
const fileName dictFile
(
stringOps::expandEnvVar("$FOAM_CASE")/"system"/region/configName
stringOps::expandEnvVar("$FOAM_CASE")
/configFilesDir/region/configName
);
if (isFile(dictFile))
@ -369,12 +371,12 @@ Foam::fileName Foam::findConfigFile
}
// Next, if the region is specified, check if there is a configuration file
// in the global system directory
// in the global configFilesDir directory
if (region != word::null)
{
const fileName dictFile
(
stringOps::expandEnvVar("$FOAM_CASE")/"system"/configName
stringOps::expandEnvVar("$FOAM_CASE")/configFilesDir/configName
);
if (isFile(dictFile))
@ -426,6 +428,7 @@ bool Foam::readConfigFile
const string& argString,
dictionary& parentDict,
const fileName& configFilesPath,
const word& configFilesDir,
const Pair<string>& contextTypeAndValue,
const word& region
)
@ -437,7 +440,13 @@ bool Foam::readConfigFile
dictArgList(argString, funcType, args, namedArgs);
// Search for the configuration file
fileName path = findConfigFile(funcType, configFilesPath, region);
fileName path = findConfigFile
(
funcType,
configFilesPath,
configFilesDir,
region
);
if (path == fileName::null)
{

View File

@ -68,6 +68,7 @@ bool Foam::functionEntries::includeFuncEntry::execute
fNameArgs,
parentDict,
functionObjectDictPath,
"system",
{"file", is.name() + " at line " + Foam::name(is.lineNumber())}
);
}

View File

@ -173,6 +173,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
args["func"],
functionsDict,
functionEntries::includeFuncEntry::functionObjectDictPath,
"system",
{"command", args.commandLine()},
region
);
@ -190,6 +191,7 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
funcs[i],
functionsDict,
functionEntries::includeFuncEntry::functionObjectDictPath,
"system",
{"command", args.commandLine()},
region
);

View File

@ -69,6 +69,7 @@ bool Foam::functionEntries::includeFvConstraintEntry::execute
fNameArgs,
parentDict,
fvConstraintDictPath,
"system",
{"file", is.name() + " at line " + Foam::name(is.lineNumber())}
);
}

View File

@ -68,6 +68,7 @@ bool Foam::functionEntries::includeFvModelEntry::execute
fNameArgs,
parentDict,
fvModelDictPath,
"constant",
{"file", is.name() + " at line " + Foam::name(is.lineNumber())}
);
}