Salome HOME
0020557: EDF 1151 SMESH: Netgen 2D fail to mesh a ring
authoreap <eap@opencascade.com>
Thu, 29 Oct 2009 08:31:59 +0000 (08:31 +0000)
committereap <eap@opencascade.com>
Thu, 29 Oct 2009 08:31:59 +0000 (08:31 +0000)
   and merge with V5

src/StdMeshers/StdMeshers_FaceSide.cxx

index 13cc6b7897d2c0949db837d8a36db32be1c7cf71..aa5e16ae54f4aa67e44110d7dd8dad0d8bc5779d 100644 (file)
@@ -97,6 +97,7 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
   myMesh = theMesh;
   myMissingVertexNodes = false;
   myIgnoreMediumNodes = theIgnoreMediumNodes;
+  myDefaultPnt2d = gp_Pnt2d( 1e+100, 1e+100 );
   if ( nbEdges == 0 ) return;
 
   SMESHDS_Mesh* meshDS = theMesh->GetMeshDS();
@@ -157,6 +158,34 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
   //dump();
 }
 
+//================================================================================
+/*!
+ * \brief Constructor of a side for vertex using data from other FaceSide
+  * \param theVertex - the vertex
+  * \param theSide - the side
+ */
+//================================================================================
+
+StdMeshers_FaceSide::StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
+                                         const gp_Pnt2d thePnt2d,
+                                         const StdMeshers_FaceSide* theSide)
+{
+  myC2d.resize(1);
+  myLength = 0;
+  myMesh = theSide->GetMesh();
+  myDefaultPnt2d = thePnt2d;
+
+  myPoints = theSide->GetUVPtStruct();
+  myNbPonits = myNbSegments = myPoints.size();
+  std::vector<uvPtStruct>::iterator it = myPoints.begin();
+  for(; it!=myPoints.end(); it++) {
+    (*it).u = thePnt2d.X();
+    (*it).v = thePnt2d.Y();
+    (*it).y = 0.0;
+    (*it).node = theNode;
+  }
+}
+
 //================================================================================
 /*!
  * \brief Return info on nodes on the side
@@ -186,7 +215,8 @@ const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool   isXConst,
       double prevNormPar = ( i == 0 ? 0 : myNormPar[ i-1 ]); // normalized param
       if ( node ) { // internal nodes may be missing
         u2node.insert( make_pair( prevNormPar, node ));
-      } else if ( i == 0 ) {
+      }
+      else if ( i == 0 ) {
         MESSAGE(" NO NODE on VERTEX" );
         return myPoints;
       }
@@ -472,7 +502,8 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
     double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
     return myC2d[ i ]->Value( myFirst[i] * ( 1 - r ) + myLast[i] * r );
   }
-  return gp_Pnt2d( 1e+100, 1e+100 );
+  //return gp_Pnt2d( 1e+100, 1e+100 );
+  return myDefaultPnt2d;
 }
 
 //================================================================================
@@ -513,15 +544,7 @@ TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace,
         return TSideVector(0);
       }
     }
-    // find out side orientation, which is important if there are several wires (PAL19080) 
-    bool isForward = true;
-    if ( nbWires > 1 ) {
-      TopExp_Explorer e( theFace, TopAbs_EDGE );
-      while ( ! e.Current().IsSame( wireEdges.back() ))
-        e.Next();
-      isForward = ( e.Current().Orientation() == wireEdges.back().Orientation() );
-    }
-
+    const bool isForward = true;
     StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
                                                          isForward, theIgnoreMediumNodes);
     wires[ iW ] = StdMeshers_FaceSidePtr( wire );