Sphinx Documentation of carputils Framework

carputils.tools

Functions for generating and executing openCARP command lines and other tools.

tools.carp_cmd([parfile, mech_symmetric]) Construct the basic openCARP command line.
tools.carpexample([parser, job_id, meshdir, …]) Generate a decorator for openCARP example run function.
tools.standard_parser([showdefault]) Generate a standard argument parser for collection of common options.
tools.basic_parser([showdefault, …])
tools.gen_physics_opts([ExtraTags, …])
tools.basicexample([parser, job_id, …]) Generate a decorator for openCARP example run function.

carputils.job

This package most importantly defines the Job class, which provides methods for executing bash commands.

Classes

job.Job(ID) A sequence of commands plus the tools to execute them.

carputils.mesh

Classes and routines for the generation of geometric meshes.

For a detailed description of how to use the mesh generation functionality, see carputils Mesh Generation.

Classes

mesh.bivslice.BiVSlice(r_lv, r_rv, …[, …])
mesh.Block([centre, size, resolution, …]) Generate a block mesh with the mesher command line utility.
mesh.Cable(x0, x1[, dx]) Generate a one dimensional mesh of line segments.
mesh.Grid(lowerleft, upperright[, …]) Generate a two dimensional mesh of a regular grid.
mesh.Ring(radius[, thickness, height, …]) Generate a mesh of a ring/cylindrical shell.
mesh.Ellipsoid(r_a, r_b, r_c[, aout, bout, …]) Generate a mesh of an ellipsoidal shell.
mesh.BoxRegion([lowerleft, upperright, tag, …]) Describe an axis-aligned cuboid for mesh tag assignment.
mesh.pipe Generate a simple pipe geometry, providing a few parameters.
mesh.SphereRegion([radius, centre, tag, bath]) Describe a sphere for mesh tag assignment.
mesh.CylinderRegion([radius, start, axis, …]) Describe a cylinder for mesh tag assignment.

Functions

mesh.generate(geom[, dirname, rootdir]) Generate the specified geometry, unless it already exists.
mesh.block_boundary_condition(block, entity, …) Generate a boundary condition definition for a Block.
mesh.block_region(block, entity, index, low, up) Generate a boundary condition definition for a Block.
mesh.linear_fibre_rule(endo, epi[, unit]) Generate a linear fibre rule in the format expected by carputils.mesh.Ring and carputils.mesh.Ellipsoid.

carputils.carpio

Each module in this package defines a class for reading and writing a specific data type. Some convenience methods are also provided for common file type conversions.

carputils.carpio.igb

Provides a class for IGB IO to/from python numpy arrays.

Classes

igb.IGBFile(filename[, mode]) IGB format file IO class.

Functions

igb.open(*args, **kwargs) Open an IGB file.

carputils.carpio.txt

Provides a class for .dat and .vec IO to/from python numpy arrays.

Classes

txt.TxtFile(filename[, mode]) file IO class for reading ascii files with extensions - dat(.gz) - elem - vec(.gz) - vtx - pts

Functions

txt.open(*args, **kwargs) Open an .dat or .vec file.

carputils.carpio.sv

Functionality to read/write state variable (sv) files.

Classes

sv.SVFile(filename, dtype, dsize, bigendian) Read a single state variable (sv) file.
sv.SVSeries() Read a set of state variable (sv) files.

Functions

sv.open(*args, **kwargs) Read a state variable (sv) file
sv.open_series(*args, **kwargs) Read a state variable (sv) file series

carputils.carpio.lut

Read binary lookup tables into python numpy arrays

Classes

lut.LUTFile(filename) Read from a LUT file.

Functions

lut.open(*args, **kwargs) Open a LUT file.

carputils.model

Modules

model.activetension
model.ionic
model.mechanics

Classes

model.ConductivityRegion([IDs, name, g_il, …]) Defines an electrical conductivity region.
model.EikonalRegion(ID[, name, vel_f, …]) Defines an Eikonal model conduction velocity region.
model.Stimulus([name]) Represents a single stimulus argument to openCARP.

Functions

model.optionlist(components) Generate a list of command line options from the specified components.

carputils.divertoutput

Execute external processes with output buffering and error checking.

divertoutput.call(cmd[, interactive, …]) Run the specified command.
divertoutput.subprocess_exceptions() Make call() raise an exception on process non-zero exit status.

carputils.stream

Some tools for handling output streams (stdout, etc.)

stream.merge(streams) Merge the provided streams into a single one.
stream.divert_std(replacement) Context manager to temporarily replace sys.stdout and sys.stderr.