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

root/gliderproc/trunk/MATLAB/opnml/FDCONT/fdvector.m

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

Initial import of Stark code.

Line 
1 function h=fdvector(bfd,ufe,vfe,sc,stride,sclab,scale_xor,scale_yor)
2 %FDVECTOR plot vectors from a bfd sampling.
3 %   FDVECTOR plots vectors from a FEM domain that has been
4 %   sampled on a finite difference grid.  The FD grid
5 %   is contained in a .bfd file (See GENBFD) and FDVECTOR
6 %   handles the interpolatopn of FE vector data onto
7 %   the FD grid.  (VECPLOT2 does the actual plotting.)
8 %
9 %   Input:   bdf    - bfd array (all 10 columns)
10 %            u      - east vector amplitude
11 %            v      - west vector amplitude
12 %            sc     - vector scaler; (optional; def = 1.)
13 %            stride - stride over nodes
14 %            sclab  - label for vector scale; (optional; def = 'cm/s')
15 %            scale_xor,scale_yor - vector scale origin (optional)
16 %
17 %   The stride argument is used to plot every other
18 %   vector (stride=2, e.g.).
19 %
20 %   Including the scale_xor,scale_yor prevents the mouse-driven
21 %   specification of the vector scale placement.
22 %
23 %   Output: h - vector of handles to objects drawn.
24
25 % DEFINE ERROR STRINGS
26 err1=['Not enough input arguments; type "help fdvector"'];
27 err2=['Too many input arguments; type "help fdvector"'];
28 err3=['Length of x,y,u,v must be the same'];
29 err4=['Length of x,y,u,v must be greater than 1'];
30 err5=['Both x and y must be specified to vector scale origin.'];
31 err6=['Stride must be an integer >1'];
32 % save the current value of the current figure's WindowButtonDownFcn,
33 % WindowButtonMotionFcn, and WindowButtonUpFcn
34 %
35 WindowButtonDownFcn=get(gcf,'WindowButtonDownFcn');
36 WindowButtonMotionFcn=get(gcf,'WindowButtonMotionFcn');
37 WindowButtonUpFcn=get(gcf,'WindowButtonUpFcn');
38 set(gcf,'WindowButtonDownFcn','');
39 set(gcf,'WindowButtonMotionFcn','');
40 set(gcf,'WindowButtonUpFcn','');
41
42 % Argument check
43 if nargin < 3
44    error(err1);
45 elseif nargin > 8
46    error(err2);
47 end
48  
49 % process argument list
50 if nargin==3
51    sc=1.;
52    sclab='cm/s';   
53    stride=1; 
54 elseif nargin==4
55    sclab='cm/s';
56    stride=1;     
57 elseif nargin==5
58    sclab='cm/s';
59    if stride<1 | ~isint(stride)
60       error(err6)
61    end
62 end
63 sclab=[' ' sclab];
64 if nargin==7
65    error(err5)
66 end
67
68 xfd=bfd(:,1);yfd=bfd(:,2);
69 ufd=fe2fd(ufe,bfd(:,4:9));
70 vfd=fe2fd(vfe,bfd(:,4:9));
71
72 if length(xfd)~=length(vfd)
73    error(err3);
74 end
75 if length(ufd)==1
76    error(err4);
77 end
78
79
80 % Find which FD nodes are entirely within FE domain
81 fdonfe=find(bfd(:,3)~=0);
82
83 x=xfd(fdonfe);
84 y=yfd(fdonfe);
85 u=ufd(fdonfe);
86 v=vfd(fdonfe);
87
88 istride=1:stride:length(x);
89 x=x(istride);
90 y=y(istride);
91 u=u(istride);
92 v=v(istride);
93
94 if exist('scale_xor')
95    h=vecplot2(x,y,u,v,...
96               sc,sclab,scale_xor,scale_yor);
97 else
98    h=vecplot2(x,y,u,v,sc,sclab);
99 end
100
101 set(h,'Color','k');
102
103
104
Note: See TracBrowser for help on using the browser.