From: skl Date: Thu, 6 Aug 2009 12:44:45 +0000 (+0000) Subject: Protection before invalid hypothesises for "Evaluate" operation. X-Git-Tag: V5_1_3rc1~123 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=3611527175ebcbc2093a22dc8be29bd8ed866c8c;hp=f4ba12e4603932bf250717988519db4dedce4b28 Protection before invalid hypothesises for "Evaluate" operation. --- diff --git a/src/StdMeshers/StdMeshers_Hexa_3D.cxx b/src/StdMeshers/StdMeshers_Hexa_3D.cxx index f0738bb89..5afb4cc43 100644 --- a/src/StdMeshers/StdMeshers_Hexa_3D.cxx +++ b/src/StdMeshers/StdMeshers_Hexa_3D.cxx @@ -772,6 +772,15 @@ bool StdMeshers_Hexa_3D::Evaluate(SMESH_Mesh & aMesh, //TopoDS_Shape aFace = meshFaces[i]->GetSubShape(); TopoDS_Shape aFace = aFaces.Value(i+1); SMESH_Algo *algo = _gen->GetAlgo(aMesh, aFace); + if( !algo ) { + std::vector 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(); bool isAllQuad = false; if (algoName == "Quadrangle_2D") { diff --git a/src/StdMeshers/StdMeshers_Prism_3D.cxx b/src/StdMeshers/StdMeshers_Prism_3D.cxx index 41657596d..f53624f82 100644 --- a/src/StdMeshers/StdMeshers_Prism_3D.cxx +++ b/src/StdMeshers/StdMeshers_Prism_3D.cxx @@ -388,6 +388,11 @@ bool StdMeshers_Prism_3D::Evaluate(SMESH_Mesh& theMesh, SMESH_subMesh *aSubMesh = theMesh.GetSubMesh(exp.Current()); meshFaces.push_back(aSubMesh); 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 aVec = (*anIt).second; int nbtri = Max(aVec[3],aVec[4]); int nbqua = Max(aVec[5],aVec[6]);