Protection before invalid hypothesises for "Evaluate" operation.

This commit is contained in:
skl 2009-08-06 12:44:45 +00:00
parent f4ba12e460
commit 3611527175
2 changed files with 14 additions and 0 deletions

View File

@ -772,6 +772,15 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh,
//TopoDS_Shape aFace = meshFaces[i]->GetSubShape(); //TopoDS_Shape aFace = meshFaces[i]->GetSubShape();
TopoDS_Shape aFace = aFaces.Value(i+1); TopoDS_Shape aFace = aFaces.Value(i+1);
SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace); SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace);
if( !algo ) {
std::vector<int> aResVec(17);
for(int i=0; i<17; i++) aResVec[i] = 0;
SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
aResMap.insert(std::make_pair(sm,aResVec));
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
string algoName = algo->GetName(); string algoName = algo->GetName();
bool isAllQuad = false; bool isAllQuad = false;
if (algoName == "Quadrangle_2D") { if (algoName == "Quadrangle_2D") {

View File

@ -388,6 +388,11 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh,
SMESH_subMesh *aSubMesh = theMesh.GetSubMesh(exp.Current()); SMESH_subMesh *aSubMesh = theMesh.GetSubMesh(exp.Current());
meshFaces.push_back(aSubMesh); meshFaces.push_back(aSubMesh);
MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i-1]); MapShapeNbElemsItr anIt = aResMap.find(meshFaces[i-1]);
if( anIt==aResMap.end() ) {
SMESH_ComputeErrorPtr& smError = aSubMesh->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
std::vector<int> aVec = (*anIt).second; std::vector<int> aVec = (*anIt).second;
int nbtri = Max(aVec[3],aVec[4]); int nbtri = Max(aVec[3],aVec[4]);
int nbqua = Max(aVec[5],aVec[6]); int nbqua = Max(aVec[5],aVec[6]);