Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef StdMeshers_FaceSide_HeaderFile
00029 #define StdMeshers_FaceSide_HeaderFile
00030
00031 #include <Geom2d_Curve.hxx>
00032 #include <GeomAdaptor_Curve.hxx>
00033 #include <TopoDS_Edge.hxx>
00034 #include <TopoDS_Vertex.hxx>
00035 #include <gp_Pnt2d.hxx>
00036
00037 #include "SMESH_StdMeshers.hxx"
00038
00039 #include <vector>
00040 #include <list>
00041 #include <boost/shared_ptr.hpp>
00042
00043 class SMDS_MeshNode;
00044 class SMESH_Mesh;
00045 class Adaptor2d_Curve2d;
00046 class Adaptor3d_Curve;
00047 class BRepAdaptor_CompCurve;
00048 class TopoDS_Face;
00049 struct SMESH_ComputeError;
00050
00051 typedef struct uvPtStruct
00052 {
00053 double param;
00054
00055 double normParam;
00056 double u;
00057 double v;
00058 double x;
00059 double y;
00060 const SMDS_MeshNode * node;
00061 } UVPtStruct;
00062
00063 class StdMeshers_FaceSide;
00064 typedef boost::shared_ptr< StdMeshers_FaceSide > StdMeshers_FaceSidePtr;
00065 typedef boost::shared_ptr< uvPtStruct > UVPtStructPtr;
00066 typedef std::vector< StdMeshers_FaceSidePtr > TSideVector;
00067 typedef boost::shared_ptr< SMESH_ComputeError > TError;
00068
00069
00074
00075
00076 class STDMESHERS_EXPORT StdMeshers_FaceSide
00077 {
00078 public:
00082 StdMeshers_FaceSide(const TopoDS_Face& theFace,
00083 const TopoDS_Edge& theEdge,
00084 SMESH_Mesh* theMesh,
00085 const bool theIsForward,
00086 const bool theIgnoreMediumNodes);
00090 StdMeshers_FaceSide(const TopoDS_Face& theFace,
00091 std::list<TopoDS_Edge>& theEdges,
00092 SMESH_Mesh* theMesh,
00093 const bool theIsForward,
00094 const bool theIgnoreMediumNodes);
00098 StdMeshers_FaceSide(const SMDS_MeshNode* theNode,
00099 const gp_Pnt2d thePnt2d,
00100 const StdMeshers_FaceSide* theSide);
00104 static TSideVector GetFaceWires(const TopoDS_Face& theFace,
00105 SMESH_Mesh & theMesh,
00106 const bool theIgnoreMediumNodes,
00107 TError & theError);
00108
00112 void Reverse();
00116 int NbPoints() const { return myNbPonits; }
00120 int NbSegments() const { return myNbSegments; }
00124 SMESH_Mesh* GetMesh() const { return myMesh; }
00128 bool MissVertexNode() const { return myMissingVertexNodes; }
00136 const std::vector<UVPtStruct>& GetUVPtStruct(bool isXConst =0, double constValue =0) const;
00142 const std::vector<UVPtStruct>& SimulateUVPtStruct(int nbSeg,
00143 bool isXConst = 0,
00144 double constValue = 0) const;
00148 inline double Parameter(double U, TopoDS_Edge & edge) const;
00152 gp_Pnt2d Value2d(double U) const;
00156 Adaptor2d_Curve2d* GetCurve2d() const;
00160 BRepAdaptor_CompCurve* GetCurve3d() const;
00164 int NbEdges() const { return myEdge.size(); }
00168 const TopoDS_Edge& Edge(int i) const { return myEdge[i]; }
00172 TopoDS_Vertex FirstVertex(int i=0) const;
00176 TopoDS_Vertex LastVertex(int i=-1) const;
00180 inline double FirstParameter(int i) const;
00184 inline double LastParameter(int i) const;
00188 double Length() const { return myLength; }
00192 inline int EdgeIndex( double U ) const;
00193
00194
00195
00196 void dump(const char* msg=0) const;
00197
00198
00199 protected:
00200
00201
00202 std::vector<uvPtStruct> myPoints, myFalsePoints;
00203 std::vector<TopoDS_Edge> myEdge;
00204 std::vector<int> myEdgeID;
00205 std::vector<Handle(Geom2d_Curve)> myC2d;
00206 std::vector<GeomAdaptor_Curve> myC3dAdaptor;
00207 std::vector<double> myFirst, myLast;
00208 std::vector<double> myNormPar;
00209 std::vector<double> myEdgeLength;
00210 std::vector<double> myIsUniform;
00211 double myLength;
00212 int myNbPonits, myNbSegments;
00213 SMESH_Mesh* myMesh;
00214 bool myMissingVertexNodes, myIgnoreMediumNodes;
00215 gp_Pnt2d myDefaultPnt2d;
00216 };
00217
00218
00219
00225
00226
00227 inline int StdMeshers_FaceSide::EdgeIndex( double U ) const
00228 {
00229 int i = myNormPar.size() - 1;
00230 while ( i > 0 && U < myNormPar[ i-1 ] ) --i;
00231 return i;
00232 }
00233
00234
00240
00241
00242 inline double StdMeshers_FaceSide::Parameter(double U, TopoDS_Edge & edge) const
00243 {
00244 int i = EdgeIndex( U );
00245 edge = myEdge[ i ];
00246 double prevU = i ? myNormPar[ i-1 ] : 0;
00247 double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
00248 return myFirst[i] * ( 1 - r ) + myLast[i] * r;
00249 }
00250
00251
00255
00256
00257 inline double StdMeshers_FaceSide::FirstParameter(int i) const
00258 {
00259 return i==0 ? 0. : i<myNormPar.size() ? myNormPar[i-1] : 1.;
00260 }
00261
00262
00266
00267
00268 inline double StdMeshers_FaceSide::LastParameter(int i) const
00269 {
00270 return i<myNormPar.size() ? myNormPar[i] : 1;
00271 }
00272
00273 #endif