Index: /issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.cpp	(revision 21561)
+++ /issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.cpp	(revision 21562)
@@ -13,34 +13,29 @@
 /*Constructor, copy, clean up and destructor*/
 AdaptiveMeshRefinement::AdaptiveMeshRefinement(){/*{{{*/
-
-    /*Set pointers to NULL*/
-    this->fathermesh    = NULL;
-    this->previousmesh  = NULL;
-    this->hmax          = -1;
-    this->elementswidth = -1;
-
+	this->Initialize();
 }
 /*}}}*/
 AdaptiveMeshRefinement::AdaptiveMeshRefinement(const AdaptiveMeshRefinement &cp){/*{{{*/
-    this->operator =(cp);
+   this->Initialize(); 
+	this->operator =(cp);
 }
 /*}}}*/
 AdaptiveMeshRefinement & AdaptiveMeshRefinement::operator =(const AdaptiveMeshRefinement &cp){/*{{{*/
 
-    /*Clean all attributes*/
-    this->CleanUp();
-
-    /*Copy all data*/
-    this->fathermesh    = cp.fathermesh;
-    this->previousmesh  = cp.previousmesh;
-    this->hmax          = cp.hmax;
-    this->elementswidth = cp.elementswidth;
-
-    return *this;
+	/*Clean all attributes*/
+	this->CleanUp();
+
+	/*Copy all data*/
+	this->fathermesh    = new TPZGeoMesh(*cp.fathermesh);
+	this->previousmesh  = new TPZGeoMesh(*cp.previousmesh); 
+	this->hmax          = cp.hmax;
+	this->elementswidth = cp.elementswidth;
+	return *this;
 
 }
 /*}}}*/
 AdaptiveMeshRefinement::~AdaptiveMeshRefinement(){/*{{{*/
-    this->CleanUp();
+	this->CleanUp();
+	gRefDBase.clear();
 }
 /*}}}*/
@@ -48,9 +43,17 @@
 
     /*Verify and delete all data*/
-    if(this->fathermesh)    delete this->fathermesh;
-    if(this->previousmesh)  delete this->previousmesh;
-	 this->hmax=-1;
-	 this->elementswidth=-1;
-	 gRefDBase.clear();
+	if(this->fathermesh)    delete this->fathermesh;
+   if(this->previousmesh)  delete this->previousmesh;
+	this->hmax=-1;
+	this->elementswidth=-1;
+}
+/*}}}*/
+void AdaptiveMeshRefinement::Initialize(){/*{{{*/
+
+	/*Set pointers to NULL*/
+	this->fathermesh    = NULL;
+	this->previousmesh  = NULL;
+	this->hmax          = -1;
+	this->elementswidth = -1;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.h	(revision 21561)
+++ /issm/trunk-jpl/src/c/classes/AdaptiveMeshRefinement.h	(revision 21562)
@@ -57,5 +57,6 @@
 	/*General methods*/
 	void CleanUp();																			// Clean all attributes
-   void SetHMax(int &h);                                                   // Define the max level of refinement
+	void Initialize();																		// Initialize the attributes with NULL and values out of usually range
+	void SetHMax(int &h);                                                   // Define the max level of refinement
    void SetElementWidth(int &width);                                       // Define elements width
 	void ExecuteRefinement(int &type_process,double *vx,double *vy,double *masklevelset,int &nvertices,int &nelements,int &nsegments,double** px,double** py,double** pz,int** pelements,int** psegments=NULL);					// A new mesh will be created and refined. This returns the new mesh
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 21561)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 21562)
@@ -1582,5 +1582,8 @@
 				name==FrictionQEnum ||
 				name==LoadingforceXEnum ||
-				name==LoadingforceYEnum
+				name==LoadingforceYEnum ||
+				name==VelEnum ||
+				name==VxPicardEnum ||
+				name==VyPicardEnum
 
 				) {
Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 21561)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 21562)
@@ -82,6 +82,4 @@
 	#ifdef _HAVE_NEOPZ_
 	this->InitializeAdaptiveRefinement();
-	FemModel *Test=this->ReMesh();//itapopo: just to test!;;
-	//if(IssmComm::GetRank()==0) Test->elements->DeepEcho();
 	#endif
 
@@ -2942,5 +2940,5 @@
    if(my_rank==0){ 
 		this->amr = new AdaptiveMeshRefinement();
-		int hmax	 = 3; //itapopo: it must be defined by interface. Using 2 just to test
+		int hmax	 = 0; //itapopo: it must be defined by interface. Using 2 just to test
 		this->amr->SetHMax(hmax); //Set max level of refinement
 		this->amr->CreateInitialMesh(numberofvertices,numberofelements,numberofsegments,elementswidth,x,y,z,elements,NULL);
@@ -2994,8 +2992,12 @@
 		output->loads=new Loads();
 	}
-	
-	//itapopo
-	// output->results=static_cast<Results*>(this->results->Copy());
-	
+	output->results=new Results();
+	output->amr = NULL;
+	if(IssmComm::GetRank()==0){
+		if(!this->amr) _error_("this->amr is NULL!");
+		output->amr = new AdaptiveMeshRefinement(*this->amr);
+		if(!output->amr) _error_("output->amr is NULL!");
+	}
+
 	/*Create vertices*/
 	output->vertices=new Vertices();
@@ -3016,5 +3018,4 @@
 	
 	int nodecounter=0;
-	
 	for(int i=0;i<output->nummodels;i++){//create nodes for each analysis in analysis_type_list
 	
Index: /issm/trunk-jpl/src/c/cores/transient_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/transient_core.cpp	(revision 21561)
+++ /issm/trunk-jpl/src/c/cores/transient_core.cpp	(revision 21562)
@@ -167,6 +167,17 @@
 			femmodel->CheckPoint();
 		}
+
+		/*Adaptive mesh refinement*/
+		#ifdef _HAVE_NEOPZ_
+		int isamr=true;
+		if(isamr){
+			FemModel* newfemmodel = femmodel->ReMesh();
+			delete femmodel;
+			femmodel = newfemmodel;
+		}
+		#endif
+	
 	}
-
+	
 	femmodel->RequestedDependentsx();
 
