Trait gut::algo::Connectivity [−][src]
pub trait Connectivity<Src, Via> where
Src: ElementIndex<usize>,
Via: ElementIndex<usize>, {
type Topo: Default;
fn num_elements(&self) -> usize;
fn push_neighbours<T>(
&self,
index: Src,
stack: &mut Vec<Src, Global>,
topo: &Self::Topo,
attribute: Option<&[T]>
)
where
T: Default + PartialEq<T>;
fn precompute_topo(&self) -> Self::Topo { ... }
fn connectivity(&self) -> (Vec<usize, Global>, usize) { ... }
fn connectivity_via_attrib<T>(
&self,
attrib: Option<&str>
) -> (Vec<usize, Global>, usize)
where
Self: Attrib,
Src: AttribIndex<Self>,
T: 'static + Default + PartialEq<T>,
{ ... }
fn connectivity_via_attrib_fn<'a, T, F>(
&self,
f: F
) -> (Vec<usize, Global>, usize)
where
T: 'a + Default + PartialEq<T>,
F: FnOnce() -> Option<&'a [T]>,
{ ... }
}
Expand description
A trait defining the primary method for determining connectivity in a mesh.
Src
specifies the element index for which to determine connectivity.
Via
specifies a secondary element index which identifies elements through which the
connectivity is determined.
Associated Types
Required methods
fn num_elements(&self) -> usize
fn num_elements(&self) -> usize
Get the number of elements which are considered for connectivity
E.g. triangles in triangle meshes or tets in a tetmesh.
Push all neighbours of the element at the given index
to the given stack
.
Additionally, topology data topo
computed using precomute_topo
and an
optional attribute
on the Src
topology is provided to help determine connectivity.
Provided methods
fn precompute_topo(&self) -> Self::Topo
fn precompute_topo(&self) -> Self::Topo
Precompute additional topology information prior to determining connectivity.
An optional function that allows implementers to precompute topology information to help
with the implementation of push_neighbours
when the mesh doesn’t already support a
certain type of topology.
Determine the connectivity of a set of meshes.
Return a Vec
with the size of self.num_elements()
indicating a unique ID of the
connected component each element belongs to. For instance, if two triangles in a triangle
mesh blong to the same connected component, they will have the same ID. Also return the
total number of components generated.
Determine the connectivity of a set of meshes.
Return a Vec
with the size of self.num_elements()
indicating a unique ID of the
connected component each element belongs to. For instance, if two triangles in a triangle
mesh blong to the same connected component, they will have the same ID. Also return the
total number of components generated.
This is a more general version of connectivity
that accepts an optional attribute of type
T
on the Src
topology to determine connectivity.
Determine the connectivity of a set of meshes.
Return a Vec
with the size of self.num_elements()
indicating a unique ID of the
connected component each element belongs to. For instance, if two triangles in a triangle
mesh blong to the same connected component, they will have the same ID. Also return the
total number of components generated.
This is the most general version of connectivity
that accepts a function that providees
attribute data of type T
on the Src
topology to determine connectivity.
Note that the provided slice must have the same length as the number of Src
indices.
Implementors
impl<M> Connectivity<FaceVertexIndex, VertexIndex> for M where
M: FaceVertex + NumFaces + NumVertices,
impl<M> Connectivity<FaceVertexIndex, VertexIndex> for M where
M: FaceVertex + NumFaces + NumVertices,
Implement face vertex connectivity for face based meshes (e.g. PolyMesh, TriMesh and QuadMesh).
This can be useful for splitting meshes based on texture coordinates, so that they can be exported in formats that don’t support additional face-vertex topologies like glTF.
impl<M> Connectivity<VertexIndex, CellIndex> for M where
M: VertexCell + CellVertex + NumVertices,
impl<M> Connectivity<VertexIndex, CellIndex> for M where
M: VertexCell + CellVertex + NumVertices,
Implement vertex connectivity for cell based meshes (e.g. TetMesh).
impl<M> Connectivity<VertexIndex, FaceIndex> for M where
M: FaceVertex + NumVertices + NumFaces,
impl<M> Connectivity<VertexIndex, FaceIndex> for M where
M: FaceVertex + NumVertices + NumFaces,
Implement vertex connectivity for face based meshes (e.g. PolyMesh, TriMesh and QuadMesh).