|
carputils
Doxygen code documentation for the python framework controlling openCARP
|
Functions for creating run scripts for openCARP simulations and other tools. More...
Classes | |
| class | MaxNPAction |
| Class to check that the maximum number of processes is not exceeded. More... | |
| class | PrintAction |
| Class to print a unformatted message like '–help' and exit. More... | |
Functions | |
| def | basic_parser (showdefault=True, overwrite_behaviour=OVERWRITE_BEHAVIOUR[0], formatter_cls=None) |
| def | standard_parser (showdefault=True) |
| Generate a standard argument parser for collection of common options. More... | |
| def | basic_job_id (args) |
| Generate default job ID. More... | |
| def | basicexample (parser=basic_parser, job_id=basic_job_id, summary=True, temp=False) |
| Generate a decorator for openCARP example run function. More... | |
| def | carp_job_id (args) |
| Generate default job ID. More... | |
| def | carpexample (parser=standard_parser, job_id=carp_job_id, meshdir=None, clean_pattern=r'^(\d{4}-\d{2}-\d{2})|(mesh)', simple=False, summary=True, temp=False, mkdir=True) |
| Generate a decorator for openCARP example run function. More... | |
| def | carp_cmd (parfile=None, mech_symmetric=False) |
| Construct the basic openCARP command line. More... | |
| def | list_to_string (pl) |
| def | gen_physics_opts (ExtraTags=None, IntraTags=None, EikonalTags=None, MechTags=None, FluidTags=None, EMI=False) |
| def | simfile_path (path, mesh=False) |
| Deprecated alias for bundle_include. More... | |
| def | bundle_include (path, mesh=False, caller_name='bundle_include') |
| Use this function to indicate that the file given as an argument has to be included in the experiment bundles. More... | |
| def | resolve_bundle_include (path, mesh) |
| Helper function for copying files marked with bundle_include within the bundle. More... | |
Variables | |
| OVERWRITE_BEHAVIOUR = tuple(clean.OVERWRITE_MODES.keys()) | |
| maxnp = None | |
Functions for creating run scripts for openCARP simulations and other tools.
| def carputils.tools.basic_job_id | ( | args | ) |
Generate default job ID.
| def carputils.tools.basic_parser | ( | showdefault = True, |
|
overwrite_behaviour = OVERWRITE_BEHAVIOUR[0], |
|||
formatter_cls = None |
|||
| ) |
| def carputils.tools.basicexample | ( | parser = basic_parser, |
|
job_id = basic_job_id, |
|||
summary = True, |
|||
temp = False |
|||
| ) |
Generate a decorator for openCARP example run function.
The decorator sets up sensible defaults for argv and sequence for an openCARP example's run function, and executes the command sequence on exit, where required.
| def carputils.tools.bundle_include | ( | path, | |
mesh = False, |
|||
caller_name = 'bundle_include' |
|||
| ) |
Use this function to indicate that the file given as an argument has to be included in the experiment bundles.
The value returned by this function is the same as the input 'path' value. This function should encapsulate the paths to external files required to run the experiment (and that should consequently be included in the experiment bundles). If the command line option –bundle is not set, the function is passive and simply returns the 'path' argument. If the command line option –bundle is set, the function will in addition:
The mesh option indicates if the file given by the path is a mesh file or not. Mesh files are copied in a dedicated subfolder within the bundle.
Warning. For now, this function call can't be split over multiple lines, i.e.
is allowed, but
is not allowed. This is due to the way the function parses and modifies the run script.
| path | Path to a file that should be included in bundles. |
| mesh | if True, the file is labeled as a mesh file. |
| caller_name | should not be modified by the user. Used for retrocompatibility with the old function name. |
| SyntaxError | if the function call is split over multiple lines. |
| def carputils.tools.carp_cmd | ( | parfile = None, |
|
mech_symmetric = False |
|||
| ) |
Construct the basic openCARP command line.
Constructs a list of command line arguments. This will automatically include the loading of the correct options for the specified solvers.
| parfile | str, optional The openCARP parameter file to be used, if any. |
| def carputils.tools.carp_job_id | ( | args | ) |
Generate default job ID.
| def carputils.tools.carpexample | ( | parser = standard_parser, |
|
job_id = carp_job_id, |
|||
meshdir = None, |
|||
clean_pattern = r'^(\d{4}-\d{2}-\d{2})|(mesh)', |
|||
simple = False, |
|||
summary = True, |
|||
temp = False, |
|||
mkdir = True |
|||
| ) |
Generate a decorator for openCARP example run function.
The decorator sets up sensible defaults for argv and sequence for a openCARP example's run function, and executes the command sequence on exit, where required.
| def carputils.tools.gen_physics_opts | ( | ExtraTags = None, |
|
IntraTags = None, |
|||
EikonalTags = None, |
|||
MechTags = None, |
|||
FluidTags = None, |
|||
EMI = False |
|||
| ) |
| def carputils.tools.list_to_string | ( | pl | ) |
| def carputils.tools.resolve_bundle_include | ( | path, | |
| mesh | |||
| ) |
Helper function for copying files marked with bundle_include within the bundle.
This function is not meant to be used directly by the user.
This function:
| path | path to a file (filename can be given without its extension) |
| mesh | set to true if the path is leading to a mesh file |
| def carputils.tools.simfile_path | ( | path, | |
mesh = False |
|||
| ) |
Deprecated alias for bundle_include.
| def carputils.tools.standard_parser | ( | showdefault = True | ) |
Generate a standard argument parser for collection of common options.
Returns ArgumentParser The parser object from the python standard library argparse module. See the online documentation <https://docs.python.org/3/library/argparse.html>_ for information on adding additional options to this parser in a run script. To actually parse the command line, use the parse_args method of the returned parser object.
| carputils.tools.maxnp = None |
| carputils.tools.OVERWRITE_BEHAVIOUR = tuple(clean.OVERWRITE_MODES.keys()) |