Index: ../trunk-jpl/src/c/classes/FemModel.cpp =================================================================== --- ../trunk-jpl/src/c/classes/FemModel.cpp (revision 24483) +++ ../trunk-jpl/src/c/classes/FemModel.cpp (revision 24484) @@ -5338,10 +5338,10 @@ hmaxvertices_serial=xNew(numberofvertices); for(int i=0;iamrbamg->thicknesserror_threshold>0) this->GethmaxVerticesFromEstimators(hmaxvertices_serial,ThicknessErrorEstimatorEnum); + if(this->amrbamg->deviatoricerror_threshold>0) this->GethmaxVerticesFromEstimators(hmaxvertices_serial,DeviatoricStressErrorEstimatorEnum); if(this->amrbamg->groundingline_distance>0) this->GethmaxVerticesFromZeroLevelSetDistance(hmaxvertices_serial,MaskGroundediceLevelsetEnum); if(this->amrbamg->icefront_distance>0) this->GethmaxVerticesFromZeroLevelSetDistance(hmaxvertices_serial,MaskIceLevelsetEnum); - if(this->amrbamg->thicknesserror_threshold>0) this->GethmaxVerticesFromEstimators(hmaxvertices_serial,ThicknessErrorEstimatorEnum); - if(this->amrbamg->deviatoricerror_threshold>0) this->GethmaxVerticesFromEstimators(hmaxvertices_serial,DeviatoricStressErrorEstimatorEnum); } if(my_rank==0){ @@ -5521,6 +5521,7 @@ IssmDouble L1,L2,L3; int vid,v1,v2,v3; bool refine; + /*Fill variables*/ switch(errorestimator_type){ @@ -5542,6 +5543,13 @@ } if(!error_elements) _error_("error_elements is NULL!\n"); if(groupthresholdGetMesh(&index,&x,&y,&numberofvertices,&numberofelements); + if(numberofelements<0) _error_("number of elements is negative!\n"); + if(numberofvertices<0) _error_("number of vertices is negative!\n"); + maxlength = xNew(numberofelements); + error_vertices = xNewZeroInit(numberofvertices); /*Find the max of the estimators if it was not provided*/ if(maxerrorGetMesh(&index,&x,&y,&numberofvertices,&numberofelements); - maxlength = xNew(numberofelements); - error_vertices = xNewZeroInit(numberofvertices); - /*Fill error_vertices (this is the sum of all elements connected to the vertex)*/ for(int i=0;i