I want to get a list of all boundary elements belonging to a certain ElementMarker
of a boundary mesh.
This code creates a simple mesh and allows to inspect the ElementMarkers
of the boundary mesh.
<< NDSolve`FEM`
cubi = Cuboid[{0, 0, 0}, {1, 1, 1}];
mesh = DiscretizeRegion[cubi, MaxCellMeasure -> 1];
bmesh = ToBoundaryMesh[mesh];
(*inspect element markers*)
groups = bmesh["BoundaryElementMarkerUnion"]
temp = Most[Range[0, 1, 1/(Length[groups])]];
colors = ColorData["BrightBands"][#] & /@ temp;
surfaces =
AssociationThread[groups,
bmesh["Wireframe"[ElementMarker == #,
"MeshElementStyle" -> FaceForm[colors[[#]]]]] & /@ groups];
Manipulate[
Show[{bmesh["Edgeframe"], choices /. surfaces}],
{{choices, groups}, groups, CheckboxBar},
ControlPlacement -> Top
]
With bmesh["Wireframe"[ElementMarker == 1]]
I can visualize a specific boundary part:
While bmesh["BoundaryElements"]
returns all the triangles of the boundary:
{TriangleElement[{{5, 6, 1}, {5, 7, 6}, {4, 3, 8}, {4, 1, 3}, {4, 8,
1}, {2, 3, 1}, {2, 7, 3}, {2, 6, 7}, {2, 1, 6}, {8, 3, 7}, {5, 1,
8}, {5, 8, 7}}, {1, 2, 3, 4, 5, 4, 6, 6, 1, 3, 5, 2}]}
How can I use something like bmesh["BoundaryElements"]
in a way that it gives me all the boundary elements that belong to a certain ElementMarker
?