cape.cfdx.bin
: CAPE executable operation¶
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.bin.aflr3(opts=None, j=0, **kw)¶
Run AFLR3 with the appropriate options
- Call:
>>> aflr3(opts=None, j=0, **kw)
- Inputs:
- opts:
cape.options.Options
Options interface with access to AFLR3 options
- j:
int
Phase number
- kw:
dict
Raw dictionary of command-line arguments
- opts:
- See also:
cape.cmd.aflr3()
- Versions:
2016-04-04
@ddalle
: Version 1.0
- cape.cfdx.bin.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:
- cmdi:
list
(str
) List of strings as for
subprocess.call()
- f:
str
File name to which to store STDOUT
- e: {f} |
str
Separate file name for STDERR
- shell:
bool
Whether or not a shell is needed
- v: {
True
} |False
Verbose option; display PWD and STDOUT values
- cmdi:
- Versions:
2014-08-30
@ddalle
: Version 1.02015-02-13
@ddalle
: Version 2.0; rely oncalli()
2017-03-12
@ddalle
: Version 2.1; add v option2019-06-10
@ddalle
: Version 2.2; add e option
- cape.cfdx.bin.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:
- cmdi:
list
[str
] List of strings as for
subprocess.call()
- f:
str
File name to which to store STDOUT
- e: {f} |
str
Name of separate file to write STDERR to
- shell:
bool
Whether or not a shell is needed
- v: {
True
} |False
Verbose option; display PWD and STDOUT values
- cmdi:
- Outputs:
- ierr:
int
Return code,
0
for successful execution
- ierr:
- Versions:
2014-08-30
@ddalle
: Version 1.02015-02-13
@ddalle
: Version 2.0; return code2017-03-12
@ddalle
: Version 2.1; Add v option2019-06-10
@ddalle
: Version 2.2; Add e option
- cape.cfdx.bin.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.- Call:
>>> txt = callo(cmdi, shell=False)
- Inputs:
- cmdi:
list
List of strings to use as a command
- shell:
bool
Whether or not a shell is needed
- cmdi:
- Outputs:
- txt:
str
Output of running the command
- txt:
- Versions:
2016-04-01
@ddalle
: Version 1.0
- cape.cfdx.bin.check_output(cmdi)¶
Capture output from a system command
- Call:
>>> txt = check_output(cmdi)
- Inputs:
- cmdi:
list
[str
] List of strings as for
subprocess.call()
- cmdi:
- Outputs:
- txt:
str
Contents of STDOUT while executing cmdi
- txt:
- Versions:
2017-03-13
@ddalle
: Version 1.0
- cape.cfdx.bin.grep(regex, fname)¶
Search for a regular expression in a file
- Call:
>>> lines = grep(regex, fname)
- Inputs:
- regex:
str
Regular expression for which to search
- fname:
str
Name of file or wild card to search
- regex:
- Outputs:
- lines:
list
(str
) List of lines containing the sought regular expression
- lines:
- Versions:
2015-12-28
@ddalle
: Version 1.0
- cape.cfdx.bin.head(fname, n=1)¶
Extract the first n lines of a file
- Call:
>>> txt = head(fname, n=1)
- Inputs:
- fname:
str
Name of file to tail
- n:
int
Number of lines to process
- fname:
- Outputs:
- txt:
str
Output of built-in tail function
- txt:
- Versions:
2015-01-12
@ddalle
: Version 1.0
- cape.cfdx.bin.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:
cape.cmd.intersect()
- Versions:
2016-04-05
@ddalle
: Version 1.0
- cape.cfdx.bin.pvpython(lay, *args, **kw)¶
Stand-alone function to execute a Paraview Python script
- Call:
>>> pvpython(lay, *args, cmd="pvpython") >>> pvpython(lay, a1, a2, ...)
- Inputs:
- lay:
str
Name of script to run
- cmd: {
"pvpython"
} |str
Name of executable to use, may be full path
- a1:
str
Command-line input to the script
- lay:
- Versions:
2015-11-22
@ddalle
: Version 1.0
- cape.cfdx.bin.tail(fname, n=1)¶
Tail the last n lines of a file
- Call:
>>> txt = tail(fname, n=1)
- Inputs:
- fname:
str
Name of file to tail
- n:
int
Number of lines to process
- fname:
- Outputs:
- txt:
str
Output of built-in tail function
- txt:
- Versions:
2015-01-12
@ddalle
: Version 1.0
- cape.cfdx.bin.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
: Version 1.0
- cape.cfdx.bin.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:
cape.cmd.verify()
- Versions:
2016-04-05
@ddalle
: Version 1.0