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 name, Time and dictionary. More... | |
| virtual | ~systemCall ()=default |
| Destructor. More... | |
| virtual bool | read (const dictionary &dict) |
| Read the function-object dictionary. More... | |
| virtual bool | execute () |
| Execute the function-object operations. More... | |
| virtual bool | write () |
| Write the function-object results. More... | |
| virtual bool | end () |
| Execute the "endCalls" at the final time-loop. More... | |
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. 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... | |
Protected Member Functions inherited from functionObject | |
| 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 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. More... | |
Public Attributes inherited from functionObject | |
| bool | log |
| Flag to write log into Info. More... | |
Static Public Attributes inherited from functionObject | |
| 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:
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.
| systemCall | ( | const word & | name, |
| const Time & | runTime, | ||
| const dictionary & | dict | ||
| ) |
Construct from name, Time and dictionary.
Definition at line 79 of file systemCall.C.
References dict, and Foam::read().

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

|
protecteddelete |
No copy assignment.
| TypeName | ( | "systemCall" | ) |
Runtime type information.
|
virtual |
Read the function-object dictionary.
Reimplemented from functionObject.
Definition at line 97 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 function-object operations.
Execute the "executeCalls" at each time-step
Implements functionObject.
Definition at line 145 of file systemCall.C.
|
virtual |
Write the function-object results.
Write, execute the "writeCalls"
Implements functionObject.
Definition at line 152 of file systemCall.C.
|
virtual |
Execute the "endCalls" at the final time-loop.
Reimplemented from functionObject.
Definition at line 159 of file systemCall.C.
|
protected |
List of calls to execute - every step.
Definition at line 165 of file systemCall.H.
|
protected |
List of calls to execute - write steps.
Definition at line 170 of file systemCall.H.
|
protected |
List of calls to execute when exiting the time-loop.
Definition at line 175 of file systemCall.H.
|
protected |
Perform system calls on the master only.
Definition at line 180 of file systemCall.H.
Referenced by systemCall::dispatch().