Salome HOME
Fix regressions
[modules/smesh.git] / src / StdMeshers / StdMeshers_ProjectionUtils.cxx
index 814c38dfdd9e50345fc94c0619851df5f42de9bf..a0164ef01e073439895d4a43bc8d8c62b6ab092f 100644 (file)
 //
 #include "StdMeshers_ProjectionUtils.hxx"
 
-#include "StdMeshers_ProjectionSource1D.hxx"
-#include "StdMeshers_ProjectionSource2D.hxx"
-#include "StdMeshers_ProjectionSource3D.hxx"
-
 #include "SMDS_EdgePosition.hxx"
+#include "SMESHDS_Mesh.hxx"
 #include "SMESH_Algo.hxx"
 #include "SMESH_Block.hxx"
 #include "SMESH_Gen.hxx"
 #include "SMESH_HypoFilter.hxx"
 #include "SMESH_Hypothesis.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_MeshAlgos.hxx"
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 #include "SMESH_subMeshEventListener.hxx"
-#include "SMESH_MeshAlgos.hxx"
+#include "StdMeshers_ProjectionSource1D.hxx"
+#include "StdMeshers_ProjectionSource2D.hxx"
+#include "StdMeshers_ProjectionSource3D.hxx"
 
 #include "utilities.h"
 
@@ -124,6 +124,10 @@ namespace {
     const char* type[] ={"COMPOUND","COMPSOLID","SOLID","SHELL","FACE","WIRE","EDGE","VERTEX"};
     BRepTools::Write( shape, SMESH_Comment("/tmp/") << type[shape.ShapeType()] << "_"
                       << shape.TShape().operator->() << ".brep");
+    if ( !theMeshDS[0] ) {
+      show_shape( TopoDS_Shape(), "avoid warning: show_shape() defined but not used");
+      show_list( "avoid warning: show_list() defined but not used", list< TopoDS_Edge >() );
+    }
 #endif
     return false;
   }
@@ -410,9 +414,8 @@ namespace {
                      const gp_Pnt2d&    uv,
                      const double&      tol2d )
   {
-    TopoDS_Vertex VV[2];
-    TopExp::Vertices( edge, VV[0], VV[1], true);
-    gp_Pnt2d v1UV = BRep_Tool::Parameters( VV[vIndex], face);
+    TopoDS_Vertex V = SMESH_MesherHelper::IthVertex( vIndex, edge, /*CumOri=*/true );
+    gp_Pnt2d v1UV = BRep_Tool::Parameters( V, face);
     double dist2d = v1UV.Distance( uv );
     return dist2d < tol2d;
   }
@@ -739,8 +742,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
         int nbE = FindFaceAssociation( face1, VV1, face2, VV2, edges1, edges2, isVCloseness );
         if ( !nbE ) RETURN_BAD_RESULT("FindFaceAssociation() failed");
         InsertAssociation( face1, face2, theMap ); // assoc faces
-        MESSAGE("Assoc FACE " << theMesh1->GetMeshDS()->ShapeToIndex( face1 )<<
-                " to "        << theMesh2->GetMeshDS()->ShapeToIndex( face2 ));
+        // MESSAGE("Assoc FACE " << theMesh1->GetMeshDS()->ShapeToIndex( face1 )<<
+        //         " to "        << theMesh2->GetMeshDS()->ShapeToIndex( face2 ));
         if ( nbE == 2 && (edge1.IsSame( edges1.front())) != (edge2.IsSame( edges2.front())))
         {
           reverseEdges( edges2, nbE );
@@ -844,8 +847,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
       }
       // Associate shells
       //
-      int nbFaces1 = SMESH_MesherHelper:: Count( shell1, TopAbs_FACE, 0 );
-      int nbFaces2 = SMESH_MesherHelper:: Count( shell2, TopAbs_FACE, 0 );
+      int nbFaces1 = SMESH_MesherHelper::Count( shell1, TopAbs_FACE, 0 );
+      int nbFaces2 = SMESH_MesherHelper::Count( shell2, TopAbs_FACE, 0 );
       if ( nbFaces1 != nbFaces2 )
         RETURN_BAD_RESULT("Different nb of faces found for shells");
       if ( nbFaces1 > 0 ) {
@@ -951,14 +954,14 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
             v2e[0].UnBind( V[0] );
             v2e[1].UnBind( V[1] );
             InsertAssociation( e0, e1, theMap );
-            MESSAGE("Assoc edge " << theMesh1->GetMeshDS()->ShapeToIndex( e0 )<<
-                    " to "        << theMesh2->GetMeshDS()->ShapeToIndex( e1 ));
+            // MESSAGE("Assoc edge " << theMesh1->GetMeshDS()->ShapeToIndex( e0 )<<
+            //         " to "        << theMesh2->GetMeshDS()->ShapeToIndex( e1 ));
             V[0] = GetNextVertex( e0, V[0] );
             V[1] = GetNextVertex( e1, V[1] );
             if ( !V[0].IsNull() ) {
               InsertAssociation( V[0], V[1], theMap );
-              MESSAGE("Assoc vertex " << theMesh1->GetMeshDS()->ShapeToIndex( V[0] )<<
-                      " to "          << theMesh2->GetMeshDS()->ShapeToIndex( V[1] ));
+              // MESSAGE("Assoc vertex " << theMesh1->GetMeshDS()->ShapeToIndex( V[0] )<<
+              //         " to "          << theMesh2->GetMeshDS()->ShapeToIndex( V[1] ));
             }
           }
           else if ( nbE0 == 2 )
@@ -985,12 +988,12 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
             InsertAssociation( e0b, e1b, theMap );
             InsertAssociation( e0n, e1n, theMap );
             InsertAssociation( v0n, v1n, theMap );
-            MESSAGE("Assoc edge " << theMesh1->GetMeshDS()->ShapeToIndex( e0b )<<
-                    " to "        << theMesh2->GetMeshDS()->ShapeToIndex( e1b ));
-            MESSAGE("Assoc edge " << theMesh1->GetMeshDS()->ShapeToIndex( e0n )<<
-                    " to "        << theMesh2->GetMeshDS()->ShapeToIndex( e1n ));
-            MESSAGE("Assoc vertex " << theMesh1->GetMeshDS()->ShapeToIndex( v0n )<<
-                    " to "          << theMesh2->GetMeshDS()->ShapeToIndex( v1n ));
+            // MESSAGE("Assoc edge " << theMesh1->GetMeshDS()->ShapeToIndex( e0b )<<
+            //         " to "        << theMesh2->GetMeshDS()->ShapeToIndex( e1b ));
+            // MESSAGE("Assoc edge " << theMesh1->GetMeshDS()->ShapeToIndex( e0n )<<
+            //         " to "        << theMesh2->GetMeshDS()->ShapeToIndex( e1n ));
+            // MESSAGE("Assoc vertex " << theMesh1->GetMeshDS()->ShapeToIndex( v0n )<<
+            //         " to "          << theMesh2->GetMeshDS()->ShapeToIndex( v1n ));
             v2e[0].UnBind( V[0] );
             v2e[1].UnBind( V[1] );
             V[0] = v0n;
@@ -1107,8 +1110,8 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
         for ( ; eIt1 != edges1.end(); ++eIt1, ++eIt2 )
         {
           InsertAssociation( *eIt1, *eIt2, theMap );
-          VV1[0] = TopExp::FirstVertex( *eIt1, true );
-          VV2[0] = TopExp::FirstVertex( *eIt2, true );
+          VV1[0] = SMESH_MesherHelper::IthVertex( 0, *eIt1, true );
+          VV2[0] = SMESH_MesherHelper::IthVertex( 0, *eIt2, true );
           InsertAssociation( VV1[0], VV2[0], theMap );
         }
         InsertAssociation( theShape1, theShape2, theMap );
@@ -1339,10 +1342,10 @@ bool StdMeshers_ProjectionUtils::FindSubShapeAssociation(const TopoDS_Shape& the
 
   InsertAssociation( VV1[ 0 ], VV2[ 0 ], theMap );
   InsertAssociation( VV1[ 1 ], VV2[ 1 ], theMap );
-  MESSAGE("Initial assoc VERT " << theMesh1->GetMeshDS()->ShapeToIndex( VV1[ 0 ] )<<
-          " to "                << theMesh2->GetMeshDS()->ShapeToIndex( VV2[ 0 ] )<<
-          "\nand         VERT " << theMesh1->GetMeshDS()->ShapeToIndex( VV1[ 1 ] )<<
-          " to "                << theMesh2->GetMeshDS()->ShapeToIndex( VV2[ 1 ] ));
+  // MESSAGE("Initial assoc VERT " << theMesh1->GetMeshDS()->ShapeToIndex( VV1[ 0 ] )<<
+  //         " to "                << theMesh2->GetMeshDS()->ShapeToIndex( VV2[ 0 ] )<<
+  //         "\nand         VERT " << theMesh1->GetMeshDS()->ShapeToIndex( VV1[ 1 ] )<<
+  //         " to "                << theMesh2->GetMeshDS()->ShapeToIndex( VV2[ 1 ] ));
   if ( theShape1.ShapeType() == TopAbs_EDGE ) {
     InsertAssociation( theShape1, theShape2, theMap );
     return true;
@@ -1586,7 +1589,7 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
           std::advance( edge2End, *nbE2 );
           if ( *nbE1 == *nbE2 && iW2 >= iW1 )
           {
-            // rotate edge2 untill coincidence with edge1 in 2D
+            // rotate edge2 until coincides with edge1 in 2D
             int i = *nbE2;
             bool sameUV = false;
             while ( !( sameUV = sameVertexUV( *edge2Beg, face2, 0, v0f1UV, vTolUV )) && --i > 0 )
@@ -1635,7 +1638,7 @@ int StdMeshers_ProjectionUtils::FindFaceAssociation(const TopoDS_Face&    face1,
               break;
             }
           }
-          // prepare to the next wire loop
+          // prepare for the next wire loop
           edge2Beg = edge2End;
         }
         edge1Beg = edge1End;
@@ -2321,7 +2324,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
 
   string algoType = algo->GetName();
   if ( algoType.substr(0, 11) != "Projection_")
-    return gen->Compute( *mesh, shape, /*shapeOnly=*/true );
+    return gen->Compute( *mesh, shape, SMESH_Gen::SHAPE_ONLY );
 
   // try to compute source mesh
 
@@ -2362,7 +2365,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
     srcMesh = mesh;
 
   if ( MakeComputed( srcMesh->GetSubMesh( srcShape ), iterationNb + 1 ) &&
-       gen->Compute( *mesh, shape, /*shapeOnly=*/true ))
+       gen->Compute( *mesh, shape, SMESH_Gen::SHAPE_ONLY ))
     return sm->IsMeshComputed();
 
   return false;
@@ -2384,7 +2387,7 @@ std::string StdMeshers_ProjectionUtils::SourceNotComputedError( SMESH_subMesh *
   if ( !sm || sm->GetAlgoState() != SMESH_subMesh::NO_ALGO )
     return usualMessage; // algo is OK, anything else is KO.
 
-  // Try to find a type of all-dimentional algorithm that would compute the
+  // Try to find a type of all-dimensional algorithm that would compute the
   // given sub-mesh if it could be launched before projection
   const TopoDS_Shape shape = sm->GetSubShape();
   const int       shapeDim = SMESH_Gen::GetShapeDim( shape );
@@ -2565,7 +2568,7 @@ namespace StdMeshers_ProjectionUtils
 
   //================================================================================
   /*!
-   * \brief Computes transformation beween two sets of 2D points using
+   * \brief Computes transformation between two sets of 2D points using
    *        a least square approximation
    *
    * See "Surface Mesh Projection For Hexahedral Mesh Generation By Sweeping"
@@ -2648,7 +2651,7 @@ namespace StdMeshers_ProjectionUtils
 
   //================================================================================
   /*!
-   * \brief Computes transformation beween two sets of 3D points using
+   * \brief Computes transformation between two sets of 3D points using
    *        a least square approximation
    *
    * See "Surface Mesh Projection For Hexahedral Mesh Generation By Sweeping"