Index: /issm/trunk/src/c/Container/Parameters.cpp
===================================================================
--- /issm/trunk/src/c/Container/Parameters.cpp	(revision 8262)
+++ /issm/trunk/src/c/Container/Parameters.cpp	(revision 8263)
@@ -43,321 +43,226 @@
 
 /*Object management*/
+/*FUNCTION Parameters::Exist{{{1*/
+bool Parameters::Exist(int enum_type){
+
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type) return true;
+	}
+	return false;
+}
+/*}}}*/
 /*FUNCTION Parameters::FindParam(bool* pbool,int enum_type){{{1*/
-int   Parameters::FindParam(bool* pbool,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(bool* pbool,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pbool);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(int* pinteger,int enum_type){{{1*/
-int   Parameters::FindParam(int* pinteger,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(int* pinteger,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pinteger);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(double* pscalar, int enum_type){{{1*/
-int   Parameters::FindParam(double* pscalar, int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(double* pscalar, int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pscalar);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(char** pstring,int enum_type){{{1*/
-int   Parameters::FindParam(char** pstring,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(char** pstring,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pstring);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){{{1*/
-int   Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(char*** pstringarray,int* pM,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pstringarray,pM);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(int** pintarray,int* pM,int enum_type){{{1*/
-int   Parameters::FindParam(int** pintarray,int* pM, int enum_type){
-
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(int** pintarray,int* pM, int enum_type){
+
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pintarray,pM);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(double** pdoublearray,int* pM,int enum_type){{{1*/
-int   Parameters::FindParam(double** pdoublearray,int* pM, int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(double** pdoublearray,int* pM, int enum_type){
+
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pdoublearray,pM);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){{{1*/
-int   Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(double** pdoublearray,int* pM, int* pN,int enum_type){
+
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pdoublearray,pM,pN);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){{{1*/
-int   Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(double*** parray,int* pM,int** pmdims_array,int** pndims_array,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(parray,pM,pmdims_array,pndims_array);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(Vec* pvec,int enum_type){{{1*/
-int   Parameters::FindParam(Vec* pvec,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(Vec* pvec,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pvec);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(Mat* pmat,int enum_type){{{1*/
-int   Parameters::FindParam(Mat* pmat,int enum_type){
-	
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-	
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(Mat* pmat,int enum_type){
+	
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pmat);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 
 }
 /*}}}*/
 /*FUNCTION Parameters::FindParam(FILE** pfid,int enum_type){{{1*/
-int   Parameters::FindParam(FILE** pfid,int enum_type){
-
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	int found=0;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Recover the value of this parameter: */
+void Parameters::FindParam(FILE** pfid,int enum_type){
+
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			param->GetParameterValue(pfid);
-			found=1;
-			break;
-		}
-	}
-	return found;
+			return;
+		}
+	}
+	_error_("could not find parameter %s",EnumToStringx(enum_type));
 }
 /*}}}*/
@@ -487,17 +392,11 @@
 Object* Parameters::FindParamObject(int enum_type){
 
-	/*Go through a dataset, and find a Param* object 
-	 *which parameter name is "name" : */
-
-	vector<Object*>::iterator object;
-	Param* param=NULL;
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Ok, this object is a parameter, recover it and ask which name it has: */
-		param=(Param*)(*object);
-
-		if(param->EnumType()==enum_type){
-			/*Ok, this is the one! Return the object: */
+	vector<Object*>::iterator object;
+	Param* param=NULL;
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		param=(Param*)(*object);
+		if(param->EnumType()==enum_type){
 			return (*object);
 		}
Index: /issm/trunk/src/c/Container/Parameters.h
===================================================================
--- /issm/trunk/src/c/Container/Parameters.h	(revision 8262)
+++ /issm/trunk/src/c/Container/Parameters.h	(revision 8263)
@@ -26,16 +26,18 @@
 		/*}}}*/
 		/*numerics: {{{1*/
-		int   FindParam(bool* pinteger,int enum_type);
-		int   FindParam(int* pinteger,int enum_type);
-		int   FindParam(double* pscalar, int enum_type);
-		int   FindParam(char** pstring,int enum_type);
-		int   FindParam(char*** pstringarray,int* pM,int enum_type);
-		int   FindParam(int** pintarray,int* pM,int enum_type);
-		int   FindParam(double** pdoublearray,int* pM,int enum_type);
-		int   FindParam(double** pdoublearray,int* pM,int* pN,int enum_type);
-		int   FindParam(double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);
-		int   FindParam(Vec* pvec,int enum_type);
-		int   FindParam(Mat* pmat,int enum_type);
-		int   FindParam(FILE** pfid,int enum_type);
+		bool  Exist(int enum_type);
+
+		void  FindParam(bool* pinteger,int enum_type);
+		void  FindParam(int* pinteger,int enum_type);
+		void  FindParam(double* pscalar, int enum_type);
+		void  FindParam(char** pstring,int enum_type);
+		void  FindParam(char*** pstringarray,int* pM,int enum_type);
+		void  FindParam(int** pintarray,int* pM,int enum_type);
+		void  FindParam(double** pdoublearray,int* pM,int enum_type);
+		void  FindParam(double** pdoublearray,int* pM,int* pN,int enum_type);
+		void  FindParam(double*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);
+		void  FindParam(Vec* pvec,int enum_type);
+		void  FindParam(Mat* pmat,int enum_type);
+		void  FindParam(FILE** pfid,int enum_type);
 		
 		void  SetParam(bool boolean,int enum_type);
@@ -55,6 +57,3 @@
 };
 
-
-
 #endif //ifndef _PARAMETERS_H_
-
Index: /issm/trunk/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
===================================================================
--- /issm/trunk/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp	(revision 8262)
+++ /issm/trunk/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp	(revision 8263)
@@ -35,5 +35,5 @@
 
 	/*First, recover qmu partition of vertices: */
-	if(!parameters->FindParam(&qmu_part,&dummy,QmuPartEnum))_error_(" could not find qmu partition vector");
+	parameters->FindParam(&qmu_part,&dummy,QmuPartEnum);
 
 	/*Some parameters: */
Index: /issm/trunk/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp
===================================================================
--- /issm/trunk/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp	(revision 8262)
+++ /issm/trunk/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp	(revision 8263)
@@ -22,6 +22,5 @@
 
 	/*Recover numberofelements: */
-	found= parameters->FindParam(&numberofelements,NumberOfElementsEnum);
-	if (!found) _error_("numberofelements not provided in parameters");
+	parameters->FindParam(&numberofelements,NumberOfElementsEnum);
 
 	/*Allocate sigma on numberofelements: */
Index: /issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp
===================================================================
--- /issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp	(revision 8262)
+++ /issm/trunk/src/c/modules/InputUpdateFromDakotax/InputUpdateFromDakotax.cpp	(revision 8263)
@@ -50,7 +50,5 @@
 
 			/*Now, pick up the parameter corresponding to root: */
-			if(!parameters->FindParam(&parameter,NULL,StringToEnumx(root))){
-				_error_("%s%s"," could not find Qmu parameter: ",root);
-			}
+			parameters->FindParam(&parameter,NULL,StringToEnumx(root));
 
 			/*We've got the parameter, we need to update it using qmu_part (a partitioning vector), and the distributed_values: */
Index: /issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp
===================================================================
--- /issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp	(revision 8262)
+++ /issm/trunk/src/c/modules/MassFluxx/MassFluxx.cpp	(revision 8263)
@@ -36,8 +36,8 @@
 
 	/*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
-	if(!parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum))_error_(" could not find QmuMassFluxSegmentsEnum");
+	parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum);
 
 	/*Retrieve index of segments being used for MassFlux computation: */
-	if(!parameters->FindParam(&counter,IndexEnum))_error_(" could not find IndexEnum");
+	parameters->FindParam(&counter,IndexEnum);
 
 	/*retrieve segments from array: */
Index: /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 8262)
+++ /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 8263)
@@ -50,5 +50,5 @@
 
 	/*Now, open file for writing, if not already done: */
-	if(!parameters->FindParam(&fid,OutputFilePointerEnum)){
+	if(!parameters->Exist(OutputFilePointerEnum)){
 		
 		/*We don't have a file pointer. Retrieve the output file name and open it for writing:*/
@@ -64,4 +64,5 @@
 		else{
 			/*We are opening different  files for output on all cpus. Append the  rank to the filename, and open: */
+			parameters->FindParam(&fid,OutputFilePointerEnum);
 			sprintf(cpu_outputfilename,"%s.%i",outputfilename,my_rank);
 			fid=pfopen(cpu_outputfilename ,"wb");
@@ -72,5 +73,4 @@
 		parameters->SetParam(fid,OutputFilePointerEnum);
 	}
-
 	#endif
 
Index: /issm/trunk/src/c/objects/FemModel.cpp
===================================================================
--- /issm/trunk/src/c/objects/FemModel.cpp	(revision 8262)
+++ /issm/trunk/src/c/objects/FemModel.cpp	(revision 8263)
@@ -168,7 +168,9 @@
 	this->loads->SetCurrentConfiguration(elements, loads, nodes,vertices, materials,parameters);
 
-	/*take care of petsc options, that depend on this analysis type: */
-	PetscOptionsFromAnalysis(this->parameters,analysis_type);
-	_printf_(VerboseSolver(),"      petsc Options set for analysis type: %s\n",EnumToStringx(analysis_type));
+	/*take care of petsc options, that depend on this analysis type (present only after model processor)*/
+	if(this->parameters->Exist(PetscOptionsStringsEnum)){
+		PetscOptionsFromAnalysis(this->parameters,analysis_type);
+		_printf_(VerboseSolver(),"      petsc Options set for analysis type: %s\n",EnumToStringx(analysis_type));
+	}
 
 }
