Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Jul 15, 2024
1 parent 8cf3fa9 commit 06307df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
7 changes: 3 additions & 4 deletions src/ciarlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::reference_cell;
use crate::traits::FiniteElement;
use crate::types::{Continuity, MapType, ReferenceCellType};
use rlst::{
rlst_dynamic_array2, rlst_dynamic_array3, Array, BaseArray,
MatrixInverse, RandomAccessByRef, RandomAccessMut, RlstScalar, Shape, VectorContainer,
rlst_dynamic_array2, rlst_dynamic_array3, Array, BaseArray, MatrixInverse, RandomAccessByRef,
RandomAccessMut, RlstScalar, Shape, VectorContainer,
};

pub mod lagrange;
Expand Down Expand Up @@ -47,8 +47,7 @@ pub struct CiarletElement<T: RlstScalar + MatrixInverse> {
interpolation_weights: EntityWeights<T>,
}

impl<T: RlstScalar + MatrixInverse> CiarletElement<T>
{
impl<T: RlstScalar + MatrixInverse> CiarletElement<T> {
/// Create a Ciarlet element
#[allow(clippy::too_many_arguments)]
pub fn create(
Expand Down
17 changes: 5 additions & 12 deletions src/ciarlet/lagrange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ use crate::polynomials::polynomial_count;
use crate::reference_cell;
use crate::traits::ElementFamily;
use crate::types::{Continuity, MapType, ReferenceCellType};
use rlst::{
rlst_dynamic_array2, rlst_dynamic_array3,
MatrixInverse, RandomAccessMut, RlstScalar,
};
use rlst::{rlst_dynamic_array2, rlst_dynamic_array3, MatrixInverse, RandomAccessMut, RlstScalar};
use std::marker::PhantomData;

/// Create a Lagrange element
pub fn create<T: RlstScalar + MatrixInverse>(
cell_type: ReferenceCellType,
degree: usize,
continuity: Continuity,
) -> CiarletElement<T>
{
) -> CiarletElement<T> {
let dim = polynomial_count(cell_type, degree);
let tdim = reference_cell::dim(cell_type);
let mut wcoeffs = rlst_dynamic_array3!(T, [dim, 1, dim]);
Expand Down Expand Up @@ -176,15 +172,13 @@ pub fn create<T: RlstScalar + MatrixInverse>(
}

/// Lagrange element family
pub struct LagrangeElementFamily<T: RlstScalar + MatrixInverse>
{
pub struct LagrangeElementFamily<T: RlstScalar + MatrixInverse> {
degree: usize,
continuity: Continuity,
_t: PhantomData<T>,
}

impl<T: RlstScalar + MatrixInverse> LagrangeElementFamily<T>
{
impl<T: RlstScalar + MatrixInverse> LagrangeElementFamily<T> {
/// Create new family
pub fn new(degree: usize, continuity: Continuity) -> Self {
Self {
Expand All @@ -195,8 +189,7 @@ impl<T: RlstScalar + MatrixInverse> LagrangeElementFamily<T>
}
}

impl<T: RlstScalar + MatrixInverse> ElementFamily for LagrangeElementFamily<T>
{
impl<T: RlstScalar + MatrixInverse> ElementFamily for LagrangeElementFamily<T> {
type T = T;
type FiniteElement = CiarletElement<T>;
type CellType = ReferenceCellType;
Expand Down
12 changes: 4 additions & 8 deletions src/ciarlet/raviart_thomas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ pub fn create<T: RlstScalar + MatrixInverse>(
cell_type: ReferenceCellType,
degree: usize,
continuity: Continuity,
) -> CiarletElement<T>
{
) -> CiarletElement<T> {
if cell_type != ReferenceCellType::Triangle && cell_type != ReferenceCellType::Quadrilateral {
panic!("Unsupported cell type");
}
Expand Down Expand Up @@ -94,15 +93,13 @@ pub fn create<T: RlstScalar + MatrixInverse>(
}

/// Raviart-Thomas element family
pub struct RaviartThomasElementFamily<T: RlstScalar + MatrixInverse>
{
pub struct RaviartThomasElementFamily<T: RlstScalar + MatrixInverse> {
degree: usize,
continuity: Continuity,
_t: PhantomData<T>,
}

impl<T: RlstScalar + MatrixInverse> RaviartThomasElementFamily<T>
{
impl<T: RlstScalar + MatrixInverse> RaviartThomasElementFamily<T> {
/// Create new family
pub fn new(degree: usize, continuity: Continuity) -> Self {
Self {
Expand All @@ -113,8 +110,7 @@ impl<T: RlstScalar + MatrixInverse> RaviartThomasElementFamily<T>
}
}

impl<T: RlstScalar + MatrixInverse> ElementFamily for RaviartThomasElementFamily<T>
{
impl<T: RlstScalar + MatrixInverse> ElementFamily for RaviartThomasElementFamily<T> {
type T = T;
type CellType = ReferenceCellType;
type FiniteElement = CiarletElement<T>;
Expand Down

0 comments on commit 06307df

Please sign in to comment.