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

A generic mesh class the provides the core functionality in 1D and 3D. More...

Inheritance diagram for carputils.mesh.general.Mesh:
carputils.mesh.cable.Cable carputils.mesh.general.Mesh2D carputils.mesh.general.Mesh3D carputils.mesh.grid.Grid carputils.mesh.bivslice.BiVSlice carputils.mesh.fourch.FourChamber carputils.mesh.pipe.Pipe carputils.mesh.ring.Ring

Public Member Functions

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 the provides the core functionality in 1D and 3D.

Constructor & Destructor Documentation

◆ __init__()

def carputils.mesh.general.Mesh.__init__ (   self)

Member Function Documentation

◆ add_region()

def carputils.mesh.general.Mesh.add_region (   self,
  tag,
  func 
)

Add a new tag region.

Tags are calculated by testing the centroid of each element with func.

Parameters

tag int Tag value of the region func callable Function returning True when a passed point is inside the region, or an instance of one of :class:carputils.mesh.BoxRegion, :class:carputils.mesh.SphereRegion or :class:carputils.mesh.CylinderRegion.

◆ element_centres()

def carputils.mesh.general.Mesh.element_centres (   self)

Calculate the centroids of the mesh elements.

Returns

array Centroids of elements, shape (nelem, 3)

◆ element_tags()

def carputils.mesh.general.Mesh.element_tags (   self)

Determine element tags based on rules passed to :meth:add_region.

Elements without an associated region default to tag 1.

Returns

array tags of elements, shape (nelem,)

◆ elements()

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

Generate and return list of numpy arrays of element node indices.

Returns

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

◆ fibres()

def carputils.mesh.general.Mesh.fibres (   self)

Generate numpy array of fibre vectors and return.

Returns

array Fibre direction vectors

◆ generate_carp()

def carputils.mesh.general.Mesh.generate_carp (   self,
  meshname 
)

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.

Parameters

meshname str The base name (without extension) of the mesh to be generated.

◆ generate_vtk()

def carputils.mesh.general.Mesh.generate_vtk (   self,
  filename 
)

Generate VTK file of mesh.

Parameters

filename str Filename to write out to

◆ n_elem()

def carputils.mesh.general.Mesh.n_elem (   self)

Count and return the total number of elements in the mesh.

Returns

int The number of elements.

◆ n_pts()

def carputils.mesh.general.Mesh.n_pts (   self)

Return the number of points/nodes in the mesh.

◆ points()

def carputils.mesh.general.Mesh.points (   self)

Generate and return numpy array of point coordinates.

Returns

array Mesh point coordinates, shape (npoint, 3)


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