66 for (
const string& call : calls)
108 executeCalls_.clear();
112 dict.readIfPresent(
"executeCalls", executeCalls_);
113 dict.readIfPresent(
"writeCalls", writeCalls_);
114 dict.readIfPresent(
"endCalls", endCalls_);
115 masterOnly_ =
dict.getOrDefault(
"master",
false);
117 if (executeCalls_.empty() && endCalls_.empty() && writeCalls_.empty())
120 <<
"No executeCalls, endCalls or writeCalls defined."
126 <<
"System calls should not be executed by someone"
127 <<
" with administrator rights for security reasons." <<
nl
134 <<
"Executing user-supplied system calls may have been disabled"
135 <<
" by default" <<
nl
136 <<
"for security reasons." <<
nl
137 <<
"If you trust the code, you may enable this by adding"
139 <<
" allowSystemOperations 1" <<
nl <<
nl
140 <<
"to the InfoSwitches setting in the system controlDict." <<
nl
141 <<
"The system controlDict is any of" <<
nl <<
nl
143 <<
" ~/.OpenFOAM/controlDict" <<
nl
144 <<
" $WM_PROJECT_DIR/etc/controlDict" <<
nl <<
endl
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
@ broadcast
broadcast [MPI]
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static int allowSystemOperations
Flag if system operations are allowed.
Abstract base-class for Time/database function objects.
const word & name() const noexcept
Return the name of this functionObject.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
functionObject(const word &name, const bool withNamePrefix=defaultUseNamePrefix)
Construct from components.
Executes system calls, entered in the form of string lists.
label dispatch(const stringList &calls)
Dispatch specified calls.
bool masterOnly_
Perform system calls on the master only.
stringList writeCalls_
List of calls to execute - write steps.
systemCall(const systemCall &)=delete
No copy construct.
stringList executeCalls_
List of calls to execute - every step.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
stringList endCalls_
List of calls to execute when exiting the time-loop.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
virtual bool end()
Execute the "endCalls" at the final time-loop.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
const int api
OpenFOAM api number (integer) corresponding to the value of OPENFOAM at the time of compilation.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
bool read(const char *buf, int32_t &val)
Same as readInt32.
int system(const std::string &command, const bool bg=false)
Execute the specified command via the shell.
bool isAdministrator()
Is the current user the administrator (root).
List< string > stringList
List of string.
Ostream & endl(Ostream &os)
Add newline and flush stream.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).