Index: /issm/trunk/src/m/classes/public/recover_areas.m
===================================================================
--- /issm/trunk/src/m/classes/public/recover_areas.m	(revision 2394)
+++ /issm/trunk/src/m/classes/public/recover_areas.m	(revision 2395)
@@ -7,36 +7,16 @@
 %      [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
 
-	%initialize elementstype
-	hutterflag=zeros(md.numberofelements,1);
-	macayealflag=zeros(md.numberofelements,1);
-	pattynflag=zeros(md.numberofelements,1);
-	stokesflag=zeros(md.numberofelements,1);
-	filltype='none';
+	%go through varargin, extract options and plug them into subtype options, by order of appearance
+	options=pairoptions(varargin{:});
+	options=deleteduplicates(options,1);
 
-	%make sure length(varargin) is even
-	if mod(length(varargin),2),
-		error('recover_elementstype_options error message: an even number of options is necessary');
-	end
+	%recover elements distribution
+	hutterflag  =BuildFlag(md,getfieldvalue(options,'hutter',''));
+	macayealflag=BuildFlag(md,getfieldvalue(options,'macayeal',''));
+	pattynflag  =BuildFlag(md,getfieldvalue(options,'pattyn',''));
+	stokesflag  =BuildFlag(md,getfieldvalue(options,'stokes',''));
+	hutterflag  =BuildFlag(md,getfieldvalue(options,'hutter',''));
+	filltype    =getfieldvalue(options,'fill','none');
 
-	%go through varargin, extract options and plug them into subtype options, by order of appearance
-	for i=1:length(varargin)/2,
-
-		optionstring=varargin{2*i-1};
-		optionvalue=varargin{2*i};
-
-		if strcmpi(optionstring,'hutter'),
-			hutterflag=BuildFlag(md,optionvalue);
-		elseif strcmpi(optionstring,'macayeal'),
-			macayealflag=BuildFlag(md,optionvalue);
-		elseif strcmpi(optionstring,'pattyn'),
-			pattynflag=BuildFlag(md,optionvalue);
-		elseif strcmpi(optionstring,'stokes'),
-			stokesflag=BuildFlag(md,optionvalue);
-		elseif strcmpi(optionstring,'fill'),
-			filltype=optionvalue;
-		else
-			error('elementstype_options error message: bad elementstype options');
-		end
-	end
 end %end function
 
