LoopStructural.interpolators.StructuredGrid#
- class LoopStructural.interpolators.StructuredGrid(origin=array([0., 0., 0.]), nsteps=array([10, 10, 10]), step_vector=array([1., 1., 1.]), rotation_xy=None)#
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.]), rotation_xy=None)#
- 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_centres
(global_index)get the centre of specified cells
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
(evaluation_points, ...)Evaluate the gradient at a location given node values
evaluate_value
(evaluation_points, property_array)Evaluate the value of of the property at the locations.
Calculate the shape function of elements for a location
Get the gradient of the element at the locations.
get_elements
()get_operators
(weights)Gets the operators specific to this support
global_cell_indices
(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
inside
(pos)Check if a position is inside the support
neighbour_global_indexes
([mask])Get neighbour indexes
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
global posotion to interpolation coefficients :param pos:
Convert from global to local coordinates within a cel :param pos - array of positions inside:
rotate
(pos)to_dict
()trilinear
(local_coords)returns the trilinear interpolation for the local coordinates :param x - double: :param array of doubles: :param y - double: :param array of doubles: :param z - double: :param array of doubles:
vtk
([node_properties, cell_properties])Return a vtk object
Attributes
Return the number of dimensions
dimension
element_scale
Return the element size
Return the elements
maximum
Return the number of elements
Return the number of points
Return the nodes
nsteps
nsteps_cells
origin
rotation_xy
step_vector
- property barycentre#
Return the number of dimensions
- cell_centres(global_index)#
get the centre of specified cells
- Parameters:
global_index (array/list) – container of integer global indexes to cells
- Returns:
numpy array – Nx3 array of cell centres
- 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#
Return the element size
- property elements#
Return the elements
- evaluate_gradient(evaluation_points, property_array) ndarray #
Evaluate the gradient at a location given node values
- Parameters:
evaluation_points (np.array((N,3))) – locations
property_array (np.array((self.nx))) – value node, has to be the same length as the number of nodes
- Returns:
np.array((N,3),dtype=float) – gradient of the implicit function at the locations
- Raises:
ValueError – if the array is not the same shape as the number of nodes
Notes
The implicit function gradient is not normalised, to convert to a unit vector normalise using vector/=np.linalg.norm(vector,axis=1)[:,None]
- evaluate_value(evaluation_points, property_array)#
Evaluate the value of of the property at the locations. Trilinear interpolation dot corner values
- Parameters:
locations (evaluation_points np array of)
name (property_name string of property)
- get_element_for_location(pos: ndarray)#
Calculate the shape function of elements for a location
- Parameters:
pos (np.array((N,3))) – location of points to calculate the shape function
- Returns:
[type] – [description]
- get_element_gradient_for_location(pos: ndarray)#
Get the gradient of the element at the locations.
- Parameters:
pos (np.array((N,3),dtype=float)) – locations
- Returns:
vertices, gradient, element, inside – [description]
- get_operators(weights: Dict[str, float]) Dict[str, Tuple[ndarray, float]] #
Gets the operators specific to this support
- Parameters:
weights (Dict[str, float]) – weight value per operator
- Returns:
operators – A dictionary with a numpy array and float weight
- global_cell_indices(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)#
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
- 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
- neighbour_global_indexes(mask=None, **kwargs)#
Get neighbour indexes
- Parameters:
neighbours (kwargs - indexes array specifying the cells to return)
- 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
- position_to_dof_coefs(pos)#
global posotion to interpolation coefficients :param pos:
- position_to_local_coordinates(pos)#
Convert from global to local coordinates within a cel :param pos - array of positions inside:
- Returns:
localx, localy, localz
- trilinear(local_coords)#
returns the trilinear interpolation for the local coordinates :param x - double: :param array of doubles: :param y - double: :param array of doubles: :param z - double: :param array of doubles:
- Returns:
array of interpolation coefficients
- vtk(node_properties={}, cell_properties={})#
Return a vtk object