From cde14742d0b171aba6aa33711a845a9db2e6980f Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 8 May 2007 10:33:01 +0000 Subject: [PATCH] NPAL15894 (Projection 2D doesn't work) fix case of a sphere --- src/StdMeshers/StdMeshers_Projection_2D.cxx | 29 ++++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/StdMeshers/StdMeshers_Projection_2D.cxx b/src/StdMeshers/StdMeshers_Projection_2D.cxx index 4aa83bdd0..c122ea631 100644 --- a/src/StdMeshers/StdMeshers_Projection_2D.cxx +++ b/src/StdMeshers/StdMeshers_Projection_2D.cxx @@ -439,11 +439,6 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& { TopoDS_Edge srcE1 = srcEdges.front(), tgtE1 = tgtEdges.front(); reverse = ( ! srcE1.IsSame( shape2ShapeMap( tgtE1 ))); - if ( BRep_Tool::IsClosed( tgtE1, tgtFace )) { - reverse = ( srcE1.Orientation() == tgtE1.Orientation() ); - if ( _sourceHypo->GetSourceFace().Orientation() != theShape.Orientation() ) - reverse = !reverse; - } } else if ( nbEdgesInWires.front() == 1 ) { @@ -474,7 +469,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& // it will remove mesh built by pattern mapper on edges and vertices // in failure case - MeshCleaner cleaner( tgtSubMesh ); + // MeshCleaner cleaner( tgtSubMesh ); // ------------------------------------------------------------------------- // mapper doesn't take care of nodes already existing on edges and vertices, @@ -497,7 +492,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& bool isSeam = helper.IsSeamShape( sm->GetId() ); - enum { NEW_NODES, OLD_NODES }; + enum { NEW_NODES = 0, OLD_NODES }; map< double, const SMDS_MeshNode* > u2nodesMaps[2], u2nodesOnSeam; map< double, const SMDS_MeshNode* >::iterator u_oldNode, u_newNode, u_newOnSeam, newEnd; set< const SMDS_MeshNode* > seamNodes; @@ -518,7 +513,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& } // sort nodes on edges by its position - map< double, const SMDS_MeshNode* > & pos2nodes = u2nodesMaps[ isOld ]; + map< double, const SMDS_MeshNode* > & pos2nodes = u2nodesMaps[isOld ? OLD_NODES : NEW_NODES]; switch ( node->GetPosition()->GetTypeOfPosition() ) { case SMDS_TOP_VERTEX: { @@ -536,14 +531,22 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& node->GetPosition()->GetTypeOfPosition()); } } - if ( u2nodesMaps[ OLD_NODES ].size() != u2nodesMaps[ NEW_NODES ].size() ) - RETURN_BAD_RESULT("Different nb of old and new nodes " << + if ( u2nodesMaps[ NEW_NODES ].size() != u2nodesMaps[ OLD_NODES ].size() ) + { + if ( u2nodesMaps[ NEW_NODES ].size() == 0 && + sm->GetSubShape().ShapeType() == TopAbs_EDGE && + BRep_Tool::Degenerated( TopoDS::Edge( sm->GetSubShape() ))) + // NPAL15894 (tt88bis.py) - project mesh built by NETGEN_1d_2D that + // does not make segments/nodes on degenerated edges + continue; + RETURN_BAD_RESULT("Different nb of old and new nodes on shape #"<< sm->GetId() <<" "<< u2nodesMaps[ OLD_NODES ].size() << " != " << u2nodesMaps[ NEW_NODES ].size()); - if ( isSeam && u2nodesMaps[ OLD_NODES ].size() != u2nodesOnSeam.size() ) + } + if ( isSeam && u2nodesMaps[ OLD_NODES ].size() != u2nodesOnSeam.size() ) { RETURN_BAD_RESULT("Different nb of old and seam nodes " << u2nodesMaps[ OLD_NODES ].size() << " != " << u2nodesOnSeam.size()); - + } // Make groups of nodes to merge u_oldNode = u2nodesMaps[ OLD_NODES ].begin(); u_newNode = u2nodesMaps[ NEW_NODES ].begin(); @@ -606,7 +609,7 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& } } - cleaner.Release(); // do not remove mesh + //cleaner.Release(); // do not remove mesh return true; } -- 2.39.2