Executes system calls, entered in the form of string lists. More...
Public Member Functions | |
TypeName ("systemCall") | |
Runtime type information. More... | |
systemCall (const word &name, const Time &runTime, const dictionary &dict) | |
Construct from Time and dictionary. More... | |
virtual | ~systemCall ()=default |
Destructor. More... | |
virtual bool | read (const dictionary &dict) |
Read the system calls. More... | |
virtual bool | execute () |
Execute the "executeCalls" at each time-step. More... | |
virtual bool | write () |
Write, execute the "writeCalls". More... | |
virtual bool | end () |
Execute the "endCalls" at the final time-loop. More... | |
![]() | |
declareRunTimeSelectionTable (autoPtr, functionObject, dictionary,(const word &name, const Time &runTime, const dictionary &dict),(name, runTime, dict)) | |
functionObject (const word &name, const bool withNamePrefix=defaultUseNamePrefix) | |
Construct from components. More... | |
autoPtr< functionObject > | clone () const |
Return clone. More... | |
virtual | ~functionObject ()=default |
Destructor. More... | |
virtual const word & | type () const =0 |
Runtime type information. More... | |
const word & | name () const noexcept |
Return the name of this functionObject. More... | |
bool | useNamePrefix () const noexcept |
Return the flag for adding a scoping name prefix. More... | |
bool | useNamePrefix (bool on) noexcept |
Modify the flag for adding a scoping name prefix. More... | |
virtual bool | execute (const label subIndex) |
Execute using the specified subIndex. More... | |
virtual bool | adjustTimeStep () |
Called at the end of Time::adjustDeltaT() if adjustTime is true. More... | |
virtual bool | filesModified () const |
Did any file get changed during execution? More... | |
virtual void | updateMesh (const mapPolyMesh &mpm) |
Update for changes of mesh. More... | |
virtual void | movePoints (const polyMesh &mesh) |
Update for changes of mesh. More... | |
Protected Member Functions | |
label | dispatch (const stringList &calls) |
Dispatch specified calls. More... | |
systemCall (const systemCall &)=delete | |
No copy construct. More... | |
void | operator= (const systemCall &)=delete |
No copy assignment. More... | |
![]() | |
word | scopedName (const word &name) const |
Return a scoped (prefixed) name. More... | |
Protected Attributes | |
stringList | executeCalls_ |
List of calls to execute - every step. More... | |
stringList | writeCalls_ |
List of calls to execute - write steps. More... | |
stringList | endCalls_ |
List of calls to execute when exiting the time-loop. More... | |
bool | masterOnly_ |
Perform system calls on the master only. More... | |
Additional Inherited Members | |
![]() | |
static autoPtr< functionObject > | New (const word &name, const Time &runTime, const dictionary &dict) |
Select from dictionary, based on its "type" entry. More... | |
![]() | |
bool | log |
Flag to write log into Info. More... | |
![]() | |
static int | debug |
Flag to execute debug content. More... | |
static bool | postProcess |
Global post-processing mode switch. More... | |
static bool | defaultUseNamePrefix |
Global default for useNamePrefix. More... | |
static word | outputPrefix |
Directory prefix. More... | |
Executes system calls, entered in the form of string lists.
Calls can be made at the following points in the calculation:
systemCall1 { type systemCall; libs (utilityFunctionObjects); ... executeCalls ( "echo execute" ); writeCalls ( "echo === writing data ===" ); endCalls ( "echo === echoing .bashrc ===" "cat ~/.bashrc" "echo \*\*\* done \*\*\*" ); }
Where the entries comprise:
Property | Description | Required | Default value |
---|---|---|---|
type | type name: systemCall | yes | |
executeCalls | list of calls on execute | yes | |
writeCalls | list of calls on write | yes | |
endCalls | list of calls on end | yes | |
master | execute on master only | no | false |
systemCall
function object, the allowSystemOperations
must be set to '1'; otherwise, system calls will not be allowed.Additionally, since the system commands are normally sent via the shell, special shell character may require backslash escaping.
Definition at line 140 of file systemCall.H.
|
protecteddelete |
No copy construct.
systemCall | ( | const word & | name, |
const Time & | runTime, | ||
const dictionary & | dict | ||
) |
Construct from Time and dictionary.
Definition at line 86 of file systemCall.C.
References dict, and Foam::read().
|
virtualdefault |
Destructor.
|
protected |
Dispatch specified calls.
Definition at line 55 of file systemCall.C.
References UPstream::master(), systemCall::masterOnly_, Pstream::scatter(), and Foam::system().
|
protecteddelete |
No copy assignment.
TypeName | ( | "systemCall" | ) |
Runtime type information.
|
virtual |
Read the system calls.
Reimplemented from functionObject.
Definition at line 104 of file systemCall.C.
References dynamicCode::allowSystemOperations, Foam::foamVersion::api, dict, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::isAdministrator(), Foam::nl, functionObject::read(), and WarningInFunction.
|
virtual |
Execute the "executeCalls" at each time-step.
Implements functionObject.
Definition at line 152 of file systemCall.C.
|
virtual |
Write, execute the "writeCalls".
Implements functionObject.
Definition at line 159 of file systemCall.C.
|
virtual |
Execute the "endCalls" at the final time-loop.
Reimplemented from functionObject.
Definition at line 166 of file systemCall.C.
|
protected |
List of calls to execute - every step.
Definition at line 149 of file systemCall.H.
|
protected |
List of calls to execute - write steps.
Definition at line 152 of file systemCall.H.
|
protected |
List of calls to execute when exiting the time-loop.
Definition at line 155 of file systemCall.H.
|
protected |
Perform system calls on the master only.
Definition at line 158 of file systemCall.H.
Referenced by systemCall::dispatch().