Index: /issm/trunk/src/c/DataSet/DataSet.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 4003)
+++ /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 4004)
@@ -550,5 +550,5 @@
 /*Objects methods*/
 /*FUNCTION DataSet::Configure{{{1*/
-void DataSet::Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters){
+void DataSet::Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,analysis_counter,analysis_type){
 
 	vector<Object*>::iterator object;
@@ -769,5 +769,5 @@
 /*}}}*/
 /*FUNCTION DataSet::FlagNodeSets{{{1*/
-void DataSet::FlagNodeSets(Vec pv_g, Vec pv_m, Vec pv_n, Vec pv_f, Vec pv_s){
+void DataSet::FlagNodeSets(Vec pv_g, Vec pv_m, Vec pv_n, Vec pv_f, Vec pv_s,int analysis_type){
 
 	vector<Object*>::iterator object;
@@ -781,6 +781,10 @@
 			node=(Node*)(*object);
 
-			/*Plug set values intp our 4 set vectors: */
-			node->CreateVecSets(pv_g,pv_m,pv_n,pv_f,pv_s);
+			if (node->InAnalysis(analysis_type)){
+
+				/*Plug set values intp our 4 set vectors: */
+				node->CreateVecSets(pv_g,pv_m,pv_n,pv_f,pv_s);
+
+			}
 
 		}
Index: /issm/trunk/src/c/DataSet/DataSet.h
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.h	(revision 4003)
+++ /issm/trunk/src/c/DataSet/DataSet.h	(revision 4004)
@@ -61,7 +61,7 @@
 		void  SetupSpcs(DataSet* nodes,Vec yg,int analysis_type);
 		void  SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type);
-		void  FlagNodeSets(Vec pv_g, Vec pv_m, Vec pv_n, Vec pv_f, Vec pv_s);
+		void  FlagNodeSets(Vec pv_g, Vec pv_m, Vec pv_n, Vec pv_f, Vec pv_s,int analysis_type);
 		void  clear();
-		void Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters);
+		void Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_counter,int analysis_type);
 		Object* GetObjectByOffset(int offset);
 		Object* GetObjectById(int* poffset,int eid);
Index: /issm/trunk/src/c/modules/BuildNodeSetsx/BuildNodeSetsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/BuildNodeSetsx/BuildNodeSetsx.cpp	(revision 4003)
+++ /issm/trunk/src/c/modules/BuildNodeSetsx/BuildNodeSetsx.cpp	(revision 4004)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-int BuildNodeSetsx( NodeSets** pnodesets, DataSet* nodes){
+int BuildNodeSetsx( NodeSets** pnodesets, DataSet* nodes,int analysis_type){
 
 	int noerr=1;
@@ -35,5 +35,5 @@
 
 	/*Get gsize; */
-	gsize=nodes->NumberOfDofs();
+	gsize=nodes->NumberOfDofs(analysis_type);
 
 	if(gsize){
@@ -49,5 +49,4 @@
 		 * pv_m, pv_n, pv_f and pv_s, their own set flags, for each dof: */
 		nodes->FlagNodeSets(flag_pv_g,flag_pv_m,flag_pv_n,flag_pv_f,flag_pv_s);
-
 
 		/*Now, every cpu has 4 flag vectors, of size gsize. Create partition vectors (like a pos=find(flag_pv_g) in matlab*/
Index: /issm/trunk/src/c/modules/BuildNodeSetsx/BuildNodeSetsx.h
===================================================================
--- /issm/trunk/src/c/modules/BuildNodeSetsx/BuildNodeSetsx.h	(revision 4003)
+++ /issm/trunk/src/c/modules/BuildNodeSetsx/BuildNodeSetsx.h	(revision 4004)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-int		BuildNodeSetsx( NodeSets** pnodesets,DataSet* nodes);
+int		BuildNodeSetsx( NodeSets** pnodesets,DataSet* nodes,int analysis_type);
 void PartitionSets(Vec* ppvb, Vec* ppvc,Vec flag_pva, Vec flag_pv_b, Vec flag_pv_c,int gsize);
 
Index: /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp	(revision 4003)
+++ /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp	(revision 4004)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-int	ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters){
+int	ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_type){
 
 	/*Intermediary*/
@@ -22,19 +22,20 @@
 	for (i=0;i<elements->Size();i++){
 		element=(Element*)elements->GetObjectByOffset(i);
-		element->Configure(elements,loads,nodes,materials,parameters);
+		element->Configure(elements,loads,nodes,materials,parameters,analysis_counter);
 	}
 	//_printf_("      Configuring loads...\n");
 	for (i=0;i<loads->Size();i++){
 		load=(Load*)loads->GetObjectByOffset(i);
-		load->Configure(elements,loads,nodes,vertices,materials,parameters);
+		if (load->InAnalysis(analysis_type)){
+			load->Configure(elements,loads,nodes,vertices,materials,parameters);
+		}
 	}
 	//_printf_("      Configuring nodes...\n");
 	for (i=0;i<nodes->Size();i++){
 		node=(Node*)nodes->GetObjectByOffset(i);
-		node->Configure(nodes,vertices);
+		if(node->InAnalysis(analysis_type)){
+				node->Configure(nodes,vertices);
+		}
 	}
-	//_printf_("      Configuring parameters...\n");
-	/*parameters ARE NOT configured!*/
-	parameters->Configure(elements,loads,nodes,vertices,materials,parameters);
 
 	return noerr;
Index: /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h
===================================================================
--- /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h	(revision 4003)
+++ /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h	(revision 4004)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-int		ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters);
+int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters,int analysis_type);
 
 #endif  /* _CONFIGUREOBJECTSX_H */
Index: /issm/trunk/src/c/objects/Elements/Beam.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 4003)
+++ /issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 4004)
@@ -164,5 +164,5 @@
 /*Object management*/
 /*FUNCTION Beam::Configure{{{1*/
-void  Beam::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
+void  Beam::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){
 
 	int i;
Index: /issm/trunk/src/c/objects/Elements/Beam.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Beam.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Elements/Beam.h	(revision 4004)
@@ -50,5 +50,5 @@
 		bool  IsInput(int name);
 		int   MyRank();
-		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters);
+		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
 		Object* copy();
 		void  SetClone(int* minranks);
Index: /issm/trunk/src/c/objects/Elements/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Element.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Elements/Element.h	(revision 4004)
@@ -24,5 +24,5 @@
 		
 		virtual        ~Element(){};
-		virtual void   Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters)=0;
+		virtual void   Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter)=0;
 		
 		virtual void   CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type)=0;
Index: /issm/trunk/src/c/objects/Elements/Sing.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 4003)
+++ /issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 4004)
@@ -105,5 +105,5 @@
 /*Object management*/
 /*FUNCTION Sing::Configure {{{1*/
-void  Sing::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
+void  Sing::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){
 
 	int i;
Index: /issm/trunk/src/c/objects/Elements/Sing.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Sing.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Elements/Sing.h	(revision 4004)
@@ -41,5 +41,5 @@
 		/*}}}*/
 		/*object management: {{{1*/
-		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters);
+		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
 		Object* copy();
 		void  DeepEcho();
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 4004)
@@ -41,5 +41,5 @@
 		/*}}}*/
 		/*FUNCTION object management {{{1*/
-		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters);
+		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
 		void  Update(IoModel* iomodel,int analysis_counter,int analysis_type);
 		Object* copy();
Index: /issm/trunk/src/c/objects/FemModel.cpp
===================================================================
--- /issm/trunk/src/c/objects/FemModel.cpp	(revision 4003)
+++ /issm/trunk/src/c/objects/FemModel.cpp	(revision 4004)
@@ -21,31 +21,65 @@
 /*Object constructors and destructor*/
 /*FUNCTION FemModel::constructor {{{1*/
-FemModel::FemModel(int in_nummodels){
+FemModel::FemModel(ConstDataHandle IOMODEL,int* analyses, int nummodels){
 
 	/*intermediary*/
 	int i;
+	IoModel* iomodel=NULL;
+	int analysis_type;
 
-	nummodels=in_nummodels;
-	analysis_counter=-1;
+	this->nummodels=nummodels;
+	analysis_counter=nummodels-1; //point to last analysis_type carried out.
 	
 	/*Dynamically allocate whatever is a list of length nummodels: */
 	analysis_type_list=(int*)xmalloc(nummodels*sizeof(int));
-	for(i=0;i<nummodels;i++)analysis_type_list[i]=NoneAnalysisEnum;
+	Rmg=(Mat*)xmalloc(nummodels*sizeof(Mat));
+	Gmn=(Mat*)xmalloc(nummodels*sizeof(Mat));
+	nodesets=(NodeSets**)xmalloc(nummodels*sizeof(NodeSet*));
+	yg=(Vec*)xmalloc(nummodels*sizeof(Vec));
+	ys=(Vec*)xmalloc(nummodels*sizeof(Vec));
 
-	Rmg=(Mat*)xmalloc(nummodels*sizeof(Mat));
+	/*Initialize: */
+	for(i=0;i<nummodels;i++)analysis_type_list[i]=analyses[i];
 	for(i=0;i<nummodels;i++)Rmg[i]=NULL;
-
-	Gmn=(Mat*)xmalloc(nummodels*sizeof(Mat));
 	for(i=0;i<nummodels;i++)Gmn[i]=NULL;
-
-	nodesets=(NodeSets**)xmalloc(nummodels*sizeof(NodeSet*));
 	for(i=0;i<nummodels;i++)nodesets[i]=NULL;
-
-	yg=(Vec*)xmalloc(nummodels*sizeof(Vec));
 	for(i=0;i<nummodels;i++)yg[i]=NULL;
-
-	ys=(Vec*)xmalloc(nummodels*sizeof(Vec));
 	for(i=0;i<nummodels;i++)ys[i]=NULL;
 
+	_printf_("   fill model with matlab workspace data\n");
+	iomodel = new IoModel(IOMODEL);
+
+	for(i=0;i<nummodels;i++){
+
+		analysis_type=analysis_type_list[i];
+	
+		_printf_("   create datasets:\n");
+		CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,IOMODEL,analysis_type,nummodels,i);
+
+		_printf_("   create degrees of freedom: \n");
+		VerticesDofx( &partition,&tpartition,vertices,parameters);
+		NodesDofx( nodes,parameters);
+
+		_printf_("   create single point constraints: \n");
+		SpcNodesx( &yg[i], nodes,constraints,analysis_type); 
+
+		_printf_("   create rigid body constraints:\n");
+		MpcNodesx( &Rmg[i], nodes,constraints,analysis_type); 
+
+		_printf_("   create node sets:\n");
+		BuildNodeSetsx(&nodesets[i], nodes,analysis_type);
+
+		_printf_("   reducing single point constraints vector:\n");
+		Reducevectorgtosx(&ys[i], yg[i],nodesets[i]);
+
+		_printf_("   normalizing rigid body constraints matrix:\n");
+		NormalizeConstraintsx(&Gmn[i], Rmg[i],nodesets[i]);
+
+		_printf_("   configuring element and loads:\n");
+		ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters,i,analysis_type);
+	}
+
+	_printf_("   free ressources:\n");
+	delete iomodel;
 }
 /*}}}1*/
@@ -107,49 +141,4 @@
 
 /*Numerics: */
-/*FUNCTION FemModel::AddAnalysis(ConstDataHandle FEMMODEL, int analysis_type) {{{1*/
-void  FemModel::AddAnalysis(ConstDataHandle IOMODEL, int analysis_type){
-
-	/*Set counter: */
-	if (analysis_counter==-1)analysis_counter=0;
-	else analysis_counter++;
-
-	/*intermediary: */
-	IoModel* iomodel=NULL;
-	
-	_printf_("   fill model with matlab workspace data\n");
-	iomodel = new IoModel(IOMODEL);
-
-	_printf_("   create datasets:\n");
-	CreateDataSets(&elements,&nodes,&vertices,&materials,&constraints,&loads,&parameters,iomodel,IOMODEL,analysis_type,nummodels,analysis_counter);
-
-	_printf_("   create degrees of freedom: \n");
-	VerticesDofx( &partition,&tpartition,vertices,parameters);
-	NodesDofx( nodes,parameters);
-	
-	_printf_("   create single point constraints: \n");
-	SpcNodesx( &yg[analysis_counter], nodes,constraints,analysis_type); 
-	
-	_printf_("   create rigid body constraints:\n");
-	MpcNodesx( &Rmg[analysis_counter], nodes,constraints,analysis_counter); 
-	
-	_printf_("   create node sets:\n");
-	BuildNodeSetsx(&nodesets[analysis_counter], nodes);
-
-	_printf_("   reducing single point constraints vector:\n");
-	Reducevectorgtosx(&ys[analysis_counter], yg[analysis_counter],nodesets[analysis_counter]);
-	
-	_printf_("   normalizing rigid body constraints matrix:\n");
-	NormalizeConstraintsx(&Gmn[analysis_counter], Rmg[analysis_counter],nodesets[analysis_counter]);
-
-	_printf_("   configuring element and loads:\n");
-	ConfigureObjectsx(elements, loads, nodes, vertices, materials,parameters);
-
-	_printf_("   process parameters:\n");
-	ProcessParamsx( parameters, partition->vector);
-
-	_printf_("   free ressources:\n");
-	delete iomodel;
-}
-/*}}}1*/
 /*FUNCTION FemModel::GetCurrentAnalysis {{{1*/
 int FemModel::GetCurrentAnalysis(){
Index: /issm/trunk/src/c/objects/FemModel.h
===================================================================
--- /issm/trunk/src/c/objects/FemModel.h	(revision 4003)
+++ /issm/trunk/src/c/objects/FemModel.h	(revision 4004)
@@ -46,5 +46,5 @@
 
 		/*constructors, destructors: */
-		FemModel(int nummodels);
+		FemModel(ConstDataHandle IOMODEL,int* analyses, int nummodels);
 		~FemModel();
 
@@ -53,5 +53,4 @@
 
 		/*Fem: */
-		void  AddAnalysis(ConstDataHandle IOMODEL, int analysis_type);
 		void  SetCurrentAnalysis(int analysis_type);
 		int   GetCurrentAnalysis(void);
Index: /issm/trunk/src/c/objects/Loads/Load.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Load.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Load.h	(revision 4004)
@@ -34,4 +34,5 @@
 		virtual void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type)=0;
 		virtual void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type)=0;
+		virtual bool  InAnalysis(int analysis_type);
 };
 #endif
Index: /issm/trunk/src/c/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 4004)
@@ -842,2 +842,8 @@
 }
 /*}}}*/
+/*FUNCTION Numericalflux::InAnalysis(int analysis_type){{{1*/
+bool Numericalflux::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Numericalflux.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Numericalflux.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Numericalflux.h	(revision 4004)
@@ -51,6 +51,6 @@
 		void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
 		void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
-
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
+		bool    InAnalysis(int analysis_type);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 4004)
@@ -776,2 +776,8 @@
 }
 /*}}}*/
+/*FUNCTION Pengrid::InAnalysis(int analysis_type){{{1*/
+bool Pengrid::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Pengrid.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Pengrid.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Pengrid.h	(revision 4004)
@@ -57,6 +57,6 @@
 		void  UpdateInputsFromConstant(int constant, int name);
 		void  UpdateInputsFromConstant(bool constant, int name);
-
 		void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type);
+		bool  InAnalysis(int analysis_type);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Penpair.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 4004)
@@ -191,2 +191,8 @@
 }
 /*}}}1*/
+/*FUNCTION Penpair::InAnalysis(int analysis_type){{{1*/
+bool Penpair::InAnalysis(int in_analysis_type){
+	if (in_analysis_type=this->analysis_type)return true;
+	else return false;
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Penpair.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Penpair.h	(revision 4003)
+++ /issm/trunk/src/c/objects/Loads/Penpair.h	(revision 4004)
@@ -49,6 +49,6 @@
 		void    UpdateInputsFromConstant(int constant, int name){ISSMERROR("Not implemented yet!");}
 		void    UpdateInputsFromConstant(bool constant, int name){ISSMERROR("Not implemented yet!");}
-
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
+		bool    InAnalysis(int analysis_type);
 
 
Index: /issm/trunk/src/c/solutions/diagnostic.cpp
===================================================================
--- /issm/trunk/src/c/solutions/diagnostic.cpp	(revision 4003)
+++ /issm/trunk/src/c/solutions/diagnostic.cpp	(revision 4004)
@@ -40,4 +40,6 @@
 	double   start_init, finish_init;
 
+	int analyses[5]={DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,SlopecomputeAnalysisEnum};
+
 	MODULEBOOT();
 
@@ -61,25 +63,11 @@
 	/*Initialize femmodel structure: */
 	MPI_Barrier(MPI_COMM_WORLD); start_init=MPI_Wtime();
-	femmodel=new FemModel(5);
 
 	/*Open handle to data on disk: */
 	fid=pfopen(inputfilename,"rb");
 
-	_printf_("read and create finite element femmodel:\n");
-	_printf_("\n   reading diagnostic horiz femmodel data:\n");
-	femmodel->AddAnalysis(fid,DiagnosticHorizAnalysisEnum);
-
-	_printf_("\n   reading diagnostic vert femmodel data:\n");
-	femmodel->AddAnalysis(fid,DiagnosticVertAnalysisEnum);
+	_printf_("create finite element model, using analyses types statically defined above:\n");
+	femmodel=new FemModel(iomodel,analyses,5);
 	
-	_printf_("\n   reading diagnostic stokes femmodel data:\n");
-	femmodel->AddAnalysis(fid,DiagnosticStokesAnalysisEnum);
-	
-	_printf_("\n   reading diagnostic hutter femmodel data:\n");
-	femmodel->AddAnalysis(fid,DiagnosticHutterAnalysisEnum);
-	
-	_printf_("\n   reading surface and bed slope computation femmodel data:\n");
-	femmodel->AddAnalysis(fid,SlopecomputeAnalysisEnum);
-
 	/*get parameters: */
 	femmodel->parameters->FindParam(&qmu_analysis,QmuAnalysisEnum);
Index: /issm/trunk/src/c/solutions/diagnostic_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/diagnostic_core.cpp	(revision 4003)
+++ /issm/trunk/src/c/solutions/diagnostic_core.cpp	(revision 4004)
@@ -79,9 +79,9 @@
 	femmodel->parameters->FindParam(&numberofdofspernode_ds,NumberOfDofsPerNodeEnum);
 
-	//for qmu analysis, be sure the velocity input we are starting from  is the one in the parameters: */
+	/*for qmu analysis, reinitialize velocity so that fake sensitivities do not show up as a result of a different restart of the convergence at each trial.*/
 	if(qmu_analysis){
-		femmodel->parameters->FindParam(&vx,&dummy,VxEnum); femmodel->UpdateInputsFromVector(vx,VxEnum,VertexEnum);
-		femmodel->parameters->FindParam(&vy,&dummy,VyEnum); femmodel->UpdateInputsFromVector(vy,VyEnum,VertexEnum);
-		femmodel->parameters->FindParam(&vz,&dummy,VzEnum); femmodel->UpdateInputsFromVector(vz,VzEnum,VertexEnum);
+		ReinitializeInputx(femmodel,VxEnum,QmuVxEnum);
+		ReinitializeInputx(femmodel,VyEnum,QmuVyEnum);
+		ReinitializeInputx(femmodel,VzEnum,QmuVzEnum);
 	}
 
Index: /issm/trunk/src/m/solutions/jpl/CreateFemModel.m
===================================================================
--- /issm/trunk/src/m/solutions/jpl/CreateFemModel.m	(revision 4003)
+++ /issm/trunk/src/m/solutions/jpl/CreateFemModel.m	(revision 4004)
@@ -18,23 +18,20 @@
 
 		displaystring(md.verbose,'%s','   generating single point constraints...');
-		[m.nodes,m.yg]=SpcNodes(m.nodes,m.constraints);
+		[m.nodes,m.yg(i)]=SpcNodes(m.nodes,m.constraints,analyses[i]);
 
 		displaystring(md.verbose,'%s','   generating rigid body constraints...');
-		[m.Rmg,m.nodes]=MpcNodes(m.nodes,m.constraints);
+		[m.Rmg(i),m.nodes]=MpcNodes(m.nodes,m.constraints,analyses[i]);
 
 		displaystring(md.verbose,'%s','   generating node sets...');
-		m.nodesets=BuildNodeSets(m.nodes);
+		m.nodesets(i)=BuildNodeSets(m.nodes,analyses[i]);
 
 		displaystring(md.verbose,'%s','   reducing single point constraints vector...');
-		m.ys=Reducevectorgtos(m.yg.vector,m.nodesets);
+		m.ys(i)=Reducevectorgtos(m.yg(i).vector,m.nodesets(i));
 		
 		displaystring(md.verbose,'%s','   normalizing rigid body constraints matrix...');
-		m.Gmn = NormalizeConstraints(m.Rmg,m.nodesets);
+		m.Gmn(i)= NormalizeConstraints(m.Rmg(i),m.nodesets(i));
 
 		displaystring(md.verbose,'%s','   configuring element and loads...');
 		[m.elements,m.loads,m.nodes,m.parameters] = ConfigureObjects( m.elements, m.loads, m.nodes, m.vertices,m.materials,m.parameters);
-
-		displaystring(md.verbose,'%s','   processing parameters...');
-		m.parameters= ProcessParams(m.parameters,m.part.vector);
 	end
 
Index: /issm/trunk/src/mex/BuildNodeSets/BuildNodeSets.cpp
===================================================================
--- /issm/trunk/src/mex/BuildNodeSets/BuildNodeSets.cpp	(revision 4003)
+++ /issm/trunk/src/mex/BuildNodeSets/BuildNodeSets.cpp	(revision 4004)
@@ -13,4 +13,5 @@
 	/*input datasets: */
 	DataSet*     nodes=NULL;
+	int analysis_type;
 
 	/* output datasets: */
@@ -25,7 +26,8 @@
 	/*Input datasets: */
 	FetchData(&nodes,NODES);
+	FetchData(&analysis_type,ANALYSISTYPE);
 	
 	/*!Generate internal degree of freedom numbers: */
-	BuildNodeSetsx(&nodesets, nodes);
+	BuildNodeSetsx(&nodesets, nodes,analysis_type);
 
 	/*write output datasets: */
Index: /issm/trunk/src/mex/BuildNodeSets/BuildNodeSets.h
===================================================================
--- /issm/trunk/src/mex/BuildNodeSets/BuildNodeSets.h	(revision 4003)
+++ /issm/trunk/src/mex/BuildNodeSets/BuildNodeSets.h	(revision 4004)
@@ -21,4 +21,5 @@
 /* serial input macros: */
 #define NODES (mxArray*)prhs[0]
+#define ANALYSISTYPE (mxArray*)prhs[1]
 
 /* serial output macros: */
@@ -29,5 +30,5 @@
 #define NLHS  1
 #undef NRHS
-#define NRHS  1
+#define NRHS  2
 
 
