function s=gcmfaces(varargin); %object: create an empty gcmfaces object %optional input: cell array containing each face data that % will be used to fill the gcmfaces object %pre-requisite : the grid (global mygrid variable) must have been % defined using grid_load or grid_load_native % providing the blue print for new gcmfaces objects %note: 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');