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

Contents 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 - (show annotations) (download)
Thu Oct 20 20:57:01 2011 UTC (13 years, 9 months ago) by gforget
Branch: MAIN
Changes since 1.2: +7 -7 lines
- add help sections at the top.

1 function s=gcmfaces(varargin);
2 %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 % now only the first input is used, and only if it is a cell array.
10
11 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
22 nFacesMax=6;
23
24 if nargin>1; fld=varargin{1}; else; fld=[]; end;
25
26 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 for iF=s.nFaces+1:nFacesMax;
33 eval(['s.f' num2str(iF) '=[];']);
34 end;
35 else;
36 s.nFaces=nFaces;
37 s.gridType=gridType;
38 for iF=1:nFacesMax;
39 eval(['s.f' num2str(iF) '=[];']);
40 end;
41 end;
42
43 s = class(s,'gcmfaces');
44

  ViewVC Help
Powered by ViewVC 1.1.22