Struct PolyMesh

Source
pub struct PolyMesh<T, D>{ /* private fields */ }
Expand description

A volumetric polytopal mesh.

It is assumed that each polytopal cell is convex.

Implementations§

Source§

impl<T, D> PolyMesh<T, D>

Source

pub fn new_empty() -> Self

Creates an empty poly mesh without any vertices, faces or cells.

Source

pub fn from_poly_data( vertices: Vec<OPoint<T, D>>, faces: NestedVec<usize>, cells: NestedVec<usize>, ) -> Self

Source

pub fn vertices(&self) -> &[OPoint<T, D>]

Source

pub fn vertices_mut(&mut self) -> &mut [OPoint<T, D>]

Source

pub fn num_faces(&self) -> usize

Source

pub fn num_cells(&self) -> usize

Source

pub fn face_vertices<'a>( &'a self, face_idx: usize, ) -> impl 'a + Iterator<Item = &'a OPoint<T, D>>

Source

pub fn face_connectivity_iter<'a>( &'a self, ) -> impl 'a + Iterator<Item = &'a [usize]>

Source

pub fn cell_connectivity_iter<'a>( &'a self, ) -> impl 'a + Iterator<Item = &'a [usize]>

Source

pub fn get_face_connectivity(&self, index: usize) -> Option<&[usize]>

Source

pub fn get_cell_connectivity(&self, index: usize) -> Option<&[usize]>

Source

pub fn get_face(&self, index: usize) -> Option<PolyMeshFace<'_, T, D>>

Source

pub fn compute_face_cell_connectivity(&self) -> NestedVec<usize>

Returns a nested array, in which each array i contains the indices of the cells associated with face i.

Source

pub fn dedup_faces(&mut self)

Removes duplicate instances of topologically equivalent faces.

Two faces are topologically equivalent if the sets of vertices connected by each face are equivalent.

Source

pub fn find_boundary_faces(&self) -> Vec<usize>

Returns the indices of the faces which are only referenced by at most one cells.

Source

pub fn concatenate<'a>( meshes: impl IntoIterator<Item = &'a PolyMesh<T, D>>, ) -> Self

Merges multiple meshes into a single instance of PolyMesh.

The mesh vertices, faces and cells are simply relabeled and glued together so that they form a well-defined PolyMesh. No mesh processing is performed.

Source§

impl<T, D> PolyMesh<T, D>
where T: Real, D: DimName, DefaultAllocator: Allocator<T, D>,

Source

pub fn split_edges_n_times(&mut self, n_times: usize)

Recursively splits each edge in the mesh the specified number of times

Source

pub fn split_edges(&mut self)

Splits the edges of all faces in the mesh by inserting a vertex at the midpoint of each edge

Source§

impl<T> PolyMesh<T, Const<3>>
where T: Scalar,

Source

pub fn triangulate(&self) -> Result<PolyMesh3d<T>, Box<dyn Error>>

Triangulate the polyhedral mesh.

Note that the algorithm currently only gives non-degenerate results when each cell is strictly convex, in the sense that no two faces of a cell are co-planar.

TODO: Can we relax the strict convexity restriction without introducing additional Steiner points into the triangulation? The restriction is explained in the paper by Max (2000) (see comments in implementation).

Source

pub fn keep_cells(&self, cell_indices: &[usize]) -> Self

Source§

impl<T> PolyMesh<T, Const<3>>
where T: Real,

Source

pub fn translate(&mut self, translation: &Vector3<T>)

Source

pub fn translated(self, translation: &Vector3<T>) -> Self

Source

pub fn compute_volume(&self) -> T

Source

pub fn intersect_convex_polyhedron<'a>( &self, polyhedron: &impl ConvexPolyhedron<'a, T>, ) -> Self

Source

pub fn intersect_half_space(&self, half_space: &HalfSpace<T>) -> Self

Trait Implementations§

Source§

impl<T, D> Clone for PolyMesh<T, D>

Source§

fn clone(&self) -> PolyMesh<T, D>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, D> Debug for PolyMesh<T, D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T, D> Deserialize<'de> for PolyMesh<T, D>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T, D> PartialEq for PolyMesh<T, D>

Source§

fn eq(&self, other: &PolyMesh<T, D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, D> Serialize for PolyMesh<T, D>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T, D> Eq for PolyMesh<T, D>
where T: Scalar + Eq, D: DimName + Eq, DefaultAllocator: Allocator<T, D>,

Source§

impl<T, D> StructuralPartialEq for PolyMesh<T, D>

Auto Trait Implementations§

§

impl<T, D> Freeze for PolyMesh<T, D>

§

impl<T, D> !RefUnwindSafe for PolyMesh<T, D>

§

impl<T, D> !Send for PolyMesh<T, D>

§

impl<T, D> !Sync for PolyMesh<T, D>

§

impl<T, D> !Unpin for PolyMesh<T, D>

§

impl<T, D> !UnwindSafe for PolyMesh<T, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,