Similar to MPACT, we would like to identify when a pin or pin mesh are redundant. This is especially relevant in the case of an automatically generated mesh with distance-based mesh coarsening. Here we may have hundreds of identical reflector pins, all of which were created as unique pins.
Suggested method for detecting duplicate pins:
Check that the mesh has the same type, number of vertices, and number of faces
Morton sort the mesh
Compare vertices using v0.isApprox(v1), since we want to allow some amount of wiggle room for floating point precision.
Check that the connectivity of each face is the same (allowing for cyclic permutations of the second face). E.g. (1, 2, 3) == (3, 1, 2)
At this point, the mesh is the same. We can forego storing the mesh.
Check if the material IDs in each face are the same (remembering to permute the material IDs according to the sorting of the faces). If the IDs are the same, don't add the pin. Return the ID of existing pin.
Similar to MPACT, we would like to identify when a pin or pin mesh are redundant. This is especially relevant in the case of an automatically generated mesh with distance-based mesh coarsening. Here we may have hundreds of identical reflector pins, all of which were created as unique pins.
Suggested method for detecting duplicate pins: