]> SALOME platform Git repositories - modules/smesh.git/blobdiff - src/SMESH/SMESH_MesherHelper.cxx
Salome HOME
0021330: EDF 1919 SMESH: Convert to quadratic gives wrong elements
[modules/smesh.git] / src / SMESH / SMESH_MesherHelper.cxx
index 34cef148deca4712e7e86afcb159b758061a334c..e46396bb67014609e3e5532ad387a30a8390a2e5 100644 (file)
@@ -1015,24 +1015,27 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
   }
   else if ( pos.second == TopAbs_EDGE )
   {
-    if ( n1->GetPosition()->GetTypeOfPosition()==SMDS_TOP_EDGE &&
-         n2->GetPosition()->GetTypeOfPosition()==SMDS_TOP_EDGE &&
+    const SMDS_PositionPtr Pos1 = n1->GetPosition();
+    const SMDS_PositionPtr Pos2 = n2->GetPosition();
+    if ( Pos1->GetTypeOfPosition()==SMDS_TOP_EDGE &&
+         Pos2->GetTypeOfPosition()==SMDS_TOP_EDGE &&
          n1->getshapeId() != n2->getshapeId() )
+    {
       // issue 0021006
       return getMediumNodeOnComposedWire(n1,n2,force3d);
-    
+    }
     E = TopoDS::Edge(meshDS->IndexToShape( edgeID = pos.first ));
     u[0] = GetNodeU(E,n1,n2, force3d ? 0 : &uvOK[0]);
     u[1] = GetNodeU(E,n2,n1, force3d ? 0 : &uvOK[1]);
   }
 
-  if(!force3d)
+  if ( !force3d & uvOK[0] && uvOK[1] )
   {
     // we try to create medium node using UV parameters of
     // nodes, else - medium between corresponding 3d points
     if( ! F.IsNull() )
     {
-      if ( uvOK[0] && uvOK[1] )
+      //if ( uvOK[0] && uvOK[1] )
       {
         if ( IsDegenShape( n1->getshapeId() )) {
           if ( myParIndex & U_periodic ) uv[0].SetCoord( 1, uv[1].Coord( 1 ));
@@ -1356,7 +1359,7 @@ SMDS_MeshFace* SMESH_MesherHelper::AddPolygonalFace (const vector<const SMDS_Mes
     for ( int i = 0; i < nodes.size(); ++i )
     {
       const SMDS_MeshNode* n1 = nodes[i];
-      const SMDS_MeshNode* n2 = nodes[(i+1)/nodes.size()];
+      const SMDS_MeshNode* n2 = nodes[(i+1)%nodes.size()];
       const SMDS_MeshNode* n12 = GetMediumNode(n1,n2,force3d);
       newNodes.push_back( n1 );
       newNodes.push_back( n12 );