Repository navigation
fix(LBIE): cvc::hexahedralize returns untwisted hexahedra; a cube's scaled Jacobian is 1 - #802
Merged
Merged
Conversation
…caled Jacobian is 1 geoframe stores a hexahedron as its six faces, and LBIE winds the second face against the first (Octree::add_hexa); saveHexa and the optimizer in octree.cpp read the top corners from it as v5 v4 v7 v6. The geoframe_adapter read and wrote both faces in plain order, so every hexahedron from cvc::hexahedralize was twisted (corner k + 4 not over corner k), and geometry::quality_improve handed LBIE's optimizer twisted hexahedra. The older convert() path (decode_hexs_from_quads) had it right. The adapter now reads and writes LBIE's layout: on the bunny at 65^3 the mean scaled Jacobian goes from ~0 to 0.85, with 97-99% of the hexahedra right-handed at every corner. hex_scaled_jacobian divided the centre Jacobian by the space diagonal cubed, so a unit cube scored 1/sqrt(27) = 0.024, though its docs say 1 and filter_hexs_by_quality's default threshold of 0.2 rejected every cube. It is now the worst corner's determinant of unit edges (the Verdict definition): 1 for a box, 1/sqrt(5) for a cube sheared by twice its height, -1 for its mirror image.
This was referenced Oct 25, 2026
transfix
added a commit
that referenced
this pull request
Oct 26, 2026
…s/live-gallery Conflicts: src/cvc/CMakeLists.txt (master's new conference and physics sources, plus this branch's ariadne/keys.cpp) and src/cvcGL/CameraController.cpp (both includes).
This was referenced Oct 27, 2026
transfix
added a commit
that referenced
this pull request
Oct 27, 2026
…sphere (#830) Master fails LbieMesherTest.AdapterKeepsLbiesHexahedronCorners on every platform: mean scaled Jacobian 0.49893 < 0.5. #802 added the test and #808 merged 13 minutes later from a branch that never had it, so neither PR's CI ran the two together. The mesh is fine; the threshold was set on the wrong mesh. The test's sphere (17^3 samples over [-1,1]^3, voxels 0.125 across) meshes as 27 hexahedra, a 3x3x3 block with 64 vertices, before and after #808. Measured: - #802's LBIE: the block was a cube inside the sphere. Its 56 outer vertices were 0.31-0.50 from the centre (radius 0.5), every hexahedron ~1.0, mean 0.9996. - #808's LBIE: the 56 outer vertices are on the sphere (0.491-0.513). The edge and corner hexahedra become wedges: mean 0.499, worst 0.218, none inverted. - The pre-#802 twisted adapter on today's mesh: every hexahedron inside out, mean -0.78. So the check that matters is that no hexahedron is inverted. The test now requires every hexahedron to be right-handed (it allowed a tenth to be inverted) and a mean above 0.4 instead of 0.5. The twisted layout still fails both by far.
transfix
added a commit
that referenced
this pull request
Oct 27, 2026
…terrupts (#825) * fix(volume): run HDF5 work on the caller's app and stop swallowing interrupts volume_io_test segfaulted intermittently when the whole binary ran as one process, in a test after CvcRawRoundTrip. It took two lifetime bugs: - hdf5_io kept the app that registered it and worked through that app instead of the one each call passes. Every cvc::app registers another hdf5_io into the process-wide handler map, and the first one registered serves every later call. So once the process's first app was destroyed, every HDF5 call ran through freed memory, and writeVolumeFile started its build_hierarchy thread on that dead app, where the writing app's ~app never saw it. hdf5_io now keeps no app; the maxdim default its constructor set moves to register_hdf5_io. - thread_info, thread_feedback and hdf5_utils::library_lock call app methods that are interruption points inside catch-alls. An interrupt that arrived there was thrown and swallowed, and boost clears the request when it throws, so the thread kept running. ~app gave up joining the hierarchy thread after 5 s and freed the app under it. They now hold interruption off (disable_interruption) while they keep their books, so the request stays pending for the thread's next interruption point. New tests, each failing without its fix: - Hdf5VolumeTest.HierarchyThreadRunsOnTheCallersApp - Hdf5VolumeTest.LibraryLockKeepsAnInterruptPending - AppTest.ThreadBookkeepingKeepsAnInterruptPending hdf5_volume_test's comment on its shared app described the first bug as the reason for sharing; it now says the sharing is no longer needed. * test(LBIE): AdapterKeepsLbiesHexahedronCorners expects #808's fitted sphere Master fails LbieMesherTest.AdapterKeepsLbiesHexahedronCorners on every platform: mean scaled Jacobian 0.49893 < 0.5. #802 added the test and #808 merged 13 minutes later from a branch that never had it, so neither PR's CI ran the two together. The mesh is fine; the threshold was set on the wrong mesh. The test's sphere (17^3 samples over [-1,1]^3, voxels 0.125 across) meshes as 27 hexahedra, a 3x3x3 block with 64 vertices, before and after #808. Measured: - #802's LBIE: the block was a cube inside the sphere. Its 56 outer vertices were 0.31-0.50 from the centre (radius 0.5), every hexahedron ~1.0, mean 0.9996. - #808's LBIE: the 56 outer vertices are on the sphere (0.491-0.513). The edge and corner hexahedra become wedges: mean 0.499, worst 0.218, none inverted. - The pre-#802 twisted adapter on today's mesh: every hexahedron inside out, mean -0.78. So the check that matters is that no hexahedron is inverted. The test now requires every hexahedron to be right-handed (it allowed a tenth to be inverted) and a mean above 0.4 instead of 0.5. The twisted layout still fails both by far.
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.
What was wrong
Every hexahedron from
cvc::hexahedralizewas twisted. geoframe stores a hexahedron as six quad faces, and LBIE winds the second face against the first:Octree::add_hexawrites them that way.saveHexaand the optimizer inoctree.cppread the top corners back asv5 v4 v7 v6.The Week-4
geoframe_adapterdecoded and encoded both faces in plain order. So corner k + 4 was never over corner k, and every hexahedron came out twisted. As a result:extract_surfaceand the cvcGLHEXSwireframe were all computed on twisted elements.geometry::quality_improveon a hex mesh handed LBIE's optimizer twisted elements.The older
convert()path (decode_hexs_from_quads) always had it right.hex_scaled_jacobianscored a perfect cube 0.024. It divided the centre Jacobian by the space diagonal cubed. Its docs say 1 for a cube, and the tests already noted the mismatch. Sofilter_hexs_by_quality's documented default threshold of 0.2 rejected every cube.The fix
geoframe_adapter: reads and writes LBIE's own layout, through oneencode_hex/decode_hexpair. It replaces four hand-unrolled copies.hex_scaled_jacobian: is now the Verdict definition, the worst corner's determinant of its three unit edges. A box scores 1, a cube sheared by twice its height scores 1/√5, and its mirror image scores −1.Bunny SDF at 65³, 12,769 hexahedra:
Tests
New test
LbieMesherTest.AdapterKeepsLbiesHexahedronCornerschecks three things on a sphere's LBIE hex mesh:to_geometrygives exactly LBIE's corners for every hexahedron.to_geoframeand thegeoframe_adapterclass write those corners back the way LBIE reads them.Updated tests:
HexUtilityFunctionsandHexJacobianMetricnow expect a cube to score 1, a sheared cube 1/√5 and the mirror image −1. They also use the documented 0.2 default threshold.test_unit_hex_metrics, a cube now scores 1.Run locally on Windows Release (MSVC, shared):
lbie_mesher_test46/46,geometry_test111/111,algorithm_test10/10.Not fixed here
These are other LBIE problems found while rendering the meshes for #803's gallery:
tetrahedralize2leaves fans of slivers and holes.