gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
GPoint.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 GPOINT_H
7 #define GPOINT_H
8 
9 #include <cmath>
10 
11 class GEntity;
12 
13 class GPoint {
14 private:
15  double X, Y, Z;
16  const GEntity *e;
17  double par[2];
18  bool success;
19 
20 public:
21  inline double x() const { return X; }
22  inline double y() const { return Y; }
23  inline double z() const { return Z; }
24  inline double &x() { return X; }
25  inline double &y() { return Y; }
26  inline double &z() { return Z; }
27  inline double u() const { return par[0]; }
28  inline double v() const { return par[1]; }
29  inline const GEntity *g() const { return e; }
30  GPoint(double _x = 0, double _y = 0, double _z = 0,
31  const GEntity *onwhat = nullptr)
32  : X(_x), Y(_y), Z(_z), e(onwhat), success(true)
33  {
34  par[0] = -1.;
35  par[1] = -1.;
36  }
37  GPoint(double _x, double _y, double _z, const GEntity *onwhat, double p)
38  : X(_x), Y(_y), Z(_z), e(onwhat), success(true)
39  {
40  par[0] = p;
41  par[1] = -1.;
42  }
43  GPoint(double _x, double _y, double _z, const GEntity *onwhat, double p[2])
44  : X(_x), Y(_y), Z(_z), e(onwhat), success(true)
45  {
46  par[0] = p[0];
47  par[1] = p[1];
48  }
49  GPoint(double _x, double _y, double _z, const GEntity *onwhat, double p1,
50  double p2)
51  : X(_x), Y(_y), Z(_z), e(onwhat), success(true)
52  {
53  par[0] = p1;
54  par[1] = p2;
55  }
56  double distance(GPoint &p)
57  {
58  double dx = X - p.x();
59  double dy = Y - p.y();
60  double dz = Z - p.z();
61  return sqrt(dx * dx + dy * dy + dz * dz);
62  }
63  bool succeeded() const { return success; }
64  bool setNoSuccess()
65  {
66  success = false;
67  return success;
68  }
69 };
70 
71 #endif
GPoint::succeeded
bool succeeded() const
Definition: GPoint.h:63
GPoint::y
double y() const
Definition: GPoint.h:22
GPoint::GPoint
GPoint(double _x, double _y, double _z, const GEntity *onwhat, double p)
Definition: GPoint.h:37
GPoint::Y
double Y
Definition: GPoint.h:15
GPoint::GPoint
GPoint(double _x=0, double _y=0, double _z=0, const GEntity *onwhat=nullptr)
Definition: GPoint.h:30
GPoint::par
double par[2]
Definition: GPoint.h:17
GPoint::Z
double Z
Definition: GPoint.h:15
GEntity
Definition: GEntity.h:31
GPoint
Definition: GPoint.h:13
GPoint::z
double z() const
Definition: GPoint.h:23
GPoint::u
double u() const
Definition: GPoint.h:27
GPoint::X
double X
Definition: GPoint.h:15
GPoint::GPoint
GPoint(double _x, double _y, double _z, const GEntity *onwhat, double p[2])
Definition: GPoint.h:43
GPoint::GPoint
GPoint(double _x, double _y, double _z, const GEntity *onwhat, double p1, double p2)
Definition: GPoint.h:49
GPoint::g
const GEntity * g() const
Definition: GPoint.h:29
GPoint::success
bool success
Definition: GPoint.h:18
GPoint::setNoSuccess
bool setNoSuccess()
Definition: GPoint.h:64
GPoint::v
double v() const
Definition: GPoint.h:28
GPoint::distance
double distance(GPoint &p)
Definition: GPoint.h:56
GPoint::e
const GEntity * e
Definition: GPoint.h:16
GPoint::y
double & y()
Definition: GPoint.h:25
GPoint::x
double x() const
Definition: GPoint.h:21
GPoint::z
double & z()
Definition: GPoint.h:26
GPoint::x
double & x()
Definition: GPoint.h:24