Skip to content
This repository was archived by the owner on Dec 2, 2025. It is now read-only.

Commit 9394d5b

Browse files
authored
construct higher degree elements in example run, not test (#68)
* construct higher degree elements in example run, not test * update version numbers
1 parent 38a7d0c commit 9394d5b

7 files changed

Lines changed: 65 additions & 44 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default = ["sleef"]
77

88
[package]
99
name = "ndelement"
10-
version = "0.2.0-dev"
10+
version = "0.2.1"
1111
edition = "2021"
1212
authors = ["Matthew Scroggs <rust@mscroggs.co.uk>"]
1313
description = "n-dimensional finite element definition library."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ndelement is an open-source library written in Rust that can be used to create n
99
You can use the latest release of ndelement by adding the following to `[dependencies]` section of your Cargo.toml file:
1010

1111
```toml
12-
ndelement = "0.2.0"
12+
ndelement = "0.2.1"
1313
```
1414

1515
### Python

RELEASE.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@ To make a new release of ndelement, follow the following steps:
1919
If you are releasing a minor version, you should increment `[y]` and set `[z]`
2020
to zero. If you are releasing a bugfix, you should increment `[z]`.
2121

22-
3) Update the version number in the "Using ndelement" section of README.md.
22+
3) Run `cargo publish --dry-run` and fix any errors.
2323

24-
4) Run `cargo publish --dry-run` and fix any errors.
25-
26-
5) Commit your changes and push to GitHub, open a pull request to merge changes back into main, and merge the
24+
4) Commit your changes and push to GitHub, open a pull request to merge changes back into main, and merge the
2725
pull request.
2826

29-
6) [Create a release on GitHub](https://github.com/bempp/ndelement/releases/new) from the `main` branch.
27+
5) [Create a release on GitHub](https://github.com/bempp/ndelement/releases/new) from the `main` branch.
3028
The release tag and title should be `v[x].[y].[z]` (where `[x]`, `[y]` and `[z]` are as in step 2).
3129
In the "Describe this release" box, you should bullet point the main changes since the last
3230
release.
3331

34-
7) Run `cargo publish`. This will push the new version to crates.io.
32+
6) Run `cargo publish`. This will push the new version to crates.io.
3533
Note: this cannot be undone, but you can use `cargo yank` to mark a version as unsuitable for use.
3634

37-
8) Open a pull request to `main` to update the version numbers in `Cargo.toml` and `pyproject.toml`
35+
7) Open a pull request to `main` to update the version numbers in `Cargo.toml` and `pyproject.toml`
3836
to `[x].[y].[z]-dev`
3937

40-
9) Add the release to the next issue of [Scientific Computing in Rust Monthly](https://github.com/rust-scicomp/scientific-computing-in-rust-monthly)
38+
8) Add the release to the next issue of [Scientific Computing in Rust Monthly](https://github.com/rust-scicomp/scientific-computing-in-rust-monthly)

examples/test_high_degree.rs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "ndelement"
7-
version = "0.2.0-dev"
7+
version = "0.2.1"
88
description = "n-dimensional finite element definition library."
99
readme = "README.md"
1010
requires-python = ">=3.8"

python/ndelement/ciarlet.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -228,38 +228,6 @@ def continuity(self) -> Continuity:
228228

229229
def element(self, cell: ReferenceCellType) -> CiarletElement:
230230
"""Create an element."""
231-
# TODO: remove these error once https://github.com/linalg-rs/rlst/issues/98 is fixed
232-
msg = "Cannot create element due to bug in RLST"
233-
if self.family == Family.Lagrange:
234-
if cell == ReferenceCellType.Interval and self.degree >= 99:
235-
raise RuntimeError(msg)
236-
if cell == ReferenceCellType.Triangle and self.degree >= 13:
237-
raise RuntimeError(msg)
238-
if cell == ReferenceCellType.Quadrilateral and self.degree >= 10:
239-
raise RuntimeError(msg)
240-
if cell == ReferenceCellType.Tetrahedron and self.degree >= 7:
241-
raise RuntimeError(msg)
242-
if cell == ReferenceCellType.Hexahedron and self.degree >= 5:
243-
raise RuntimeError(msg)
244-
if self.family == Family.RaviartThomas:
245-
if cell == ReferenceCellType.Triangle and self.degree >= 10:
246-
raise RuntimeError(msg)
247-
if cell == ReferenceCellType.Quadrilateral and self.degree >= 7:
248-
raise RuntimeError(msg)
249-
if cell == ReferenceCellType.Tetrahedron and self.degree >= 5:
250-
raise RuntimeError(msg)
251-
if cell == ReferenceCellType.Hexahedron and self.degree >= 3:
252-
raise RuntimeError(msg)
253-
if self.family == Family.NedelecFirstKind:
254-
if cell == ReferenceCellType.Triangle and self.degree >= 10:
255-
raise RuntimeError(msg)
256-
if cell == ReferenceCellType.Quadrilateral and self.degree >= 7:
257-
raise RuntimeError(msg)
258-
if cell == ReferenceCellType.Tetrahedron and self.degree >= 5:
259-
raise RuntimeError(msg)
260-
if cell == ReferenceCellType.Hexahedron and self.degree >= 3:
261-
raise RuntimeError(msg)
262-
263231
return CiarletElement(_lib.element_family_create_element(self._rs_family, cell.value))
264232

265233

src/ciarlet.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,5 +1275,4 @@ mod test {
12751275
test_entity_closure_dofs_lagrange!(Tetrahedron, 5);
12761276
test_entity_closure_dofs_lagrange!(Hexahedron, 2);
12771277
test_entity_closure_dofs_lagrange!(Hexahedron, 3);
1278-
test_entity_closure_dofs_lagrange!(Hexahedron, 4);
12791278
}

0 commit comments

Comments
 (0)