From: eap Date: Mon, 1 Feb 2010 11:09:38 +0000 (+0000) Subject: 0019296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh X-Git-Tag: V5_1_4a1~118 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d99b0dffec7544761b5dd3e178aea0785ee71ed;p=modules%2Fsmesh.git 0019296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh * Evaluate(): do not call algo->Evaluate() if needed submeshes failed to evaluate --- diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 7a2c07db4..d93b598a5 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -54,6 +54,8 @@ #include #include +#include + using namespace std; //============================================================================= @@ -1609,17 +1611,32 @@ bool SMESH_subMesh::Evaluate(MapShapeNbElems& aResMap) SMESH_Hypothesis::Hypothesis_Status hyp_status; algo = gen->GetAlgo((*_father), _subShape); - if(algo) { + if(algo && !aResMap.count(this) ) + { ret = algo->CheckHypothesis((*_father), _subShape, hyp_status); if (!ret) return false; - if ( !aResMap.count(this) ) + if (_father->HasShapeToMesh() && algo->NeedDescretBoundary()) { - _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); - ret = algo->Evaluate((*_father), _subShape, aResMap); - - aResMap.insert( make_pair( this,vector(0))); + // check submeshes needed + bool subMeshEvaluated = true; + int dimToCheck = SMESH_Gen::GetShapeDim( _subShape ) - 1; + SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,/*complexShapeFirst=*/true); + while ( smIt->more() && subMeshEvaluated ) + { + SMESH_subMesh* sm = smIt->next(); + int dim = SMESH_Gen::GetShapeDim( sm->GetSubShape() ); + if (dim < dimToCheck) break; // the rest subMeshes are all of less dimension + const vector & nbs = aResMap[ sm ]; + subMeshEvaluated = (std::accumulate( nbs.begin(), nbs.end(), 0 ) > 0 ); + } + if ( !subMeshEvaluated ) + return false; } + _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo); + ret = algo->Evaluate((*_father), _subShape, aResMap); + + aResMap.insert( make_pair( this,vector(0))); } return ret;