Repository navigation
Conversation
Unit tests that pass or fail by their exit status, with helpers shared by the tests in test/unit/common.hpp. geometry.cpp checks the area, the enclosed volume (int X.n dA / 3) and int n dA of a torus, a tube around a trefoil knot, a torus of varying cross-section and a prolate spheroid (closed ends) against exact values, and the surface nodes and normals (distance from the centerline, unit length, outward, exact normal). It also writes element lists (elements of different orders with a given orientation, the default orientation, and data/loop.geom) with Write, reads them back with Read and checks that the geometry and the file are reproduced exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uracy layer-potentials.cpp checks, for the Laplace and the Stokes kernels on a non-planar loop of varying radius, the double-layer potential of a constant density (-c inside, -c/2 on the surface, 0 outside) and Green's identity S[du/dn] - D[u] for a point source outside and inside the body, on the surface (self-interaction), near it on both sides at 1e-1, 1e-3 and 1e-6 radii (near-interaction), at 1 and 4 radii, on the centerline and far away, against exact values. The panels are refined toward the interior source. The errors must be within 20 times the tolerance (1e-10), and also for tolerances 1e-4, 1e-6 and 1e-8 with Laplace. Targets within 1e-3 radii of the surface are less accurate than the tolerance (with Laplace about 5e-9 at 1e-3 radii and 4e-8 at 1e-6 radii for 1e-10), so their checks only bound the error at its present level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…f26f80) scale-invariance.cpp computes the Laplace and Stokes single- and double-layer potentials of a ring (default orientation) and of a non-planar loop (an orientation passed to Init) at length scale 1 and at 1e-10 (radius 1e-11), on the surface and near it at angles away from the reference direction of the elements. The single-layer potentials must scale with the length and the double-layer potentials must not change, to 1e-11. Before bf26f80 the ring integral gave every target of a ring of radius below about 1e-8 the reference angle: built against a754cba the errors are 4e-3 to 0.95, against 2622281 at most 7e-13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check target builds the programs in test/unit/ with the flags of the Makefile, runs each of them from the project root (so that ./data holds the quadrature tables), and fails if any of them fails. EXTRA_CXXFLAGS is added last to CXXFLAGS, so that it can override them: with -g0 the unit tests build in about half the time and memory (186 s instead of 355 s for the largest). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On every push, pull request and manual dispatch, check out the repository with the SCTL submodule on ubuntu-latest and run make -j check with g++ and OpenMP, without debug information (-g0), which would double the compile time. The quadrature tables in data/ are regular git files, not git LFS, so a plain checkout has them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds unit tests under
test/unit/, amake checktarget, and a GitHub Actions workflow that runs them on every push and pull request.Tests
geometry.cpp: area, enclosed volume and ∫n dA against exact values for a torus, a tube around a trefoil knot, a torus of varying cross-section and a prolate spheroid; surface nodes and normals; geometry files written and read back bit for bit.layer-potentials.cpp: for Laplace and Stokes on a non-planar loop of varying radius, the double layer of a constant density and Green's identity with the source inside and outside. Targets are on the surface, near it on both sides (1e-1, 1e-3 and 1e-6 radii), at 1 and 4 radii, on the centerline and far away. The threshold is 20×tol at tol 1e-10, plus looser tolerances for Laplace.scale-invariance.cpp: the regression test for bf26f80. The same geometry is evaluated at scale 1 and 1e-10: the single layer must scale with length and the double layer must not change, to 1e-11. It fails on a754cba (errors 4e-3 to 0.95) and passes on 2622281 (at most 7e-13).The tests only use element order 10 and Fourier orders 12 and 16, which have shipped tables, so they never generate tables.
Known limitation
Targets within 1e-3 radii of the surface are less accurate than the tolerance (Laplace: about 5e-9 at 1e-3 radii and 4e-8 at 1e-6 radii for tol 1e-10). For now their thresholds only bound the error at its present level. The cause is the precomputed ring quadrature tables (a sampling bug in
BuildToroidalSpecialQuadRulesand the L2 truncation of the rules). The fix and regenerated tables will come separately; then these thresholds can be tightened to 20×tol.Build and CI
make checkbuildstest/unit/*and runs each test from the repository root, so that./dataholds the tables.EXTRA_CXXFLAGSis appended last toCXXFLAGS. CI usesEXTRA_CXXFLAGS=-g0, which halves compile time and memory.make -j8 check EXTRA_CXXFLAGS=-g0takes about 2.5 min on a 96-core node and 3 min on 4 cores; all tests pass.🤖 Generated with Claude Code