Index: /issm/trunk-jpl/src/m/classes/sealevelmodel.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/sealevelmodel.m	(revision 20110)
+++ /issm/trunk-jpl/src/m/classes/sealevelmodel.m	(revision 20110)
@@ -0,0 +1,94 @@
+%SEALEVELMODEL class definition
+%
+%   Usage:
+%      slm = sealevelmodel(varargin)
+%
+%      where varargin is a variable list of options: 
+%
+%   Example: 
+%      slm = sealevel('icecap',md_greenland,'icecap',md_antarctica,'earth',md_earth);
+
+classdef sealevelmodel
+	properties (SetAccess=public) %Model fields
+		% {{{
+		icecaps          = {}; % list of ice cap models
+		earth            = 0;  % model for the whole earth
+		cluster          = 0;
+		miscellaneous    = 0;
+		settings         = 0;
+		private          = 0;
+		%}}}
+	end
+	methods
+		function slm = sealevelmodel(varargin) % {{{
+
+			if nargin==0, 
+				slm=setdefaultparameters(slm);
+			else 
+				slm=setdefaultparameters(slm);
+
+				options=pairoptions(varargin{:}); 
+			
+				%recover all the icecap models: 
+				slm.icecaps=getfieldvalues(options,'ice_cap',{}); 
+				bandwidths=getfieldvalues(options,'bandwidth',{200000});
+				
+				%recover the earth model:
+				slm.earth = getfieldvalue(options,'earth');
+
+				%start plugging the ice caps into the earth model: 
+				earth=slm.earth;
+				for i=1:length(slm.icecaps),
+					icecap=slm.icecaps{i};
+					icecap.mesh.segments=alignsegments(icecap.mesh.segments);
+
+					%call patch routine:
+					if icecap.mesh.epsg==3413, hem=1; else hem=-1; end
+					earth.mesh=patchglobe(earth.mesh,icecap.mesh,'hem',hem,'bandwidth',bandwidths{i},'plot',1);
+				end
+
+				
+				%build transition matrices: 
+				%disp('sealevelmodel: building  icecap transition tables');
+				%[C,ia,ib]=intersect([slm.earth.mesh.lat slm.earth.mesh.long],[slm.icecaps{i}.mesh.lat slm.icecaps{i}.mesh.long],'rows');
+
+				
+			end
+		end
+		%}}}
+		function checkconsistency(slm,solutiontype) % {{{
+
+			%is the coupler turned on? 
+			for i=1:length(slm.icecaps),
+				if slm.icecaps{i}.transient.iscoupler==0,
+					error(sprintf('sealevelmodel checkconsistenty error:  icecap model %s should have the transient coupler option turned on!',slm.icecaps{i}.miscellaneous.name));
+				end
+			end
+				
+			if slm.earth.transient.iscoupler==0,
+				error('sealevelmodel checkconsistenty error:  earth model should have the transient coupler option turned on!');
+			end
+
+
+		end
+		%}}}
+		function slm = setdefaultparameters(slm) % {{{
+
+			%initialize subclasses
+			slm.icecaps           = {};
+			slm.earth             = {};
+			slm.miscellaneous     = miscellaneous();
+			slm.settings          = settings();
+			slm.private           = private();
+			slm.cluster           = generic();
+		end
+		%}}}
+		function disp(self) % {{{
+			disp(sprintf('%19s: %-22s -- %s','icecaps'         ,['[' num2str(length(self.icecaps)) 'x1 ' class(self.icecaps) ']'],'ice caps'));
+			disp(sprintf('%19s: %-22s -- %s','earth'           ,['[1x1 ' class(self.earth) ']'],'earth'));
+			disp(sprintf('%19s: %-22s -- %s','settings'        ,['[1x1 ' class(self.settings) ']'],'settings properties'));
+			disp(sprintf('%19s: %-22s -- %s','cluster'         ,['[1x1 ' class(self.cluster) ']'],'cluster parameters (number of cpus...)'));
+			disp(sprintf('%19s: %-22s -- %s','miscellaneous'   ,['[1x1 ' class(self.miscellaneous) ']'],'miscellaneous fields'));
+		end % }}}
+	end
+end
