Index: /issm/trunk/src/m/classes/model.m
===================================================================
--- /issm/trunk/src/m/classes/model.m	(revision 9508)
+++ /issm/trunk/src/m/classes/model.m	(revision 9509)
@@ -22,13 +22,13 @@
 		 numberofelements    = modelfield('default',0,'marshall',true,'format','Integer');
 		 numberofnodes       = modelfield('default',0,'marshall',true,'format','Integer');
-		 elements            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
-		 elements_type       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
-		 vertices_type       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 x                   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 y                   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 z                   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 elements            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
+		 elements_type       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
+		 vertices_type       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 x                   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 y                   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 z                   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 		 nodeconnectivity    = modelfield('default',NaN,'marshall',false);
-		 elementconnectivity = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
-		 edges               = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 elementconnectivity = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
+		 edges               = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 
 		 %I/O
@@ -38,5 +38,5 @@
 		 numberofelements2d = modelfield('default',0,'marshall',true,'format','Integer');
 		 numberofnodes2d    = modelfield('default',0,'marshall',true,'format','Integer');
-		 elements2d         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 elements2d         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 elements_type2d    = modelfield('default',NaN,'marshall',false);
 		 vertices_type2d    = modelfield('default',NaN,'marshall',false);
@@ -61,9 +61,9 @@
 
 		 %Nodes
-		 nodeonhutter         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 nodeonmacayeal       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 nodeonpattyn         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 nodeonstokes         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 borderstokes         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 nodeonhutter         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 nodeonmacayeal       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 nodeonpattyn         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 nodeonstokes         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 borderstokes         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 
 		 %Stokes
@@ -72,5 +72,5 @@
 
 		 %Penalties
-		 penalties            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 penalties            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 penalty_offset       = modelfield('default',0,'marshall',true,'format','Double');
 		 penalty_lock         = modelfield('default',0,'marshall',true,'format','Integer');
@@ -78,5 +78,5 @@
 		 segmentmarkers       = modelfield('default',NaN,'marshall',false);
 		 rifts                = modelfield('default',NaN,'marshall',false);
-		 riftinfo             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 riftinfo             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 riftproperties       = modelfield('default',NaN,'marshall',false);
 		 numrifts             = modelfield('default',0,'marshall',true,'format','Integer');
@@ -84,14 +84,14 @@
 		 %Projections
 		 uppernodes           = modelfield('default',NaN,'marshall',false);
-		 upperelements        = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
-		 lowerelements        = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
+		 upperelements        = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
+		 lowerelements        = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
 		 lowernodes           = modelfield('default',NaN,'marshall',false);
 
 		 %Extrusion
 		 numlayers         = modelfield('default',0,'marshall',true,'format','Integer');
-		 elementonbed      = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',2);
-		 elementonsurface  = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',2);
-		 nodeonbed         = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',1);
-		 nodeonsurface     = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',1);
+		 elementonbed      = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2);
+		 elementonsurface  = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2);
+		 nodeonbed         = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',1);
+		 nodeonsurface     = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',1);
 		 minh              = modelfield('default',0,'marshall',false);
 
@@ -118,45 +118,45 @@
 		 g                = modelfield('default',0,'marshall',true,'format','Double');
 		 yts              = modelfield('default',0,'marshall',true,'format','Double');
-		 drag_coefficient = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 drag_p           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
-		 drag_q           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
-		 rheology_B       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 rheology_n       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
+		 drag_coefficient = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 drag_p           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
+		 drag_q           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
+		 rheology_B       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 rheology_n       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
 		 rheology_law     = modelfield('default','','marshall',true,'format','String');
 
 		 %Geometrical parameters
-		 elementoniceshelf = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',2);
-		 elementonicesheet = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',2);
-		 elementonwater    = modelfield('default',NaN,'marshall',true,'format','BooleanMat','sizetype',2);
-		 nodeoniceshelf    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 nodeonicesheet    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 nodeonwater       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 surface           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 thickness         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 thickness_coeff   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 bed               = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 bathymetry        = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 elementoniceshelf = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2);
+		 elementonicesheet = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2);
+		 elementonwater    = modelfield('default',NaN,'marshall',true,'format','BooleanMat','mattype',2);
+		 nodeoniceshelf    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 nodeonicesheet    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 nodeonwater       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 surface           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 thickness         = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 thickness_coeff   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 bed               = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 bathymetry        = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 
 		 %Boundary conditions
 		 nodeonboundary = modelfield('default',NaN,'marshall',false);
-		 pressureload   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
-		 spcvx          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 spcvy          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 spcvz          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 spctemperature = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 spcthickness   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 spcwatercolumn = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 diagnostic_ref = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 pressureload   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
+		 spcvx          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 spcvy          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 spcvz          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 spctemperature = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 spcthickness   = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 spcwatercolumn = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 diagnostic_ref = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 
 		 %Observations 
-		 vx_obs                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 vy_obs                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 vx_obs                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 vy_obs                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 		 vel_obs                   = modelfield('default',NaN,'marshall',false);
-		 surface_accumulation_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 surface_ablation_rate     = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 surface_mass_balance      = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 dhdt                      = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 geothermalflux            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 thickness_obs             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 surface_accumulation_rate = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 surface_ablation_rate     = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 surface_mass_balance      = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 dhdt                      = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 geothermalflux            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 thickness_obs             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 
 		 %Statics parameters
@@ -183,15 +183,15 @@
 		 %Control
 		 control_analysis = modelfield('default',0,'marshall',true,'format','Boolean');
-		 control_type     = modelfield('default',0,'marshall',true,'format','DoubleMat','sizetype',3);
-		 weights          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 control_type     = modelfield('default',0,'marshall',true,'format','DoubleMat','mattype',3);
+		 weights          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 		 nsteps           = modelfield('default',0,'marshall',true,'format','Integer');
-		 maxiter          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
-		 cm_responses     = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 maxiter          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
+		 cm_responses     = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 tolx             = modelfield('default',0,'marshall',true,'format','Double');
-		 optscal          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 optscal          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 eps_cm           = modelfield('default',0,'marshall',true,'format','Double');
-		 cm_min           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
-		 cm_max           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
-		 cm_jump          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 cm_min           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
+		 cm_max           = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
+		 cm_jump          = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 cm_gradient      = modelfield('default',0,'marshall',true,'format','Boolean');
 		 epsvel                         = modelfield('default',0,'marshall',true,'format','Double');
@@ -200,7 +200,7 @@
 		 num_cm_responses               = modelfield('default',0,'marshall',true,'format','Integer');
 		 %Output
-		 requested_outputs               = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',3);
+		 requested_outputs               = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',3);
 		 %Debugging
-		 verbose                        = modelfield('default',0,'marshall',true,'format','Integer');
+		 verbose                        = modelfield('default',0,'marshall',true,'preprocess','marshallverbose','format','Integer');
 		 mem_debug                      = modelfield('default',0,'marshall',false);
 		 gprof                          = modelfield('default',0,'marshall',false);
@@ -211,16 +211,16 @@
 		 outputfilename                 = modelfield('default','','marshall',true,'format','String');
 		 results                        = modelfield('default',struct(),'marshall',false);
-		 vx                             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 vy                             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 vz                             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 vx                             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 vy                             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 vz                             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 		 vel                            = modelfield('default',NaN,'marshall',false);
-		 temperature                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1); %temperature solution vector
-		 waterfraction                  = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 temperature                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1); %temperature solution vector
+		 waterfraction                  = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 		 groundingline_melting_rate                = modelfield('default',NaN,'marshall',true,'format','Double');
-		 basal_melting_rate             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 basal_melting_rate_correction  = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
-		 pressure                       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 basal_melting_rate             = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 basal_melting_rate_correction  = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
+		 pressure                       = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 		 %Hydrology
-		 watercolumn                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',1);
+		 watercolumn                    = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',1);
 
 		 %Hydrology
@@ -261,5 +261,5 @@
 		 dakotadat                       = modelfield('default','','marshall',false);
 		 qmu_analysis                    = modelfield('default',0,'marshall',true,'format','Boolean');
-		 part                            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','sizetype',2);
+		 part                            = modelfield('default',NaN,'marshall',true,'format','DoubleMat','mattype',2);
 		 npart                           = modelfield('default',0,'marshall',true,'format','Integer');
 		 numberofvariables               = modelfield('default',0,'marshall',true,'format','Integer');
Index: /issm/trunk/src/m/classes/modelfield.m
===================================================================
--- /issm/trunk/src/m/classes/modelfield.m	(revision 9508)
+++ /issm/trunk/src/m/classes/modelfield.m	(revision 9509)
@@ -10,5 +10,5 @@
 		preprocess='';
 		format='Int';
-		sizetype=0;
+		mattype=0;
 	end
 	methods
Index: /issm/trunk/src/m/model/marshall.m
===================================================================
--- /issm/trunk/src/m/model/marshall.m	(revision 9508)
+++ /issm/trunk/src/m/model/marshall.m	(revision 9509)
@@ -20,18 +20,18 @@
 fields=fieldnames(template);
 for i=1:length(fields),
-	field=fields{i};
-	marshall=template.(field){2};
-	if marshall,
-		if strcmpi(field,'verbose'),
-			WriteData(fid,field,VerboseToBinary(md.verbose),{'Integer'});
+	fieldname=fields{i};
+	if template.(fieldname).marshall,
+		if ~isempty(template.(fieldname).preprocess),
+			eval(['fieldvalue=' template.(fieldname).preprocess '(md.(fieldname));']);
 		else
-			WriteData(fid,field,md.(field),template.(field)(3:end));
+			fieldvalue=md.(fieldname);
 		end
+		WriteData(fid,fieldname,fieldvalue,template.(fieldname));
 	end
 end
 
 %Quick fix: add some fields needed by parameters
-WriteData(fid,'numberofvertices',md.numberofnodes,{'Integer'});
-WriteData(fid,'numberofedges',size(md.edges,1),{'Integer'});
+WriteData(fid,'numberofvertices',md.numberofnodes,modelfield('format','Integer'));
+WriteData(fid,'numberofedges',size(md.edges,1),modelfield('format','Integer'));
 
 %close file
@@ -41,17 +41,15 @@
 end
 
-function WriteData(fid,fieldname,fieldvalue,fieldtype) % {{{
+function WriteData(fid,fieldname,fieldvalue,fieldprop) % {{{
 %WRITEDATA - write model field in binary file
 %
 %   Usage:
-%      WriteData(fid,fieldname,fieldvalue,fieldtype)
-%
-%   Example:
-%     WriteData(fid,'thickness',md.thickness,{'DoubleMat',1})
+%      WriteData(fid,fieldname,fieldvalue,fieldprop)
+%
 
 %first recover data, enum of the data and type of data
 data=fieldvalue;
 enum=BuildEnum(fieldname);
-data_type=fieldtype{1};
+data_type=fieldprop.format;
 
 if issparse(data),
@@ -113,5 +111,5 @@
 
 	%matrix type:
-	mattype=fieldtype{2};
+	mattype=fieldprop.mattype;
 
 	%Get size
@@ -165,5 +163,5 @@
 
 	%matrix type:
-	mattype=fieldtype{2};
+	mattype=fieldprop.mattype;
 
 	%Get size
@@ -338,2 +336,6 @@
 	error('TypeToCode error message: data type not supported yet!');
 end% }}}
+
+%Some processing, should be moved to the corresponding classes in the future
+function out=marshallverbose(in)
+	out = VerboseToBinary(in);
