X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Projection_3D.cxx;h=af93f888de2313eacc45570822effb1785534564;hb=42e8757bfcaefe3c43310a911ba62662265573db;hp=68eda5d6593ea297364697efd0f8b1d9b276a54b;hpb=358f8ddd54e7ed553eecc22ca665575e4019e3a0;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_Projection_3D.cxx b/src/StdMeshers/StdMeshers_Projection_3D.cxx index 68eda5d65..af93f888d 100644 --- a/src/StdMeshers/StdMeshers_Projection_3D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_3D.cxx @@ -48,7 +48,11 @@ #include "utilities.h" -#define RETURN_BAD_RESULT(msg) { MESSAGE(msg); return false; } +#include +#include +#include + +#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; } #define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z()) #define SHOWYXZ(msg, xyz) // {\ // gp_Pnt p (xyz); \ @@ -92,6 +96,7 @@ bool StdMeshers_Projection_3D::CheckHypothesis(SMESH_Mesh& SMESH_Hypothesis::Hypothesis_Status& aStatus) { // check aShape that must be a 6 faces block +/* PAL16229 if ( TAssocTool::Count( aShape, TopAbs_SHELL, 1 ) != 1 || TAssocTool::Count( aShape, TopAbs_FACE , 1 ) != 6 || TAssocTool::Count( aShape, TopAbs_EDGE , 1 ) != 12 || @@ -100,7 +105,7 @@ bool StdMeshers_Projection_3D::CheckHypothesis(SMESH_Mesh& aStatus = HYP_BAD_GEOMETRY; return false; } - +*/ list ::const_iterator itl; const list &hyps = GetUsedHypothesis(aMesh, aShape); @@ -206,14 +211,24 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS srcShell = TopoDS::Shell( exp.Current() ); if ( nbShell != 1 ) return error(COMPERR_BAD_SHAPE, - SMESH_Comment("Shape must have 1 shell but not") << nbShell); + SMESH_Comment("Source shape must have 1 shell but not ") << nbShell); exp.Init( aShape, TopAbs_SHELL ); for ( nbShell = 0; exp.More(); exp.Next(), ++nbShell ) tgtShell = TopoDS::Shell( exp.Current() ); if ( nbShell != 1 ) return error(COMPERR_BAD_SHAPE, - SMESH_Comment("Shape must have 1 shell but not") << nbShell); + SMESH_Comment("Target shape must have 1 shell but not ") << nbShell); + + // Check that shapes are blocks + if ( TAssocTool::Count( tgtShell, TopAbs_FACE , 1 ) != 6 || + TAssocTool::Count( tgtShell, TopAbs_EDGE , 1 ) != 12 || + TAssocTool::Count( tgtShell, TopAbs_WIRE , 1 ) != 6 ) + return error(COMPERR_BAD_SHAPE, "Target shape is not a block"); + if ( TAssocTool::Count( srcShell, TopAbs_FACE , 1 ) != 6 || + TAssocTool::Count( srcShell, TopAbs_EDGE , 1 ) != 12 || + TAssocTool::Count( srcShell, TopAbs_WIRE , 1 ) != 6 ) + return error(COMPERR_BAD_SHAPE, "Source shape is not a block"); // Assure that mesh on a source shape is computed @@ -251,12 +266,12 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS TopExp::Vertices( TopoDS::Edge( exp.Current() ), tgtV000, tgtV100 ); if ( !shape2ShapeMap.IsBound( tgtV000 ) || !shape2ShapeMap.IsBound( tgtV100 )) - return error(dfltErr(),"Association of subshapes failed" ); + return error("Association of subshapes failed" ); srcV000 = TopoDS::Vertex( shape2ShapeMap( tgtV000 )); srcV100 = TopoDS::Vertex( shape2ShapeMap( tgtV100 )); if ( !TAssocTool::IsSubShape( srcV000, srcShell ) || !TAssocTool::IsSubShape( srcV100, srcShell )) - return error(dfltErr(),"Incorrect association of subshapes" ); + return error("Incorrect association of subshapes" ); } // Load 2 SMESH_Block's with src and tgt shells @@ -342,12 +357,12 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS gp_Pnt srcCoord = gpXYZ( srcNode ); gp_XYZ srcParam; if ( !srcBlock.ComputeParameters( srcCoord, srcParam )) - return error(dfltErr(),SMESH_Comment("Can't compute normalized parameters ") + return error(SMESH_Comment("Can't compute normalized parameters ") << "for source node " << srcNode->GetID()); // compute coordinates of target node by srcParam gp_XYZ tgtXYZ; if ( !tgtBlock.ShellPoint( srcParam, tgtXYZ )) - return error(dfltErr(),"Can't compute coordinates by normalized parameters"); + return error("Can't compute coordinates by normalized parameters"); // add node SMDS_MeshNode* newNode = tgtMeshDS->AddNode( tgtXYZ.X(), tgtXYZ.Y(), tgtXYZ.Z() ); tgtMeshDS->SetNodeInVolume( newNode, helper.GetSubShapeID() );