-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* start adding quadrature * Make Gauss-Jacobi quadrature work * remove dependency * hyperlink * add tetrahedron
- Loading branch information
Showing
7 changed files
with
374 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
pub mod ciarlet; | ||
pub mod polynomials; | ||
pub mod quadrature; | ||
pub mod reference_cell; | ||
pub mod traits; | ||
pub mod types; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//! Quadrature | ||
mod gauss_jacobi; | ||
pub use gauss_jacobi::make_gauss_jacobi_quadrature; | ||
|
||
use crate::traits::QuadratureRule as QuadratureRuleTrait; | ||
use rlst::RlstScalar; | ||
|
||
/// Quadrature rule | ||
pub struct QuadratureRule<T: RlstScalar<Real = T>> { | ||
points: Vec<T>, | ||
npoints: usize, | ||
dim: usize, | ||
weights: Vec<T>, | ||
} | ||
|
||
impl<T: RlstScalar<Real = T>> QuadratureRule<T> { | ||
/// Create new | ||
pub fn new(points: Vec<T>, weights: Vec<T>) -> Self { | ||
let npoints = weights.len(); | ||
debug_assert!(points.len() % npoints == 0); | ||
let dim = points.len() / npoints; | ||
Self { | ||
points, | ||
npoints, | ||
dim, | ||
weights, | ||
} | ||
} | ||
} | ||
impl<T: RlstScalar<Real = T>> QuadratureRuleTrait for QuadratureRule<T> { | ||
type T = T; | ||
fn points(&self) -> &[T] { | ||
&self.points | ||
} | ||
fn weights(&self) -> &[T] { | ||
&self.weights | ||
} | ||
fn npoints(&self) -> usize { | ||
self.npoints | ||
} | ||
fn dim(&self) -> usize { | ||
self.dim | ||
} | ||
} |
Oops, something went wrong.