/[MITgcm]/MITgcm_contrib/gael/matlab_class/@gcmfaces/mk3D.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/@gcmfaces/mk3D.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Wed Apr 21 23:53:06 2010 UTC (15 years, 2 months ago) by gforget
Branch: MAIN
Changes since 1.1: +9 -6 lines
speed up mk3D.m

1 gforget 1.1 function a = mk3D(b,c)
2    
3     a=c;
4    
5     if isa(b,'gcmfaces');
6     %go from 2D field to 3D field
7 gforget 1.2 n3=size(a.f1,3);
8 gforget 1.1 for iFace=1:a.nFaces;
9     iF=num2str(iFace);
10 gforget 1.2 eval(['tmp1=b.f' iF ';']); [n1,n2]=size(tmp1); tmp1=tmp1(:);
11     tmp1=tmp1*ones(1,size(a.f1,3)); tmp1=reshape(tmp1,[n1 n2 n3]);
12     eval(['a.f' iF '=tmp1;']);
13 gforget 1.1 end;
14     elseif isa(b,'double');
15 gforget 1.2 n3=length(b);
16     if size(b,1)~=1; b=b'; end;
17 gforget 1.1 for iFace=1:a.nFaces;
18     iF=num2str(iFace);
19 gforget 1.2 eval(['tmp1=c.f' iF ';']); tmp2=size(tmp1); n1=tmp2(1); n2=tmp2(2);
20     tmp1=reshape(ones(n1*n2,1)*b,[n1 n2 n3]);;
21     eval(['a.f' iF '=tmp1;']);
22 gforget 1.1 end;
23     else
24     error('indexing not supported by gcmfaces objects')
25     end
26    
27    

  ViewVC Help
Powered by ViewVC 1.1.22