KyleVaughn / UM2

An unstructured mesh library for automated method of characteristic mesh generation
https://univeristy-of-michigan-unstructured-mesh-code.readthedocs.io/en/main/index.html#
MIT License
7 stars 2 forks source link

Identify duplicate pins in an MPACT model #153

Open KyleVaughn opened 5 months ago

KyleVaughn commented 5 months ago

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:

  1. Check that the mesh has the same type, number of vertices, and number of faces
  2. Morton sort the mesh
  3. Compare vertices using v0.isApprox(v1), since we want to allow some amount of wiggle room for floating point precision.
  4. 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)
  5. At this point, the mesh is the same. We can forego storing the mesh.
  6. 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.