Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
systemCall Class Reference

Executes system calls, entered in the form of string lists. More...

Inheritance diagram for systemCall:
Inheritance graph
[legend]
Collaboration diagram for systemCall:
Collaboration graph
[legend]

Public Member Functions

 TypeName ("systemCall")
 
 systemCall (const word &name, const Time &runTime, const dictionary &dict)
 
virtual ~systemCall ()=default
 
virtual bool read (const dictionary &dict)
 
virtual bool execute ()
 
virtual bool write ()
 
virtual bool end ()
 
- 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)
 
autoPtr< functionObjectclone () const
 
virtual ~functionObject ()=default
 
virtual const wordtype () const =0
 
const wordname () const noexcept
 
bool useNamePrefix () const noexcept
 
bool useNamePrefix (bool on) noexcept
 
virtual bool execute (const label subIndex)
 
virtual bool adjustTimeStep ()
 
virtual bool filesModified () const
 
virtual void updateMesh (const mapPolyMesh &mpm)
 
virtual void movePoints (const polyMesh &mesh)
 

Protected Member Functions

label dispatch (const stringList &calls)
 
 systemCall (const systemCall &)=delete
 
void operator= (const systemCall &)=delete
 
- Protected Member Functions inherited from functionObject
word scopedName (const word &name) const
 

Protected Attributes

stringList executeCalls_
 
stringList writeCalls_
 
stringList endCalls_
 
bool masterOnly_
 

Additional Inherited Members

- Static Public Member Functions inherited from functionObject
static autoPtr< functionObjectNew (const word &name, const Time &runTime, const dictionary &dict)
 
- Public Attributes inherited from functionObject
bool log
 
- Static Public Attributes inherited from functionObject
static int debug
 
static bool postProcess
 
static bool defaultUseNamePrefix
 
static word outputPrefix
 

Detailed Description

Executes system calls, entered in the form of string lists.

Calls can be made at the following points in the calculation:

Usage
Example of the function object specification:
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
Note
Since this function object executes system calls, there is a potential security risk. In order to use the 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.

See also
Foam::functionObject Foam::functionObjects::timeControl
Source files

Definition at line 136 of file systemCall.H.

Constructor & Destructor Documentation

◆ systemCall() [1/2]

systemCall ( const systemCall )
protecteddelete

◆ systemCall() [2/2]

systemCall ( const word name,
const Time runTime,
const dictionary dict 
)

Definition at line 79 of file systemCall.C.

References dict, and Foam::read().

Here is the call graph for this function:

◆ ~systemCall()

virtual ~systemCall ( )
virtualdefault

Member Function Documentation

◆ dispatch()

Foam::label dispatch ( const stringList calls)
protected

Definition at line 48 of file systemCall.C.

References UPstream::master(), systemCall::masterOnly_, Pstream::scatter(), and Foam::system().

Here is the call graph for this function:

◆ operator=()

void operator= ( const systemCall )
protecteddelete

◆ TypeName()

TypeName ( "systemCall"  )

◆ read()

bool read ( const dictionary dict)
virtual

◆ execute()

bool execute ( )
virtual

Implements functionObject.

Definition at line 145 of file systemCall.C.

◆ write()

bool write ( )
virtual

Implements functionObject.

Definition at line 152 of file systemCall.C.

◆ end()

bool end ( )
virtual

Reimplemented from functionObject.

Definition at line 159 of file systemCall.C.

Member Data Documentation

◆ executeCalls_

stringList executeCalls_
protected

Definition at line 145 of file systemCall.H.

◆ writeCalls_

stringList writeCalls_
protected

Definition at line 148 of file systemCall.H.

◆ endCalls_

stringList endCalls_
protected

Definition at line 151 of file systemCall.H.

◆ masterOnly_

bool masterOnly_
protected

Definition at line 154 of file systemCall.H.

Referenced by systemCall::dispatch().


The documentation for this class was generated from the following files: