source: issm/trunk/src/m/kml/edgeadjacency.m@ 6312

Last change on this file since 6312 was 6312, checked in by jschierm, 14 years ago

Intermediate version of kml_mesh_write.m with overlapping partitions.

File size: 1.1 KB
Line 
1%
2% create an edge adjacency table for the elements in the model.
3%
4% [edgeadj]=edgeadjacency(elem,nodecon)
5%
6% where the required input is:
7% elem (numeric, element connectivity array (elems x nodes))
8% nodecon (numeric, node connectivity array (nodes x elems+1))
9%
10% and the required output is:
11% edgeadj (numeric, edge adjacency array (elems x edges))
12%
13function [edgeadj]=edgeadjacency(elem,nodecon)
14
15if ~nargin
16 help edgeadjacency
17 return
18end
19
20%% create the edge adjacency array
21
22edgeadj=zeros(size(elem));
23
24% loop over the elements
25
26for i=1:size(elem,1)
27
28% loop over the edges for each element (trias only for now)
29
30 for j=1:size(elem,2)
31 inode1=elem(i,j);
32 inode2=elem(i,mod(j,size(elem,2))+1);
33
34% loop over the elements containing the first node of the edge to see
35% if they contain the second node of the edge
36
37 for k=1:nodecon(inode1,end)
38 if (nodecon(inode1,k) ~= i) && ...
39 ~isempty(find(elem(nodecon(inode1,k),:)==inode2,1))
40 edgeadj(i,j)=nodecon(inode1,k);
41 break;
42 end
43 end
44 end
45end
46
47end
Note: See TracBrowser for help on using the repository browser.