STYLE: use <case> instead of $FOAM_CASE expansion in more places

This commit is contained in:
Mark Olesen
2018-10-15 21:19:13 +02:00
parent c6520033c9
commit 5c8a1b746d
11 changed files with 56 additions and 56 deletions

View File

@ -292,7 +292,7 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
:
codeRoot_(stringOps::expand("$FOAM_CASE")/topDirName),
codeRoot_(stringOps::expand("<case>")/topDirName),
libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")),
codeName_(codeName),
codeDirName_(codeDirName)

View File

@ -197,7 +197,7 @@ public:
}
//- Root for dynamic code compilation
// Expanded from \$FOAM_CASE/dynamicCode
// Expanded from \<case\>/dynamicCode
const fileName& codeRoot() const
{
return codeRoot_;
@ -228,12 +228,12 @@ public:
#endif
}
//- Path for specified code name relative to \$FOAM_CASE
//- Path for specified code name relative to \<case\>
// Corresponds to topDirName/codeDirName()
fileName codeRelPath() const;
//- Library path for specified code name relative to \$FOAM_CASE
//- Library path for specified code name relative to \<case\>
// Corresponds to
// dynamicCode/codeDirName()/libSubDir()/lib\<codeName\>.so
fileName libRelPath() const;

View File

@ -140,7 +140,7 @@ bool Foam::functionObject::read(const dictionary& dict)
{
if (!postProcess)
{
log = dict.lookupOrDefault<Switch>("log", true);
log = dict.lookupOrDefault("log", true);
}
return true;

View File

@ -34,8 +34,8 @@ Description
\section secFunctionObjects Using function objects
FunctionObjects are selected by additional entries in the
$FOAM_CASE/system/controlDict dictionary. Each object is listed in the \c
FunctionObjects are selected by additional entries in the global case
system/controlDict dictionary. Each object is listed in the \c
functions sub-dictionary, e.g. to select the \c functionObjectType
functionObject the following entry would be specified:
@ -59,7 +59,7 @@ Description
Where:
\table
Property | Description | Required | Default value
Property | Description | Required | Default
type | Type of function object | yes |
libs | Libraries containing implementation | yes |
region | Name of region for multi-region cases | no |
@ -120,7 +120,6 @@ SourceFiles
#include "typeInfo.H"
#include "autoPtr.H"
#include "Switch.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -176,7 +175,7 @@ public:
static word outputPrefix;
//- Switch write log to Info
Switch log;
bool log;
// Declare run-time constructor selection tables

View File

@ -98,64 +98,54 @@ Foam::functionObject* Foam::functionObjectList::remove
void Foam::functionObjectList::listDir
(
const fileName& dir,
wordHashSet& foMap
wordHashSet& available
)
{
// Search specified directory for functionObject configuration files
{
fileNameList foFiles(fileHandler().readDir(dir));
for (const fileName& f : foFiles)
for (const fileName& f : fileHandler().readDir(dir))
{
if (f.ext().empty())
{
foMap.insert(f);
}
available.insert(f);
}
}
// Recurse into sub-directories
for (const fileName& d : fileHandler().readDir(dir, fileName::DIRECTORY))
{
fileNameList foDirs(fileHandler().readDir(dir, fileName::DIRECTORY));
for (const fileName& d : foDirs)
{
listDir(dir/d, foMap);
}
listDir(dir/d, available);
}
}
void Foam::functionObjectList::list()
{
wordHashSet foMap;
wordHashSet available;
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
for (const fileName& d : etcDirs)
for (const fileName& d : findEtcDirs(functionObjectDictPath))
{
listDir(d, foMap);
listDir(d, available);
}
Info<< nl
<< "Available configured functionObjects:"
<< foMap.sortedToc()
<< available.sortedToc()
<< nl;
}
Foam::fileName Foam::functionObjectList::findDict(const word& funcName)
{
// First check if there is a functionObject dictionary file in the
// case system directory
fileName dictFile = stringOps::expand("$FOAM_CASE")/"system"/funcName;
// First check for functionObject dictionary file in globalCase system/
fileName dictFile = stringOps::expand("<system>")/funcName;
if (isFile(dictFile))
{
return dictFile;
}
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
for (const fileName& d : etcDirs)
for (const fileName& d : findEtcDirs(functionObjectDictPath))
{
dictFile = search(funcName, d);
if (!dictFile.empty())

View File

@ -102,7 +102,7 @@ class functionObjectList
//- Search the specified directory for functionObject
//- configuration files, add to the given map and recurse
static void listDir(const fileName& dir, wordHashSet& foMap);
static void listDir(const fileName& dir, wordHashSet& available);
//- No copy construct
functionObjectList(const functionObjectList&) = delete;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -99,11 +99,12 @@ Foam::functionObjects::abort::abort
:
functionObject(name),
time_(runTime),
abortFile_("$FOAM_CASE/" + name),
abortFile_(time_.globalPath()/name),
action_(Time::stopAtControls::saNextWrite),
triggered_(false)
{
abortFile_.expand();
abortFile_.clean();
read(dict);
// Cleanup old files from previous runs
@ -123,6 +124,12 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
if (dict.readIfPresent("file", abortFile_))
{
abortFile_.expand();
if (!abortFile_.isAbsolute())
{
abortFile_ = time_.globalPath()/abortFile_;
abortFile_.clean();
}
}
const auto oldAction = action_;

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,7 +28,7 @@ Group
grpUtilitiesFunctionObjects
Description
Watches for presence of the named file in the $FOAM_CASE directory
Watches for presence of the named file in the case directory
and aborts the calculation if it is present.
The presence of the abort file is only checked on the master process.
@ -42,7 +42,7 @@ Description
\table
Property | Description | Required | Default value
type | Type name: abort | yes |
file | The abort filename | no | $FOAM_CASE/name
file | The abort filename | no | \<case\>/name
action | Abort action | no | nextWrite
\endtable

View File

@ -25,6 +25,7 @@ License
#include "noiseModel.H"
#include "functionObject.H"
#include "stringOps.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -140,17 +141,15 @@ Foam::label Foam::noiseModel::findStartTimeIndex
Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const
{
fileName baseDir("$FOAM_CASE");
word datasetName("input" + Foam::name(dataseti));
baseDir =
baseDir.expand()
return
(
stringOps::expand("<case>") // ie, globalPath()
/ functionObject::outputPrefix
/ "noise"
/ outputPrefix_
/ type()
/datasetName;
return baseDir;
/ ("input" + Foam::name(dataseti))
);
}

View File

@ -25,6 +25,7 @@ License
#include "pointNoise.H"
#include "noiseFFT.H"
#include "stringOps.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -240,11 +241,13 @@ void pointNoise::calculate()
{
fileName fName = inputFileNames_[filei];
fName.expand();
if (!fName.isAbsolute())
{
fName = "$FOAM_CASE"/fName;
fName.expand();
// ie, globalPath() / name
fName = stringOps::expand("<case>")/fName;
}
Function1Types::CSV<scalar> data("pressure", dict_, fName);
processData(filei, data);
}

View File

@ -28,6 +28,7 @@ License
#include "surfaceWriter.H"
#include "noiseFFT.H"
#include "graph.H"
#include "stringOps.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -464,10 +465,11 @@ void surfaceNoise::calculate()
if (!fName.isAbsolute())
{
fName = "$FOAM_CASE"/fName;
// ie, globalPath() / name
fName = stringOps::expand("<case>")/fName;
}
initialise(fName.expand());
initialise(fName);
// Container for pressure time history data per face
List<scalarField> pData;