]> 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:20:10 +0000 (11:20 +0000)
committereap <eap@opencascade.com>
Fri, 20 Jul 2007 11:20:10 +0000 (11:20 +0000)
+  /*!
+   * \brief Return wires of a face as StdMeshers_FaceSide's
+   */
+  static TSideVector GetFaceWires(const TopoDS_Face& theFace,
+                                  SMESH_Mesh &       theMesh,
+                                  const bool         theIgnoreMediumNodes,
+                                  TError &           theError);

src/StdMeshers/StdMeshers_FaceSide.cxx
src/StdMeshers/StdMeshers_FaceSide.hxx

index 85057fb5c49710465d5c8b037ea35e0c753d2fff..3063577c05de8bdc4ca23a044ecdb8ce620b5734 100644 (file)
@@ -35,6 +35,8 @@
 #include "SMESH_Algo.hxx"
 #include "SMESH_Mesh.hxx"
 #include "SMESH_MeshEditor.hxx"
+#include "SMESH_ComputeError.hxx"
+#include "SMESH_Block.hxx"
 
 #include <Adaptor2d_Curve2d.hxx>
 #include <BRepAdaptor_CompCurve.hxx>
@@ -464,3 +466,50 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
   }
   return gp_Pnt2d( 1e+100, 1e+100 );
 }
+
+//================================================================================
+/*!
+ * \brief Return wires of a face as StdMeshers_FaceSide's
+ */
+//================================================================================
+
+TSideVector StdMeshers_FaceSide::GetFaceWires(const TopoDS_Face& theFace,
+                                              SMESH_Mesh &       theMesh,
+                                              const bool         theIgnoreMediumNodes,
+                                              TError &           theError)
+{
+  TopoDS_Vertex V1;
+  list< TopoDS_Edge > edges;
+  list< int > nbEdgesInWires;
+  int nbWires = SMESH_Block::GetOrderedEdges (theFace, V1, edges, nbEdgesInWires);
+
+  // split list of all edges into separate wires
+  TSideVector 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 )
+  {
+    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 ( !SMESH_Algo::VertexNode( TopExp::FirstVertex( wireEdges.front(), true),
+                                     theMesh.GetMeshDS()))
+    {
+      wireEdges.splice(wireEdges.end(), wireEdges,
+                       wireEdges.begin(), ++wireEdges.begin());
+      if ( from->IsSame( wireEdges.front() )) {
+        theError = TError
+          ( new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH,"No nodes on vertices"));
+        return TSideVector(0);
+      }
+    }
+    StdMeshers_FaceSide* wire = new StdMeshers_FaceSide( theFace, wireEdges, &theMesh,
+                                                         true, theIgnoreMediumNodes);
+    wires[ iW ] = StdMeshers_FaceSidePtr( wire );
+    from = to;
+  }
+  return wires;
+}
+
index 1463d2d1fd57aafe415f1414fa4c361ba2bba4f0..43c92bf2b33b01cfc492e4e111d331eb0fd2c935 100644 (file)
@@ -45,6 +45,7 @@ class Adaptor2d_Curve2d;
 class Adaptor3d_Curve;
 class BRepAdaptor_CompCurve;
 class TopoDS_Face;
+class SMESH_ComputeError;
 
 typedef struct uvPtStruct
 {
@@ -61,6 +62,8 @@ typedef struct uvPtStruct
 class StdMeshers_FaceSide;
 typedef boost::shared_ptr< StdMeshers_FaceSide > StdMeshers_FaceSidePtr;
 typedef boost::shared_ptr< uvPtStruct > UVPtStructPtr;
+typedef std::vector< StdMeshers_FaceSidePtr > TSideVector;
+typedef boost::shared_ptr< SMESH_ComputeError > TError;
 
 //================================================================================
 /*!
@@ -88,6 +91,15 @@ public:
                       SMESH_Mesh*        theMesh,
                       const bool         theIsForward,
                       const bool         theIgnoreMediumNodes);
+
+  /*!
+   * \brief Return wires of a face as StdMeshers_FaceSide's
+   */
+  static TSideVector GetFaceWires(const TopoDS_Face& theFace,
+                                  SMESH_Mesh &       theMesh,
+                                  const bool         theIgnoreMediumNodes,
+                                  TError &           theError);
+
   /*!
    * \brief Change orientation of side geometry
    */
@@ -115,15 +127,15 @@ public:
     *
     * Missing nodes are allowed only on internal vertices
    */
-  const vector<UVPtStruct>& GetUVPtStruct(bool isXConst, double constValue) const;
+  const vector<UVPtStruct>& GetUVPtStruct(bool isXConst =0, double constValue =0) const;
   /*!
    * \brief Simulates detailed data on nodes
     * \param isXConst - true if normalized parameter X is constant
     * \param constValue - constant parameter value
    */
   const vector<UVPtStruct>& SimulateUVPtStruct(int    nbSeg,
-                                               bool   isXConst,
-                                               double constValue) const;
+                                               bool   isXConst   = 0,
+                                               double constValue = 0) const;
   /*!
    * \brief Return edge and parameter on edge by normalized parameter
    */