/[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.2 - (show annotations) (download)
Tue Jun 21 21:17:31 2011 UTC (14 years, 1 month ago) by gforget
Branch: MAIN
Changes since 1.1: +26 -12 lines
- remove the complicated logic at the beginning
- infer old nFaces/gridType arguments from mygrid instead

1 function s=gcmfaces(varargin);
2 %object: create a gcmfaces object
3 %input: cell array (optional)
4 %
5 %note: - the current format is determined based on the global mygrid.
6 % - if no input is specified, create an empty gcmfaces object.
7 % - otherwise each record of the cell array must provide the data for one face.
8 % - 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