Merged
Conversation
If, when first meet, the edge had a lower tag in the tetra than the tag found from one of the next tetra, the tag inconsistency was not detected due to the tag value accumulation inside the hash table. If the first stored tag of an edge was higher than one of the tag found after, the inconsistency was suitabily detected.
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.
This PR aims to fix incomplete check of the consistency of edge tag inside tetra
Reminder of Mmg data structures
We don't store the edges in a "unique" way inside an edge array.
Instead, each tetra is able to retrieve, for each of its edges, "geometrical" informations (is the edge a
referenceedge, anon-manifoldone, aridgeone...). These informations are stored under the form of binary tags inside aMMG5_xTetrastructure:MMG5_xTetrastructures stores the edge tags inside itstagarray for each of the 6 tetra edges;xtfield of the tetra stores the position of itsMMG5_xTetrainside the xtetra array.Thus, for an edge shared by multiple tetras, bugs may lead to inconsistencies (differences) between the tags stored by tetra, while tags should be identical in all the tetra that are sharing the edge as soon as the edge is marked as
MG_BDYinside the tetra (boundary edge belonging to a boundary face).For illustration, on the attached picture, if we suppose that the edge$4^{th}$ edge of the tetra number $1$ and the $2^d$ edge of the tetra $2$ , as soon as the edge belongs to a boundary face in both tetra (edge marked
p-qis theMG_BDYin both tetra) we should have:Debug function
MMG3D_chkmeshedgestagsThe
MMG3D_chkmeshedgestagfunction is provided for debugging purpose and called by theMMG3D_chkmshfunction at the end of the remeshing process (during the mesh packing) when debug mode is enabled (-dcommand line option).Incomplete implementation
Initial implementation calls the
MMG5_hashEdgeTagfunction which cumulates the edge tags inside a hash table :16the first time the edge is hased, the function stores the edge with tag16and returns16;1or17the second time the edge is hased, then the tag of the edge inside the hash table is updated to17(acumulation of binary tagstag |= 1ortag |= 17) and the function returns17;16the third time the edge is hashed, then the tag of the edge inside the hash table stays17and the function still returns17.In consequence, if the edge
p-qis processed first from the tetra 1 in which it has tag16(MG_BDY) then from the tetra 2 in which it has tag17(MG_REF & MG_BDY), the implementation in thedevelopbranch fails to detect the lack of consistency. If tetra are processed in reverse order, the inconsistency is detected because we store first the tag17in the hash table, then we compare the tag stored inside the xtetra of tetra 2, which is16with the value stored in the hash table (17).Fix
The current PR proposes to replace the call to the
MMG5_hashEdgeTagfunction by a call to theMMG5_hGetfunction. This function:1if the edge is founded in the hash table and stores the associated tag (so we can compare it with the tetra edge tag);0if the edge is not founded: in this case, we call theMMG5_hEdgefunction to store the edge and the associated tag.It allows to detect inconsistencies independently of the order in which we process the tetra.