]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
PAL15881 New NETGEN capability: is it possible to do only a 2D mesh ?
authoreap <eap@opencascade.com>
Fri, 20 Jul 2007 11:21:20 +0000 (11:21 +0000)
committereap <eap@opencascade.com>
Fri, 20 Jul 2007 11:21:20 +0000 (11:21 +0000)
    move some code to StdMeshers_FaceSide::GetFaceWires()

src/StdMeshers/StdMeshers_MEFISTO_2D.cxx

index c919f6a1e045e3bba6c410edc363142a6d0cc627..ebf2080601532d6238d69b864d941848dc78ee09 100644 (file)
@@ -187,42 +187,29 @@ bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aSh
   const bool ignoreMediumNodes = _quadraticMesh;
 
   // get all edges of a face
-  TopoDS_Vertex V1;
-  list< TopoDS_Edge > edges;
-  list< int > nbEdgesInWires;
-  int nbWires = SMESH_Block::GetOrderedEdges (F, V1, edges, nbEdgesInWires);
-
-  if (_hypLengthFromEdges) _edgeLength = 0;
-
-  // split list of all edges into separate wires
-  TWireVector wires ( nbWires );
-  list< int >::iterator nbE = nbEdgesInWires.begin();
-  list< TopoDS_Edge >::iterator from, to;
-  from = to = edges.begin();
-  for ( int iW = 0; iW < nbWires; ++iW )
+  TError problem;
+  TWireVector wires = StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, problem );
+  int nbWires = wires.size();
+  if ( problem && !problem->IsOK() ) return error( problem );
+  if ( nbWires == 0 ) return error( "Problem in StdMeshers_FaceSide::GetFaceWires()");
+  if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments
+    return error(COMPERR_BAD_INPUT_MESH,
+                 SMESH_Comment("Too few segments: ")<<wires[0]->NbSegments());
+
+  // compute average edge length
+  if (_hypLengthFromEdges)
   {
-    std::advance( to, *nbE++ );
-    list< TopoDS_Edge > wireEdges( from, to );
-    // assure that there is a node on the first vertex
-    // as StdMeshers_FaceSide::GetUVPtStruct() requires
-    while ( !VertexNode( TopExp::FirstVertex( wireEdges.front(), true),
-                         aMesh.GetMeshDS()))
+    _edgeLength = 0;
+    int nbSegments = 0;
+    for ( int iW = 0; iW < nbWires; ++iW )
     {
-      wireEdges.splice(wireEdges.end(), wireEdges,
-                       wireEdges.begin(), ++wireEdges.begin());
-      if ( from->IsSame( wireEdges.front() ))
-        return error(COMPERR_BAD_INPUT_MESH,"No nodes on vertices");
+      StdMeshers_FaceSidePtr wire = wires[ iW ];
+      _edgeLength += wire->Length();
+      nbSegments  += wire->NbSegments();
     }
-    StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( F, wireEdges, &aMesh,
-                                                         true, ignoreMediumNodes);
-    wires[ iW ] = StdMeshers_FaceSidePtr( wire );
-    if (_hypLengthFromEdges && wire->NbSegments() )
-      _edgeLength += wire->Length() / wire->NbSegments();
-    from = to;
+    if ( nbSegments )
+      _edgeLength /= nbSegments;
   }
-  if ( wires[0]->NbSegments() < 3 ) // ex: a circle with 2 segments
-    return error(COMPERR_BAD_INPUT_MESH,
-                 SMESH_Comment("Too few segments")<<wires[0]->NbSegments());
 
   if (_hypLengthFromEdges && _edgeLength < DBL_MIN )
     _edgeLength = 100;
@@ -502,15 +489,12 @@ bool StdMeshers_MEFISTO_2D::LoadPoints(TWireVector &                 wires,
       VWMap.Clear(); // wires have no common vertices
   }
 
-  const bool isXConst = false; // meaningles here
-  const double constValue = 0; // meaningles here
-
   int m = 0;
   list< int > mOnVertex;
 
   for ( int iW = 0; iW < wires.size(); ++iW )
   {
-    const vector<UVPtStruct>& uvPtVec = wires[ iW ]->GetUVPtStruct(isXConst,constValue);
+    const vector<UVPtStruct>& uvPtVec = wires[ iW ]->GetUVPtStruct();
     if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) {
       return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Unexpected nb of points on wire ")
                    << iW << uvPtVec.size()<<" != "<<wires[ iW ]->NbPoints());