function s=gcmfaces(varargin); %object: create a gcmfaces object %input: cell array (optional) % %note: - the current format is determined based on the global mygrid. % - if no input is specified, create an empty gcmfaces object. % - otherwise each record of the cell array must provide the data for one face. % - this routine used to have several inputs of various types; % now only the first input is used, and only if it is a cell array. global mygrid; nFaces=mygrid.nFaces; if nFaces==1; gridType='ll'; elseif nFaces==4; gridType='llpc'; elseif nFaces==5; gridType='llc'; elseif nFaces==6; gridType='cube'; else; error('wrong gcmfaces definition'); end; nFacesMax=6; if nargin>1; fld=varargin{1}; else; fld=[]; end; if iscell(fld); s.nFaces=length(fld); s.gridType=gridType; for iF=1:s.nFaces; eval(['s.f' num2str(iF) '=fld{iF};']); end; for iF=s.nFaces+1:nFacesMax; eval(['s.f' num2str(iF) '=[];']); end; else; s.nFaces=nFaces; s.gridType=gridType; for iF=1:nFacesMax; eval(['s.f' num2str(iF) '=[];']); end; end; s = class(s,'gcmfaces');