Index: /issm/trunk/src/m/classes/@pairoptions/exist.m
===================================================================
--- /issm/trunk/src/m/classes/@pairoptions/exist.m	(revision 2397)
+++ /issm/trunk/src/m/classes/@pairoptions/exist.m	(revision 2398)
@@ -1,7 +1,7 @@
-function bool=exist(pairoptions,optioname),
+function bool=exist(pairoptions,field),
 %EXIST - check if the option exist
 %
 %   Usage:
-%      bool=exist(pairoptions,optioname)
+%      bool=exist(pairoptions,field)
 
 %some argument checking: 
@@ -10,16 +10,8 @@
 	error('exist error message: bad usage');
 end
-
-if ~ischar(optioname),
-	error('exist error message: optioname should be a string');
+if ~ischar(field),
+	error('exist error message: field should be a string');
 end
 
 %Recover option
-bool=0;
-for i=1:size(pairoptions.list,1),
-	if strcmpi(pairoptions.list{i,1},optioname)
-		bool=1;
-		return
-	end
-end
-
+bool=ismember(field,pairoptions.list(:,1));
Index: /issm/trunk/src/m/classes/@pairoptions/getfieldvalueerr.m
===================================================================
--- /issm/trunk/src/m/classes/@pairoptions/getfieldvalueerr.m	(revision 2398)
+++ /issm/trunk/src/m/classes/@pairoptions/getfieldvalueerr.m	(revision 2398)
@@ -0,0 +1,28 @@
+function value=getfieldvalueerr(pairoptions,field),
+%GETFIELDVALUEERR - get the value of an option
+%
+%   Usage:
+%      value=getfieldvalueerr(pairoptions,field)
+%
+%   Find an option value from a field. If the field is not
+%   found, an error message will be displayed
+%
+%   Examples:
+%      value=getfieldvalueerr(options,'caxis');
+
+%some argument checking: 
+if ~ischar(field),
+	error('getfieldvalueerr error message: field should be a string');
+end
+
+%Recover option
+if ~exist(pairoptions,field)
+	error(['error message: field ' field ' has not been provided'])
+else
+	for i=1:size(pairoptions.list,1),
+		if strcmpi(pairoptions.list{i,1},field)
+			value=pairoptions.list{i,2};
+			return
+		end
+	end
+end
Index: /issm/trunk/src/m/classes/public/mesh/meshyams.m
===================================================================
--- /issm/trunk/src/m/classes/public/mesh/meshyams.m	(revision 2397)
+++ /issm/trunk/src/m/classes/public/mesh/meshyams.m	(revision 2398)
@@ -24,18 +24,12 @@
 options=pairoptions(varargin{:});
 options=deleteduplicates(options,1);
-if ~exist(options,'domainoutline'),
-	error('meshyams error message: no ''domainoutline'' was provided');
-end
-if ~exist(options,'velocities'),
-	error('meshyams error message: no ''velocities'' was provided');
-end
 
 %recover some fields
 disp('MeshYams Options:')
-domainoutline=getfieldvalue(options,'domainoutline');
+domainoutline=getfieldvalueerr(options,'domainoutline');
 disp(sprintf('   %-15s: ''%s''','DomainOutline',domainoutline));
 groundeddomain=getfieldvalue(options,'groundeddomain','N/A');
 disp(sprintf('   %-15s: ''%s''','GroundedDomain',groundeddomain));
-velocities=getfieldvalue(options,'velocities');
+velocities=getfieldvalueerr(options,'velocities');
 disp(sprintf('   %-15s: ''%s''','Velocities',velocities));
 resolution=getfieldvalue(options,'resolution',5000);
Index: /issm/trunk/src/m/classes/public/process_solve_options.m
===================================================================
--- /issm/trunk/src/m/classes/public/process_solve_options.m	(revision 2397)
+++ /issm/trunk/src/m/classes/public/process_solve_options.m	(revision 2398)
@@ -5,44 +5,14 @@
 %      options=process_solve_options(options)
 %
-%   See also: SOLVE,RECOVER_SOLVE_OPTIONS
+%   See also: SOLVE
 
 %analysis_type: check on this option, error out otherwise
-found=0;
-for i=1:size(options,1),
-	if strcmpi(options{i,1},'analysis_type'),
-		analysis_type=options{i,2};
-		found=1;
-		break
-	end
-end
-if ~found,
-	error('recover_solve_options error message: no ''analysis_type'' was provided');
-end
+analysis_type=getfieldvalueerr(options,'analysis_type');
 
 %sub_analysis_type: check on it, not mandatory
-found=0;
-for i=1:size(options,1),
-	if strcmpi(options{i,1},'sub_analysis_type'),
-		sub_analysis_type=options{i,2};
-		found=1;
-		break
-	end
-end
-if ~found
-	sub_analysis_type='none';
-end
+sub_analysis_type=getfieldvalue(options,'sub_analysis_type','none');
 
 %batch mode for launching jobs.
-found=0;
-for i=1:size(options,1),
-	if strcmpi(options{i,1},'batch'),
-		batch=options{i,2};
-		found=1;
-		break
-	end
-end
-if ~found
-	batch='no';
-end
+outoptions.batch=getfieldvalue(options,'batch','no');
 
 %check solution type is supported
@@ -51,5 +21,5 @@
 else
 	%convert to enum
-	analysis_type=eval([upper(analysis_type(1)) lower(analysis_type(2:end)) 'AnalysisEnum']);
+	outoptions.analysis_type=eval([upper(analysis_type(1)) lower(analysis_type(2:end)) 'AnalysisEnum']);
 end
 if ~ismemberi(sub_analysis_type,{'steady','transient','none','horiz','adjoint','gradient','inverse','vert',''}),
@@ -57,56 +27,13 @@
 else
 	%convert to enum
-	sub_analysis_type=eval([upper(sub_analysis_type(1)) lower(sub_analysis_type(2:end)) 'AnalysisEnum']);
+	outoptions.sub_analysis_type=eval([upper(sub_analysis_type(1)) lower(sub_analysis_type(2:end)) 'AnalysisEnum']);
 end
 
 %  process qmu arguments
-
-%first, the defaults
-qmudir ='qmu';% qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
-qmufile='qmu';%  qmufile can not be changed unless cielo_ice_script.sh is also changed
-ivar   =1;
-iresp  =1;
-imethod=1;
-iparams=1;
-runmpi =false;
-
-for i=1:size(options,1),
-	switch options{i,1},
-	case 'qmudir'
-		qmudir=options{i,2};
-	case 'qmufile'
-		qmufile=options{i,2};
-	case 'ivar'
-		ivar=options{i,2};
-	case 'iresp'
-		iresp=options{i,2};
-	case 'imethod'
-		imethod=options{i,2};
-	case 'iparams'
-		iparams=options{i,2};
-	case 'overwrite'
-		outoptions.overwrite=options{i,2};
-	case 'outfiles'
-		outoptions.outfiles=options{i,2};
-	case 'rstfile'
-		outoptions.rstfile=options{i,2}; 
-	case 'rundakota'
-		outoptions.rundakota=options{i,2};
-	case 'runmpi'
-		runmpi=options{i,2};
-	otherwise
-		%nothing
-	end
-end
-
-%setup final options structure
-outoptions.analysis_type=analysis_type;
-outoptions.sub_analysis_type=sub_analysis_type;
-outoptions.qmudir=qmudir;
-outoptions.qmufile=qmufile;
-outoptions.ivar=ivar;
-outoptions.iresp=iresp;
-outoptions.imethod=imethod;
-outoptions.iparams=iparams;
-outoptions.runmpi=runmpi;
-outoptions.batch=batch;
+outoptions.qmudir=getfieldvalue(options,'qmudir','qmu');  % qmudir =['qmu_' datestr(now,'yyyymmdd_HHMMSS')];
+outoptions.qmufile=getfieldvalue(options,'qmufile','qmu');% qmufile cannot be changed unless cielo_ice_script.sh is also changed
+outoptions.ivar=getfieldvalue(options,'ivar',1);
+outoptions.iresp=getfieldvalue(options,'iresp',1);
+outoptions.imethod=getfieldvalue(options,'imethod',1);
+outoptions.iparams=getfieldvalue(options,'iparams',1);
+outoptions.runmpi=getfieldvalue(options,'runmpi',false);
Index: sm/trunk/src/m/classes/public/recover_solve_options.m
===================================================================
--- /issm/trunk/src/m/classes/public/recover_solve_options.m	(revision 2397)
+++ 	(revision )
@@ -1,22 +1,0 @@
-function options=recover_solve_options(md,varargin)
-%RECOVER_SOLVE_OPTIONS - recover solution options
-%
-%   Usage:
-%      options=recover_solve_options(md,varargin);
-%
-%   See also: SOLVE
-
-%initialize options.
-options=cell(0,2);
-
-%make sure length(varargin) is even, ie options come in pairs.
-if mod(length(varargin),2),
-	error('recover_solve_options error message: an even number of options is necessary');
-end
-
-%go through varargin, extract options 
-for i=1:length(varargin)/2,
-
-	options(end+1,:)={varargin{2*i-1} varargin{2*i}};
-
-end
Index: /issm/trunk/src/m/classes/public/solve.m
===================================================================
--- /issm/trunk/src/m/classes/public/solve.m	(revision 2397)
+++ /issm/trunk/src/m/classes/public/solve.m	(revision 2398)
@@ -18,5 +18,5 @@
 
 %recover options
-options=optionlist2cell(varargin{:});
+options=pairoptions(varargin{:});
 
 %add default options
