| Algorithm 2 Boundary Recovery | |
| 1: | BoundaryRecovery(Γ,Θ) |
| 2: | Γ = Tetrahedral mesh |
| 3: | Θ = Original/Desired Boundary mesh |
| 4: | Output: Constrained Delaunay of Γ (an almost Delaunay mesh) |
| 5: | Ω ← Extract numerical boundary faces of Γ by considering faces that only belong to one tetrahedron |
| 6: | M ← Θ ∩ Ω′ {Find list of missing faces} |
| 7: | for all Faces, Mi, in missing faces list M do |
| 8: | e ← Find all tetrahedral elements that share at least one of the vertices of Mi |
| 9: | Concatenate all members of e, leaving only their exterior surface → ψ |
| 10: | if ψ is non-closed surface then |
| 11: | K ← All the vertices and edges of the hole |
| 12: | Construct missing face Mi as well as any additional missing faces in neighbourhood using members of K. Remove all the members of K used in construction of missing faces. |
| 13: | if K ≠ θ then |
| 14: | Cover the hole by creating new numerical faces by using simplexes of K |
| 15: | end if |
| 16: | end if |
| 17: | Meshi = Call Last_Resort_Algorithm(Ψi,ηe) |
| 18: | if Last Resort was successful then |
| 19: | Insert Meshi back to Γ |
| 20: | else |
| 21: | Move Mi to the bottom of missing face list M |
| 22: | end if |
| 23: | if M = ∅ or we have tried all missing faces in M then |
| 24: | break the loop |
| 25: | end if |
| 26: | end for |
| 27: | Return Modified Γ |