Index: /issm/trunk/src/m/classes/public/modeldefault/modeldefault.m
===================================================================
--- /issm/trunk/src/m/classes/public/modeldefault/modeldefault.m	(revision 2398)
+++ /issm/trunk/src/m/classes/public/modeldefault/modeldefault.m	(revision 2399)
@@ -37,5 +37,5 @@
 %recover options
 disp(sprintf('\nRecovering options...\n'));
-options=optionlist2cell(varargin{:});
+options=pairoptions(varargin{:});
 
 %process options
Index: /issm/trunk/src/m/classes/public/modeldefault/modeldefault_process.m
===================================================================
--- /issm/trunk/src/m/classes/public/modeldefault/modeldefault_process.m	(revision 2398)
+++ /issm/trunk/src/m/classes/public/modeldefault/modeldefault_process.m	(revision 2399)
@@ -13,136 +13,65 @@
 
 %domainoutline
-optionstruct.domainoutline=find_option(options,'domainoutline');
-if isempty(optionstruct.domainoutline),
-	error('modeldefault_process error pessage: at least the option ''domainoutline'' must be specified')
-end
+optionstruct.domainoutline=getfieldvalueerr(options,'domainoutline');
 
 %resolution
-optionstruct.resolution=find_option(options,'resolution');
-if isempty(optionstruct.resolution),
-	optionstruct.resolution=10000;
-end
+optionstruct.resolution=getfieldvalue(options,'resolution',10000);
 disp(sprintf('   %-18s: %g','resolution',optionstruct.resolution));
 
 %iceshelves
-optionstruct.iceshelves=find_option(options,'iceshelves');
-if isempty(optionstruct.iceshelves),
-	iceshelves=[ISSM_DIR '/../models/Antarctica/Exp_Par/Iceshelves.exp'];
-	if exist(iceshelves),
-		optionstruct.iceshelves=iceshelves;
-	else
-		optionstruct.iceshelves='';
-	end
-end
+iceshelves=[ISSM_DIR '/../models/Antarctica/Exp_Par/Iceshelves.exp'];
+optionstruct.iceshelves=getfieldvalue(options,'iceshelves',iceshelves);
 disp(sprintf('   %-18s: %s','iceshelves',optionstruct.iceshelves));
 
 %islands
-optionstruct.islands=find_option(options,'islands');
-if isempty(optionstruct.islands),
-	islands=[ISSM_DIR '/../models/Antarctica/Exp_Par/Islands.exp'];
-	if exist(islands),
-		optionstruct.islands=islands;
-	else
-		optionstruct.islands='';
-	end
-end
+islands=[ISSM_DIR '/../models/Antarctica/Exp_Par/Islands.exp'];
+optionstruct.islands=getfieldvalue(options,'islands',islands);
 disp(sprintf('   %-18s: %s','islands',optionstruct.islands));
 
 %thicknesspath
-optionstruct.thicknesspath=find_option(options,'thicknesspath');
-if isempty(optionstruct.thicknesspath),
-	thicknesspath=[modeldatapath '/BedMap/gridded/thickness.mat'];
-	if exist(thicknesspath),
-		optionstruct.thicknesspath=thicknesspath;
-	else
-		optionstruct.thicknesspath='';
-	end
-end
+thicknesspath=[modeldatapath '/BedMap/gridded/thickness.mat'];
+optionstruct.thicknesspath=getfieldvalue(options,'thicknesspath',thicknesspath);
 disp(sprintf('   %-18s: %s','thicknesspath',optionstruct.thicknesspath));
 
 %firnpath
-optionstruct.firnpath=find_option(options,'firnpath');
-if isempty(optionstruct.firnpath),
-	firnpath=[modeldatapath '/BroekeFirn1km/firn.mat'];
-	if exist(firnpath),
-		optionstruct.firnpath=firnpath;
-	else
-		optionstruct.firnpath='';
-	end
-end
+firnpath=[modeldatapath '/BroekeFirn1km/firn.mat'];
+optionstruct.firnpath=getfieldvalue(options,'firnpath',firnpath);
 disp(sprintf('   %-18s: %s','firnpath',optionstruct.firnpath));
 
 %surfacepath
-optionstruct.surfacepath=find_option(options,'surfacepath');
-if isempty(optionstruct.surfacepath),
-	surfacepath=[modeldatapath '/BamberDEMAntarctica1km/surface_smooth30_lowslope.mat'];
-	if exist(surfacepath),
-		optionstruct.surfacepath=surfacepath;
-	else
-		optionstruct.surfacepath='';
-	end
-end
+surfacepath=[modeldatapath '/BamberDEMAntarctica1km/surface_smooth30_lowslope.mat'];
+optionstruct.surfacepath=getfieldvalue(options,'surfacepath',surfacepath);
 disp(sprintf('   %-18s: %s','surfacepath',optionstruct.surfacepath));
 
 %mosaicpath
-optionstruct.mosaicpath=find_option(options,'mosaicpath');
-if isempty(optionstruct.mosaicpath),
-	mosaicpath=[modeldatapath '/RignotAntarcticaVelMosaicRampErsAlos/RignotAntVel.mat'];
-	if exist(mosaicpath),
-		optionstruct.mosaicpath=mosaicpath;
-	else
-		optionstruct.mosaicpath='';
-	end
-end
+mosaicpath=[modeldatapath '/RignotAntarcticaVelMosaicRampErsAlos/RignotAntVel.mat'];
+optionstruct.mosaicpath=getfieldvalue(options,'mosaicpath',mosaicpath);
 disp(sprintf('   %-18s: %s','mosaicpath',optionstruct.mosaicpath));
 
 %temperaturepath
-optionstruct.temperaturepath=find_option(options,'temperaturepath');
-if isempty(optionstruct.temperaturepath),
-	temperaturepath=[modeldatapath '/GiovinettoZwallyTemperatures92/Giovinetto_Temperatures.mat'];
-	if exist(temperaturepath),
-		optionstruct.temperaturepath=temperaturepath;
-	else
-		optionstruct.temperaturepath='';
-	end
-end
+temperaturepath=[modeldatapath '/GiovinettoZwallyTemperatures92/Giovinetto_Temperatures.mat'];
+optionstruct.temperaturepath=getfieldvalue(options,'temperaturepath',temperaturepath);
 disp(sprintf('   %-18s: %s','temperaturepath',optionstruct.temperaturepath));
 
 %heatfluxpath
-optionstruct.heatfluxpath=find_option(options,'heatfluxpath');
-if isempty(optionstruct.heatfluxpath),
-	heatfluxpath=[modeldatapath '/HeatfluxAntarctica/RignotHeatFlux.mat'];
-	if exist(heatfluxpath),
-		optionstruct.heatfluxpath=heatfluxpath;
-	else
-		optionstruct.heatfluxpath='';
-	end
-end
+heatfluxpath=[modeldatapath '/HeatfluxAntarctica/RignotHeatFlux.mat'];
+optionstruct.heatfluxpath=getfieldvalue(options,'heatfluxpath',heatfluxpath);
 disp(sprintf('   %-18s: %s','heatfluxpath',optionstruct.heatfluxpath));
 
 %numlayers
-optionstruct.numlayers=find_option(options,'numlayers');
-if isempty(optionstruct.numlayers),
-	optionstruct.numlayers=0;
-end
+optionstruct.numlayers=getfieldvalue(options,'numlayers',0);
 disp(sprintf('   %-18s: %g','numlayers',optionstruct.numlayers));
 
 %extrusionexponent
-optionstruct.extrusionexponent=find_option(options,'extrusionexponent');
-if isempty(optionstruct.extrusionexponent),
-	optionstruct.extrusionexponent=3;
-end
+optionstruct.extrusionexponent=getfieldvalue(options,'extrusionexponent',3);
 disp(sprintf('   %-18s: %g','extrusionexponent',optionstruct.extrusionexponent));
 
 
 %elementstype
-optionstruct.elementstype=find_option(options,'elementstype');
-if isempty(optionstruct.elementstype),
-	if optionstruct.numlayers>0,
-		optionstruct.elementstype='pattyn';
-	else
-		optionstruct.elementstype='macayeal';
-	end
+if optionstruct.numlayers>0,
+	elementstype='pattyn';
+else
+	elementstype='macayeal';
 end
+optionstruct.elementstype=getfieldvalue(options,'elementstype',elementstype);
 disp(sprintf('   %-18s: %s','elementstype',optionstruct.elementstype));
-
Index: /issm/trunk/src/m/utils/Nightly/nightlyrun.m
===================================================================
--- /issm/trunk/src/m/utils/Nightly/nightlyrun.m	(revision 2398)
+++ /issm/trunk/src/m/utils/Nightly/nightlyrun.m	(revision 2399)
@@ -27,13 +27,11 @@
 
 %recover options
-options=optionlist2cell(varargin{:});
+options=pairoptions(varargin{:});
 
 %check some options
-rank=find_option(options,'rank');
-if isempty(rank), rank=1; end
-numprocs=find_option(options,'numprocs');
-if (isempty(numprocs) | numprocs<rank), numprocs=1; end
-procedure=find_option(options,'procedure');
-if isempty(procedure), procedure='check'; end
+rank=getfieldvalue(options,'rank',1);
+numprocs=getfieldvalue(options,'numprocs',1);
+if (numprocs<rank), numprocs=1; end
+procedure=getfieldvalue(options,'procedure','check');
 
 %Go to Test directory
Index: /issm/trunk/src/m/utils/Nightly/runme.m
===================================================================
--- /issm/trunk/src/m/utils/Nightly/runme.m	(revision 2398)
+++ /issm/trunk/src/m/utils/Nightly/runme.m	(revision 2399)
@@ -26,5 +26,5 @@
 
 %recover options
-options=optionlist2cell(varargin{:});
+options=pairoptions(varargin{:});
 
 %check arguments
@@ -60,56 +60,41 @@
 
 	%CHECK analysis_type
-	analysis_type_arg=find_option(options,'analysis_type');
-	if ~isempty(analysis_type_arg),
-		if ~ismember(analysis_type,analysis_type_arg)
-			continue
-		end
+	analysis_type_arg=getfieldvalue(options,'analysis_type',{analysis_type});
+	if ~ismember(analysis_type,analysis_type_arg)
+		continue
 	end
 
 	%CHECK sub_analysis_type
-	sub_analysis_type_arg=find_option(options,'sub_analysis_type');
-	if ~isempty(sub_analysis_type_arg),
-		if ~ismember(sub_analysis_type,sub_analysis_type_arg)
-			continue
-		end
+	sub_analysis_type_arg=getfieldvalue(options,'sub_analysis_type',{sub_analysis_type});
+	if ~ismember(sub_analysis_type,sub_analysis_type_arg)
+		continue
 	end
 
 	%CHECK qmu
-	qmu_arg=find_option(options,'qmu');
-	if ~isempty(qmu_arg),
-		if qmu~=qmu_arg,
-			continue
-		end
+	qmu_arg=getfieldvalue(options,'qmu',qmu);
+	if qmu~=qmu_arg,
+		continue
 	end
 
 	%CHECK control
-	control_arg=find_option(options,'control');
-	if ~isempty(control_arg),
-		if control~=control_arg,
-			continue
-		end
+	control_arg=getfieldvalue(options,'control',control);
+	if control~=control_arg,
+		continue
 	end
 
 	%CHECK control_fit
-	control_fit_arg=find_option(options,'control_fit');
-	if ~isempty(control_fit_arg),
-		if ~ismember(control_fit,control_fit_arg)
-			continue
-		end
+	control_fit_arg=getfieldvalue(options,'control_fit',{control_fit});
+	if ~ismember(control_fit,control_fit_arg)
+		continue
 	end
 
 	%CHECK parallel
-	parallel_arg=find_option(options,'parallel');
-	if ~isempty(parallel_arg),
-		if parallel~=parallel_arg,
-			continue
-		end
+	parallel_arg=getfieldvalue(options,'parallel',parallel);
+	if parallel~=parallel_arg,
+		continue
 	end
 
 	%CHECK procedure
-	procedure=find_option(options,'procedure');
-	if isempty(procedure),
-		procedure='check';
-	end
+	procedure=getfieldvalue(options,'procedure','check');
 	if ~ismember(procedure,{'check','update'})
 		disp('runme warning: procedure not supported, defaulting to test ''check''')
@@ -138,5 +123,5 @@
 		md.name=testname;
 		%check and modify number of cpus if necessary
-		numcpus=find_option(options,'numprocs');
+		numcpus=getfieldvalue(options,'numprocs',[]);
 		if ~isempty(numcpus) & numcpus>1,
 			if md.np>numcpus,
