Geometry (Point Clouds, Meshes and Integration Points)#
The package pysdic provides objects to store and process the geometry of the observed
surfaces: point clouds, meshes made of vertices and elements, and integration points located
inside the elements. These objects wrap the array-based functions of
pysdic.fem and can be converted to and from meshio, pyvista and vtk.
Definition of Notations#
\(E\): the dimension of the space (e.g. 2 or 3).
\(N_v\), \(N_e\): the number of vertices and elements of a mesh.
\(N_{vpe}\): the number of vertices per element.
\(K\): the topological dimension of the elements (1 for segments, 2 for triangles and quadrangles).
\(N_p\): the number of points (of a point cloud or a set of integration points).
\(\Xi = (\xi, \eta, ...)\): the natural coordinates of a point in the reference element.
The supported element types (segment_2, segment_3, triangle_3, triangle_6,
quadrangle_4, quadrangle_8) are described in pysdic.fem.
Note
All the objects store their arrays as copies and return read-only views. They can carry
properties (one array of shape \((N, \dots)\) per name), accessible with
obj.properties or directly with obj[name] (see Core Tools), and can be
saved to JSON, HDF5 and NPZ files.
Geometrical objects#
PointCloud: A cloud of \(N_p\) points in a space of dimension \(E\), with properties for each point.
Connectivity: The \(N_e\) elements of a mesh (vertex indices), with an element type and properties for each element.
Mesh: A mesh made of vertices (
pysdic.PointCloud) and elements (pysdic.Connectivity), with the finite element operations, the geometry of the elements, the ray casting and the neighborhoods.IntegrationPoints: \(N_p\) points located in the elements of a mesh by their element index and natural coordinates, with weights and properties.
Creating 3D surface meshes#
Create structured surface meshes on a grid of \((n_1, n_2)\) vertices, with a UV map for texturing.
The n_* arguments are numbers of vertices, and the surfaces can be placed in any local frame
with the frame argument (requires the optional package py3dframe).
create_uniform_quadrangle_4_mesh:
quadrangle_4mesh of a given grid of vertices of shape \((n_x, n_y, E)\), optionally connected along each direction.create_3d_quadrangle_4_heightmap:
quadrangle_4mesh of a height surface \(z = f(x, y)\).create_3d_triangle_3_heightmap:
triangle_3mesh of a height surface \(z = f(x, y)\).create_3d_quadrangle_4_cylindrical:
quadrangle_4mesh of a cylindrical surface \(r = f(h, \theta)\).create_3d_triangle_3_cylindrical:
triangle_3mesh of a cylindrical surface \(r = f(h, \theta)\), optionally closed on the axis.create_3d_quadrangle_4_spherical:
quadrangle_4mesh of a spherical surface \(r = f(\theta, \phi)\).create_3d_triangle_3_spherical:
triangle_3mesh of a spherical surface \(r = f(\theta, \phi)\), optionally closed at the poles.
Creating 2D surface meshes#
Create structured meshes of planar domains (\(E = 2\)), e.g. for a planar analysis with a camera of the plane or a camera observing the plane \(Z_w = 0\) (see Implemented Extrinsic).
create_2d_quadrangle_4_rectangle:
quadrangle_4mesh of a rectangle.create_2d_triangle_3_rectangle:
triangle_3mesh of a rectangle.create_2d_quadrangle_4_polar:
quadrangle_4mesh of a polar domain (disk, annulus or sector).create_2d_triangle_3_polar:
triangle_3mesh of a polar domain (disk, annulus or sector).
Converting meshes#
quadrangle_4_to_triangle_3: Split each quadrangle of a
quadrangle_4mesh into two triangles ("first","second","alternate"or"random"diagonal), with the properties and the UV map.triangle_3_to_triangle_6: Convert a
triangle_3mesh into a quadratictriangle_6mesh (a vertex added at the middle of each edge).quadrangle_4_to_quadrangle_8: Convert a
quadrangle_4mesh into a serendipityquadrangle_8mesh (a vertex added at the middle of each edge).
Visualization#
Plotter3D: Display point clouds, meshes (with properties, textures and vector fields) and integration points with
pyvista.
Important
The visualization requires the optional package pyvista (pip install pyvista).
The quick_visualize methods of pysdic.PointCloud and pysdic.Mesh
give a fast preview without creating a plotter.