LoopStructural.interpolators.UnStructuredTetMesh#
- class LoopStructural.interpolators.UnStructuredTetMesh(nodes: ndarray, elements: ndarray, neighbours: ndarray, aabb_nsteps=None)#
Bases:
BaseSupportAn unstructured mesh defined by nodes, elements and neighbours An axis aligned bounding box (AABB) is used to speed up finding which tetra a point is in. The aabb grid is calculated so that there are approximately 10 tetra per element.
- Parameters:
nodes (array or array like) – container of vertex locations
elements (array or array like, dtype cast to long) – container of tetra indicies
neighbours (array or array like, dtype cast to long) – array containing element neighbours
aabb_nsteps (list, optional) – force nsteps for aabb, by default None
- __init__(nodes: ndarray, elements: ndarray, neighbours: ndarray, aabb_nsteps=None)#
An unstructured mesh defined by nodes, elements and neighbours An axis aligned bounding box (AABB) is used to speed up finding which tetra a point is in. The aabb grid is calculated so that there are approximately 10 tetra per element.
- Parameters:
nodes (array or array like) – container of vertex locations
elements (array or array like, dtype cast to long) – container of tetra indicies
neighbours (array or array like, dtype cast to long) – array containing element neighbours
aabb_nsteps (list, optional) – force nsteps for aabb, by default None
Methods
__init__(nodes, elements, neighbours[, ...])An unstructured mesh defined by nodes, elements and neighbours An axis aligned bounding box (AABB) is used to speed up finding which tetra a point is in.
evaluate_gradient(pos, property_array)Evaluate the gradient of an interpolant at the locations
evaluate_shape(locations)Convenience function returning barycentric coords
evaluate_shape_derivatives(locations[, elements])Get the gradients of all tetras
evaluate_value(pos, property_array)Evaluate value of interpolant
get_element_for_location(points)Determine the tetrahedron from a numpy array of points
Get the gradient of the tetra for a location
get_element_gradients([elements])Get the gradients of all tetras
get_elements()This function goes through all of the elements in the mesh and assembles a numpy array with the neighbours for each element
inside(pos)Check if a position is inside the support
Called when the geometry changes
set_nelements(nelements)vtk([node_properties, cell_properties])Return a vtk object
Attributes
Return the number of dimensions
dimensionCalculate the volume of a tetrahedron using the 4 corners volume = abs(det(A))/6 where A is the jacobian of the corners
Return the elements
n_cellsReturn the number of elements
Return the number of points
Return the nodes
ntetraGet the normal to all of the shared elements
Get the area of the share triangle
- property barycentre#
Return the number of dimensions
- property element_size#
Calculate the volume of a tetrahedron using the 4 corners volume = abs(det(A))/6 where A is the jacobian of the corners
- Returns:
_type_ – _description_
- property elements#
Return the elements
- evaluate_gradient(pos, property_array)#
Evaluate the gradient of an interpolant at the locations
- Parameters:
array (pos - numpy) – locations
string (prop -) – property to evaluate
- evaluate_shape(locations)#
Convenience function returning barycentric coords
- evaluate_shape_derivatives(locations, elements=None)#
Get the gradients of all tetras
- Parameters:
elements
- evaluate_value(pos, property_array)#
Evaluate value of interpolant
- Parameters:
array (pos - numpy) – locations
string (prop -) – property name
- get_element_for_location(points: ndarray) Tuple#
Determine the tetrahedron from a numpy array of points
- Parameters:
pos (np.array)
- get_element_gradient_for_location(pos)#
Get the gradient of the tetra for a location
- Parameters:
pos
- get_element_gradients(elements=None)#
Get the gradients of all tetras
- Parameters:
elements
- get_neighbours()#
This function goes through all of the elements in the mesh and assembles a numpy array with the neighbours for each element
- inside(pos)#
Check if a position is inside the support
- property n_elements#
Return the number of elements
- property n_nodes#
Return the number of points
- property nodes#
Return the nodes
- onGeometryChange()#
Called when the geometry changes
Get the normal to all of the shared elements
Get the area of the share triangle
- vtk(node_properties={}, cell_properties={})#
Return a vtk object