Skip to main content

Builder

Trait Builder 

Source
pub trait Builder {
    type EntityDescriptor: Debug + PartialEq + Eq + Clone + Copy + Hash;
    type Mesh: Mesh<EntityDescriptor = Self::EntityDescriptor>;
    type T: Scalar;
    type CellData<'a>;

Show 19 methods // Required methods fn add_point(&mut self, id: usize, data: &[Self::T]); fn add_point_parametric_coords( &mut self, _id: usize, _entity_dim: usize, _coords: &[Self::T], ); fn add_cell(&mut self, id: usize, cell_data: Self::CellData<'_>); fn add_cell_from_nodes_and_type( &mut self, id: usize, nodes: &[usize], cell_type: Self::EntityDescriptor, cell_degree: usize, ); fn create_mesh(&self) -> Self::Mesh; fn point_count(&self) -> usize; fn cell_count(&self) -> usize; fn point_indices_to_ids(&self) -> &[usize]; fn cell_indices_to_ids(&self) -> &[usize]; fn cell_points(&self, index: usize) -> &[usize]; fn cell_vertices(&self, index: usize) -> &[usize]; fn point(&self, index: usize) -> &[Self::T]; fn points(&self) -> &[Self::T]; fn point_parametric_coords( &self, _index: usize, ) -> Option<(usize, &[Self::T])>; fn cell_type(&self, index: usize) -> Self::EntityDescriptor; fn cell_degree(&self, index: usize) -> usize; fn gdim(&self) -> usize; fn tdim(&self) -> usize; fn npts(&self, cell_type: Self::EntityDescriptor, degree: usize) -> usize;
}
Expand description

A builder is a factory that creates meshes.

After instantiation points and cells can be added. To build the actual mesh call Builder::create_mesh.

Required Associated Types§

Source

type EntityDescriptor: Debug + PartialEq + Eq + Clone + Copy + Hash

Type used as identifier of different entity types

Source

type Mesh: Mesh<EntityDescriptor = Self::EntityDescriptor>

The type of the mesh that the builder creates

Source

type T: Scalar

The floating point type used for coordinates

Source

type CellData<'a>

The type of the data that is input to add a cell

Required Methods§

Source

fn add_point(&mut self, id: usize, data: &[Self::T])

Add a point to the mesh

Source

fn add_point_parametric_coords( &mut self, _id: usize, _entity_dim: usize, _coords: &[Self::T], )

Add parametric coordinates for a point (optional)

Source

fn add_cell(&mut self, id: usize, cell_data: Self::CellData<'_>)

Add a cell to the mesh

Source

fn add_cell_from_nodes_and_type( &mut self, id: usize, nodes: &[usize], cell_type: Self::EntityDescriptor, cell_degree: usize, )

Add a cell to the mesh

Source

fn create_mesh(&self) -> Self::Mesh

Create the mesh

Source

fn point_count(&self) -> usize

Number of points

Source

fn cell_count(&self) -> usize

Number of cells

Source

fn point_indices_to_ids(&self) -> &[usize]

Get the insertion ids of each point

Source

fn cell_indices_to_ids(&self) -> &[usize]

Get the insertion ids of each cell

Source

fn cell_points(&self, index: usize) -> &[usize]

Get the indices of the points of a cell

Source

fn cell_vertices(&self, index: usize) -> &[usize]

Get the indices of the points of a cell

Source

fn point(&self, index: usize) -> &[Self::T]

Get the coordinates of a point

Source

fn points(&self) -> &[Self::T]

Get all points

Source

fn point_parametric_coords(&self, _index: usize) -> Option<(usize, &[Self::T])>

Get parametric coordinates for a point, if available

Source

fn cell_type(&self, index: usize) -> Self::EntityDescriptor

Get the type of a cell

Source

fn cell_degree(&self, index: usize) -> usize

Get the degree of a cell’s geometry

Source

fn gdim(&self) -> usize

Geometric dimension

Source

fn tdim(&self) -> usize

Topoligical dimension

Source

fn npts(&self, cell_type: Self::EntityDescriptor, degree: usize) -> usize

Number of points in a cell with the given type and degree

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§