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

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

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

Initial import of Stark code.

Line 
1 % DRAWELEMS3D draw 2-D FEM element configuration in 3-D
2 %
3 % DRAWELEMS3D draws element boundries given a valid grid structure. 
4 %
5 %  INPUT : fem_grid_struct - (from LOADGRID, see FEM_GRID_STRUCT)       
6 %           
7 % OUTPUT : hel - handle to the element object.
8 %
9 %   CALL : hel=drawelems3d(fem_grid_struct);
10 %
11 % Written by: Brian O. Blanton
12 % Summer 1998
13 %                 
14 function hel=drawelems3d(fem_grid_struct)
15
16 % DEFINE ERROR STRINGS
17 err1=['Not enough input arguments; need a fem_grid_struct'];
18
19 % check arguments
20 if nargin ==0
21    error(err1);
22 end 
23
24 if ~is_valid_struct(fem_grid_struct)
25    error('    Argument to DRAWELEMS must be a valid fem_grid_struct.')
26 end
27
28 % Extract grid fields from fem_grid_struct
29 %
30 elems=fem_grid_struct.e;
31 % COPY FIRST COLUMN TO LAST TO CLOSE ELEMENTS
32 %
33 elems=elems(:,[1 2 3 1]);
34
35 x=fem_grid_struct.x;
36 y=fem_grid_struct.y;
37 z=fem_grid_struct.z;
38
39 elems=elems';
40 [m,n]=size(elems);
41 xt=x(elems);
42 yt=y(elems);
43 zt=z(elems);
44 if n~=1
45    if m>n
46       xt=reshape(xt,n,m);
47       yt=reshape(yt,n,m);
48       zt=reshape(zt,n,m);
49    else
50       xt=reshape(xt,m,n);
51       yt=reshape(yt,m,n);
52       zt=reshape(zt,m,n);
53    end
54    xt=[xt
55        NaN*ones(size(1:length(xt)))];
56    yt=[yt
57        NaN*ones(size(1:length(yt)))];
58    zt=[zt
59        NaN*ones(size(1:length(zt)))];
60 end
61 xt=xt(:);
62 yt=yt(:);
63 zt=zt(:);
64 %
65 % DRAW GRID
66 %
67 hel=line(xt,yt,zt,'LineWidth',1,'LineStyle','-','Color',[.8 .8 .8]);
68 set(hel,'Tag','elements');
69  
70 %
71 %        Brian O. Blanton
72 %        Curr. in Marine Sciences
73 %        15-1A Venable Hall
74 %        CB# 3300
75 %        Uni. of North Carolina
76 %        Chapel Hill, NC
77 %                 27599-3300
78 %
79 %        919-962-4466
80 %        blanton@cuda.chem.unc.edu
81 %
82 %        Summer 1997
83 %
Note: See TracBrowser for help on using the browser.