gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
OCCFace.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef OCC_FACE_H
7 #define OCC_FACE_H
8 
9 #include "GmshConfig.h"
10 #include "GFace.h"
11 #include "GModel.h"
12 #include "Range.h"
13 
14 #if defined(HAVE_OCC)
15 
16 #include <BRepLProp_SLProps.hxx>
17 #include <GeomAPI_ProjectPointOnSurf.hxx>
18 #include <TopoDS_Face.hxx>
19 
20 class OCCFace : public GFace {
21 private:
22  TopoDS_Face _s;
23  Handle(Geom_Surface) _occface;
24  const BRepAdaptor_Surface _sf;
25  double _umin, _umax, _vmin, _vmax;
26  bool _periodic[2];
27  double _period[2];
28  double _radius;
29  SPoint3 _center;
30  void _setup();
31  mutable GeomAPI_ProjectPointOnSurf _projector;
32  bool _project(const double p[3], double uv[2], double xyz[3]) const;
33 
34 public:
35  OCCFace(GModel *m, TopoDS_Face s, int num);
36  virtual ~OCCFace() {}
37  virtual SBoundingBox3d bounds(bool fast = false);
38  virtual Range<double> parBounds(int i) const;
39  virtual GPoint point(double par1, double par2) const;
40  virtual GPoint closestPoint(const SPoint3 &queryPoint,
41  const double initialGuess[2]) const;
42  virtual bool containsPoint(const SPoint3 &pt) const;
43  virtual bool containsParam(const SPoint2 &pt);
44  virtual SVector3 normal(const SPoint2 &param) const;
45  virtual Pair<SVector3, SVector3> firstDer(const SPoint2 &param) const;
46  virtual void secondDer(const SPoint2 &, SVector3 &, SVector3 &,
47  SVector3 &) const;
48  virtual GEntity::GeomType geomType() const;
49  virtual ModelType getNativeType() const { return OpenCascadeModel; }
50  virtual void *getNativePtr() const { return (void *)&_s; }
51  virtual SPoint2 parFromPoint(const SPoint3 &, bool onSurface = true,
52  bool convTestXYZ = false) const;
53  virtual double curvatureMax(const SPoint2 &param) const;
54  virtual double curvatures(const SPoint2 &param, SVector3 &dirMax,
55  SVector3 &dirMin, double &curvMax,
56  double &curvMin) const;
57  // tells if it's a sphere, and if it is, returns parameters
58  virtual bool isSphere(double &radius, SPoint3 &center) const;
59  virtual bool periodic(int dim) const { return _periodic[dim]; }
60  virtual double period(int dim) const { return _period[dim]; }
61  // save itself in BREP format (for debug e.g.)
62  void writeBREP(const char *filename);
63  bool buildSTLTriangulation(bool force = false);
64 };
65 
66 #endif
67 
68 #endif
GFace::containsParam
virtual bool containsParam(const SPoint2 &pt)
Definition: GFace.cpp:1403
GFace::firstDer
virtual Pair< SVector3, SVector3 > firstDer(const SPoint2 &param) const =0
GFace.h
GFace
Definition: GFace.h:33
SPoint2
Definition: SPoint2.h:12
GEntity::OpenCascadeModel
@ OpenCascadeModel
Definition: GEntity.h:82
SPoint3
Definition: SPoint3.h:14
GFace::isSphere
virtual bool isSphere(double &radius, SPoint3 &center) const
Definition: GFace.h:333
GFace::point
virtual GPoint point(double par1, double par2) const =0
SVector3
Definition: SVector3.h:16
GEntity::getNativeType
virtual ModelType getNativeType() const
Definition: GEntity.h:268
GEntity::containsPoint
virtual bool containsPoint(const SPoint3 &pt) const
Definition: GEntity.h:265
GFace::dim
virtual int dim() const
Definition: GFace.h:175
GPoint
Definition: GPoint.h:13
GFace::closestPoint
virtual GPoint closestPoint(const SPoint3 &queryPoint, const double initialGuess[2]) const
Definition: GFace.cpp:1323
Range.h
GEntity::period
virtual double period(int dim) const
Definition: GEntity.h:245
GEntity::getNativePtr
virtual void * getNativePtr() const
Definition: GEntity.h:271
GEntity::periodic
virtual bool periodic(int dim) const
Definition: GEntity.h:244
Range
Definition: Range.h:10
GFace::secondDer
virtual void secondDer(const SPoint2 &param, SVector3 &dudu, SVector3 &dvdv, SVector3 &dudv) const =0
GModel
Definition: GModel.h:44
GFace::parFromPoint
virtual SPoint2 parFromPoint(const SPoint3 &, bool onSurface=true, bool convTestXYZ=false) const
Definition: GFace.cpp:1254
GEntity::geomType
virtual GeomType geomType() const
Definition: GEntity.h:238
GFace::bounds
virtual SBoundingBox3d bounds(bool fast=false)
Definition: GFace.cpp:273
GEntity::GeomType
GeomType
Definition: GEntity.h:88
GEntity::parBounds
virtual Range< double > parBounds(int i) const
Definition: GEntity.h:259
GFace::curvatureMax
virtual double curvatureMax(const SPoint2 &param) const
Definition: GFace.cpp:1020
Pair
Definition: Pair.h:10
GFace::buildSTLTriangulation
virtual bool buildSTLTriangulation(bool force=false)
Definition: GFace.cpp:1585
GModel.h
GFace::normal
virtual SVector3 normal(const SPoint2 &param) const
Definition: GFace.cpp:1416
GFace::curvatures
virtual double curvatures(const SPoint2 &param, SVector3 &dirMax, SVector3 &dirMin, double &curvMax, double &curvMin) const
Definition: GFace.cpp:1031
SBoundingBox3d
Definition: SBoundingBox3d.h:21