Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/geometry/geometry_map.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Geometry map
use crate::{traits::GeometryMap as GeometryMapTrait, types::RealScalar};
use ndelement::{reference_cell, traits::FiniteElement, types::ReferenceCellType};
use ndelement::{reference_cell, traits::MappedFiniteElement, types::ReferenceCellType};
use rlst::{Array, DynArray, RlstScalar, ValueArrayImpl};

/// Single element geometry
Expand Down Expand Up @@ -48,7 +48,7 @@ impl<'a, T: RealScalar, B2D: ValueArrayImpl<T, 2>, C2D: ValueArrayImpl<usize, 2>
{
/// Create new
pub fn new<A2D: ValueArrayImpl<T, 2>>(
element: &impl FiniteElement<CellType = ReferenceCellType, T = T>,
element: &impl MappedFiniteElement<CellType = ReferenceCellType, T = T>,
points: &Array<A2D, 2>,
geometry_points: &'a Array<B2D, 2>,
entities: &'a Array<C2D, 2>,
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/mixed/entity_geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ use crate::{
traits::Geometry,
types::RealScalar,
};
use ndelement::traits::FiniteElement;
use ndelement::traits::MappedFiniteElement;

/// Geometry of an entity
#[derive(Debug)]
pub struct MixedEntityGeometry<'a, T: RealScalar, E: FiniteElement> {
pub struct MixedEntityGeometry<'a, T: RealScalar, E: MappedFiniteElement> {
geometry: &'a MixedGeometry<T, E>,
element_index: usize,
cell_index: usize,
sub_entity_dim: usize,
sub_entity_index: usize,
}

impl<'a, T: RealScalar, E: FiniteElement> MixedEntityGeometry<'a, T, E> {
impl<'a, T: RealScalar, E: MappedFiniteElement> MixedEntityGeometry<'a, T, E> {
/// Create new
pub fn new(
geometry: &'a MixedGeometry<T, E>,
Expand All @@ -36,7 +36,7 @@ impl<'a, T: RealScalar, E: FiniteElement> MixedEntityGeometry<'a, T, E> {
}
}

impl<T: RealScalar, E: FiniteElement> Geometry for MixedEntityGeometry<'_, T, E> {
impl<T: RealScalar, E: MappedFiniteElement> Geometry for MixedEntityGeometry<'_, T, E> {
type T = T;
type Point<'a>
= Point<'a, T>
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/mixed/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ use ndelement::{
};
use ndelement::{
reference_cell,
traits::{ElementFamily, FiniteElement},
traits::{ElementFamily, MappedFiniteElement},
types::ReferenceCellType,
};
use rlst::{DynArray, rlst_dynamic_array};
use std::collections::HashMap;
use std::fmt::{Debug, Formatter};

/// Single element geometry
pub struct MixedGeometry<T: RealScalar, E: FiniteElement> {
pub struct MixedGeometry<T: RealScalar, E: MappedFiniteElement> {
points: DynArray<T, 2>,
cells: Vec<DynArray<usize, 2>>,
elements: Vec<HashMap<ReferenceCellType, E>>,
pub(crate) insertion_indices_to_element_indices: Vec<usize>,
pub(crate) insertion_indices_to_cell_indices: Vec<usize>,
}

impl<T: RealScalar, E: FiniteElement> Debug for MixedGeometry<T, E> {
impl<T: RealScalar, E: MappedFiniteElement> Debug for MixedGeometry<T, E> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
f.debug_struct("MixedGeometry")
.field("points", &self.points)
Expand Down Expand Up @@ -115,7 +115,7 @@ where
}
}

impl<T: RealScalar, E: FiniteElement> MixedGeometry<T, E> {
impl<T: RealScalar, E: MappedFiniteElement> MixedGeometry<T, E> {
/// Create single element geometry
pub fn new(
cell_types_in: &[ReferenceCellType],
Expand Down
8 changes: 4 additions & 4 deletions src/geometry/single_element/entity_geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ use crate::{
traits::Geometry,
types::RealScalar,
};
use ndelement::traits::FiniteElement;
use ndelement::traits::MappedFiniteElement;

/// Geometry of an entity
#[derive(Debug)]
pub struct SingleElementEntityGeometry<'a, T: RealScalar, E: FiniteElement> {
pub struct SingleElementEntityGeometry<'a, T: RealScalar, E: MappedFiniteElement> {
geometry: &'a SingleElementGeometry<T, E>,
cell_index: usize,
sub_entity_dimension: usize,
sub_entity_index: usize,
}

impl<'a, T: RealScalar, E: FiniteElement> SingleElementEntityGeometry<'a, T, E> {
impl<'a, T: RealScalar, E: MappedFiniteElement> SingleElementEntityGeometry<'a, T, E> {
/// Create new
pub fn new(
geometry: &'a SingleElementGeometry<T, E>,
Expand All @@ -33,7 +33,7 @@ impl<'a, T: RealScalar, E: FiniteElement> SingleElementEntityGeometry<'a, T, E>
}
}

impl<T: RealScalar, E: FiniteElement> Geometry for SingleElementEntityGeometry<'_, T, E> {
impl<T: RealScalar, E: MappedFiniteElement> Geometry for SingleElementEntityGeometry<'_, T, E> {
type T = T;
type Point<'a>
= Point<'a, T>
Expand Down
9 changes: 5 additions & 4 deletions src/geometry/single_element/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@ use crate::types::RealScalar;
use ndelement::{
ciarlet::{CiarletElement, lagrange},
map::IdentityMap,
traits::FiniteElement,
types::Continuity,
};
use ndelement::{
reference_cell,
traits::{ElementFamily, FiniteElement},
traits::{ElementFamily, MappedFiniteElement},
types::ReferenceCellType,
};
use rlst::{DynArray, rlst_dynamic_array};
use std::fmt::{Debug, Formatter};

/// Single element geometry
pub struct SingleElementGeometry<T: RealScalar, E: FiniteElement> {
pub struct SingleElementGeometry<T: RealScalar, E: MappedFiniteElement> {
points: DynArray<T, 2>,
cells: DynArray<usize, 2>,
elements: Vec<E>,
}

impl<T: RealScalar, E: FiniteElement> Debug for SingleElementGeometry<T, E> {
impl<T: RealScalar, E: MappedFiniteElement> Debug for SingleElementGeometry<T, E> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
f.debug_struct("SingleElementGeometry")
.field("points", &self.points)
Expand Down Expand Up @@ -85,7 +86,7 @@ where
}
}

impl<T: RealScalar, E: FiniteElement> SingleElementGeometry<T, E> {
impl<T: RealScalar, E: MappedFiniteElement> SingleElementGeometry<T, E> {
/// Create single element geometry
pub fn new(
cell_type: ReferenceCellType,
Expand Down
27 changes: 15 additions & 12 deletions src/grid/local_grid/mixed/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use ndelement::{
ciarlet::{CiarletElement, LagrangeElementFamily},
map::IdentityMap,
reference_cell,
traits::{ElementFamily, FiniteElement},
traits::{ElementFamily, FiniteElement, MappedFiniteElement},
types::{Continuity, ReferenceCellType},
};
use rlst::dense::{base_array::BaseArray, data_container::VectorContainer};
Expand All @@ -34,8 +34,11 @@ use std::collections::HashMap;

/// Mixed grid entity
#[derive(Debug)]
pub struct MixedGridEntity<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
{
pub struct MixedGridEntity<
'a,
T: RealScalar,
E: MappedFiniteElement<CellType = ReferenceCellType, T = T>,
> {
grid: &'a MixedGrid<T, E>,
cell_type: ReferenceCellType,
cell_index: usize,
Expand All @@ -45,7 +48,7 @@ pub struct MixedGridEntity<'a, T: RealScalar, E: FiniteElement<CellType = Refere
geometry_cell_index: usize,
}

impl<'e, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
impl<'e, T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
MixedGridEntity<'e, T, E>
{
/// Create new
Expand All @@ -69,7 +72,7 @@ impl<'e, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
}
}
}
impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Entity
impl<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Entity
for MixedGridEntity<'_, T, E>
{
type T = T;
Expand Down Expand Up @@ -123,14 +126,14 @@ impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Entit
pub struct MixedGridEntityIter<
'a,
T: RealScalar,
E: FiniteElement<CellType = ReferenceCellType, T = T>,
E: MappedFiniteElement<CellType = ReferenceCellType, T = T>,
> {
grid: &'a MixedGrid<T, E>,
entity_type: ReferenceCellType,
index: usize,
}

impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
impl<'a, T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
MixedGridEntityIter<'a, T, E>
{
/// Create new
Expand All @@ -142,7 +145,7 @@ impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
}
}
}
impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Iterator
impl<'a, T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Iterator
for MixedGridEntityIter<'a, T, E>
{
type Item = MixedGridEntity<'a, T, E>;
Expand All @@ -155,7 +158,7 @@ impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> I

/// Serial mixed element grid
#[derive(Debug)]
pub struct MixedGrid<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> {
pub struct MixedGrid<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> {
topology: MixedTopology,
geometry: MixedGeometry<T, E>,
}
Expand Down Expand Up @@ -190,7 +193,7 @@ impl<T: RealScalar + serde::Serialize> ConvertToSerializable
}
}

impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> MixedGrid<T, E> {
impl<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> MixedGrid<T, E> {
/// Create new
pub fn new(topology: MixedTopology, geometry: MixedGeometry<T, E>) -> Self {
Self { topology, geometry }
Expand Down Expand Up @@ -249,7 +252,7 @@ impl<T: RealScalar> MixedGrid<T, CiarletElement<T, IdentityMap>> {
}
}

impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Grid
impl<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Grid
for MixedGrid<T, E>
{
type T = T;
Expand Down Expand Up @@ -358,7 +361,7 @@ impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Grid
}

#[cfg(feature = "mpi")]
impl<T: RealScalar + Equivalence, E: FiniteElement<CellType = ReferenceCellType, T = T>>
impl<T: RealScalar + Equivalence, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
DistributableGrid for MixedGrid<T, E>
{
type ParallelGrid<'a, C: Communicator + 'a> =
Expand Down
27 changes: 16 additions & 11 deletions src/grid/local_grid/single_element/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use ndelement::{
ciarlet::{CiarletElement, LagrangeElementFamily},
map::IdentityMap,
reference_cell,
traits::{ElementFamily, FiniteElement},
traits::{ElementFamily, FiniteElement, MappedFiniteElement},
types::{Continuity, ReferenceCellType},
};
use rlst::dense::{base_array::BaseArray, data_container::VectorContainer};
Expand All @@ -35,15 +35,15 @@ use rlst::{SliceArray, rlst_dynamic_array};
pub struct SingleElementGridEntity<
'a,
T: RealScalar,
E: FiniteElement<CellType = ReferenceCellType, T = T>,
E: MappedFiniteElement<CellType = ReferenceCellType, T = T>,
> {
grid: &'a SingleElementGrid<T, E>,
cell_index: usize,
entity_dim: usize,
entity_index: usize,
}

impl<'e, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
impl<'e, T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
SingleElementGridEntity<'e, T, E>
{
/// Create new
Expand All @@ -61,7 +61,7 @@ impl<'e, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
}
}
}
impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Entity
impl<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Entity
for SingleElementGridEntity<'_, T, E>
{
type T = T;
Expand Down Expand Up @@ -111,14 +111,14 @@ impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Entit
pub struct SingleElementGridEntityIter<
'a,
T: RealScalar,
E: FiniteElement<CellType = ReferenceCellType, T = T>,
E: MappedFiniteElement<CellType = ReferenceCellType, T = T>,
> {
grid: &'a SingleElementGrid<T, E>,
entity_type: ReferenceCellType,
index: usize,
}

impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
impl<'a, T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
SingleElementGridEntityIter<'a, T, E>
{
/// Create new
Expand All @@ -130,7 +130,7 @@ impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>>
}
}
}
impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Iterator
impl<'a, T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Iterator
for SingleElementGridEntityIter<'a, T, E>
{
type Item = SingleElementGridEntity<'a, T, E>;
Expand All @@ -143,7 +143,10 @@ impl<'a, T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> I

/// Serial single element grid
#[derive(Debug)]
pub struct SingleElementGrid<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> {
pub struct SingleElementGrid<
T: RealScalar,
E: MappedFiniteElement<CellType = ReferenceCellType, T = T>,
> {
topology: SingleTypeTopology,
geometry: SingleElementGeometry<T, E>,
}
Expand Down Expand Up @@ -178,7 +181,9 @@ impl<T: RealScalar + serde::Serialize> ConvertToSerializable
}
}

impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> SingleElementGrid<T, E> {
impl<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
SingleElementGrid<T, E>
{
/// Create new
pub fn new(topology: SingleTypeTopology, geometry: SingleElementGeometry<T, E>) -> Self {
Self { topology, geometry }
Expand Down Expand Up @@ -221,7 +226,7 @@ impl<T: RealScalar> SingleElementGrid<T, CiarletElement<T, IdentityMap>> {
}
}

impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Grid
impl<T: RealScalar, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>> Grid
for SingleElementGrid<T, E>
{
type T = T;
Expand Down Expand Up @@ -320,7 +325,7 @@ impl<T: RealScalar, E: FiniteElement<CellType = ReferenceCellType, T = T>> Grid
}

#[cfg(feature = "mpi")]
impl<T: RealScalar + Equivalence, E: FiniteElement<CellType = ReferenceCellType, T = T>>
impl<T: RealScalar + Equivalence, E: MappedFiniteElement<CellType = ReferenceCellType, T = T>>
DistributableGrid for SingleElementGrid<T, E>
{
type ParallelGrid<'a, C: Communicator + 'a> =
Expand Down