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

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/mapind.m

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

Initial import of Stark code.

Line 
1 function mi=mapind(x,y,l,m)
2
3 % mi=mapind(x,y,l,ele,xgrid,ygrid)
4 %
5 % Maps individuals at positions (X,Y) in element L onto a finite
6 % element mesh, providing an estimate of the density of individuals.
7
8 xl=m.x(m.e);
9 yl=m.y(m.e);
10 A=    [ xl(:,1) .* (yl(:,2) - yl(:,3)) + ...
11         xl(:,2) .* (yl(:,3) - yl(:,1)) + ...
12         xl(:,3) .* (yl(:,1) - yl(:,2)) ]/2;
13 nnode=max(m.e(:));
14
15 mi=zeros(nnode,1);
16 [p,n]=phi(x,y,l,ele,xgrid,ygrid);
17 l3=l*ones(1,3);
18 p=p./A(l3);
19
20 n=[n(:);[1:nnode+1]'];
21 p=[p(:);zeros(nnode+1,1)];
22 [n,i]=sort(n(:));
23 p=p(i);
24 pcs=cumsum(p);
25 nind=[find(diff(n))];
26 mi=diff([0;pcs(nind)]);
27 mi=mi.*(mi>=0);
Note: See TracBrowser for help on using the browser.