Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Ellipsoid and Hexahedron #102

Merged
merged 6 commits into from
Oct 10, 2024
Merged

Conversation

JoshuaLampert
Copy link
Member

Integrating Ellipsoid and Hexahedron should simply work. However, I needed to set pretty high tolerances for Ellipsoid for some reason. Do you know why @mikeingold?
I also added other geometries, which do not implement any parametric function yet, in the support matrix, cf. #57

@JoshuaLampert
Copy link
Member Author

Just as a note: The link behind the 🎗️ in the docs doesn't seem to work.

test/combinations.jl Outdated Show resolved Hide resolved
test/combinations.jl Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (bd71834) to head (7fb473b).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #102   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          258       260    +2     
=========================================
+ Hits           258       260    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JoshuaLampert
Copy link
Member Author

However, I needed to set pretty high tolerances for Ellipsoid for some reason. Do you know why @mikeingold?

Ah, I see why. The result of measure is already off by the tolerance because Meshes.jl doesn't implement an analytical measure for an Ellipsoid (which is also not so easy to determine in general) and thus uses a fallback.

julia> using Meshes, MeshIntegrals

julia> origin = Point(0, 0, 0)
Point with Cartesian{NoDatum} coordinates
├─ x: 0.0 m
├─ y: 0.0 m
└─ z: 0.0 m

julia> radii = (1.0, 1.0, 1.0)
(1.0, 1.0, 1.0)

julia> ellipsoid = Ellipsoid(radii, origin)
Ellipsoid
├─ radii: (1.0 m, 1.0 m, 1.0 m)
├─ center: Point(x: 0.0 m, y: 0.0 m, z: 0.0 m)
└─ rotation: LinearAlgebra.UniformScaling{Bool}(true)

julia> using Unitful: m

julia> 4pi*m^2 - measure(ellipsoid)
0.02225157793214194 m^2

julia> 4pi*m^2 - integral(f, ellipsoid, GaussLegendre(100))
-4.96278573791642e-11 m^2

The result from integral is actually much more precise.

@mikeingold
Copy link
Collaborator

Ah, I see why. The result of measure is already off by the tolerance because Meshes.jl doesn't implement an analytical measure for an Ellipsoid (which is also not so easy to determine in general) and thus uses a fallback.

The result from integral is actually much more precise.

Exactly. This is something I've definitely seen. When there's no analytic solution defined for measure, Meshes will simplexify the geometry and essentially take a finite element approximation, so integrating a unit integrand function will probably be more accurate. This is one of the motivations behind moving away from the old auto tests that relied on measure as a benchmark.

@JoshuaLampert
Copy link
Member Author

JoshuaLampert commented Oct 9, 2024

Once the overall goal to test against analytical solutions for non-trivial functions is achieved in the future, we will not depend on measure anyway.

@mikeingold
Copy link
Collaborator

mikeingold commented Oct 9, 2024 via email

@JoshuaLampert
Copy link
Member Author

JoshuaLampert commented Oct 9, 2024

Weird. It looks like the Documenter site's stable version is stale and
hasn't been updated since ~v13.2. The pages under dev are up to date,
though. Have you ever seen this kind of thing happen before?

Indeed. I don't know why this is and I don't see anything suspicious in the logs.

docs/src/supportmatrix.md Outdated Show resolved Hide resolved
@mikeingold
Copy link
Collaborator

Weird. It looks like the Documenter site's stable version is stale and
hasn't been updated since ~v13.2. The pages under dev are up to date,
though. Have you ever seen this kind of thing happen before?

Indeed. I don't know why this is and I don't see anything suspicious in the logs.

We don't have to hold up this PR over it. I just added #103 for tracking.

@mikeingold mikeingold mentioned this pull request Oct 10, 2024
@mikeingold mikeingold merged commit 08222a8 into main Oct 10, 2024
15 checks passed
@mikeingold mikeingold deleted the ellipsoid-hexahedron branch October 10, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants