LoopStructural.interpolators.TetMesh#
- class LoopStructural.interpolators.TetMesh(origin=array([0., 0., 0.]), nsteps=array([10., 10., 10.]), step_vector=array([1., 1., 1.]))#
Bases:
BaseStructuredSupport
- Parameters:
array (origin - 3d list or numpy)
ints (nsteps - 3d list or numpy array of)
int (step_vector - 3d list or numpy array of)
- __init__(origin=array([0., 0., 0.]), nsteps=array([10., 10., 10.]), step_vector=array([1., 1., 1.]))#
- Parameters:
array (origin - 3d list or numpy)
ints (nsteps - 3d list or numpy array of)
int (step_vector - 3d list or numpy array of)
Methods
__init__
([origin, nsteps, step_vector])associateInterpolator
(interpolator)cell_corner_indexes
(cell_indexes)Returns the indexes of the corners of a cell given its location xi, yi, zi
check_position
(pos)[summary]
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
(pos[, elements])evaluate_value
(pos, property_array)Evaluate value of interpolant
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 a numpy array of all of the elements in the mesh
This function goes through all of the elements in the mesh and assembles a numpy array with the neighbours for each element
global_cell_indices
(indexes)Convert from cell indexes to global cell index
global_cell_indicies
(indexes)Convert from cell indexes to global cell index
global_index_to_cell_index
(global_index)Convert from global indexes to xi,yi,zi
global_index_to_node_index
(global_index)Convert from global indexes to xi,yi,zi
global_node_indices
(indexes)Convert from node indexes to global node index
global_node_indicies
(indexes)Convert from node indexes to global node index
inside
(pos)Check if a position is inside the support
node_indexes_to_position
(node_indexes)Function to be called when the geometry of the support changes
position_to_cell_corners
(pos)position_to_cell_global_index
(pos)Get the indexes (i,j,k) of a cell that a point is inside
Get the vertices of the cell a point is in
rotate
(pos)tetra_global_index
(indices, tetra_index)Get the global index of a tetra from the cell index and the local tetra index
to_dict
()vtk
([node_properties, cell_properties])Return a vtk object
Attributes
Return the barycentres of all tetrahedrons or of specified tetras using global index
dimension
element_scale
Calculate 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
maximum
n_cells
Return the number of elements
Return the number of points
neighbours
Return the nodes
nsteps
nsteps_cells
ntetra
origin
rotation_xy
Get the normal to all of the shared elements
shared_element_scale
Get the area of the share triangle
step_vector
- property barycentre: ndarray#
Return the barycentres of all tetrahedrons or of specified tetras using global index
- Returns:
barycentres (numpy array) – barycentres of all tetrahedrons
- cell_corner_indexes(cell_indexes: ndarray) ndarray #
Returns the indexes of the corners of a cell given its location xi, yi, zi
- Parameters:
x_cell_index
y_cell_index
z_cell_index
- check_position(pos: ndarray) ndarray #
[summary]
[extended_summary]
- Parameters:
pos ([type]) – [description]
- Returns:
[type] – [description]
- 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: ndarray, property_array: ndarray) ndarray #
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_value(pos: ndarray, property_array: ndarray) ndarray #
Evaluate value of interpolant
- Parameters:
array (pos - numpy) – locations
string (prop -) – property name
- get_element_for_location(pos: ndarray)#
Determine the tetrahedron from a numpy array of points
- Parameters:
pos (np.array)
- get_element_gradient_for_location(pos: ndarray)#
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_elements()#
Get a numpy array of all of the elements in the mesh
- Returns:
numpy array elements
- get_neighbours() ndarray #
This function goes through all of the elements in the mesh and assembles a numpy array with the neighbours for each element
- global_cell_indices(indexes) ndarray #
Convert from cell indexes to global cell index
- Parameters:
indexes
- global_cell_indicies(indexes: ndarray)#
Convert from cell indexes to global cell index
- Parameters:
indexes
- global_index_to_cell_index(global_index)#
Convert from global indexes to xi,yi,zi
- Parameters:
global_index
- global_index_to_node_index(global_index: ndarray)#
Convert from global indexes to xi,yi,zi
- Parameters:
global_index
- global_node_indices(indexes) ndarray #
Convert from node indexes to global node index
- Parameters:
indexes
- global_node_indicies(indexes: ndarray)#
Convert from node indexes to global node index
- Parameters:
indexes
- inside(pos: ndarray)#
Check if a position is inside the support
- property n_elements: int#
Return the number of elements
- property n_nodes#
Return the number of points
- property nodes#
Return the nodes
- onGeometryChange()#
Function to be called when the geometry of the support changes
- position_to_cell_index(pos: ndarray) ndarray #
Get the indexes (i,j,k) of a cell that a point is inside
- Parameters:
pos (np.array) – Nx3 array of xyz locations
- Returns:
np.ndarray – N,3 i,j,k indexes of the cell that the point is in
- position_to_cell_vertices(pos)#
Get the vertices of the cell a point is in
- Parameters:
pos (np.array) – Nx3 array of xyz locations
- Returns:
np.array((N,3),dtype=float), np.array(N,dtype=int) – vertices, inside
Get the normal to all of the shared elements
Get the area of the share triangle
- tetra_global_index(indices, tetra_index)#
Get the global index of a tetra from the cell index and the local tetra index
- Parameters:
indices
tetra_index
- vtk(node_properties={}, cell_properties={})#
Return a vtk object