X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FStdMeshers%2FStdMeshers_Projection_2D.cxx;h=ad6f45e572bdb05ebb40db1b893de3c05d572e1b;hb=d36721295492f8f08e3722573091f34e4dc86e78;hp=17bde5c85eed37d1f8bf7dcaf86882284d1b9b64;hpb=d4a710ce52f6e76786a7b3845e2f7975dc9a00b1;p=modules%2Fsmesh.git diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 17bde5c85..ad6f45e57 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -72,8 +72,6 @@ StdMeshers_Projection_2D::StdMeshers_Projection_2D(int hypId, int studyId, SMESH :SMESH_2D_Algo(hypId, studyId, gen) { _name = "Projection_2D"; - _shapeType = (1 << TopAbs_FACE); // 1 bit per shape type - _compatibleHypothesis.push_back("ProjectionSource2D"); _sourceHypo = 0; } @@ -796,8 +794,18 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& if ( !TAssocTool::FindSubShapeAssociation( tgtFace, tgtMesh, srcShape, srcMesh, shape2ShapeMap) || !shape2ShapeMap.IsBound( tgtFace )) + { + if ( srcShape.ShapeType() == TopAbs_FACE ) + { + int nbE1 = TAssocTool::Count( tgtFace, TopAbs_EDGE, /*ignoreSame=*/true ); + int nbE2 = TAssocTool::Count( srcShape, TopAbs_EDGE, /*ignoreSame=*/true ); + if ( nbE1 != nbE2 ) + return error(COMPERR_BAD_SHAPE, + SMESH_Comment("Different number of edges in source and target faces: ") + << nbE2 << " and " << nbE1 ); + } return error(COMPERR_BAD_SHAPE,"Topology of source and target faces seems different" ); - + } TopoDS_Face srcFace = TopoDS::Face( shape2ShapeMap( tgtFace ).Oriented(TopAbs_FORWARD)); // ---------------------------------------------- @@ -808,7 +816,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& SMESH_subMesh* tgtSubMesh = tgtMesh->GetSubMesh( tgtFace ); if ( tgtMesh == srcMesh ) { - if ( !TAssocTool::MakeComputed( srcSubMesh )) + if ( !TAssocTool::MakeComputed( srcSubMesh ) || !srcSubMesh->IsMeshComputed() ) return error(COMPERR_BAD_INPUT_MESH,"Source mesh not computed"); } else { @@ -1007,24 +1015,18 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& ( u2nodesMaps[ NEW_NODES ].size() == u2nodesOnSeam.size() ); if ( !mergeNewToOld ) - { - // if ( u2nodesMaps[ NEW_NODES ].size() == 0 && - // sm->GetSubShape().ShapeType() == TopAbs_EDGE && - // helper.IsDegenShape( sm->GetId() ) ) - // // NPAL15894 (tt88bis.py) - project mesh built by NETGEN_1d_2D that - // // does not make segments/nodes on degenerated edges - // continue; - - // if ( u2nodesMaps[ OLD_NODES ].size() == 0 && - // sm->GetSubShape().ShapeType() == TopAbs_VERTEX ) - // // old nodes are optional on vertices in the case of 1D-2D projection - // continue; - - //RETURN_BAD_RESULT - MESSAGE("Different nb of old and new nodes on shape #"<< sm->GetId() <<" "<< - u2nodesMaps[ OLD_NODES ].size() << " != " << - u2nodesMaps[ NEW_NODES ].size()); - } + if ( u2nodesMaps[ NEW_NODES ].size() > 0 && + u2nodesMaps[ OLD_NODES ].size() > 0 ) + { + u_oldNode = u2nodesMaps[ OLD_NODES ].begin(); + newEnd = u2nodesMaps[ OLD_NODES ].end(); + for ( ; u_oldNode != newEnd; ++u_oldNode ) + _badInputElements.push_back( u_oldNode->second ); + return error( COMPERR_BAD_INPUT_MESH, + SMESH_Comment( "Existing mesh mismatches the projected 2D mesh on " ) + << ( sm->GetSubShape().ShapeType() == TopAbs_EDGE ? "edge" : "vertex" ) + << " #" << sm->GetId() ); + } if ( isSeam && !mergeSeamToNew ) { //RETURN_BAD_RESULT MESSAGE("Different nb of old and seam nodes " <<