mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: argList: added -noFunctionObjects to all argList
This commit is contained in:
@ -39,12 +39,6 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
argList::addBoolOption("writep", "write the final pressure field");
|
argList::addBoolOption("writep", "write the final pressure field");
|
||||||
|
|
||||||
argList::addBoolOption
|
|
||||||
(
|
|
||||||
"noFunctionObjects",
|
|
||||||
"do not execute functionObjects"
|
|
||||||
);
|
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
#include "createMesh.H"
|
#include "createMesh.H"
|
||||||
@ -57,10 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Since solver contains no time loop it would never execute
|
// Since solver contains no time loop it would never execute
|
||||||
// function objects so do it ourselves.
|
// function objects so do it ourselves.
|
||||||
if (!args.optionFound("noFunctionObjects"))
|
|
||||||
{
|
|
||||||
runTime.functionObjects().start();
|
runTime.functionObjects().start();
|
||||||
}
|
|
||||||
|
|
||||||
adjustPhi(phi, U, p);
|
adjustPhi(phi, U, p);
|
||||||
|
|
||||||
@ -112,10 +103,7 @@ int main(int argc, char *argv[])
|
|||||||
p.write();
|
p.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.optionFound("noFunctionObjects"))
|
|
||||||
{
|
|
||||||
runTime.functionObjects().end();
|
runTime.functionObjects().end();
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||||
|
|||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "PstreamReduceOps.H"
|
#include "PstreamReduceOps.H"
|
||||||
|
#include "argList.H"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@ -215,7 +216,8 @@ Foam::Time::Time
|
|||||||
const fileName& rootPath,
|
const fileName& rootPath,
|
||||||
const fileName& caseName,
|
const fileName& caseName,
|
||||||
const word& systemName,
|
const word& systemName,
|
||||||
const word& constantName
|
const word& constantName,
|
||||||
|
const bool enableFunctionObjects
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TimePaths
|
TimePaths
|
||||||
@ -259,7 +261,94 @@ Foam::Time::Time
|
|||||||
graphFormat_("raw"),
|
graphFormat_("raw"),
|
||||||
runTimeModifiable_(true),
|
runTimeModifiable_(true),
|
||||||
|
|
||||||
functionObjects_(*this)
|
functionObjects_(*this, enableFunctionObjects)
|
||||||
|
{
|
||||||
|
libs_.open(controlDict_, "libs");
|
||||||
|
|
||||||
|
// Explicitly set read flags on objectRegistry so anything constructed
|
||||||
|
// from it reads as well (e.g. fvSolution).
|
||||||
|
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
|
||||||
|
|
||||||
|
setControls();
|
||||||
|
|
||||||
|
// Time objects not registered so do like objectRegistry::checkIn ourselves.
|
||||||
|
if (runTimeModifiable_)
|
||||||
|
{
|
||||||
|
monitorPtr_.reset
|
||||||
|
(
|
||||||
|
new fileMonitor
|
||||||
|
(
|
||||||
|
regIOobject::fileModificationChecking == inotify
|
||||||
|
|| regIOobject::fileModificationChecking == inotifyMaster
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// File might not exist yet.
|
||||||
|
fileName f(controlDict_.filePath());
|
||||||
|
|
||||||
|
if (!f.size())
|
||||||
|
{
|
||||||
|
// We don't have this file but would like to re-read it.
|
||||||
|
// Possibly if in master-only reading mode. Use a non-existing
|
||||||
|
// file to keep fileMonitor synced.
|
||||||
|
f = controlDict_.objectPath();
|
||||||
|
}
|
||||||
|
|
||||||
|
controlDict_.watchIndex() = addWatch(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::Time::Time
|
||||||
|
(
|
||||||
|
const word& controlDictName,
|
||||||
|
const argList& args,
|
||||||
|
const word& systemName,
|
||||||
|
const word& constantName
|
||||||
|
)
|
||||||
|
:
|
||||||
|
TimePaths
|
||||||
|
(
|
||||||
|
args.rootPath(),
|
||||||
|
args.caseName(),
|
||||||
|
systemName,
|
||||||
|
constantName
|
||||||
|
),
|
||||||
|
|
||||||
|
objectRegistry(*this),
|
||||||
|
|
||||||
|
libs_(),
|
||||||
|
|
||||||
|
controlDict_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
controlDictName,
|
||||||
|
system(),
|
||||||
|
*this,
|
||||||
|
IOobject::MUST_READ_IF_MODIFIED,
|
||||||
|
IOobject::NO_WRITE,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
startTimeIndex_(0),
|
||||||
|
startTime_(0),
|
||||||
|
endTime_(0),
|
||||||
|
|
||||||
|
stopAt_(saEndTime),
|
||||||
|
writeControl_(wcTimeStep),
|
||||||
|
writeInterval_(GREAT),
|
||||||
|
purgeWrite_(0),
|
||||||
|
subCycling_(false),
|
||||||
|
|
||||||
|
writeFormat_(IOstream::ASCII),
|
||||||
|
writeVersion_(IOstream::currentVersion),
|
||||||
|
writeCompression_(IOstream::UNCOMPRESSED),
|
||||||
|
graphFormat_("raw"),
|
||||||
|
runTimeModifiable_(true),
|
||||||
|
|
||||||
|
functionObjects_(*this, !args.optionFound("noFunctionObjects"))
|
||||||
{
|
{
|
||||||
libs_.open(controlDict_, "libs");
|
libs_.open(controlDict_, "libs");
|
||||||
|
|
||||||
@ -303,7 +392,8 @@ Foam::Time::Time
|
|||||||
const fileName& rootPath,
|
const fileName& rootPath,
|
||||||
const fileName& caseName,
|
const fileName& caseName,
|
||||||
const word& systemName,
|
const word& systemName,
|
||||||
const word& constantName
|
const word& constantName,
|
||||||
|
const bool enableFunctionObjects
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TimePaths
|
TimePaths
|
||||||
@ -348,7 +438,7 @@ Foam::Time::Time
|
|||||||
graphFormat_("raw"),
|
graphFormat_("raw"),
|
||||||
runTimeModifiable_(true),
|
runTimeModifiable_(true),
|
||||||
|
|
||||||
functionObjects_(*this)
|
functionObjects_(*this, enableFunctionObjects)
|
||||||
{
|
{
|
||||||
libs_.open(controlDict_, "libs");
|
libs_.open(controlDict_, "libs");
|
||||||
|
|
||||||
@ -395,7 +485,8 @@ Foam::Time::Time
|
|||||||
const fileName& rootPath,
|
const fileName& rootPath,
|
||||||
const fileName& caseName,
|
const fileName& caseName,
|
||||||
const word& systemName,
|
const word& systemName,
|
||||||
const word& constantName
|
const word& constantName,
|
||||||
|
const bool enableFunctionObjects
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TimePaths
|
TimePaths
|
||||||
@ -439,7 +530,7 @@ Foam::Time::Time
|
|||||||
graphFormat_("raw"),
|
graphFormat_("raw"),
|
||||||
runTimeModifiable_(true),
|
runTimeModifiable_(true),
|
||||||
|
|
||||||
functionObjects_(*this)
|
functionObjects_(*this, enableFunctionObjects)
|
||||||
{
|
{
|
||||||
libs_.open(controlDict_, "libs");
|
libs_.open(controlDict_, "libs");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,8 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
// Forward declaration of classes
|
||||||
|
class argList;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class Time Declaration
|
Class Time Declaration
|
||||||
@ -184,14 +186,24 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct given name, rootPath and casePath
|
//- Construct given name of dictionary to read and argument list
|
||||||
|
Time
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const argList& args,
|
||||||
|
const word& systemName = "system",
|
||||||
|
const word& constantName = "constant"
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct given name of dictionary to read, rootPath and casePath
|
||||||
Time
|
Time
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const fileName& rootPath,
|
const fileName& rootPath,
|
||||||
const fileName& caseName,
|
const fileName& caseName,
|
||||||
const word& systemName = "system",
|
const word& systemName = "system",
|
||||||
const word& constantName = "constant"
|
const word& constantName = "constant",
|
||||||
|
const bool enableFunctionObjects = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct given dictionary, rootPath and casePath
|
//- Construct given dictionary, rootPath and casePath
|
||||||
@ -201,7 +213,8 @@ public:
|
|||||||
const fileName& rootPath,
|
const fileName& rootPath,
|
||||||
const fileName& caseName,
|
const fileName& caseName,
|
||||||
const word& systemName = "system",
|
const word& systemName = "system",
|
||||||
const word& constantName = "constant"
|
const word& constantName = "constant",
|
||||||
|
const bool enableFunctionObjects = true
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct given endTime, rootPath and casePath
|
//- Construct given endTime, rootPath and casePath
|
||||||
@ -210,7 +223,8 @@ public:
|
|||||||
const fileName& rootPath,
|
const fileName& rootPath,
|
||||||
const fileName& caseName,
|
const fileName& caseName,
|
||||||
const word& systemName = "system",
|
const word& systemName = "system",
|
||||||
const word& constantName = "constant"
|
const word& constantName = "constant",
|
||||||
|
const bool enableFunctionObjects = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,12 @@ Foam::argList::initValidTables::initValidTables()
|
|||||||
);
|
);
|
||||||
validParOptions.set("roots", "(dir1 .. dirN)");
|
validParOptions.set("roots", "(dir1 .. dirN)");
|
||||||
|
|
||||||
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"noFunctionObjects",
|
||||||
|
"do not execute functionObjects"
|
||||||
|
);
|
||||||
|
|
||||||
Pstream::addValidParOptions(validParOptions);
|
Pstream::addValidParOptions(validParOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,9 +4,4 @@
|
|||||||
|
|
||||||
Foam::Info<< "Create time\n" << Foam::endl;
|
Foam::Info<< "Create time\n" << Foam::endl;
|
||||||
|
|
||||||
Foam::Time runTime
|
Foam::Time runTime(Foam::Time::controlDictName, args);
|
||||||
(
|
|
||||||
Foam::Time::controlDictName,
|
|
||||||
args.rootPath(),
|
|
||||||
args.caseName()
|
|
||||||
);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user