Skip to content

Commit d9b6fa1

Browse files
mikeingoldJoshuaLampertgithub-actions[bot]
authored
Add official support for Frustum, Pyramid, and Wedge geometries (#168)
* Add TODO for branch * Add Wedge testset * Styling * Add pkgversion check * Add placeholder testsets for Pyramid and Frustum * Add Frustum tests * Strip links * Fix typo * Update todo * Update solution * Add missing tests * Add tests for Pyramid * Update support matrix * Remove todo * Update changelog * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Joshua Lampert <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b9d5269 commit d9b6fa1

File tree

3 files changed

+77
-3
lines changed

3 files changed

+77
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add official support for Frustum, Pyramid, and Wedge geometries.
13+
1014
### Changed
1115

1216
- Improved unit tests for `Meshes.Cylinder` and `Meshes.CylinderSurface` ([GitHub Issue #67](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/67)).

docs/src/support.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ designed to check for accuracy.
4141
| `CylinderSurface` | ⚠️ |||
4242
| `Disk` | ⚠️ |||
4343
| `Ellipsoid` ||||
44-
| `Frustum` | 🛑 | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) |
44+
| `Frustum` | ⚠️ | | |
4545
| `FrustumSurface` | ⚠️ |||
4646
| `Hexahedron` ||||
4747
| `Line` ||||
4848
| `ParaboloidSurface` | ⚠️ |||
4949
| `ParametrizedCurve` ||||
5050
| `Plane` ||||
5151
| `Polyarea` | 🛑 | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) |
52-
| `Pyramid` | 🛑 | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) |
52+
| `Pyramid` | ⚠️ | | |
5353
| `Quadrangle` | ⚠️ |||
5454
| `Ray` ||||
5555
| `Ring` ||||
@@ -61,7 +61,7 @@ designed to check for accuracy.
6161
| `Tetrahedron` | ⚠️ |||
6262
| `Triangle` ||||
6363
| `Torus` | ⚠️ |||
64-
| `Wedge` | 🛑 | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) | [🎗️](https://github.com/JuliaGeometry/MeshIntegrals.jl/issues/28) |
64+
| `Wedge` | ⚠️ | | |
6565

6666
| Symbol | Support Level |
6767
|--------|---------|

test/combinations.jl

+70
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,31 @@ end
422422
runtests(testable; rtol = 1e-2)
423423
end
424424

425+
@testitem "Meshes.Frustum" setup=[Combinations] begin
426+
if pkgversion(Meshes) >= v"0.52.12"
427+
# Geometry
428+
r = 2.5u"m"
429+
h = 3.5u"m"
430+
origin = Point(0, 0, 0)
431+
midpoint = Point(0.0u"m", 0.0u"m", 0.5 * h)
432+
apex = Point(0.0u"m", 0.0u"m", h)
433+
= Vec(0, 0, 1)
434+
xy_plane = Plane(origin, ẑ)
435+
base = Disk(xy_plane, r)
436+
mid_plane = Plane(midpoint, ẑ)
437+
mid_disk = Disk(mid_plane, 0.5 * r)
438+
frustum = Frustum(base, mid_disk)
439+
440+
# Integrand & Solution
441+
integrand(p) = 1.0u"A"
442+
solution = (7 // 8) ** r^2 * h / 3) * u"A"
443+
444+
# Package and run tests
445+
testable = TestableGeometry(integrand, frustum, solution)
446+
runtests(testable)
447+
end
448+
end
449+
425450
@testitem "Meshes.FrustumSurface" setup=[Combinations] begin
426451
# Geometry
427452
# Create a frustum whose radius halves at the top, i.e. the bottom half of a cone
@@ -491,6 +516,7 @@ end
491516
end
492517

493518
@testitem "Meshes.ParaboloidSurface" setup=[Combinations] begin
519+
# Geometry
494520
origin = Point(0, 0, 0)
495521
parab = ParaboloidSurface(origin, 2.5, 4.15)
496522

@@ -546,6 +572,26 @@ end
546572
runtests(testable)
547573
end
548574

575+
@testitem "Meshes.Pyramid" setup=[Combinations] begin
576+
if pkgversion(Meshes) >= v"0.52.12"
577+
# Geometry
578+
a = Point(-1, -1, 0)
579+
b = Point(1, -1, 0)
580+
c = Point(1, 1, 0)
581+
d = Point(-1, 1, 0)
582+
apex = Point(0, 0, 1)
583+
pyramid = Pyramid(a, b, c, d, apex)
584+
# Integrand & Solution
585+
integrand(p) = 1.0u"A"
586+
w = norm(b - a)
587+
h = norm(d - a)
588+
solution = (1 // 3) * w * h * u"A*m"
589+
# Package and run tests
590+
testable = TestableGeometry(integrand, pyramid, solution)
591+
runtests(testable)
592+
end
593+
end
594+
549595
@testitem "Meshes.Quadrangle" setup=[Combinations] begin
550596
using SpecialFunctions: erf
551597

@@ -739,3 +785,27 @@ end
739785
testable = TestableGeometry(integrand, triangle, solution)
740786
runtests(testable)
741787
end
788+
789+
@testitem "Meshes.Wedge" setup=[Combinations] begin
790+
if pkgversion(Meshes) >= v"0.52.12"
791+
# Geometry
792+
a₀ = Point(0, 0, 0)
793+
b₀ = Point(1, 0, 0)
794+
c₀ = Point(0, 1, 0)
795+
a₁ = Point(0, 0, 1)
796+
b₁ = Point(1, 0, 1)
797+
c₁ = Point(0, 1, 1)
798+
wedge = Wedge(a₀, b₀, c₀, a₁, b₁, c₁)
799+
800+
# Integrand & Solution
801+
function integrand(p::Meshes.Point)
802+
x, y, z = ustrip.(u"m", to(p))
803+
(x + 2y + 3z) * u"A"
804+
end
805+
solution = (5 // 4) * u"A*m^3"
806+
807+
# Package and run tests
808+
testable = TestableGeometry(integrand, wedge, solution)
809+
runtests(testable)
810+
end
811+
end

0 commit comments

Comments
 (0)