Salome HOME
PR: synchro V7_main tag mergefrom_V6_main_28Feb13
[modules/smesh.git] / src / StdMeshers / StdMeshers_Projection_1D2D.cxx
index ac46c0380ca885ef302f51b4c4c7baf5736f2ef1..73feed3cc3d910346b2908a9d52b91dce50c5b61 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -27,6 +27,7 @@
 
 #include "SMESH_Gen.hxx"
 #include "SMESH_MesherHelper.hxx"
+#include "SMESH_subMesh.hxx"
 #include "SMESH_subMeshEventListener.hxx"
 #include "StdMeshers_FaceSide.hxx"
 #include "StdMeshers_ProjectionSource2D.hxx"
@@ -69,7 +70,7 @@ namespace
    * \brief Structure used to temporary remove EventProparatorToEdges from faceSubMesh
    *  in order to prevent propagation of CLEAN event from FACE to EDGEs during 
    *  StdMeshers_Projection_1D2D::Compute(). The CLEAN event is emmited by Pattern mapper
-   * and causes removal of faces generated on adjacent FACEs.
+   *  and causes removal of faces generated on adjacent FACEs.
    */
   struct UnsetterOfEventProparatorToEdges
   {
@@ -94,7 +95,7 @@ StdMeshers_Projection_1D2D::StdMeshers_Projection_1D2D(int hypId, int studyId, S
   :StdMeshers_Projection_2D(hypId, studyId, gen)
 {
   _name = "Projection_1D2D";
-  _requireDescretBoundary = false;
+  _requireDiscreteBoundary = false;
   _supportSubmeshes = true;
 }
 
@@ -107,9 +108,13 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape
 {
   UnsetterOfEventProparatorToEdges eventBarrier( theMesh.GetSubMesh( theShape ));
 
+  // 1) Project faces
+
   if ( !StdMeshers_Projection_2D::Compute(theMesh, theShape))
     return false;
 
+  // 2) Create segments
+
   SMESHDS_Mesh * meshDS = theMesh.GetMeshDS();
 
   SMESHDS_SubMesh * faceSubMesh = meshDS->MeshElements( theShape );
@@ -143,7 +148,7 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape
         return error("The existing 1D mesh mismatches the generated 2D mesh");
     }
 
-    const bool checkExisting = wires[ iWire ]->NbSegments();
+    const bool checkExisting = ( wires[ iWire ]->NbSegments() || helper.HasSeam() );
 
     if ( _quadraticMesh )
     {
@@ -172,7 +177,7 @@ bool StdMeshers_Projection_1D2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape
         meshDS->SetMeshElementOnShape( e, edgeID );
       }
     }
-  }   
+  }
 
   return true;
 }
@@ -194,9 +199,9 @@ bool StdMeshers_Projection_1D2D::Evaluate(SMESH_Mesh&         theMesh,
   if ( !srcMesh ) srcMesh = & theMesh;
   SMESH_subMesh* srcFaceSM = srcMesh->GetSubMesh( srcFace );
 
-  typedef StdMeshers_ProjectionUtils SPU;
+  namespace SPU = StdMeshers_ProjectionUtils;
   SPU::TShapeShapeMap shape2ShapeMap;
-  SPU::InitVertexAssociation( _sourceHypo, shape2ShapeMap, theShape );
+  SPU::InitVertexAssociation( _sourceHypo, shape2ShapeMap );
   if ( !SPU::FindSubShapeAssociation( theShape, &theMesh, srcFace, srcMesh, shape2ShapeMap))
     return error(COMPERR_BAD_SHAPE,"Topology of source and target faces seems different" );
 
@@ -232,7 +237,7 @@ bool StdMeshers_Projection_1D2D::Evaluate(SMESH_Mesh&         theMesh,
         if ( aVec.empty() )
           return error(COMPERR_BAD_INPUT_MESH,"Source mesh is wrongly evaluated");
       }
-      TopoDS_Shape tgtEdge = shape2ShapeMap( srcSM->GetSubShape() );
+      TopoDS_Shape tgtEdge = shape2ShapeMap( srcSM->GetSubShape(), /*isSrc=*/true  );
       SMESH_subMesh* tgtSM = theMesh.GetSubMesh( tgtEdge );
       aResMap.insert(std::make_pair(tgtSM,aVec));
     }