carputils.mesh
.Blockcarputils.mesh.
Block
(centre=(0.0, 0.0, 0.0), size=(1.0, 1.0, 1.0), resolution=0.1, etype='tetra', periodic=0, periodic_tag=1234, pertb=0.0)Generate a block mesh with the mesher command line utility.
This class describes a tissue block with optional additional bath region. For example, to define a 2x2x2mm block centred on the origin with 1mm bath on the positive z side:
>>> geom = Block(size=(2,2,2))
>>> geom.set_bath(thickness=(0,0,1), both_sides=False)
Regions may also be specified using the BoxRegion
,
SphereRegion
and CylinderRegion
objects:
>>> reg = BoxRegion((-1,-1,-1), (1,1,0), tag=10)
>>> geom.add_region(reg)
Generate a list of command line options to pass to mesher to generate the
described mesh with the mesher_opts()
method:
>>> opts = geom.mesher_opts('meshname') # meshname.pts, meshname.elem, etc.
Note
While the mesher executable takes arguments in centimetres and micrometres, this class expects all physical sizes to be specified in millimetres. Arguments are converted to the correct units when generating the mesher command line.
add_region
(region)Add a region definition.
bath_limits
()Return the lower and upper limits of the block, including the bath.
corner_at_origin
()Put the corner of the tissue block at the origin.
mesher_opts
(meshname)Generate a list of command line arguments for mesher.
resolution
()Return the currently set mesh resolution.
set_bath
(thickness, both_sides=True)Add a bath region of the specified thickness.
Note that this method does not use the mesher convention of positive bath size meaning bath on one side and negative bath size meaning bath on both sides. Instead always use positive thickness values and the optional both_sides parameter to control this behaviour.
set_fibres
(fibre_endo=None, fibre_epi=None, sheet_endo=None, sheet_epi=None)Set the angles for generated fibres in the generated geometry.
shape
(bath=True)Determine the number of points in each dimension.
tissue_limits
()Return the lower and upper limits of the block, excluding the bath.