|
| 1 | +//! Finite element definitions |
| 2 | +
|
| 3 | +use ndelement::ciarlet::{lagrange, nedelec, raviart_thomas}; |
| 4 | +use ndelement::types::{Continuity, ReferenceCellType}; |
| 5 | +use paste::paste; |
| 6 | + |
| 7 | +fn main() { |
| 8 | + macro_rules! construct_lagrange { |
| 9 | + ($cell:ident, $max_degree:expr) => { |
| 10 | + paste! { |
| 11 | + for d in 1..[<$max_degree>] { |
| 12 | + println!("Constructing Lagrange(degree={d}, cell={:?})", ReferenceCellType::[<$cell>]); |
| 13 | + let _e = lagrange::create::<f64>(ReferenceCellType::[<$cell>], d, Continuity::Standard); |
| 14 | + } |
| 15 | + } |
| 16 | + }; |
| 17 | + } |
| 18 | + |
| 19 | + macro_rules! construct_raviart_thomas { |
| 20 | + ($cell:ident, $max_degree:expr) => { |
| 21 | + paste! { |
| 22 | + for d in 1..[<$max_degree>] { |
| 23 | + println!("Constructing RaviartThomas(degree={d}, cell={:?})", ReferenceCellType::[<$cell>]); |
| 24 | + let _e = raviart_thomas::create::<f64>(ReferenceCellType::[<$cell>], d, Continuity::Standard); |
| 25 | + } |
| 26 | + } |
| 27 | + }; |
| 28 | + } |
| 29 | + |
| 30 | + macro_rules! construct_nedelec { |
| 31 | + ($cell:ident, $max_degree:expr) => { |
| 32 | + paste! { |
| 33 | + for d in 1..[<$max_degree>] { |
| 34 | + println!("Constructing Nedelec(degree={d}, cell={:?})", ReferenceCellType::[<$cell>]); |
| 35 | + let _e = nedelec::create::<f64>(ReferenceCellType::[<$cell>], d, Continuity::Standard); |
| 36 | + } |
| 37 | + } |
| 38 | + }; |
| 39 | + } |
| 40 | + |
| 41 | + construct_lagrange!(Interval, 14); |
| 42 | + construct_lagrange!(Triangle, 8); |
| 43 | + construct_lagrange!(Quadrilateral, 8); |
| 44 | + construct_lagrange!(Tetrahedron, 6); |
| 45 | + construct_lagrange!(Hexahedron, 6); |
| 46 | + |
| 47 | + construct_raviart_thomas!(Triangle, 8); |
| 48 | + construct_raviart_thomas!(Quadrilateral, 8); |
| 49 | + construct_raviart_thomas!(Tetrahedron, 6); |
| 50 | + construct_raviart_thomas!(Hexahedron, 6); |
| 51 | + |
| 52 | + construct_nedelec!(Triangle, 8); |
| 53 | + construct_nedelec!(Quadrilateral, 8); |
| 54 | + construct_nedelec!(Tetrahedron, 6); |
| 55 | + construct_nedelec!(Hexahedron, 6); |
| 56 | +} |
0 commit comments