mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 01:30:34 +05:00
0019296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh
* Evaluate(): ** do not read from out of vector range ** report error if algo->Evaluate() returns negative number
This commit is contained in:
parent
8d99b0dffe
commit
0cadad987c
@ -1686,8 +1686,20 @@ SMESH::long_array* SMESH_Gen_i::Evaluate(SMESH::SMESH_Mesh_ptr theMesh,
|
||||
MapShapeNbElemsItr anIt = aResMap.begin();
|
||||
for(; anIt!=aResMap.end(); anIt++) {
|
||||
const vector<int>& aVec = (*anIt).second;
|
||||
for(i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++) {
|
||||
nbels[i] += aVec[i];
|
||||
for(i = SMESH::Entity_Node; i < aVec.size(); i++) {
|
||||
int nbElem = aVec[i];
|
||||
if ( nbElem < 0 ) // algo failed, check that it has reported a message
|
||||
{
|
||||
SMESH_subMesh* sm = anIt->first;
|
||||
SMESH_ComputeErrorPtr& error = sm->GetComputeError();
|
||||
const SMESH_Algo* algo = myGen.GetAlgo( myLocMesh, sm->GetSubShape());
|
||||
if ( algo && !error.get() || error->IsOK() )
|
||||
error.reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED,"Failed to evaluate",algo));
|
||||
}
|
||||
else
|
||||
{
|
||||
nbels[i] += aVec[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return nbels._retn();
|
||||
|
Loading…
Reference in New Issue
Block a user