Index: /issm/trunk-jpl/src/m/classes/mesh2dvertical.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 16325)
+++ /issm/trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 16325)
@@ -0,0 +1,222 @@
+%MESH2DVERTICAL class definition
+%
+%   Usage:
+%      mesh2dvertical=mesh2dvertical();
+
+classdef mesh2dvertical
+	properties (SetAccess=public) 
+		x                           = NaN;
+		z                           = NaN;
+		elements                    = NaN
+		numberofelements            = 0;
+		numberofvertices            = 0;
+		numberofedges               = 0;
+
+		lat                         = NaN
+		long                        = NaN
+		hemisphere                  = NaN
+
+		vertexonboundary            = NaN
+
+		edges                       = NaN
+		segments                    = NaN
+		segmentmarkers              = NaN
+		vertexconnectivity          = NaN
+		elementconnectivity         = NaN
+		average_vertex_connectivity = 0;
+
+		extractedvertices           = NaN
+		extractedelements           = NaN
+	end
+	methods
+		function obj = mesh2dvertical(varargin) % {{{
+			switch nargin
+				case 0
+					obj=setdefaultparameters(obj);
+				otherwise
+					error('constructor not supported');
+			end
+		end % }}}
+		function obj = setdefaultparameters(obj) % {{{
+
+			%the connectivity is the averaged number of nodes linked to a
+			%given node through an edge. This connectivity is used to initially
+			%allocate memory to the stiffness matrix. A value of 16 seems to
+			%give a good memory/time ration. This value can be checked in
+			%trunk/test/Miscellaneous/runme.m
+			obj.average_vertex_connectivity=25;
+		end % }}}
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
+
+			md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
+			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
+				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
+			end
+			md = checkfield(md,'mesh.numberofelements','>',0);
+			md = checkfield(md,'mesh.numberofvertices','>',0);
+			md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+
+			switch(solution),
+				case ThermalSolutionEnum(),
+					md = checkmessage(md,'thermal not supported for 2d mesh');
+			end
+		end % }}}
+		function disp(obj) % {{{
+			disp(sprintf('   2d Mesh:')); 
+
+			disp(sprintf('\n      Elements and vertices:'));
+			fielddisplay(obj,'numberofelements','number of elements');
+			fielddisplay(obj,'numberofvertices','number of vertices');
+			fielddisplay(obj,'elements','vertex indices of the mesh elements');
+			fielddisplay(obj,'x','vertices x coordinate [m]');
+			fielddisplay(obj,'z','vertices z coordinate [m]');
+			fielddisplay(obj,'edges','edges of the 2d mesh (vertex1 vertex2 element1 element2)');
+			fielddisplay(obj,'numberofedges','number of edges of the 2d mesh');
+
+			disp(sprintf('\n      Properties:'));
+			fielddisplay(obj,'vertexonboundary','vertices on the boundary of the domain flag list');
+			fielddisplay(obj,'segments','edges on domain boundary (vertex1 vertex2 element)');
+			fielddisplay(obj,'segmentmarkers','number associated to each segment');
+			fielddisplay(obj,'vertexconnectivity','list of vertices connected to vertex_i');
+			fielddisplay(obj,'elementconnectivity','list of vertices connected to element_i');
+			fielddisplay(obj,'average_vertex_connectivity','average number of vertices connected to one vertex');
+
+			disp(sprintf('\n      Extracted model:'));
+			fielddisplay(obj,'extractedvertices','vertices extracted from the model');
+			fielddisplay(obj,'extractedelements','elements extracted from the model');
+
+			disp(sprintf('\n      Projection:'));
+			fielddisplay(obj,'lat','vertices latitude [degrees]');
+			fielddisplay(obj,'long','vertices longitude [degrees]');
+			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+		end % }}}
+		function marshall(obj,md,fid) % {{{
+			WriteData(fid,'enum',MeshTypeEnum(),'data',StringToEnum(['Mesh' meshtype(obj)]),'format','Integer');
+			WriteData(fid,'object',obj,'class','mesh','fieldname','x','format','DoubleMat','mattype',1);
+			WriteData(fid,'object',obj,'class','mesh','fieldname','z','format','DoubleMat','mattype',1);
+			WriteData(fid,'enum',MeshZEnum(),'data',zeros(obj.numberofvertices,1),'format','DoubleMat','mattype',1);
+			WriteData(fid,'object',obj,'class','mesh','fieldname','elements','format','DoubleMat','mattype',2);
+			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
+			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
+		end % }}}
+		function t = meshtype(obj) % {{{
+			t = '2Dvertical';
+		end % }}}
+		function [data datatype] = processdata(self,md,data,options) % {{{
+
+			%transpose data if necessary
+			if (size(data,2) > size(data,1)),
+				data=data';
+			end
+			datasize=size(data);
+
+			%convert to double if necessary
+			if ~isnumeric(data);
+				disp('processdata info message: data is not numeric (logical?). Converted to double');
+				data=double(data);
+			end
+
+			%check length
+			if datasize(1)~=md.mesh.numberofvertices & datasize(1)~=md.mesh.numberofelements
+				error('plotmodel error message: data not supported yet');
+			end
+
+			%quiver?
+			if datasize(2)>1,
+				datatype=3;
+
+				%check number of columns, add zeros if necessary,
+				if (md.mesh.dimension==3)
+					if datasize(2)==2,
+						data=[data, zeros(datasize(1),1)];
+					elseif datasize(2)~=3,
+						error('plotmodel error message: data provided should have 2 or 3 columns for quiver plot, and 1 for regular plot');
+					end
+					%elseif ((md.mesh.dimension==2) & datasize(2)~=2),
+					%	error('plotmodel error message: data provided should have 2 columns for quiver plot, and 1 for regular plot');
+				end
+			end
+
+			%smoothing?
+			if exist(options,'smooth')
+				data=averaging(md,data,getfieldvalue(options,'smooth'));
+				datasize(1)=md.mesh.numberofvertices;
+				%---> go to node data
+			end
+
+			%element data
+			if (datasize(1)==md.mesh.numberofelements & datasize(2)==1),
+
+				%Initialize datatype if non patch
+				if datatype~=4 & datatype~=5,
+					datatype=1;
+				end
+
+				%Mask?
+				if exist(options,'mask'),
+					flags=getfieldvalue(options,'mask');
+					pos=find(~flags);
+					if length(flags)==md.mesh.numberofvertices,
+						[pos2 dummy]=find(ismember(md.mesh.elements,pos));
+						data(pos2,:)=NaN;
+					elseif length(flags)==md.mesh.numberofelements
+						data(pos,:)=NaN;
+					else
+						disp('plotmodel warning: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements');
+					end
+				end
+
+				%log?
+				if exist(options,'log'),
+					bounds=getfieldvalue(options,'caxis',[min(data(:)) max(data(:))]);
+					data(find(data<bounds(1)))=bounds(1);
+					if any(data<=0),
+						error('Log option cannot be applied on negative values. Use caxis option (Rignot''s settings: [1.5 max(data)])');
+					end
+					pos=find(~isnan(data));
+					data(pos)=log(data(pos))/log(getfieldvalue(options,'log'));
+				end
+			end
+
+			%node data
+			if (datasize(1)==md.mesh.numberofvertices & datasize(2)==1),
+				datatype=2;
+
+				%Mask?
+				if exist(options,'mask'),
+					flags=getfieldvalue(options,'mask');
+					pos=find(~flags);
+					if length(flags)==md.mesh.numberofvertices,
+						data(pos,:)=NaN;
+					elseif length(flags)==md.mesh.numberofelements
+						data(md.mesh.elements(pos,:),:)=NaN;
+					else
+						disp('plotmodel warning: mask length not supported yet (supported length are md.mesh.numberofvertices and md.mesh.numberofelements');
+					end
+				end
+
+				%log?
+				if exist(options,'log'),
+					%if any(data<=0),
+					%	error('Log option cannot be applied on negative values. Use caxis option (Rignot''s settings: [1.5 max(data)])');
+					%end
+					data=log(data)/log(getfieldvalue(options,'log'));
+				end
+			end
+		end % }}}
+		function [x y z elements is2d isplanet] = processmesh(self,options) % {{{
+
+			isplanet = 0;
+			is2d     = 1;
+
+			elements = self.elements;
+			x        = self.x;
+			y        = self.z;
+			z        = zeros(self.numberofvertices,1);
+		end % }}}
+	end
+end
Index: /issm/trunk-jpl/src/m/plot/applyoptions.m
===================================================================
--- /issm/trunk-jpl/src/m/plot/applyoptions.m	(revision 16324)
+++ /issm/trunk-jpl/src/m/plot/applyoptions.m	(revision 16325)
@@ -49,5 +49,5 @@
 
 %view 
-if md.mesh.dimension==3 & ~exist(options,'layer'),
+if strcmp(meshtype(md.mesh),'3D') & ~exist(options,'layer'),
 	view(getfieldvalue(options,'view',3));
 else
@@ -60,5 +60,5 @@
 	eval(['axis ' getfieldvalue(options,'axis')]);
 else
-	if ((md.mesh.dimension==2) | exist(options,'layer')),
+	if strcmpi(meshtype(md.mesh),'2Dhorizontal') | exist(options,'layer'),
 		axis tight equal;
 	else
Index: /issm/trunk-jpl/src/m/plot/processdata.m
===================================================================
--- /issm/trunk-jpl/src/m/plot/processdata.m	(revision 16324)
+++ /issm/trunk-jpl/src/m/plot/processdata.m	(revision 16325)
@@ -15,4 +15,15 @@
 if (iscell(data) | isempty(data) | length(data)==0 | (length(data)==1 & ~isstruct(data) & isnan(data))),
 	error('plotmodel error message: data provided is empty');
+end
+
+%Process NaN if any (do not know before mask is applied)
+if exist(options,'nan')
+	data(find(isnan(data)))=getfieldvalue(options,'nan',0);
+end
+
+%special case for mesg 2dvertical
+if strcmp(meshtype(md.mesh),'2Dvertical'),
+	[data datatype] = processdata(md.mesh,md,data,options);
+	return;
 end
 
@@ -51,8 +62,4 @@
 datasize=size(data);
 
-%Process NaN if any (do not know before mask is applied)
-if exist(options,'nan')
-	data(find(isnan(data)))=getfieldvalue(options,'nan',0);
-end
 %non patch processing
 if datatype~=4 & datatype~=5,
Index: /issm/trunk-jpl/src/m/plot/processmesh.m
===================================================================
--- /issm/trunk-jpl/src/m/plot/processmesh.m	(revision 16324)
+++ /issm/trunk-jpl/src/m/plot/processmesh.m	(revision 16325)
@@ -13,4 +13,10 @@
 if md.mesh.numberofvertices==md.mesh.numberofelements
 	error(['plot error message: the number of elements is the same as the number of nodes...']);
+end
+
+%special case for mesg 2dvertical
+if strcmp(meshtype(md.mesh),'2Dvertical'),
+	[x y z elements is2d isplanet] = processmesh(md.mesh,options);
+	return;
 end
 
