XIAN-FEM-2026June/三维matlab代码/matlab 3D一阶基 + bele/find_pec_edges.m

25 lines
671 B
Matlab
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function edgeIds = find_pec_edges(pecDomains, mesh)
%FIND_PEC_EDGES 收集 PEC 边界三角面上的边自由度1-based edge id
triIdx = findTri(pecDomains, mesh);
edgeIds = zeros(numel(triIdx) * 3, 1);
for n = 1:numel(triIdx)
numTet = mesh.ConnOfTri(triIdx(n), 1);
numFace = mesh.ConnOfTri(triIdx(n), 2);
if numFace == 1
e = mesh.EdgeOfTet(numTet, [1, 2, 4]);
elseif numFace == 2
e = mesh.EdgeOfTet(numTet, [1, 3, 5]);
elseif numFace == 3
e = mesh.EdgeOfTet(numTet, [2, 3, 6]);
else
e = mesh.EdgeOfTet(numTet, [4, 5, 6]);
end
edgeIds((n - 1) * 3 + (1:3)) = e;
end
edgeIds = unique(edgeIds);
end