From d01dceb67ed0d0eea100809ed4d119c36ddc60e6 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 20 Jul 2007 11:20:10 +0000 Subject: [PATCH] PAL15881 New NETGEN capability: is it possible to do only a 2D mesh ? + /*! + * \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 | 49 ++++++++++++++++++++++++++ src/StdMeshers/StdMeshers_FaceSide.hxx | 18 ++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/src/StdMeshers/StdMeshers_FaceSide.cxx b/src/StdMeshers/StdMeshers_FaceSide.cxx index 85057fb5c..3063577c0 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.cxx +++ b/src/StdMeshers/StdMeshers_FaceSide.cxx @@ -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 #include @@ -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; +} + diff --git a/src/StdMeshers/StdMeshers_FaceSide.hxx b/src/StdMeshers/StdMeshers_FaceSide.hxx index 1463d2d1f..43c92bf2b 100644 --- a/src/StdMeshers/StdMeshers_FaceSide.hxx +++ b/src/StdMeshers/StdMeshers_FaceSide.hxx @@ -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& GetUVPtStruct(bool isXConst, double constValue) const; + const vector& 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& 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 */ -- 2.39.2