Skip to content

Commit

Permalink
raise ValueError for Gauss order out of the range (#220)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Scroggs <[email protected]>
  • Loading branch information
pescap and mscroggs authored Nov 8, 2024
1 parent c0c0e38 commit d1e4a89
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bempp/api/integration/gauss.py
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,10 @@ def rule(order):
Orders between 1 and 30 are supported.
"""
if order < 1 or order > 30:
raise ValueError(
f"Gauss quadrature order must be between 1 and 30. Provided: {order}"
)
npoints = order
address = (npoints * (npoints - 1)) // 2
return (
Expand Down
4 changes: 4 additions & 0 deletions bempp/api/integration/triangle_gauss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,10 @@ def rule(order):
The order must be between 1 and 20.
"""
if order < 1 or order > 20:
raise ValueError(
f"Symmetric Gauss quadrature order must be between 1 and 20. Provided: {order}"
)
npoints = points_per_order[order - 1]
address = points_address[npoints - 1]
bary_coords = coords[3 * address : 3 * (address + npoints)].reshape(
Expand Down

0 comments on commit d1e4a89

Please sign in to comment.