%BALANCETHICKNESS class definition
%
%   Usage:
%      balancethickness=balancethickness();

classdef balancethickness
	properties (SetAccess=public) 
		spcthickness      = NaN;
		thickening_rate   = NaN;
		stabilization     = 0;
	end
	methods
		function obj = balancethickness(varargin) % {{{
			switch nargin
				case 0
					obj=setdefaultparameters(obj);
				otherwise
					error('constructor not supported');
			end
		end % }}}
		function obj = setdefaultparameters(obj) % {{{

			%Type of stabilization used
			obj.stabilization=1;

		end % }}}
		function md = checkconsistency(obj,md,solution,analyses) % {{{
			%Early return
			if solution~=BalancethicknessSolutionEnum, return; end

			md = checkfield(md,'balancethickness.spcthickness','forcing',1);
			md = checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
			md = checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
		end % }}}
		function disp(obj) % {{{
			disp(sprintf('   balance thickness solution parameters:'));

			fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint)');
			fielddisplay(obj,'thickening_rate','ice thickening rate used in the mass conservation (dh/dt)');
			fielddisplay(obj,'stabilization','0: None, 1: SU, 2: MacAyeal''s artificial diffusivity, 3:DG');

		end % }}}
		function marshall(obj,fid) % {{{
			WriteData(fid,'object',obj,'fieldname','spcthickness','format','DoubleMat','mattype',1);
			WriteData(fid,'object',obj,'fieldname','thickening_rate','format','DoubleMat','mattype',1);
			WriteData(fid,'object',obj,'fieldname','stabilization','format','Integer');
		end % }}}
	end
end
