Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 21860)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 21861)
@@ -1544,148 +1544,4 @@
 }
 /*}}}*/
-void FemModel::ReMesh(void){/*{{{*/
-
-	/*Intermediaries*/
-	IssmDouble *newx			= NULL;
-	IssmDouble *newy			= NULL;
-	IssmDouble *newz			= NULL;
-	int *newelementslist		= NULL;
-	int newnumberofvertices	= -1;
-	int newnumberofelements = -1;
-	bool* my_elements			= NULL; 
-	int* my_vertices			= NULL;
-	int elementswidth       = this->GetElementsWidth();//just tria elements in this version
-	int amrtype;
-
-	/*Branch to specific amr depending on requested method*/	
-	parameters->FindParam(&amrtype,AmrTypeEnum);
-	switch(amrtype){
-		#if defined(_HAVE_NEOPZ_) && !defined(_HAVE_ADOLC_)
-		case AmrNeopzEnum: this->ReMeshNeopz(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
-		#endif
-
-		#if defined(_HAVE_BAMG_) && !defined(_HAVE_ADOLC_)
-		case AmrBamgEnum: this->ReMeshBamg(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
-		#endif
-
-		default: _error_("not implemented yet");
-	}
-
-	/*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/
-	this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
-
-	if(this->loads->Size()!=0) _error_("not supported yet");
-
-	/*Create vertices*/
-	Vertices* new_vertices=new Vertices();
-	this->CreateVertices(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,my_vertices,newx,newy,newz,new_vertices);
-
-	/*Creating elements*/
-	/*Just Tria in this version*/
-	Elements* new_elements=new Elements();
-	this->CreateElements(newnumberofelements,elementswidth,newelementslist,my_elements,new_elements);
-
-	/*Creating materials*/
-	Materials* new_materials=new Materials();
-	this->CreateMaterials(newnumberofelements,my_elements,new_materials);
-
-	/*Creating nodes and constraints*/
-	/*Just SSA (2D) and P1 in this version*/
-	Nodes* new_nodes=new Nodes();
-	Constraints* new_constraints=new Constraints();
-
-	int nodecounter=0;
-	int constraintcounter=0;
-	for(int i=0;i<this->nummodels;i++){//create nodes for each analysis in analysis_type_list
-
-		int analysis_enum = this->analysis_type_list[i];
-
-		/*As the domain is 2D, it is not necessary to create nodes for this analysis*/
-		/*itapopo must verify if domain is not 3D. Only 2D in this version!*/
-		if(analysis_enum==StressbalanceVerticalAnalysisEnum) continue;	    
-
-		this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes);
-		if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints);
-		this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
-
-		if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
-		constraintcounter = new_constraints->NumberOfConstraints();
-		/*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
-		_assert_(nodecounter>=0);
-	}
-
-	new_elements->Presort();
-	new_nodes->Presort();
-	new_vertices->Presort();
-	this->loads->Presort();
-	new_materials->Presort();
-	new_constraints->Presort();
-
-	/*reset hooks for elements, loads and nodes: */
-	new_elements->ResetHooks();
-	this->loads->ResetHooks();
-	new_materials->ResetHooks();
-
-	/*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
-	int analysis_type;
-	for(int i=0;i<this->nummodels;i++){
-		analysis_type=this->analysis_type_list[i];
-		//SetCurrentConfiguration(analysis_type);
-
-		this->analysis_counter=i;	
-		/*Now, plug analysis_counter and analysis_type inside the parameters: */
-		this->parameters->SetParam(this->analysis_counter,AnalysisCounterEnum);
-		this->parameters->SetParam(analysis_type,AnalysisTypeEnum);
-		this->parameters->SetParam(analysis_type,ConfigurationTypeEnum);
-
-		/*configure elements, loads and nodes, for this new analysis: */
-		new_elements->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
-		this->loads->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
-
-		/*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
-		if(this->parameters->Exist(ToolkitsOptionsStringsEnum)){
-			ToolkitsOptionsFromAnalysis(this->parameters,analysis_type);
-			if(VerboseSolver()) _printf0_("      toolkits Options set for analysis type: " << EnumToStringx(analysis_type) << "\n");
-		}
-
-		ConfigureObjectsx(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
-		if(i==0){ 
-			VerticesDofx(new_vertices,this->parameters); //only call once, we only have one set of vertices
-		}
-		SpcNodesx(new_nodes,new_constraints,this->parameters,analysis_type);
-		NodesDofx(new_nodes,this->parameters,analysis_type);
-	}
-
-	/*Finally: interpolate all inputs and insert them into the new elements.*/
-	this->InterpolateInputs(new_vertices,new_elements);
-
-	/*Delete old structure and set new pointers*/
-	delete this->vertices;		this->vertices		= new_vertices;
-	delete this->elements;		this->elements		= new_elements;
-	delete this->nodes;			this->nodes			= new_nodes;
-	delete this->constraints;	this->constraints	= new_constraints;
-	delete this->materials;		this->materials	= new_materials;
-
-	GetMaskOfIceVerticesLSMx(this);
-
-	/*Insert MISMIP+ bed topography*/
-	if(false) this->BedrockFromMismipPlus();
-
-	/*Adjust base, thickness and mask grounded ice leve set*/
-	if(true) this->AdjustBaseThicknessAndMask();
-
-	/*Reset current configuration: */
-	analysis_type=this->analysis_type_list[this->analysis_counter];
-	SetCurrentConfiguration(analysis_type);
-
-	/*Cleanup*/
-	xDelete<IssmDouble>(newx);
-	xDelete<IssmDouble>(newy);
-	xDelete<IssmDouble>(newz);
-	xDelete<int>(newelementslist);
-	xDelete<int>(my_vertices);
-	xDelete<bool>(my_elements);
-}
-/*}}}*/
 void FemModel::RequestedDependentsx(void){/*{{{*/
 
@@ -2429,4 +2285,148 @@
 /*AMR*/
 #if !defined(_HAVE_ADOLC_)
+void FemModel::ReMesh(void){/*{{{*/
+
+	/*Intermediaries*/
+	IssmDouble *newx			= NULL;
+	IssmDouble *newy			= NULL;
+	IssmDouble *newz			= NULL;
+	int *newelementslist		= NULL;
+	int newnumberofvertices	= -1;
+	int newnumberofelements = -1;
+	bool* my_elements			= NULL; 
+	int* my_vertices			= NULL;
+	int elementswidth       = this->GetElementsWidth();//just tria elements in this version
+	int amrtype;
+
+	/*Branch to specific amr depending on requested method*/	
+	parameters->FindParam(&amrtype,AmrTypeEnum);
+	switch(amrtype){
+		#if defined(_HAVE_NEOPZ_) && !defined(_HAVE_ADOLC_)
+		case AmrNeopzEnum: this->ReMeshNeopz(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
+								 #endif
+
+								 #if defined(_HAVE_BAMG_) && !defined(_HAVE_ADOLC_)
+		case AmrBamgEnum: this->ReMeshBamg(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist); break;
+								#endif
+
+		default: _error_("not implemented yet");
+	}
+
+	/*Partitioning the new mesh. Maybe ElementsAndVerticesPartitioning.cpp could be modified to set this without iomodel.*/
+	this->ElementsAndVerticesPartitioning(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,&my_elements,&my_vertices);
+
+	if(this->loads->Size()!=0) _error_("not supported yet");
+
+	/*Create vertices*/
+	Vertices* new_vertices=new Vertices();
+	this->CreateVertices(newnumberofvertices,newnumberofelements,elementswidth,newelementslist,my_vertices,newx,newy,newz,new_vertices);
+
+	/*Creating elements*/
+	/*Just Tria in this version*/
+	Elements* new_elements=new Elements();
+	this->CreateElements(newnumberofelements,elementswidth,newelementslist,my_elements,new_elements);
+
+	/*Creating materials*/
+	Materials* new_materials=new Materials();
+	this->CreateMaterials(newnumberofelements,my_elements,new_materials);
+
+	/*Creating nodes and constraints*/
+	/*Just SSA (2D) and P1 in this version*/
+	Nodes* new_nodes=new Nodes();
+	Constraints* new_constraints=new Constraints();
+
+	int nodecounter=0;
+	int constraintcounter=0;
+	for(int i=0;i<this->nummodels;i++){//create nodes for each analysis in analysis_type_list
+
+		int analysis_enum = this->analysis_type_list[i];
+
+		/*As the domain is 2D, it is not necessary to create nodes for this analysis*/
+		/*itapopo must verify if domain is not 3D. Only 2D in this version!*/
+		if(analysis_enum==StressbalanceVerticalAnalysisEnum) continue;	    
+
+		this->CreateNodes(newnumberofvertices,my_vertices,nodecounter,analysis_enum,new_nodes);
+		if(analysis_enum==StressbalanceAnalysisEnum) this->CreateConstraints(newnumberofvertices,newnumberofelements,nodecounter,constraintcounter,newx,newy,my_vertices,new_constraints);
+		this->UpdateElements(newnumberofelements,newelementslist,my_elements,nodecounter,i,new_elements);
+
+		if(new_nodes->Size()) nodecounter=new_nodes->MaximumId();
+		constraintcounter = new_constraints->NumberOfConstraints();
+		/*Make sure nodecounter is at least 0 (if no node exists, maxid will be -1*/
+		_assert_(nodecounter>=0);
+	}
+
+	new_elements->Presort();
+	new_nodes->Presort();
+	new_vertices->Presort();
+	this->loads->Presort();
+	new_materials->Presort();
+	new_constraints->Presort();
+
+	/*reset hooks for elements, loads and nodes: */
+	new_elements->ResetHooks();
+	this->loads->ResetHooks();
+	new_materials->ResetHooks();
+
+	/*do the post-processing of the datasets to get an FemModel that can actually run analyses: */
+	int analysis_type;
+	for(int i=0;i<this->nummodels;i++){
+		analysis_type=this->analysis_type_list[i];
+		//SetCurrentConfiguration(analysis_type);
+
+		this->analysis_counter=i;	
+		/*Now, plug analysis_counter and analysis_type inside the parameters: */
+		this->parameters->SetParam(this->analysis_counter,AnalysisCounterEnum);
+		this->parameters->SetParam(analysis_type,AnalysisTypeEnum);
+		this->parameters->SetParam(analysis_type,ConfigurationTypeEnum);
+
+		/*configure elements, loads and nodes, for this new analysis: */
+		new_elements->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
+		this->loads->SetCurrentConfiguration(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
+
+		/*take care of toolkits options, that depend on this analysis type (present only after model processor)*/
+		if(this->parameters->Exist(ToolkitsOptionsStringsEnum)){
+			ToolkitsOptionsFromAnalysis(this->parameters,analysis_type);
+			if(VerboseSolver()) _printf0_("      toolkits Options set for analysis type: " << EnumToStringx(analysis_type) << "\n");
+		}
+
+		ConfigureObjectsx(new_elements,this->loads,new_nodes,new_vertices,new_materials,this->parameters);
+		if(i==0){ 
+			VerticesDofx(new_vertices,this->parameters); //only call once, we only have one set of vertices
+		}
+		SpcNodesx(new_nodes,new_constraints,this->parameters,analysis_type);
+		NodesDofx(new_nodes,this->parameters,analysis_type);
+	}
+
+	/*Finally: interpolate all inputs and insert them into the new elements.*/
+	this->InterpolateInputs(new_vertices,new_elements);
+
+	/*Delete old structure and set new pointers*/
+	delete this->vertices;		this->vertices		= new_vertices;
+	delete this->elements;		this->elements		= new_elements;
+	delete this->nodes;			this->nodes			= new_nodes;
+	delete this->constraints;	this->constraints	= new_constraints;
+	delete this->materials;		this->materials	= new_materials;
+
+	GetMaskOfIceVerticesLSMx(this);
+
+	/*Insert MISMIP+ bed topography*/
+	if(false) this->BedrockFromMismipPlus();
+
+	/*Adjust base, thickness and mask grounded ice leve set*/
+	if(true) this->AdjustBaseThicknessAndMask();
+
+	/*Reset current configuration: */
+	analysis_type=this->analysis_type_list[this->analysis_counter];
+	SetCurrentConfiguration(analysis_type);
+
+	/*Cleanup*/
+	xDelete<IssmDouble>(newx);
+	xDelete<IssmDouble>(newy);
+	xDelete<IssmDouble>(newz);
+	xDelete<int>(newelementslist);
+	xDelete<int>(my_vertices);
+	xDelete<bool>(my_elements);
+}
+/*}}}*/
 void FemModel::BedrockFromMismipPlus(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/FemModel.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.h	(revision 21860)
+++ /issm/trunk-jpl/src/c/classes/FemModel.h	(revision 21861)
@@ -73,5 +73,4 @@
 		void InitFromFids(char* rootpath, FILE* IOMODEL, FILE* toolkitsoptionsfid, int in_solution_type, bool trace, IssmPDouble* X=NULL);
 		void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
-		void ReMesh(void);
 		void Restart(void);
 		void SetCurrentConfiguration(int configuration_type);
@@ -158,4 +157,5 @@
 		/*AMR*/
 		#if !defined(_HAVE_ADOLC_)
+		void ReMesh(void);
 		void BedrockFromMismipPlus(void);
 		void AdjustBaseThicknessAndMask(void);
