gmsh-TingyuanDoc
0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
Go to the documentation of this file.
18 template <
class T>
inline double myhypot(
const T &a,
const T &b)
20 return std::sqrt(a * a + b * b);
23 template <
class T>
inline double hypotenuse(T
const &a, T
const &b, T
const &
c)
25 return std::sqrt(a * a + b * b +
c *
c);
28 template <
typename T>
inline int gmsh_sign(T
const &value)
30 return (T(0) < value) - (value < T(0));
39 inline double pow_int(
const double &a,
const int &n)
41 if(n < 0)
return pow_int(1 / a, -n);
47 case 3:
return a * a * a;
49 const double a2 = a * a;
53 const double a2 = a * a;
57 const double a3 = a * a * a;
61 const double a3 = a * a * a;
65 const double a2 = a * a;
70 const double a3 = a * a * a;
74 const double a2 = a * a;
82 inline double pow_int(
const double &a,
const double &d)
85 int n =
static_cast<int>(d + .5);
89 double myatan2(
double a,
double b);
93 inline double crossProd(
double a[3],
double b[3],
int i)
97 return a[i1] * b[i2] - a[i2] * b[i1];
102 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
105 inline void prodve(
double a[3],
double b[3],
double c[3])
107 c[2] = a[0] * b[1] - a[1] * b[0];
108 c[1] = -a[0] * b[2] + a[2] * b[0];
109 c[0] = a[1] * b[2] - a[2] * b[1];
112 inline double prosca(
double const a[3],
double const b[3])
114 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
117 void matvec(
double mat[3][3],
double vec[3],
double res[3]);
118 void matmat(
double mat1[3][3],
double mat2[3][3],
double res[3][3]);
121 return sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
125 const double mod =
norm3(a);
127 const double one_over_mod = 1. / mod;
128 a[0] *= one_over_mod;
129 a[1] *= one_over_mod;
130 a[2] *= one_over_mod;
134 double norm2(
double a[3][3]);
136 void normal3points(
double x0,
double y0,
double z0,
double x1,
double y1,
137 double z1,
double x2,
double y2,
double z2,
double n[3]);
138 void normal2points(
double x0,
double y0,
double z0,
double x1,
double y1,
139 double z1,
double n[3]);
140 int sys2x2(
double mat[2][2],
double b[2],
double res[2]);
141 int sys3x3(
double mat[3][3],
double b[3],
double res[3],
double *det);
142 int sys3x3_with_tol(
double mat[3][3],
double b[3],
double res[3],
double *det);
143 double det2x2(
double mat[2][2]);
144 double det2x3(
double mat[2][3]);
145 double det3x3(
double mat[3][3]);
147 double trace2(
double mat[3][3]);
148 double inv3x3(
double mat[3][3],
double inv[3][3]);
149 double inv2x2(
double mat[2][2],
double inv[2][2]);
151 double angle_plan(
double v[3],
double p1[3],
double p2[3],
double n[3]);
152 double triangle_area(
double p0[3],
double p1[3],
double p2[3]);
154 void circumCenterXY(
double *p1,
double *p2,
double *p3,
double *res);
156 double *uv =
nullptr);
167 void eigenvalue(
double mat[3][3],
double re[3]);
168 void FindCubicRoots(
const double coeff[4],
double re[3],
double im[3]);
170 void gradSimplex(
double *x,
double *y,
double *
z,
double *v,
double *grad);
176 double tolx = 1.e-6);
183 std::vector<SPoint3> &closePts,
184 const std::vector<SPoint3> &pts,
192 std::vector<SPoint3> &closePts,
193 const std::vector<SPoint3> &pts,
198 const SPoint3 &p2,
double *xp,
double *yp,
199 double *otherp,
double *x,
double *y,
double *other);
201 const double &xp,
double *
distance,
const double &r1,
205 std::vector<double> &distancesE,
206 std::vector<int> &isInYarn,
207 std::vector<SPoint3> &closePts,
208 const std::vector<SPoint3> &pts,
210 const double radius);
213 std::vector<double> &distances, std::vector<double> &distancesE,
214 std::vector<int> &isInYarn, std::vector<SPoint3> &closePts,
215 const std::vector<SPoint3> &pts,
const SPoint3 &p1,
const SPoint3 &p2,
216 const double maxA,
const double minA,
const double maxB,
const double minB,
217 const int typeLevelSet);
225 void fillMeanPlane(
double res[4],
double t1[3],
double t2[3],
232 std::vector<SPoint3> &ptsProj,
235 std::vector<SPoint3> &pointsUV,
239 bool catenary(
double x0,
double x1,
double y0,
double y1,
double ys,
int N,
double det2x2(double mat[2][2])
double triangle_area(double p0[3], double p1[3], double p2[3])
int computeDistanceRatio(const double &y, const double &yp, const double &x, const double &xp, double *distance, const double &r1, const double &r2)
int sys3x3_with_tol(double mat[3][3], double b[3], double res[3], double *det)
int gmsh_sign(T const &value)
bool catenary(double x0, double x1, double y0, double y1, double ys, int N, double *yp)
double trace2(double mat[3][3])
double distance(MVertex *v1, MVertex *v2)
static double c(int i, int j, fullMatrix< double > &CA, const std::vector< SPoint3 > &P, const std::vector< SPoint3 > &Q)
void circumCenterXYZ(double *p1, double *p2, double *p3, double *res, double *uv=nullptr)
void signedDistancesPointsEllipsePoint(std::vector< double > &distances, std::vector< double > &distancesE, std::vector< int > &isInYarn, std::vector< SPoint3 > &closePts, const std::vector< SPoint3 > &pts, const SPoint3 &p1, const SPoint3 &p2, const double radius)
void f(int n, double u, double *val)
double scalProd(double a[3], double b[3])
void signedDistancesPointsLine(std::vector< double > &distances, std::vector< SPoint3 > &closePts, const std::vector< SPoint3 > &pts, const SPoint3 &p1, const SPoint3 &p2)
void gradSimplex(double *x, double *y, double *z, double *v, double *grad)
void eigenvalue(double mat[3][3], double re[3])
void normal3points(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, double n[3])
double norm3(double a[3])
void fillMeanPlane(double res[4], double t1[3], double t2[3], mean_plane &meanPlane)
double angle_02pi(double A3)
void projectPointToPlane(const SPoint3 &pt, SPoint3 &ptProj, const mean_plane &meanPlane)
void signedDistancePointTriangle(const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3, const SPoint3 &p, double &d, SPoint3 &closePt)
bool newton_fd(bool(*func)(fullVector< double > &, fullVector< double > &, void *), fullVector< double > &x, void *data, double relax=1., double tolx=1.e-6)
double angle_plan(double v[3], double p1[3], double p2[3], double n[3])
double pow_int(const double &a, const int &n)
void eigenvalue2x2(double mat[2][2], double v[2])
void normal2points(double x0, double y0, double z0, double x1, double y1, double z1, double n[3])
void signedDistancesPointsEllipseLine(std::vector< double > &distances, std::vector< double > &distancesE, std::vector< int > &isInYarn, std::vector< SPoint3 > &closePts, const std::vector< SPoint3 > &pts, const SPoint3 &p1, const SPoint3 &p2, const double maxA, const double minA, const double maxB, const double minB, const int typeLevelSet)
double crossProd(double a[3], double b[3], int i)
void projectPointsToPlane(const std::vector< SPoint3 > &pts, std::vector< SPoint3 > &ptsProj, const mean_plane &meanPlane)
double prosca(double const a[3], double const b[3])
double triangle_area2d(double p0[2], double p1[2], double p2[2])
void signedDistancesPointsTriangle(std::vector< double > &distances, std::vector< SPoint3 > &closePts, const std::vector< SPoint3 > &pts, const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3)
void circumCenterXY(double *p1, double *p2, double *p3, double *res)
double trace3x3(double mat[3][3])
void prodve(double a[3], double b[3], double c[3])
double inv3x3(double mat[3][3], double inv[3][3])
void transformPointsIntoOrthoBasis(const std::vector< SPoint3 > &ptsProj, std::vector< SPoint3 > &pointsUV, const SPoint3 &ptCG, const mean_plane &meanPlane)
void changeReferential(const int direction, const SPoint3 &p, const SPoint3 &closePt, const SPoint3 &p1, const SPoint3 &p2, double *xp, double *yp, double *otherp, double *x, double *y, double *other)
void matmat(double mat1[3][3], double mat2[3][3], double res[3][3])
void invert_singular_matrix3x3(double MM[3][3], double II[3][3])
double norm2(double a[3][3])
void eigsort(double d[3])
int intersection_segments(const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &q1, const SPoint3 &q2, double x[2])
3D VERSION
int sys3x3(double mat[3][3], double b[3], double res[3], double *det)
double myhypot(const T &a, const T &b)
double ComputeVonMises(double *val)
void signedDistancePointLine(const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p, double &distance, SPoint3 &closePt)
double computeInnerRadiusForQuad(double *x, double *y, int i)
double det3x3(double mat[3][3])
double hypotenuse(T const &a, T const &b, T const &c)
static void direction(Vertex *v1, Vertex *v2, double d[3])
double det2x3(double mat[2][3])
double myatan2(double a, double b)
void computeMeanPlaneSimple(const std::vector< SPoint3 > &points, mean_plane &meanPlane)
double inv2x2(double mat[2][2], double inv[2][2])
double norme(double a[3])
double ComputeScalarRep(int numComp, double *val, int tensorRep=0)
int sys2x2(double mat[2][2], double b[2], double res[2])
void matvec(double mat[3][3], double vec[3], double res[3])
void planarQuad_xyz2xy(double *x, double *y, double *z, double *xn, double *yn)
void FindCubicRoots(const double coeff[4], double re[3], double im[3])