Salome HOME
IPAL53702: Quadrangle mapping does not use some boundary nodes
[modules/smesh.git] / src / StdMeshers / StdMeshers_Quadrangle_2D.cxx
index 955fc11473dab13d350b0d50d1efa403ef267674..15a7595d52f81c4490d0cb3aeead52eed098ccb1 100644 (file)
@@ -30,6 +30,7 @@
 #include "SMDS_FacePosition.hxx"
 #include "SMDS_MeshElement.hxx"
 #include "SMDS_MeshNode.hxx"
+#include "SMESHDS_Mesh.hxx"
 #include "SMESH_Block.hxx"
 #include "SMESH_Comment.hxx"
 #include "SMESH_Gen.hxx"
@@ -93,7 +94,6 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
     myQuadType(QUAD_STANDARD),
     myHelper( NULL )
 {
-  MESSAGE("StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D");
   _name = "Quadrangle_2D";
   _shapeType = (1 << TopAbs_FACE);
   _compatibleHypothesis.push_back("QuadrangleParams");
@@ -110,7 +110,6 @@ StdMeshers_Quadrangle_2D::StdMeshers_Quadrangle_2D (int hypId, int studyId,
 
 StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D()
 {
-  MESSAGE("StdMeshers_Quadrangle_2D::~StdMeshers_Quadrangle_2D");
 }
 
 //=============================================================================
@@ -160,7 +159,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
     }
     else if (strcmp("TrianglePreference", aHyp->GetName()) == 0){
       isFirstParams = false;
-      myTrianglePreference = true; 
+      myTrianglePreference = true;
     }
     else {
       isFirstParams = false;
@@ -173,18 +172,18 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
     if (isFirstParams) {
       if (strcmp("QuadranglePreference", aHyp->GetName()) == 0) {
         myQuadranglePreference = true;
-        myTrianglePreference = false; 
+        myTrianglePreference = false;
         myQuadType = QUAD_STANDARD;
       }
       else if (strcmp("TrianglePreference", aHyp->GetName()) == 0){
         myQuadranglePreference = false;
-        myTrianglePreference = true; 
+        myTrianglePreference = true;
         myQuadType = QUAD_STANDARD;
       }
     }
-    else {
-      const StdMeshers_QuadrangleParams* aHyp2 = 
-        (const StdMeshers_QuadrangleParams*)aHyp;
+    else if (const StdMeshers_QuadrangleParams* aHyp2 =
+             dynamic_cast<const StdMeshers_QuadrangleParams*>( aHyp ))
+    {
       myTriaVertexID = aHyp2->GetTriaVertex();
 
       if (!myQuadranglePreference && !myTrianglePreference) { // priority of hypos
@@ -205,7 +204,7 @@ bool StdMeshers_Quadrangle_2D::CheckHypothesis
 
 //=============================================================================
 /*!
- *  
+ *
  */
 //=============================================================================
 
@@ -609,8 +608,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh&         aMesh,
       int stop = 0;
       if ( quad->side[3].grid->Edge(0).IsNull() ) // left side is simulated one
       {
-        // quad divided at I but not at J, as nbvertic==nbright==2
-        stop++; // we stop at a second node
+        if ( nbright == 2 ) // quad divided at I but not at J (2D_mesh_QuadranglePreference_01/B1)
+          stop++; // we stop at a second node
       }
       else
       {
@@ -657,7 +656,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh&         aMesh,
       }
       // for each node of the up edge find nearest node
       // in the first row of the regular grid and link them
-      for ( ; i > stop; i--) {
+      for ( ; i > stop; i--)
+      {
         a = uv_e2[i].node;
         b = uv_e2[i - 1].node;
         gp_Pnt pb = SMESH_TNodeXYZ( b );
@@ -791,8 +791,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh&         aMesh,
       }
     }
   } else {
-    if (quad->nbNodeOut(3) && nbhoriz == 2) {
-//      MESSAGE("left edge is out");
+    if (quad->nbNodeOut(3) && nbhoriz == 2)
+    {
       int g = nbvertic - 1; // last processed node in the grid
       int stop = 0;
       i = quad->side[ QUAD_LEFT_SIDE ].to-1; // nbleft - 1;
@@ -3300,7 +3300,7 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh &        aMesh,
 
     UVPtStruct nullUVPtStruct;
     nullUVPtStruct.node = 0;
-    nullUVPtStruct.x = nullUVPtStruct.y = nullUVPtStruct.u = nullUVPtStruct.y = 0;
+    nullUVPtStruct.x = nullUVPtStruct.y = nullUVPtStruct.u = nullUVPtStruct.v = 0;
     nullUVPtStruct.param = 0;
     
 
@@ -4523,7 +4523,7 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face&          theFace,
       // move corners to make sides equal by length
       int nbEqualV  = equVerts.size();
       int nbExcessV = nbEqualV - ( 1 + nbC[0] + nbC[1] );
-      if ( nbExcessV > 0 ) // there is nbExcessV vertices that can become corners
+      if ( nbExcessV > 0 ) // there are nbExcessV vertices that can become corners
       {
         // calculate normalized length of each "side" enclosed between neighbor equVerts
         vector< double > accuLength;
@@ -4584,6 +4584,7 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face&          theFace,
           if ( iBestEV > iS-1 + nbExcessV )
             iBestEV = iS-1 + nbExcessV;
           theVertices[ iCorner ] = helper.IthVertex( 0, edgeVec[ evVec[ iBestEV ]]);
+          cornerInd  [ iCorner ] = evVec[ iBestEV ];
           refinedCorners.insert( evVec[ iBestEV ]);
           iCorner = helper.WrapIndex( iCorner + 1, cornerInd.size() );
         }