Index: ../trunk-jpl/src/m/classes/calvingdev.m
===================================================================
--- ../trunk-jpl/src/m/classes/calvingdev.m	(revision 0)
+++ ../trunk-jpl/src/m/classes/calvingdev.m	(revision 19034)
@@ -0,0 +1,62 @@
+%CALVINGDEV class definition
+%
+%   Usage:
+%      calvingdev=calvingdev();
+
+classdef calvingdev
+	properties (SetAccess=public) 
+		stabilization = 0;
+		coeff         = NaN;
+		meltingrate   = NaN;
+	end
+	methods
+		function obj = calvingdev(varargin) % {{{
+			switch nargin
+				case 0
+					obj=setdefaultparameters(obj);
+				case 1
+					inputstruct=varargin{1};
+					list1 = properties('calvingdev');
+					list2 = fieldnames(inputstruct);
+					for i=1:length(list1)
+						fieldname = list1{i};
+						if ismember(fieldname,list2),
+							obj.(fieldname) = inputstruct.(fieldname);
+						end
+					end
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function obj = setdefaultparameters(obj) % {{{
+
+			%stabilization = 2 by default
+			obj.stabilization = 2;
+
+			%Proportionality coefficient in Pi model
+			obj.coeff=2e13;
+		end % }}}
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
+			%Early return
+			if (solution~=TransientSolutionEnum() | md.transient.iscalving==0), return; end
+
+			md = checkfield(md,'fieldname','calving.stabilization','values',[0 1 2]);
+			md = checkfield(md,'fieldname','calving.coeff','>',0,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'fieldname','calving.meltingrate','NaN',1,'size',[md.mesh.numberofvertices 1],'>=',0);
+		end % }}}
+		function disp(obj) % {{{
+			disp(sprintf('   Calving Pi parameters:'));
+			fielddisplay(obj,'stabilization','0: no, 1: artificial_diffusivity, 2: streamline upwinding');
+			fielddisplay(obj,'coeff','proportionality coefficient in Pi model');
+			fielddisplay(obj,'meltingrate','melting rate at given location [m/a]');
+
+		end % }}}
+		function marshall(obj,md,fid) % {{{
+			yts=365.0*24.0*3600.0;
+			WriteData(fid,'enum',CalvingLawEnum(),'data',CalvingDevEnum(),'format','Integer');
+			WriteData(fid,'enum',LevelsetStabilizationEnum(),'data',obj.stabilization,'format','Integer');
+			WriteData(fid,'enum',CalvingpiCoeffEnum(),'data',obj.coeff,'format','DoubleMat','mattype',1);
+			WriteData(fid,'class','calving','object',obj,'fieldname','meltingrate','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1,'scale',1./yts);
+		end % }}}
+	end
+end
