Salome HOME
Merge remote branch 'origin/V8_5_asterstudy'
[modules/smesh.git] / src / StdMeshers / StdMeshers_QuadFromMedialAxis_1D2D.cxx
index c7df8a3f7f74812aeaea025cc325bde3b3f200d3..0b9005bcaa07fadefbd9c679a0774c0900a7bf3c 100644 (file)
@@ -71,8 +71,8 @@ using namespace std;
 class StdMeshers_QuadFromMedialAxis_1D2D::Algo1D : public StdMeshers_Regular_1D
 {
 public:
-  Algo1D(int studyId, SMESH_Gen* gen):
-    StdMeshers_Regular_1D( gen->GetANewId(), studyId, gen )
+  Algo1D(SMESH_Gen* gen):
+    StdMeshers_Regular_1D( gen->GetANewId(), gen )
   {
   }
   void SetSegmentLength( double len )
@@ -152,9 +152,8 @@ public:
 //================================================================================
 
 StdMeshers_QuadFromMedialAxis_1D2D::StdMeshers_QuadFromMedialAxis_1D2D(int        hypId,
-                                                                       int        studyId,
                                                                        SMESH_Gen* gen)
-  : StdMeshers_Quadrangle_2D(hypId, studyId, gen),
+  : StdMeshers_Quadrangle_2D(hypId, gen),
     _regular1D( 0 )
 {
   _name = "QuadFromMedialAxis_1D2D";
@@ -604,7 +603,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
@@ -741,7 +740,7 @@ namespace
     }
 
     // cout << "from salome.geom import geomBuilder" << endl;
-    // cout << "geompy = geomBuilder.New(salome.myStudy)" << endl;
+    // cout << "geompy = geomBuilder.New()" << endl;
     Handle(TColgp_HArray1OfPnt) points = new TColgp_HArray1OfPnt(1, pnt.size());
     for ( size_t i = 0; i < pnt.size(); ++i )
     {
@@ -1019,7 +1018,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
    */
@@ -1155,6 +1154,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 );
@@ -1384,10 +1385,13 @@ namespace
                    const SMESH_MAT2d::MedialAxis& theMA,
                    TMAPar2NPoints &               thePointsOnE )
   {
+    SMESH_Mesh*     mesh = theHelper.GetMesh();
+    SMESHDS_Mesh* meshDS = theHelper.GetMeshDS();
+
     list< TopoDS_Edge > ee1( theSinuFace._sinuSide [0].begin(), theSinuFace._sinuSide [0].end() );
     list< TopoDS_Edge > ee2( theSinuFace._sinuSide [1].begin(), theSinuFace._sinuSide [1].end() );
-    StdMeshers_FaceSide sideOut( theSinuFace.Face(), ee1, theHelper.GetMesh(), true, true );
-    StdMeshers_FaceSide sideIn ( theSinuFace.Face(), ee2, theHelper.GetMesh(), true, true );
+    StdMeshers_FaceSide sideOut( theSinuFace.Face(), ee1, mesh, true, true, &theHelper );
+    StdMeshers_FaceSide sideIn ( theSinuFace.Face(), ee2, mesh, true, true, &theHelper );
     const UVPtStructVec& uvsOut = sideOut.GetUVPtStruct();
     const UVPtStructVec& uvsIn  = sideIn.GetUVPtStruct();
     // if ( uvs1.size() != uvs2.size() )
@@ -1396,7 +1400,6 @@ namespace
     const SMESH_MAT2d::Branch& branch = *theMA.getBranch(0);
     SMESH_MAT2d::BoundaryPoint bp[2];
     SMESH_MAT2d::BranchPoint   brp;
-    SMESHDS_Mesh*              meshDS = theHelper.GetMeshDS();
 
     map< double, const SMDS_MeshNode* > nodeParams; // params of existing nodes
     map< double, const SMDS_MeshNode* >::iterator u2n;
@@ -1510,7 +1513,8 @@ namespace
     for ( int i = 0; i < 4; ++i )
     {
       theFace._quad->side[i] = StdMeshers_FaceSide::New( face, side[i], mesh, i < QUAD_TOP_SIDE,
-                                                         /*skipMediumNodes=*/true, proxyMesh );
+                                                         /*skipMediumNodes=*/true,
+                                                         &theHelper, proxyMesh );
     }
 
     if ( theFace.IsRing() )
@@ -1639,7 +1643,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
@@ -1892,7 +1896,7 @@ namespace
           continue;
 
         StdMeshers_FaceSide side( face, theSinuEdges[i], mesh,
-                                  /*isFwd=*/true, /*skipMediumNodes=*/true );
+                                  /*isFwd=*/true, /*skipMediumNodes=*/true, &theHelper );
         vector<const SMDS_MeshNode*> nodes = side.GetOrderedNodes();
         for ( size_t in = 1; in < nodes.size(); ++in )
         {
@@ -2163,7 +2167,7 @@ bool StdMeshers_QuadFromMedialAxis_1D2D::Compute(SMESH_Mesh&         theMesh,
     SMESH_MAT2d::MedialAxis ma( F, sinuFace._sinuEdges, minSegLen, /*ignoreCorners=*/true );
 
     if ( !_regular1D )
-      _regular1D = new Algo1D( _studyId, _gen );
+      _regular1D = new Algo1D( _gen );
     _regular1D->SetSegmentLength( minSegLen );
 
     vector<double> maParams;