Skip to content

Commit

Permalink
Add lowest order integration rule for tets (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnala authored Jun 6, 2024
1 parent 19749db commit 02a80c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
with respect to documented and/or tested features.

### Unreleased

- Added: The lowest order, one point integration rule for tetrahedral elements
- Changed: Initializing `Basis` for `ElementTetP0` without specifying
`intorder` or `quadrature` will now automatically fall back to a one
point integration rule

### [9.1.1] - 2024-04-23

- Fixed: Tests now pass with `numpy==2.0rc1`
Expand Down
20 changes: 18 additions & 2 deletions skfem/quadrature.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,26 @@ def get_quadrature(refdom_or_elem: Union[Type[Refdom], Type[Element], Element],
def get_quadrature_tet(norder: int) -> Tuple[np.ndarray, np.ndarray]:
"""Return a nth order accurate quadrature rule for the reference
tetrahedron (0,0,0) (0,0,1) (0,1,0) (1,0,0)."""
if norder <= 1:
norder = 2
if norder < 1:
norder = 1
try:
return {
1: (
np.array(
[
[
.25,
],
[
.25,
],
[
.25,
],
]
),
np.array([1 / 6]),
),
2: (
np.array(
[
Expand Down

0 comments on commit 02a80c3

Please sign in to comment.