Executes system calls, entered in the form of string lists. More...
#include <systemCall.H>


Public Member Functions | |
| TypeName ("systemCall") | |
| Runtime type information. | |
| systemCall (const word &name, const Time &runTime, const dictionary &dict) | |
| Construct from name, Time and dictionary. | |
| virtual | ~systemCall ()=default |
| Destructor. | |
| virtual bool | read (const dictionary &dict) |
| Read the function-object dictionary. | |
| 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. | |
| Public Member Functions inherited from functionObject | |
| 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. | |
| autoPtr< functionObject > | clone () const |
| Return clone. | |
| virtual | ~functionObject ()=default |
| Destructor. | |
| virtual const word & | type () const =0 |
| Runtime type information. | |
| const word & | name () const noexcept |
| Return the name of this functionObject. | |
| bool | useNamePrefix () const noexcept |
| Return the flag for adding a scoping name prefix. | |
| bool | useNamePrefix (bool on) noexcept |
| Modify the flag for adding a scoping name prefix. | |
| virtual bool | execute (const label subIndex) |
| Execute using the specified subIndex. | |
| virtual bool | adjustTimeStep () |
| Called at the end of Time::adjustDeltaT() if adjustTime is true. | |
| virtual bool | filesModified () const |
| Did any file get changed during execution? | |
| virtual void | updateMesh (const mapPolyMesh &mpm) |
| Update for changes of mesh. | |
| virtual void | movePoints (const polyMesh &mesh) |
| Update for changes of mesh. | |
Protected Member Functions | |
| label | dispatch (const stringList &calls) |
| Dispatch specified calls. | |
| systemCall (const systemCall &)=delete | |
| No copy construct. | |
| void | operator= (const systemCall &)=delete |
| No copy assignment. | |
| Protected Member Functions inherited from functionObject | |
| word | scopedName (const word &name) const |
| Return a scoped (prefixed) name. | |
Protected Attributes | |
| stringList | executeCalls_ |
| List of calls to execute - every step. | |
| stringList | writeCalls_ |
| List of calls to execute - write steps. | |
| stringList | endCalls_ |
| List of calls to execute when exiting the time-loop. | |
| bool | masterOnly_ |
| Perform system calls on the master only. | |
Additional Inherited Members | |
| Static Public Member Functions inherited from functionObject | |
| static autoPtr< functionObject > | New (const word &name, const Time &runTime, const dictionary &dict) |
| Select from dictionary, based on its "type" entry. | |
| Public Attributes inherited from functionObject | |
| bool | log |
| Flag to write log into Info. | |
| Static Public Attributes inherited from functionObject | |
| static int | debug |
| Flag to execute debug content. | |
| static bool | postProcess |
| Global post-processing mode switch. | |
| static bool | defaultUseNamePrefix |
| Global default for useNamePrefix. | |
| static word | outputPrefix |
| Directory prefix. | |
Executes system calls, entered in the form of string lists.
Calls can be made at the following points in the calculation:
system/controlDict.functions: systemCallFO
{
// Mandatory entries
type systemCall;
libs (utilityFunctionObjects);
...
// Optional entries
executeCalls
(
"echo execute"
);
writeCalls
(
"echo === writing data ==="
);
endCalls
(
"echo === echoing .bashrc ==="
"cat ~/.bashrc"
"echo \*\*\* done \*\*\*"
);
// Inherited entries
...
}
where the entries mean:
| Property | Description | Type | Reqd | Deflt |
|---|---|---|---|---|
type | Type name: systemCall | word | yes | - |
libs | Library name: utilityFunctionObjects | word | yes | - |
executeCalls | List of calls on execute | stringList | yes | - |
writeCalls | List of calls on write | stringList | yes | - |
endCalls | List of calls on end | stringList | yes | - |
master | Execute on master only | bool | no | false |
The inherited entries are elaborated in:
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 154 of file systemCall.H.
|
protecteddelete |
No copy construct.
References systemCall().
Referenced by operator=(), and systemCall().


| systemCall | ( | const word & | name, |
| const Time & | runTime, | ||
| const dictionary & | dict ) |
Construct from name, Time and dictionary.
Definition at line 78 of file systemCall.C.
References dict, endCalls_, executeCalls_, functionObject::functionObject(), masterOnly_, functionObject::name(), read(), and writeCalls_.

|
virtualdefault |
Destructor.
References dict.
|
protected |
Dispatch specified calls.
Definition at line 48 of file systemCall.C.
References UPstream::broadcast, UList< T >::empty(), UPstream::master(), masterOnly_, and Foam::system().
Referenced by end(), execute(), and write().


|
protecteddelete |
| TypeName | ( | "systemCall" | ) |
Runtime type information.
References dict, functionObject::name(), and runTime.

|
virtual |
Read the function-object dictionary.
Reimplemented from functionObject.
Definition at line 97 of file systemCall.C.
References dynamicCode::allowSystemOperations, Foam::foamVersion::api, dict, endCalls_, Foam::endl(), executeCalls_, Foam::exit(), Foam::FatalError, FatalErrorInFunction, Foam::isAdministrator(), masterOnly_, Foam::nl, functionObject::read(), WarningInFunction, and writeCalls_.
Referenced by systemCall().


|
virtual |
Execute the function-object operations.
Execute the "executeCalls" at each time-step
Implements functionObject.
Definition at line 145 of file systemCall.C.
References dispatch(), and executeCalls_.

|
virtual |
Write the function-object results.
Write, execute the "writeCalls"
Implements functionObject.
Definition at line 152 of file systemCall.C.
References dispatch(), and writeCalls_.

|
virtual |
Execute the "endCalls" at the final time-loop.
Reimplemented from functionObject.
Definition at line 159 of file systemCall.C.
References dispatch(), and endCalls_.

|
protected |
List of calls to execute - every step.
Definition at line 165 of file systemCall.H.
Referenced by execute(), read(), and systemCall().
|
protected |
List of calls to execute - write steps.
Definition at line 170 of file systemCall.H.
Referenced by read(), systemCall(), and write().
|
protected |
List of calls to execute when exiting the time-loop.
Definition at line 175 of file systemCall.H.
Referenced by end(), read(), and systemCall().
|
protected |
Perform system calls on the master only.
Definition at line 180 of file systemCall.H.
Referenced by dispatch(), read(), and systemCall().