Salome HOME
Merge branch 'OCCT780'
[modules/smesh.git] / src / StdMeshers / StdMeshers_QuadFromMedialAxis_1D2D.cxx
index c531c5aaee5881e63bee3c138e68e0b251501c73..88f79d159bac305c7872ba678f7b5f6a4d3e547c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -30,6 +30,7 @@
 #include "SMESH_Gen.hxx"
 #include "SMESH_MAT2d.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_SequentialMesh.hxx"
 #include "SMESH_MeshEditor.hxx"
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_ProxyMesh.hxx"
@@ -144,7 +145,7 @@ public:
     return true;
   }
 };
+
 //================================================================================
 /*!
  * \brief Constructor sets algo features
@@ -203,7 +204,7 @@ bool StdMeshers_QuadFromMedialAxis_1D2D::CheckHypothesis(SMESH_Mesh&         aMe
 namespace
 {
   typedef map< const SMDS_MeshNode*, list< const SMDS_MeshNode* > > TMergeMap;
-  
+
   //================================================================================
   /*!
    * \brief Sinuous face
@@ -236,11 +237,11 @@ namespace
   /*!
    * \brief Temporary mesh
    */
-  struct TmpMesh : public SMESH_Mesh
+  struct TmpMesh : public SMESH_SequentialMesh
   {
     TmpMesh()
     {
-      _myMeshDS = new SMESHDS_Mesh(/*id=*/0, /*isEmbeddedMode=*/true);
+      _meshDS = new SMESHDS_Mesh(/*id=*/0, /*isEmbeddedMode=*/true);
     }
   };
 
@@ -260,8 +261,8 @@ namespace
     virtual void ProcessEvent(const int                       event,
                               const int                       eventType,
                               SMESH_subMesh*                  faceSubMesh,
-                              SMESH_subMeshEventListenerData* data,
-                              const SMESH_Hypothesis*         hyp)
+                              SMESH_subMeshEventListenerData* /*data*/,
+                              const SMESH_Hypothesis*         /*hyp*/)
     {
       if ( eventType == SMESH_subMesh::ALGO_EVENT )
       {
@@ -506,7 +507,7 @@ namespace
     theSinuEdges[1].clear();
     theShortEdges[0].clear();
     theShortEdges[1].clear();
-   
+
     vector<TopoDS_Edge> & allEdges = theSinuFace._edges;
     const size_t nbEdges = allEdges.size();
     if ( nbEdges < 4 && theSinuFace._nbWires == 1 )
@@ -603,7 +604,7 @@ namespace
              theSinuEdges [0].size() > 0 && theSinuEdges [1].size() > 0 );
 
     // the sinuous EDGEs can be composite and C0 continuous,
-    // therefor we use a complex criterion to find TWO short non-sinuous EDGEs
+    // therefore we use a complex criterion to find TWO short non-sinuous EDGEs
     // and the rest EDGEs will be treated as sinuous.
     // A short edge should have the following features:
     // a) straight
@@ -841,7 +842,7 @@ namespace
 
 
     // Find 1D algo to mesh branchEdge
-  
+
     // look for a most local 1D hyp assigned to the FACE
     int mostSimpleShape = -1, maxShape = TopAbs_EDGE;
     TopoDS_Edge edge;
@@ -1018,7 +1019,7 @@ namespace
    *  \param [in] theDivPoints - projections of VERTEXes to MA
    *  \param [in] theSinuEdges - the sinuous EDGEs
    *  \param [in] theSideEdgeIDs - indices of sinuous EDGEs per side
-   *  \param [in] theIsEdgeComputed - is sinuous EGDE is meshed
+   *  \param [in] theIsEdgeComputed - is sinuous EDGE is meshed
    *  \param [in,out] thePointsOnE - the map to fill
    *  \param [out] theNodes2Merge - the map of nodes to merge
    */
@@ -1154,6 +1155,8 @@ namespace
       bool isShortPrev[2], isShortNext[2], isPrevCloser[2];
       TMAPar2NPoints::iterator u2NPPrev = u2NP, u2NPNext = u2NP;
       --u2NPPrev; ++u2NPNext;
+      if ( u2NPNext == thePointsOnE.end() )
+        u2NPNext = thePointsOnE.begin(); // hope theSinuFace.IsRing()
       for ( int iS = 0; iS < 2; ++iS ) // side with Vertex and side with Nodes
       {
         NodePoint np     = get( u2NP->second,     iS );
@@ -1183,6 +1186,8 @@ namespace
         if ( !npCloseV._node || npCloseV._node == npVert._node )
         {
           npProj = npCloseN;
+          if ( i+1 < projToMerge.size() && u2NPClose == projToMerge[ i+1 ])
+            ++i;
           thePointsOnE.erase( u2NPClose );
           continue;
         }
@@ -1246,7 +1251,7 @@ namespace
   //================================================================================
 
   void separateNodes( SMESH_MesherHelper&            theHelper,
-                      const SMESH_MAT2d::MedialAxis& theMA,
+                      const SMESH_MAT2d::MedialAxis& /*theMA*/,
                       TMAPar2NPoints &               thePointsOnE,
                       SinuousFace&                   theSinuFace,
                       const vector< bool >&          theIsComputedEdge)
@@ -1446,7 +1451,7 @@ namespace
       nIn = nodeParams.rbegin()->second;
     else
       nIn = u2n->second;
-    
+
     // find position of distant nodes in uvsOut and uvsIn
     size_t iDistOut, iDistIn;
     for ( iDistOut = 0; iDistOut < uvsOut.size(); ++iDistOut )
@@ -1641,7 +1646,7 @@ namespace
   //================================================================================
   /*!
    * \brief Divide the sinuous EDGEs by projecting the division point of Medial
-   *        Axis to the EGDEs
+   *        Axis to the EDGEs
    *  \param [in] theHelper - the helper
    *  \param [in] theMinSegLen - minimal segment length
    *  \param [in] theMA - the Medial Axis
@@ -1718,8 +1723,8 @@ namespace
         if ( isComputed[ edgeIDs1[i]] &&
              isComputed[ edgeIDs2[i]] )
         {
-          int nbNodes1 = meshDS->MeshElements(edgeIDs[ edgeIDs1[i]] )->NbNodes();
-          int nbNodes2 = meshDS->MeshElements(edgeIDs[ edgeIDs2[i]] )->NbNodes();
+          smIdType nbNodes1 = meshDS->MeshElements(edgeIDs[ edgeIDs1[i]] )->NbNodes();
+          smIdType nbNodes2 = meshDS->MeshElements(edgeIDs[ edgeIDs2[i]] )->NbNodes();
           if ( nbNodes1 != nbNodes2 )
             return false;
           if (( int(i)-1 >= 0 ) &&
@@ -1930,7 +1935,7 @@ namespace
                           const vector<TopoDS_Edge>& theShortEdges,
                           SMESH_Algo*                the1dAlgo,
                           const bool                 theHasRadialHyp,
-                          const bool                 theIs2nd)
+                          const bool                 /*theIs2nd*/)
   {
     SMESH_Hypothesis::Hypothesis_Status aStatus;
     for ( size_t i = 0; i < theShortEdges.size(); ++i )
@@ -2147,6 +2152,7 @@ bool StdMeshers_QuadFromMedialAxis_1D2D::computeQuads( SMESH_MesherHelper& theHe
 bool StdMeshers_QuadFromMedialAxis_1D2D::Compute(SMESH_Mesh&         theMesh,
                                                  const TopoDS_Shape& theShape)
 {
+  std::cout << "helper_quad " << theMesh.IsParallel() << std::endl;
   SMESH_MesherHelper helper( theMesh );
   helper.SetSubShape( theShape );