## 2 Methods
### Optimization Method
#### 2.4.5 Remeshing  
This section describes the remeshing method and its implementation for resolving the current design in each iteration. A copy of the LS mesh serves as the starting point. Analogous to the redistancing method, all tetrahedra are looped and split based on the MT cases (see Figure 7) and the individual tetrahedra are assigned the respective material ID. The resulting mesh is then improved using the method described in [38]. The method consists of the following four iterative phases [38]:  
* Split all edges with \(l_{e}>l_{e_{max}}\),
* Collapse edges \(l_{e}<l_{e_{min}}\),
* Swap edges of elements with \(q<q_{min}\),
* Smooth all vertices. In the first phase, edges with a length greater than \(l_{e_{max}}=\frac{4l_{lat}}{3}\) are split by creating an additional vertex in the middle of the edge to be split. All tetrahedra adjacent to the updated edge are updated. In the second phase, all edges with a length less than \(l_{e_{min}}=\frac{4l_{lat}}{5}\) are collected, and then, all permissible collapses are performed. The first two phases of the remeshing method primarily ensure that the edge length converges towards the target edge length \(l_{tar}\). In the third phase, all tetrahedra whose quality \(q\) is less than \(q_{min}\) are identified [38]. The volume-length measure [39] is applied as a quality measure. For the adjacent edges, all possible edge swaps are tested and the one with the best possible quality is performed. The edge swap phase is primarily used to improve the tetrahedral quality. In the fourth phase, all vertices are repositioned in a hierarchical smoothing. For this purpose, the vertices are divided into volume and boundary vertices and successively smoothed. The classification of the vertices is explained in more detail below [38]. Smoothing the boundary vertices involves a projection step onto the surface, where we project onto the level set functions using [PERSON]'s method instead of onto a moving least square-based geometric definition as in [38]. In the phases listed above, many operations occur that are not permitted because they are not feature-preserving or because inverted tetrahedra are created during execution. For the former, a concise set of rules was established in [38], which is based on a classification of vertices, edges and tetrahedra as well as associated conditions. The classification uses the number of labels of the adjacent tetrahedra (here: #material ids). For vertices, for example, if there is exactly one material in the adjacent tetrahedra, it is a volume vertex and if there is more than one material, it is a boundary vertex (see Figure 8a). The classification then allows rules to be defined that describe which mesh modifications are permitted. This is illustrated by the example of an edge collapse in Figure 8b,c [38]. The four phases described above are followed by a quality improvement phase, in which the last remaining tetrahedra with poor quality are eliminated [38]. At this point, we also use the method described in [40], which classifies the bad tetrahedra and then applies targeted operations depending on the type of tetrahedron. Figure 7: Five unique marching tetrahedra cases based on [36]. The resulting discretized interface consisting of triangles is shown in orange. For the implementation of the mesh modification (edge collapses, edge swap, etc. ), we use the unique cavity operator from [41]. This allows the mesh modifications required for the phases described above to be represented using the same operator and, therefore, the same code. This can significantly reduce the implementation and maintenance effort for the mesh modification [41]. The different operations can be implemented by different initializations and subsequent filling of the cavity [41]. Figure 9 shows an edge collapse and an edge swap using a 2D triangle mesh. For the edge collapse \(A\to B\) (Figure 9a), all elements (tetrahedrons or triangles) are added to the cavity adjacent to vertex \(A\) for the initialization, after which they are all deleted.