NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FEM/elgen.m

Revision 495 (checked in by cbc, 12 years ago)

Initial import of Stark code.

Line 
1 %
2 % ELGEN generate an element list for a rectangular FEM mesh
3 %
4 % ELGEN generate an element list for a FEM mesh with nhorz nodes in the
5 %       x-direction and nvert nodes in the y-direction.  This function
6 %       is used primarily to provide element lists for transect data
7 %       so that contours can be computed for the normal component of
8 %       the transect. 
9 %
10 %       Example: If a transect is made with 25 horizontal and 10 vertical
11 %       stations,  ELGEN would be called as follows:
12 %       
13 %           >> ellist=elgen(25,10);
14 %
15 %       The result would be an element list containing the node numbers
16 %       for the three vertices of 2*(nhorz-1)*(nvert-1) elements in a matrix
17 %       with 2*(nhorz-1)*(nvert-1) rows and 3 columns.
18 %
19 %
20 %        Brian O. Blanton
21 %        Curriculum in Marine Sciences
22 %        Ocean Processes Numerical Modeling Laboratory
23 %        15-1A Venable Hall
24 %        CB# 3300
25 %        Uni. of North Carolina
26 %        Chapel Hill, NC
27 %                 27599-3300
28 %
29 %        919-962-4466
30 %        blanton@marine.unc.edu
31 %
32 %        September 1994
33 %
34
35 function ellist=elgen(nhorz,nvert)
36 nrx=nhorz-1;
37 nry=nvert-1;
38 ellist=zeros(nrx*nry*2,3);
39
40 iel=0;
41 for ic=1:nrx
42    for ir=1:nry
43       iel=iel+1;
44       n1=ir+(ic-1)*nvert;
45       n2=n1+nvert;
46       n3=n2+1;
47       ellist(iel,:)=[n1 n2 n3];
48       iel=iel+1;
49       n2=n3;
50       n3=n1+1;
51       ellist(iel,:)=[n1 n2 n3];
52    end
53 end
54
Note: See TracBrowser for help on using the browser.