source: issm/branches/trunk-jpl-damage/src/m/kml/kmlnodeconnectivity.m@ 12168

Last change on this file since 12168 was 12168, checked in by cborstad, 13 years ago

merged trunk-jpl into branch through revision 12167

File size: 1.2 KB
Line 
1%
2% create a node connectivity table for the elements in the model.
3%
4% [nodecon]=edgeadjacency(elem,nnodes,mxepg)
5%
6% where the required input is:
7% elem (numeric, element connectivity array (elems x nodes))
8%
9% and the required output is:
10% nodecon (numeric, node connectivity array (nnodes x mxepg+1))
11%
12% the optional input is:
13% nnodes (numeric, number of nodes)
14% mxepg (numeric, max elements per node)
15%
16function [nodecon]=kmlnodeconnectivity(elem,nnodes,mxepg)
17
18if ~nargin
19 help kmlnodeconnectivity
20 return
21end
22
23if ~exist('nnodes','var') || isempty(nnodes)
24 nnodes=max(max(elem));
25end
26if ~exist('mxepg','var') || isempty(mxepg)
27 mxepg=25;
28end
29
30%% create the node connectivity array
31
32nodecon=zeros(nnodes,mxepg+1);
33
34% loop over the elements
35
36for i=1:size(elem,1)
37
38% loop over the nodes for each element
39
40 for j=1:size(elem,2)
41 if elem(i,j)
42 nodecon(elem(i,j),nodecon(elem(i,j),end)+1)=i;
43 nodecon(elem(i,j),end)=nodecon(elem(i,j),end)+1;
44 end
45 end
46end
47
48%% sort the node connectivity array
49
50% loop over the nodes
51
52for i=1:size(nodecon,1)
53 if (nodecon(i,end) > 1)
54 nodecon(i,1:nodecon(i,end))=sort(nodecon(i,1:nodecon(i,end)));
55 end
56end
57
58end
Note: See TracBrowser for help on using the repository browser.