Indices of edges of mesh elements belonging to the specified faces of 2-D geometry
pdesde is not recommended. Use
Find the indices of the mesh elements' edges located on the outer boundaries of the geometry and belonging to the specified faces.
Define two circles and a rectangle and place these in one matrix.
R1 = [3,4,-1,1,1,-1,0.5,0.5,-0.75,-0.75]'; C1 = [1,-0.5,-0.25,0.25]'; C2 = [1,0.5,-0.25,0.25]'; C1 = [C1;zeros(length(R1) - length(C1),1)]; C2 = [C2;zeros(length(R1) - length(C2),1)]; gd = [R1,C1,C2];
Create a set formula that subtracts one circle from the rectangle and adds the other circle to the rectangle.
sf = 'R1-C1+C2';
Create and plot the geometry.
ns = char('R1','C1','C2'); ns = ns'; gd = decsg(gd,sf,ns); pdegplot(gd,'FaceLabels','on')
Create and plot a mesh.
[p,e,t] = initmesh(gd); pdemesh(p,e,t)
Find the indices of the mesh elements' edges located on the outer boundaries and belonging to face 1. Display the result as a column vector.
i1 = pdesde(e,1); i1.'
ans = 42×1 1 2 3 4 5 6 7 8 9 10 ⋮
The resulting vector contains indices of all mesh edges in this geometry, except the eight internal edges surrounding face 2.
length(e) - length(i1)
ans = 8
pdesde function to find the mesh edges surrounding face 2. The result is an empty vector because none of these mesh edges belong to the outer boundary of the geometry.
i2 = pdesde(e,2)
i2 = 1x0 empty double row vector
e— Mesh edges
Mesh edges, specified as a
Ne matrix of
Ne is the number of edges in the mesh. For details on
the mesh data representation, see
FaceID— Face IDs
Face IDs, specified as a vector of integers.
i— Indices of mesh edges on outer boundaries
Indices of the mesh edges on the outer boundaries, returned as a vector of integers.