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

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

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


Revision 1.3 - (hide annotations) (download)
Thu Oct 20 20:57:01 2011 UTC (13 years, 8 months ago) by gforget
Branch: MAIN
Changes since 1.2: +7 -7 lines
- add help sections at the top.

1 gforget 1.1 function s=gcmfaces(varargin);
2 gforget 1.3 %object: create an empty gcmfaces object
3     %optional input: cell array containing each face data that
4     % will be used to fill the gcmfaces object
5     %pre-requisite : the grid (global mygrid variable) must have been
6     % defined using grid_load or grid_load_native
7     % providing the blue print for new gcmfaces objects
8     %note: this routine used to have several inputs of various types;
9 gforget 1.2 % now only the first input is used, and only if it is a cell array.
10 gforget 1.1
11 gforget 1.2 global mygrid;
12    
13     nFaces=mygrid.nFaces;
14    
15     if nFaces==1; gridType='ll';
16     elseif nFaces==4; gridType='llpc';
17     elseif nFaces==5; gridType='llc';
18     elseif nFaces==6; gridType='cube';
19     else; error('wrong gcmfaces definition');
20     end;
21 gforget 1.1
22     nFacesMax=6;
23    
24 gforget 1.2 if nargin>1; fld=varargin{1}; else; fld=[]; end;
25    
26 gforget 1.1 if iscell(fld);
27     s.nFaces=length(fld);
28     s.gridType=gridType;
29     for iF=1:s.nFaces;
30     eval(['s.f' num2str(iF) '=fld{iF};']);
31     end;
32 gforget 1.2 for iF=s.nFaces+1:nFacesMax;
33 gforget 1.1 eval(['s.f' num2str(iF) '=[];']);
34     end;
35     else;
36 gforget 1.2 s.nFaces=nFaces;
37     s.gridType=gridType;
38     for iF=1:nFacesMax;
39     eval(['s.f' num2str(iF) '=[];']);
40     end;
41 gforget 1.1 end;
42    
43     s = class(s,'gcmfaces');
44    

  ViewVC Help
Powered by ViewVC 1.1.22