Mesh base class¶
vertax.meshes.mesh
Abstract mesh module.
NoPublicConstructor ¶
Bases: type
Metaclass that ensures a private constructor.
If a class uses this metaclass like this:
class SomeClass(metaclass=NoPublicConstructor):
pass
If you try to instantiate your class (SomeClass()),
a TypeError will be thrown.
Mesh ¶
Mesh()
Generic mesh structure. It is an abstract base class, not to be used directly.
It defines common attributes and functions between PbcMesh and BoundedMesh.
Do nothing but create attributes. Do not call this, but call specialized class methods to create meshes.
See PbcMesh and BoundedMesh.
Technically, it uses a DCEL structure.
edges
instance-attribute
¶
edges: Array = jnp.array([])
The interface between cells. Technically half-edges.
width
instance-attribute
¶
width: float = 0
The mesh live in a rectangle of size [0, width] in the X direction.
height
instance-attribute
¶
height: float = 0
The mesh live in a rectangle of size [0, height] in the Y direction.
faces_params
instance-attribute
¶
faces_params: Array = jnp.array([])
Parameters attached to faces. Can be optimized.
edges_params
instance-attribute
¶
edges_params: Array = jnp.array([])
Parameters attached to edges. Can be optimized.
vertices_params
instance-attribute
¶
vertices_params: Array = jnp.array([])
Parameters attached to vertices. Can be optimized.
nb_half_edges
property
¶
nb_half_edges: int
Get the number of half-edges of the mesh, ie. twice the number of edges.
save_mesh ¶
save_mesh(path: str) -> None
Save mesh to a file.
All mesh data is saved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the saved file. The extension is .npz. |
required |
load_mesh
classmethod
¶
load_mesh(path: str) -> Self
Load a mesh from a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the mesh file (.npz). |
required |
Returns:
| Type | Description |
|---|---|
Self
|
The mesh loaded from the .npz file. |