pub struct CMapBuilder<T>where
T: CoordsFloat,{ /* private fields */ }
Expand description
Implementations§
Source§impl<T: CoordsFloat> CMapBuilder<T>
§Regular methods
impl<T: CoordsFloat> CMapBuilder<T>
§Regular methods
Sourcepub fn n_darts(self, n_darts: usize) -> Self
pub fn n_darts(self, n_darts: usize) -> Self
Set the number of dart that the created map will contain.
Sourcepub fn grid_descriptor(self, grid_descriptor: GridDescriptor<T>) -> Self
pub fn grid_descriptor(self, grid_descriptor: GridDescriptor<T>) -> Self
Set the GridDescriptor
that will be used when building the map.
Sourcepub fn vtk_file(self, file_path: impl AsRef<Path> + Debug) -> Self
pub fn vtk_file(self, file_path: impl AsRef<Path> + Debug) -> Self
Set the VTK file that will be used when building the map.
§Panics
This function may panic if the file cannot be loaded.
Sourcepub fn add_attribute<A: AttributeBind + 'static>(self) -> Self
pub fn add_attribute<A: AttributeBind + 'static>(self) -> Self
Add the attribute A
to the attributes the created map will contain.
§Usage
Each attribute must be uniquely typed, i.e. a single type or struct cannot be added twice to the builder / map. This includes type aliases as these are not distinct from the compiler’s perspective.
If you have multiple attributes that are represented using the same data type, you may want to look into the Newtype pattern here and here
Sourcepub fn build(self) -> Result<CMap2<T>, BuilderError>
pub fn build(self) -> Result<CMap2<T>, BuilderError>
Consumes the builder and produce a CMap2
object.
§Return / Errors
This method return a Result
taking the following values:
Ok(map: CMap2)
if generation was successful,Err(BuilderError)
otherwise. SeeBuilderError
for possible failures.
§Panics
This method may panic if type casting goes wrong during parameters parsing.
Source§impl<T: CoordsFloat> CMapBuilder<T>
§Pre-definite structures
impl<T: CoordsFloat> CMapBuilder<T>
§Pre-definite structures
Sourcepub fn unit_grid(n_square: usize) -> Self
pub fn unit_grid(n_square: usize) -> Self
Create a CMapBuilder
with a predefinite GridDescriptor
value.
§Arguments
n_square: usize
– Number of cells along each axis.
§Return
This function return a builder structure with pre-definite parameters set to generate a specific map.
The map generated by this pre-definite value corresponds to an orthogonal mesh, with an equal number of cells along each axis:
Sourcepub fn unit_triangles(n_square: usize) -> Self
pub fn unit_triangles(n_square: usize) -> Self
Create a CMapBuilder
with a predefinite GridDescriptor
value.
§Arguments
n_square: usize
– Number of cells along each axis.
§Return
This function return a builder structure with pre-definite parameters set to generate a specific map.
The map generated by this pre-definite value corresponds to an orthogonal mesh, with an equal number of cells along each axis. Each cell will be split across their diagonal (top left to bottom right) to form triangles:
Trait Implementations§
Source§impl<T> Default for CMapBuilder<T>where
T: CoordsFloat + Default,
impl<T> Default for CMapBuilder<T>where
T: CoordsFloat + Default,
Source§fn default() -> CMapBuilder<T>
fn default() -> CMapBuilder<T>
Source§impl<T: CoordsFloat> From<GridDescriptor<T>> for CMapBuilder<T>
impl<T: CoordsFloat> From<GridDescriptor<T>> for CMapBuilder<T>
Source§fn from(value: GridDescriptor<T>) -> Self
fn from(value: GridDescriptor<T>) -> Self
Source§impl<T: CoordsFloat, P: AsRef<Path> + Debug> From<P> for CMapBuilder<T>
Create a CMapBuilder
from the VTK file specified by the path.
impl<T: CoordsFloat, P: AsRef<Path> + Debug> From<P> for CMapBuilder<T>
Create a CMapBuilder
from the VTK file specified by the path.
§Panics
This function may panic if the file cannot be loaded.
Auto Trait Implementations§
impl<T> Freeze for CMapBuilder<T>where
T: Freeze,
impl<T> !RefUnwindSafe for CMapBuilder<T>
impl<T> Send for CMapBuilder<T>
impl<T> Sync for CMapBuilder<T>
impl<T> Unpin for CMapBuilder<T>where
T: Unpin,
impl<T> !UnwindSafe for CMapBuilder<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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