get_neighbor.m

来自「hodge decomposition for 2D vector fields」· M 代码 · 共 30 行

M
30
字号

function [neighbor_triangle,neighbor_point]=get_neighbor(node,triangle) 
%% get the neighboring triangles and neighboring nodes of a node 
%% node: the reference node 
%% triangle: the Grid Table 
%% neighbor_triangle: the neighbor triangles of the reference node 
%% neighbor_point: the neighbor points of the reference node 
M=size(triangle,1); 
neighbor_triangle=[]; 
for i=1:M 
temp=triangle(i,:); 
if find(temp==node)>0 
neighbor_triangle=[neighbor_triangle i]; 
end; 
end; 
neighbor_point=[]; 
N=length(neighbor_triangle); 
for i=1:N 
temp=triangle(neighbor_triangle(i),:); 
for j=1:3 
if find(neighbor_point==temp(j))>0 
continue; 
else 
neighbor_point=[neighbor_point temp(j)]; 
end; 
end; 
end; 
neighbor_point=sort(neighbor_point); 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?