carputils
Doxygen code documentation for the python framework controlling openCARP
Public Member Functions | List of all members
carputils.mesh.general.Mesh3D Class Reference

A generic mesh class adding the core functionality for 3D meshes. More...

Inheritance diagram for carputils.mesh.general.Mesh3D:
carputils.mesh.general.Mesh carputils.mesh.bivslice.BiVSlice carputils.mesh.fourch.FourChamber carputils.mesh.pipe.Pipe carputils.mesh.ring.Ring

Public Member Functions

def __init__ (self, fibre_rule=lambda t:0.0, fibre_rule_2=None, tetrahedrise=True)
 
def elements (self)
 Generate and return array of element point indices. More...
 
def faces (self, selection, return_elem=False)
 Generate an array of faces on the specified surface. More...
 
def n_face (self, surface)
 Return the number of faces in a given surface. More...
 
def face_centres (self, selection)
 Calculate the centroids of faces on the specified surface. More...
 
def face_normals (self, selection, unit=True)
 Calculate the normals to faces on the specified surface. More...
 
def face_areas (self, selection)
 Calculate the areas of faces on the specified surface. More...
 
def generate_cyl_coords (self, filename)
 Generate cylindrical coordinate field for the mesh. More...
 
def generate_carp (self, meshname, faces=[])
 Generate the mesh and store it to disk in openCARP format. More...
 
def generate_carp_rigid_dbc (self, basename)
 Generate files for DBC definiton preventing free motion. More...
 
def generate_vtk_face (self, filename, selection)
 Generate VTK file of selected face. More...
 
- Public Member Functions inherited from carputils.mesh.general.Mesh
def __init__ (self)
 
def add_region (self, tag, func)
 Add a new tag region. More...
 
def points (self)
 Generate and return numpy array of point coordinates. More...
 
def n_pts (self)
 Return the number of points/nodes in the mesh. More...
 
def elements (self)
 Generate and return list of numpy arrays of element node indices. More...
 
def n_elem (self)
 Count and return the total number of elements in the mesh. More...
 
def element_centres (self)
 Calculate the centroids of the mesh elements. More...
 
def element_tags (self)
 Determine element tags based on rules passed to :meth:add_region. More...
 
def fibres (self)
 Generate numpy array of fibre vectors and return. More...
 
def generate_carp (self, meshname)
 Generate the mesh and store it to disk in openCARP format. More...
 
def generate_vtk (self, filename)
 Generate VTK file of mesh. More...
 

Detailed Description

A generic mesh class adding the core functionality for 3D meshes.

Parameters

fibre_rule callable, optional Function describing the transmural variation of fibre angle, takes a single normalised transmural distance on [0,1] and returns a helix angle in radians, defaults to circumferentially oriented fibres fibre_rule_2 callable, optional Function describing a second fiber rule tetrahedrise bool, optional Whether to divide the hybrid mesh into tetrahedra

Constructor & Destructor Documentation

◆ __init__()

def carputils.mesh.general.Mesh3D.__init__ (   self,
  fibre_rule = lambda t: 0.0,
  fibre_rule_2 = None,
  tetrahedrise = True 
)

Member Function Documentation

◆ elements()

def carputils.mesh.general.Mesh3D.elements (   self)

Generate and return array of element point indices.

Returns

list of arrays List of arrays of shape (nelem, nlocalnode) for each hybrid element type in the generated mesh

◆ face_areas()

def carputils.mesh.general.Mesh3D.face_areas (   self,
  selection 
)

Calculate the areas of faces on the specified surface.

Parameters

selection str One of ['top', 'bottom', 'inside', 'outside']

Returns

array Areas of faces on the specified surface

◆ face_centres()

def carputils.mesh.general.Mesh3D.face_centres (   self,
  selection 
)

Calculate the centroids of faces on the specified surface.

Parameters

selection str One of ['top', 'bottom', 'inside', 'outside']

Returns

array Centres of the surface faces

◆ face_normals()

def carputils.mesh.general.Mesh3D.face_normals (   self,
  selection,
  unit = True 
)

Calculate the normals to faces on the specified surface.

Parameters

selection str One of ['top', 'bottom', 'inside', 'outside'] unit bool True to normalise vectors before returning, default is True

Returns

array Normals to faces on the specified surface

◆ faces()

def carputils.mesh.general.Mesh3D.faces (   self,
  selection,
  return_elem = False 
)

Generate an array of faces on the specified surface.

Parameters

selection str One of ['top', 'bottom', 'inside', 'outside'] return_elem bool, optional True to return an array of faces' parent element along with the face node indicies array

Returns

face array Indices of each selected face elem int, when return_elem == True The parent to which this face blongs

◆ generate_carp()

def carputils.mesh.general.Mesh3D.generate_carp (   self,
  meshname,
  faces = [] 
)

Generate the mesh and store it to disk in openCARP format.

Simply pass the basename to store the mesh to:

>>> geom.generate_carp('mesh/new')

to save the mesh to mesh/new.pts, mesh/new.elem and mesh/new.lon. To also work out and store .vtx, .surf and .neubc files for certain faces, specify these as a list as the 'faces' argument:

>>> geom.generate_carp('mesh/new', faces['inside'])

to additionally generate the files mesh/new_inside.vtx, mesh/new_inside.surf and mesh/new_inside.neubc.

Note that neubc files are only generated for tetrahedral meshes.

Parameters

meshname str The base name (without extension) of the mesh to be generated. faces list, optional List of faces to generate, entries must be one of

['top', 'bottom', 'inside', 'outside']

◆ generate_carp_rigid_dbc()

def carputils.mesh.general.Mesh3D.generate_carp_rigid_dbc (   self,
  basename 
)

Generate files for DBC definiton preventing free motion.

Generate vertex files for the imposition of Dirichlet boundary conditions preventing the free rotation and translation of the mesh. See :ref:dbc_free_body_motion for an explanation.

Parameters

basename str Mesh base name (without extension)

◆ generate_cyl_coords()

def carputils.mesh.general.Mesh3D.generate_cyl_coords (   self,
  filename 
)

Generate cylindrical coordinate field for the mesh.

Returns
transmural, longitudinal and circumferential fiber field

◆ generate_vtk_face()

def carputils.mesh.general.Mesh3D.generate_vtk_face (   self,
  filename,
  selection 
)

Generate VTK file of selected face.

Parameters

filename str Filename of VTK file to generate selection str One of ['top', 'bottom', 'inside', 'outside']

◆ n_face()

def carputils.mesh.general.Mesh3D.n_face (   self,
  surface 
)

Return the number of faces in a given surface.

Returns

int The number of faces


The documentation for this class was generated from the following file: