Classes
For more information on the classes, refer to the Rust documentation of splashsurf_lib.
- class pysplashsurf.SphInterpolator(particle_positions, particle_densities, particle_rest_mass, compact_support_radius)
Interpolator of per-particle quantities to arbitrary points using SPH interpolation (with cubic kernel)
Methods
interpolate_normals(interpolation_points)Interpolates surface normals (i.e. normalized SPH gradient of the indicator function) of the fluid to the given points using SPH interpolation.
interpolate_quantity(particle_quantity, ...)Interpolates a scalar or vectorial per particle quantity to the given points
See SphInterpolator for more information.
- interpolate_normals(interpolation_points)
Interpolates surface normals (i.e. normalized SPH gradient of the indicator function) of the fluid to the given points using SPH interpolation
- interpolate_quantity(particle_quantity, interpolation_points, *, first_order_correction=False)
Interpolates a scalar or vectorial per particle quantity to the given points
Mesh types
- class pysplashsurf.TriMesh3d
Triangle surface mesh in 3D
- Attributes:
Methods
copy()Returns a copy (deep copy) of this mesh
Computes the vertex normals of the mesh using an area weighted average of the adjacent triangle faces
Computes the vertex-vertex connectivity of the mesh
write_to_file(path, *[, file_format])Writes the mesh to a file using
meshio.write_points_cellsSee TriMesh3d for more information.
- copy()
Returns a copy (deep copy) of this mesh
- dtype
Numpy dtype of the underlying scalar type (either
np.float32ornp.float64)
- triangles
The Mx3 array of vertex indices per triangle
- vertex_normals_parallel()
Computes the vertex normals of the mesh using an area weighted average of the adjacent triangle faces
- vertex_vertex_connectivity()
Computes the vertex-vertex connectivity of the mesh
- vertices
The Nx3 array of vertex positions of the mesh
- write_to_file(path, *, file_format=...)
Writes the mesh to a file using
meshio.write_points_cells
- class pysplashsurf.MixedTriQuadMesh3d
Mixed triangle and quad surface mesh in 3D
- Attributes:
Methods
copy()Returns a copy (deep copy) of this mesh
Returns a copy of all quad cells of the mesh as an Nx4 array of vertex indices
Returns a copy of all triangle cells of the mesh as an Nx3 array of vertex indices
write_to_file(path, *[, file_format])Writes the mesh to a file using
meshio.write_points_cellsSee MixedTriQuadMesh3d for more information.
- copy()
Returns a copy (deep copy) of this mesh
- dtype
Numpy dtype of the underlying scalar type (either
np.float32ornp.float64)
- get_quads()
Returns a copy of all quad cells of the mesh as an Nx4 array of vertex indices
- get_triangles()
Returns a copy of all triangle cells of the mesh as an Nx3 array of vertex indices
- vertices
The Nx3 array of vertex positions of the mesh
- write_to_file(path, *, file_format=...)
Writes the mesh to a file using
meshio.write_points_cells
- class pysplashsurf.MeshWithData(mesh)
Mesh with attached point and cell attributes
- Attributes:
cell_attributesThe attributes attached to the cells (triangles or quads) of the mesh
dtypeNumpy dtype of the underlying scalar type (either
np.float32ornp.float64)meshThe wrapped mesh without associated data and attributes
mesh_typeType of the underlying mesh
ncellsNumber of cells (triangles or quads) in the mesh
nverticesNumber of vertices in the mesh
point_attributesThe attributes attached points (vertices) of the mesh
Methods
add_cell_attribute(name, attribute)Attaches a cell attribute to the mesh
add_point_attribute(name, attribute)Attaches a point attribute to the mesh
copy()Returns a copy (deep copy) of this mesh with its data and attributes
Returns a copy of the wrapped mesh without associated data and attributes
write_to_file(path, *[, file_format])Writes the mesh and its attributes to a file using
meshio.write_points_cellsSee MeshWithData for more information.
- add_cell_attribute(name, attribute)
Attaches a cell attribute to the mesh
There has to be exactly one attribute value per cell in the mesh. As attribute data, the following numpy array types are supported:
1D array with shape (N,) of
np.uint641D array with shape (N,) of the mesh scalar type (
np.float32ornp.float64)2D array with shape (N,3) of the mesh scalar type (
np.float32ornp.float64)
The data is copied into the mesh object.
- add_point_attribute(name, attribute)
Attaches a point attribute to the mesh
There has to be exactly one attribute value per vertex in the mesh. As attribute data, the following numpy array types are supported:
1D array with shape (N,) of
np.uint641D array with shape (N,) of the mesh scalar type (
np.float32ornp.float64)2D array with shape (N,3) of the mesh scalar type (
np.float32ornp.float64)
The data is copied into the mesh object.
- cell_attributes
The attributes attached to the cells (triangles or quads) of the mesh
- copy()
Returns a copy (deep copy) of this mesh with its data and attributes
- copy_mesh()
Returns a copy of the wrapped mesh without associated data and attributes
- dtype
Numpy dtype of the underlying scalar type (either
np.float32ornp.float64)
- mesh
The wrapped mesh without associated data and attributes
- mesh_type
Type of the underlying mesh
- ncells
Number of cells (triangles or quads) in the mesh
- nvertices
Number of vertices in the mesh
- point_attributes
The attributes attached points (vertices) of the mesh
- write_to_file(path, *, file_format=...)
Writes the mesh and its attributes to a file using
meshio.write_points_cells
Helper and return types
- class pysplashsurf.Aabb3d
Three-dimensional axis-aligned bounding box defined by its minimum and maximum corners
Methods
contains_point(point)Checks if the given point is inside the AABB, the AABB is considered to be half-open to its max coordinate
from_min_max(min, max)Constructs an AABB with the given min and max coordinates
from_points(points)Constructs the smallest AABB fitting around all the given points
See Aabb3d for more information.
- contains_point(point)
Checks if the given point is inside the AABB, the AABB is considered to be half-open to its max coordinate
- static from_min_max(min, max)
Constructs an AABB with the given min and max coordinates
- static from_points(points)
Constructs the smallest AABB fitting around all the given points
- max
The max coordinate of the AABB
- min
The min coordinate of the AABB
- class pysplashsurf.MeshType
Enum specifying the type of mesh wrapped by a
MeshWithData
- class pysplashsurf.NeighborhoodLists
Per particle neighborhood lists
Methods
Returns all stored neighborhood lists as a list of lists
- get_neighborhood_lists()
Returns all stored neighborhood lists as a list of lists
- class pysplashsurf.SurfaceReconstruction
Result returned by surface reconstruction functions with surface mesh and other data
- Attributes:
gridThe marching cubes grid parameters used for the surface reconstruction
meshThe reconstructed triangle mesh
particle_densitiesThe global array of particle densities (None if they were only computed locally)
particle_inside_aabbA boolean array indicating whether each particle was inside the AABB used for the reconstruction (None if no AABB was set)
particle_neighborsThe global neighborhood lists per particle (None if they were only computed locally)
See SurfaceReconstruction for more information.
- grid
The marching cubes grid parameters used for the surface reconstruction
- mesh
The reconstructed triangle mesh
- particle_densities
The global array of particle densities (None if they were only computed locally)
- particle_inside_aabb
A boolean array indicating whether each particle was inside the AABB used for the reconstruction (None if no AABB was set)
- particle_neighbors
The global neighborhood lists per particle (None if they were only computed locally)
- class pysplashsurf.UniformGrid
Struct containing the parameters of the uniform grid used for the surface reconstruction
- Attributes:
aabbThe AABB of the grid containing all marching cubes vertices influenced by the particle kernels
cell_sizeReturns the cell size of the uniform grid (the marching cubes voxel size)
ncells_per_dimReturns the number of cells (marching cubes voxels) per dimension in the uniform grid
npoints_per_dimReturns the number of points (marching cubes vertices) per dimension in the uniform grid
See UniformGrid for more information.
- aabb
The AABB of the grid containing all marching cubes vertices influenced by the particle kernels
- cell_size
Returns the cell size of the uniform grid (the marching cubes voxel size)
- ncells_per_dim
Returns the number of cells (marching cubes voxels) per dimension in the uniform grid
- npoints_per_dim
Returns the number of points (marching cubes vertices) per dimension in the uniform grid
- class pysplashsurf.VertexVertexConnectivity
Vertex-vertex connectivity of a mesh
Methods
Returns a copy of the wrapped connectivity data
Returns the wrapped connectivity data by moving it out of this object (zero copy)
- copy_connectivity()
Returns a copy of the wrapped connectivity data
- take_connectivity()
Returns the wrapped connectivity data by moving it out of this object (zero copy)