cape.cfdx.cmdrun
: Execute system calls for CAPE¶
This template module provides an interface for simple command-line
tools. The general approach for CAPE is to create a function for each
command-line binary that is called. This module contains two methods,
calli()
and callf()
, that are wrappers for the built-in
subprocess.call()
, and several useful command-line utilities.
- See also:
- cape.cfdx.cmdrun.aflr3(opts=None, j=0, **kw)¶
Run AFLR3 with the appropriate options
- Call:
>>> aflr3(opts=None, j=0, **kw)
- Inputs:
- See also:
- Versions:
2016-04-04
@ddalle
: v1.0
- cape.cfdx.cmdrun.callf(cmdi, f=None, e=None, shell=None, v=True, check=True)¶
Call a command with alternate STDOUT by filename
- Call:
>>> callf(cmdi, f=None, e=None, shell=None, v=True, check=True)
- Inputs:
- Versions:
2014-08-30
@ddalle
: v1.02015-02-13
@ddalle
: v2.0; rely oncalli()
2017-03-12
@ddalle
: v2.1; add v option2019-06-10
@ddalle
: v2.2; add e option2024-05-25
@ddalle
: v2.3; don’t remove RUNNING
- cape.cfdx.cmdrun.calli(cmdi, f=None, e=None, shell=None, v=True)¶
Call a command with alternate STDOUT by filename
- Call:
>>> ierr = calli(cmdi, f=None, e=None, shell=None, v=True)
- Inputs:
- Outputs:
- ierr:
int
Return code,
0
for successful execution
- ierr:
- Versions:
2014-08-30
@ddalle
: v1.02015-02-13
@ddalle
: v2.0; return code2017-03-12
@ddalle
: v2.1; Add v option2019-06-10
@ddalle
: v2.2; Add e option2024-01-17
@ddalle
: v2.3; flush() STDOUT manually
- cape.cfdx.cmdrun.callo(cmdi, shell=False)¶
Call a command and get the output text
This function is basically a substitute for
subprocess.check_output()
, which was not available in Python 2.6.
- cape.cfdx.cmdrun.check_output(cmdi)¶
Capture output from a system command
- cape.cfdx.cmdrun.grep(regex, fname)¶
Search for a regular expression in a file
- cape.cfdx.cmdrun.head(fname, n=1)¶
Extract the first n lines of a file
- cape.cfdx.cmdrun.intersect(opts=None, **kw)¶
Run Cart3D
intersect
to combine overlapping triangulations- Call:
>>> intersect(opts=None, **kw)
- Inputs:
- opts:
cape.options.Options
Options interface with access to
verify
options- kw:
dict
Raw dictionary of command-line arguments
- opts:
- See also:
- Versions:
2016-04-05
@ddalle
: v1.0
- cape.cfdx.cmdrun.pvpython(lay, *args, **kw)¶
Stand-alone function to execute a Paraview Python script
- cape.cfdx.cmdrun.tail(fname, n=1)¶
Tail the last n lines of a file
- cape.cfdx.cmdrun.tecmcr(mcr='export-lay.mcr', **kwargs)¶
Run a Tecplot macro
- Call:
>>> tecmcr(mcr="export-lay.mcr")
- Inputs:
- mcr:
str
File name of Tecplot macro
- mcr:
- Versions:
2015-03-10
@ddalle
: v1.0
- cape.cfdx.cmdrun.verify(opts=None, **kw)¶
Run Cart3D binary
verify
to test a triangulation- Call:
>>> verify(opts=None, **kw)
- Inputs:
- opts:
cape.options.Options
Options interface with access to
verify
options- kw:
dict
Raw dictionary of command-line arguments
- opts:
- See also:
- Versions:
2016-04-05
@ddalle
: v1.0