mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: use <case> instead of $FOAM_CASE expansion in more places
This commit is contained in:
@ -292,7 +292,7 @@ bool Foam::dynamicCode::writeDigest(const std::string& sha1) const
|
|||||||
|
|
||||||
Foam::dynamicCode::dynamicCode(const word& codeName, const word& codeDirName)
|
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")),
|
libSubDir_(stringOps::expand("platforms/$WM_OPTIONS/lib")),
|
||||||
codeName_(codeName),
|
codeName_(codeName),
|
||||||
codeDirName_(codeDirName)
|
codeDirName_(codeDirName)
|
||||||
|
|||||||
@ -197,7 +197,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Root for dynamic code compilation
|
//- Root for dynamic code compilation
|
||||||
// Expanded from \$FOAM_CASE/dynamicCode
|
// Expanded from \<case\>/dynamicCode
|
||||||
const fileName& codeRoot() const
|
const fileName& codeRoot() const
|
||||||
{
|
{
|
||||||
return codeRoot_;
|
return codeRoot_;
|
||||||
@ -228,12 +228,12 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Path for specified code name relative to \$FOAM_CASE
|
//- Path for specified code name relative to \<case\>
|
||||||
// Corresponds to topDirName/codeDirName()
|
// Corresponds to topDirName/codeDirName()
|
||||||
fileName codeRelPath() const;
|
fileName codeRelPath() const;
|
||||||
|
|
||||||
|
|
||||||
//- Library path for specified code name relative to \$FOAM_CASE
|
//- Library path for specified code name relative to \<case\>
|
||||||
// Corresponds to
|
// Corresponds to
|
||||||
// dynamicCode/codeDirName()/libSubDir()/lib\<codeName\>.so
|
// dynamicCode/codeDirName()/libSubDir()/lib\<codeName\>.so
|
||||||
fileName libRelPath() const;
|
fileName libRelPath() const;
|
||||||
|
|||||||
@ -140,7 +140,7 @@ bool Foam::functionObject::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (!postProcess)
|
if (!postProcess)
|
||||||
{
|
{
|
||||||
log = dict.lookupOrDefault<Switch>("log", true);
|
log = dict.lookupOrDefault("log", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -34,8 +34,8 @@ Description
|
|||||||
|
|
||||||
\section secFunctionObjects Using function objects
|
\section secFunctionObjects Using function objects
|
||||||
|
|
||||||
FunctionObjects are selected by additional entries in the
|
FunctionObjects are selected by additional entries in the global case
|
||||||
$FOAM_CASE/system/controlDict dictionary. Each object is listed in the \c
|
system/controlDict dictionary. Each object is listed in the \c
|
||||||
functions sub-dictionary, e.g. to select the \c functionObjectType
|
functions sub-dictionary, e.g. to select the \c functionObjectType
|
||||||
functionObject the following entry would be specified:
|
functionObject the following entry would be specified:
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ Description
|
|||||||
|
|
||||||
Where:
|
Where:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default
|
||||||
type | Type of function object | yes |
|
type | Type of function object | yes |
|
||||||
libs | Libraries containing implementation | yes |
|
libs | Libraries containing implementation | yes |
|
||||||
region | Name of region for multi-region cases | no |
|
region | Name of region for multi-region cases | no |
|
||||||
@ -120,7 +120,6 @@ SourceFiles
|
|||||||
|
|
||||||
#include "typeInfo.H"
|
#include "typeInfo.H"
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "Switch.H"
|
|
||||||
#include "runTimeSelectionTables.H"
|
#include "runTimeSelectionTables.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -176,7 +175,7 @@ public:
|
|||||||
static word outputPrefix;
|
static word outputPrefix;
|
||||||
|
|
||||||
//- Switch write log to Info
|
//- Switch write log to Info
|
||||||
Switch log;
|
bool log;
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|||||||
@ -98,64 +98,54 @@ Foam::functionObject* Foam::functionObjectList::remove
|
|||||||
void Foam::functionObjectList::listDir
|
void Foam::functionObjectList::listDir
|
||||||
(
|
(
|
||||||
const fileName& dir,
|
const fileName& dir,
|
||||||
wordHashSet& foMap
|
wordHashSet& available
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Search specified directory for functionObject configuration files
|
// Search specified directory for functionObject configuration files
|
||||||
|
for (const fileName& f : fileHandler().readDir(dir))
|
||||||
{
|
{
|
||||||
fileNameList foFiles(fileHandler().readDir(dir));
|
if (f.ext().empty())
|
||||||
for (const fileName& f : foFiles)
|
|
||||||
{
|
{
|
||||||
if (f.ext().empty())
|
available.insert(f);
|
||||||
{
|
|
||||||
foMap.insert(f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recurse into sub-directories
|
// Recurse into sub-directories
|
||||||
|
for (const fileName& d : fileHandler().readDir(dir, fileName::DIRECTORY))
|
||||||
{
|
{
|
||||||
fileNameList foDirs(fileHandler().readDir(dir, fileName::DIRECTORY));
|
listDir(dir/d, available);
|
||||||
for (const fileName& d : foDirs)
|
|
||||||
{
|
|
||||||
listDir(dir/d, foMap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectList::list()
|
void Foam::functionObjectList::list()
|
||||||
{
|
{
|
||||||
wordHashSet foMap;
|
wordHashSet available;
|
||||||
|
|
||||||
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
|
for (const fileName& d : findEtcDirs(functionObjectDictPath))
|
||||||
|
|
||||||
for (const fileName& d : etcDirs)
|
|
||||||
{
|
{
|
||||||
listDir(d, foMap);
|
listDir(d, available);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Available configured functionObjects:"
|
<< "Available configured functionObjects:"
|
||||||
<< foMap.sortedToc()
|
<< available.sortedToc()
|
||||||
<< nl;
|
<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::functionObjectList::findDict(const word& funcName)
|
Foam::fileName Foam::functionObjectList::findDict(const word& funcName)
|
||||||
{
|
{
|
||||||
// First check if there is a functionObject dictionary file in the
|
// First check for functionObject dictionary file in globalCase system/
|
||||||
// case system directory
|
|
||||||
fileName dictFile = stringOps::expand("$FOAM_CASE")/"system"/funcName;
|
fileName dictFile = stringOps::expand("<system>")/funcName;
|
||||||
|
|
||||||
if (isFile(dictFile))
|
if (isFile(dictFile))
|
||||||
{
|
{
|
||||||
return dictFile;
|
return dictFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
fileNameList etcDirs(findEtcDirs(functionObjectDictPath));
|
for (const fileName& d : findEtcDirs(functionObjectDictPath))
|
||||||
|
|
||||||
for (const fileName& d : etcDirs)
|
|
||||||
{
|
{
|
||||||
dictFile = search(funcName, d);
|
dictFile = search(funcName, d);
|
||||||
if (!dictFile.empty())
|
if (!dictFile.empty())
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class functionObjectList
|
|||||||
|
|
||||||
//- Search the specified directory for functionObject
|
//- Search the specified directory for functionObject
|
||||||
//- configuration files, add to the given map and recurse
|
//- 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
|
//- No copy construct
|
||||||
functionObjectList(const functionObjectList&) = delete;
|
functionObjectList(const functionObjectList&) = delete;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
\\ / 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
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -99,11 +99,12 @@ Foam::functionObjects::abort::abort
|
|||||||
:
|
:
|
||||||
functionObject(name),
|
functionObject(name),
|
||||||
time_(runTime),
|
time_(runTime),
|
||||||
abortFile_("$FOAM_CASE/" + name),
|
abortFile_(time_.globalPath()/name),
|
||||||
action_(Time::stopAtControls::saNextWrite),
|
action_(Time::stopAtControls::saNextWrite),
|
||||||
triggered_(false)
|
triggered_(false)
|
||||||
{
|
{
|
||||||
abortFile_.expand();
|
abortFile_.clean();
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
// Cleanup old files from previous runs
|
// Cleanup old files from previous runs
|
||||||
@ -123,6 +124,12 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
|
|||||||
if (dict.readIfPresent("file", abortFile_))
|
if (dict.readIfPresent("file", abortFile_))
|
||||||
{
|
{
|
||||||
abortFile_.expand();
|
abortFile_.expand();
|
||||||
|
|
||||||
|
if (!abortFile_.isAbsolute())
|
||||||
|
{
|
||||||
|
abortFile_ = time_.globalPath()/abortFile_;
|
||||||
|
abortFile_.clean();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto oldAction = action_;
|
const auto oldAction = action_;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,7 +28,7 @@ Group
|
|||||||
grpUtilitiesFunctionObjects
|
grpUtilitiesFunctionObjects
|
||||||
|
|
||||||
Description
|
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.
|
and aborts the calculation if it is present.
|
||||||
|
|
||||||
The presence of the abort file is only checked on the master process.
|
The presence of the abort file is only checked on the master process.
|
||||||
@ -42,7 +42,7 @@ Description
|
|||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
type | Type name: abort | yes |
|
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
|
action | Abort action | no | nextWrite
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "noiseModel.H"
|
#include "noiseModel.H"
|
||||||
#include "functionObject.H"
|
#include "functionObject.H"
|
||||||
|
#include "stringOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -140,17 +141,15 @@ Foam::label Foam::noiseModel::findStartTimeIndex
|
|||||||
|
|
||||||
Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const
|
Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const
|
||||||
{
|
{
|
||||||
fileName baseDir("$FOAM_CASE");
|
return
|
||||||
word datasetName("input" + Foam::name(dataseti));
|
(
|
||||||
baseDir =
|
stringOps::expand("<case>") // ie, globalPath()
|
||||||
baseDir.expand()
|
/ functionObject::outputPrefix
|
||||||
/functionObject::outputPrefix
|
/ "noise"
|
||||||
/"noise"
|
/ outputPrefix_
|
||||||
/outputPrefix_
|
/ type()
|
||||||
/type()
|
/ ("input" + Foam::name(dataseti))
|
||||||
/datasetName;
|
);
|
||||||
|
|
||||||
return baseDir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "pointNoise.H"
|
#include "pointNoise.H"
|
||||||
#include "noiseFFT.H"
|
#include "noiseFFT.H"
|
||||||
|
#include "stringOps.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -240,11 +241,13 @@ void pointNoise::calculate()
|
|||||||
{
|
{
|
||||||
fileName fName = inputFileNames_[filei];
|
fileName fName = inputFileNames_[filei];
|
||||||
fName.expand();
|
fName.expand();
|
||||||
|
|
||||||
if (!fName.isAbsolute())
|
if (!fName.isAbsolute())
|
||||||
{
|
{
|
||||||
fName = "$FOAM_CASE"/fName;
|
// ie, globalPath() / name
|
||||||
fName.expand();
|
fName = stringOps::expand("<case>")/fName;
|
||||||
}
|
}
|
||||||
|
|
||||||
Function1Types::CSV<scalar> data("pressure", dict_, fName);
|
Function1Types::CSV<scalar> data("pressure", dict_, fName);
|
||||||
processData(filei, data);
|
processData(filei, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "surfaceWriter.H"
|
#include "surfaceWriter.H"
|
||||||
#include "noiseFFT.H"
|
#include "noiseFFT.H"
|
||||||
#include "graph.H"
|
#include "graph.H"
|
||||||
|
#include "stringOps.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -464,10 +465,11 @@ void surfaceNoise::calculate()
|
|||||||
|
|
||||||
if (!fName.isAbsolute())
|
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
|
// Container for pressure time history data per face
|
||||||
List<scalarField> pData;
|
List<scalarField> pData;
|
||||||
|
|||||||
Reference in New Issue
Block a user