| 1 |
gforget |
1.1 |
function s=gcmfaces(varargin); |
| 2 |
gforget |
1.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 |
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 |
|
|
|