sdynpy.core.sdynpy_geometry.NodeArray
- class NodeArray(shape, buffer=None, offset=0, strides=None, order=None)[source]
Bases:
SdynpyArray
Node information array
Use the node_array helper function to create the array.
- __init__()
Methods
by_grid
(grid_spacing[, x_min, y_min, z_min, ...])Selects nodes in a grid
by_position
(position_array)Select node by closest position
from_unv
(unv_data_dict[, combine])Load NodeArrays from universal file data from read_unv
global_coordinate
(cs_array)Get the global coordinate of each node
project_to_minimum_plane
(coordinates[, ...])Projects coordinates to a single best-fit plane
reduce
(node_list)Keep only nodes that are contained in node_list
triangulate
(cs_array[, projection_function, ...])Creates elements for a node set using Delaunay Triangulation
Attributes
- by_grid(grid_spacing, x_min=None, y_min=None, z_min=None, x_max=None, y_max=None, z_max=None)[source]
Selects nodes in a grid
- Parameters
grid_spacing (float) – Approximate grid spacing between selected nodes
x_min (float, optional) – Minimum X-value of the grid. The default is the minimum node x-coordinate.
y_min (float, optional) – Minimun Y-value of the grid. The default is the minimum node y-coordinate.
z_min (float, optional) – Minimum Z-value of the grid. The default is the minimum node z-coordinate.
x_max (float, optional) – Maximum X-value of the grid. The default is the maximum node x-coordinate.
y_max (float, optional) – Maximum Y-value of the grid. The default is the maximum node y-coordinate.
z_max (float, optional) – Maximum Z-value of the grid. The default is the maximum node z-coordinate.
- Returns
NodeArray containing the closest nodes to the grid points
- Return type
- by_position(position_array)[source]
Select node by closest position
- Parameters
position_array (np.ndarray) – A (…,3) shape array containing positions of nodes to keep
- Returns
NodArray containing nodes that were closest to the positions in position_array.
- Return type
- data_dtype = [('id', 'uint64'), ('coordinate', 'float64', (3,)), ('color', 'uint16'), ('def_cs', 'uint64'), ('disp_cs', 'uint64')]
- static from_unv(unv_data_dict, combine=True)[source]
Load NodeArrays from universal file data from read_unv
- Parameters
unv_data_dict (dict) – Dictionary containing data from read_unv
combine (bool, optional) – If True, return as a single NodeArray
- Returns
output_arrays – Nodes read from unv
- Return type
- global_coordinate(cs_array)[source]
Get the global coordinate of each node
- Parameters
cs_array (CoordinateSystemArray) – CoordinateSystemArray consisting of the local coordinate systems for each node
- Returns
points – Coordinates of the nodes in the global coordinate system.
- Return type
np.ndarray
- static project_to_minimum_plane(coordinates, return_3D=True)[source]
Projects coordinates to a single best-fit plane
- Parameters
coordinates (np.ndarray) – A (…,3) coordinate array.
return_3D (bool, optional) – If True, return the 3D coordinates of the projected points. Otherwise return the projected 2D coordinate. The default is True.
- Returns
Points projected to a best-fit plane.
- Return type
np.ndarray
- reduce(node_list)[source]
Keep only nodes that are contained in node_list
- Parameters
node_list (iterable) – Iterable containing nodes to keep.
- Returns
NodeArray containing only nodes in node_list.
- Return type
- triangulate(cs_array, projection_function=None, return_element_array=True, element_color=1, condition_threshold=None)[source]
Creates elements for a node set using Delaunay Triangulation
- Parameters
cs_array (CoordinateSystemArray) – CoordinateSystemArray containing coordinate systems for each node.
projection_function (function, optional) – Function to use to project 3D coordinates to 2D coordinates for triangulation. The default is None.
return_element_array (bool, optional) – Returns an ElementArray if True, otherwise it simply returns the triangle simplices. The default is True.
element_color (np.ndarray or int, optional) – Integers representing colors applied to the elements. The default is 1.
condition_threshold (float, optional) – Condition number threshold used to remove triangles that are poorly shaped. The default is None.
- Returns
ElementArray containing elements or np.ndarray containing triangle simplices.
- Return type
ElementArray or np.ndarray