carputils
Doxygen code documentation for the python framework controlling openCARP
|
A generic mesh class adding the core functionality for 3D meshes. More...
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... | |
![]() | |
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... | |
A generic mesh class adding the core functionality for 3D meshes.
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
def carputils.mesh.general.Mesh3D.__init__ | ( | self, | |
fibre_rule = lambda t: 0.0 , |
|||
fibre_rule_2 = None , |
|||
tetrahedrise = True |
|||
) |
def carputils.mesh.general.Mesh3D.elements | ( | self | ) |
Generate and return array of element point indices.
list of arrays List of arrays of shape (nelem, nlocalnode) for each hybrid element type in the generated mesh
def carputils.mesh.general.Mesh3D.face_areas | ( | self, | |
selection | |||
) |
Calculate the areas of faces on the specified surface.
selection str One of ['top', 'bottom', 'inside', 'outside']
array Areas of faces on the specified surface
def carputils.mesh.general.Mesh3D.face_centres | ( | self, | |
selection | |||
) |
Calculate the centroids of faces on the specified surface.
selection str One of ['top', 'bottom', 'inside', 'outside']
array Centres of the surface faces
def carputils.mesh.general.Mesh3D.face_normals | ( | self, | |
selection, | |||
unit = True |
|||
) |
Calculate the normals to faces on the specified surface.
selection str One of ['top', 'bottom', 'inside', 'outside'] unit bool True to normalise vectors before returning, default is True
array Normals to faces on the specified surface
def carputils.mesh.general.Mesh3D.faces | ( | self, | |
selection, | |||
return_elem = False |
|||
) |
Generate an array of faces on the specified surface.
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
face array Indices of each selected face elem int, when return_elem == True The parent to which this face blongs
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:
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:
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.
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
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.
basename str Mesh base name (without extension)
def carputils.mesh.general.Mesh3D.generate_cyl_coords | ( | self, | |
filename | |||
) |
Generate cylindrical coordinate field for the mesh.
def carputils.mesh.general.Mesh3D.generate_vtk_face | ( | self, | |
filename, | |||
selection | |||
) |
Generate VTK file of selected face.
filename str Filename of VTK file to generate selection str One of ['top', 'bottom', 'inside', 'outside']
def carputils.mesh.general.Mesh3D.n_face | ( | self, | |
surface | |||
) |
Return the number of faces in a given surface.
int The number of faces