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

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

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

revision 1.1 by gforget, Wed Feb 10 14:43:47 2010 UTC revision 1.2 by gforget, Wed Apr 21 23:53:06 2010 UTC
# Line 4  a=c; Line 4  a=c;
4    
5  if isa(b,'gcmfaces');  if isa(b,'gcmfaces');
6     %go from 2D field to 3D field     %go from 2D field to 3D field
7     for kk=1:size(a.f1,3)        n3=size(a.f1,3);
8        for iFace=1:a.nFaces;        for iFace=1:a.nFaces;
9           iF=num2str(iFace);           iF=num2str(iFace);
10           eval(['a.f' iF '(:,:,kk)=b.f' iF '(:,:);']);           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        end;        end;
    end;  
14  elseif isa(b,'double');  elseif isa(b,'double');
15     for kk=1:size(a.f1,3)        n3=length(b);
16          if size(b,1)~=1; b=b'; end;
17        for iFace=1:a.nFaces;          for iFace=1:a.nFaces;  
18           iF=num2str(iFace);           iF=num2str(iFace);
19           eval(['a.f' iF '(:,:,kk)=b(kk);']);           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        end;        end;
    end;  
23  else  else
24     error('indexing not supported by gcmfaces objects')     error('indexing not supported by gcmfaces objects')
25  end  end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.22