Skip to content

Commit

Permalink
Add analytic tests for Disk
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeingold committed Oct 16, 2024
1 parent 3f10240 commit a0a7812
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions test/combinations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -355,16 +355,22 @@ end
end

@testitem "Meshes.Disk" setup=[Setup] begin
origin = Point(0, 0, 0)
= Vec(0, 0, 1)
xy_plane = Plane(origin, ẑ)
disk = Disk(xy_plane, 2.5)
center = Point(1, 2, 3)
= Vec(1/2, 1/2, sqrt(2)/2)
plane = Plane(center, n̂)
radius = 2.5
disk = Disk(plane, radius)

f(p) = 1.0
function f(p::P) where {P <: Meshes.Point}
offset = p - center
ur = hypot(offset.coords...)
r = ustrip(u"m", ur)
exp(-r^2)
end
fv(p) = fill(f(p), 3)

# Scalar integrand
sol = Meshes.measure(disk)
sol = - π * exp(-radius^2)) * u"m^2"
@test integral(f, disk, GaussLegendre(100)) sol
@test integral(f, disk, GaussKronrod()) sol
@test integral(f, disk, HAdaptiveCubature()) sol
Expand Down

0 comments on commit a0a7812

Please sign in to comment.