gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
Numeric.h File Reference
#include <cmath>
#include <vector>
#include "SPoint2.h"
#include "SPoint3.h"
#include "SVector3.h"
Include dependency graph for Numeric.h:

Go to the source code of this file.

Classes

class  fullVector< scalar >
 
struct  mean_plane
 

Functions

template<class T >
double myhypot (const T &a, const T &b)
 
template<class T >
double hypotenuse (T const &a, T const &b, T const &c)
 
template<typename T >
int gmsh_sign (T const &value)
 
double pow_int (const double &a, const int &n)
 
double pow_int (const double &a, const double &d)
 
double myatan2 (double a, double b)
 
double myasin (double a)
 
double myacos (double a)
 
double crossProd (double a[3], double b[3], int i)
 
double scalProd (double a[3], double b[3])
 
void prodve (double a[3], double b[3], double c[3])
 
double prosca (double const a[3], double const b[3])
 
void matvec (double mat[3][3], double vec[3], double res[3])
 
void matmat (double mat1[3][3], double mat2[3][3], double res[3][3])
 
double norm3 (double a[3])
 
double norme (double a[3])
 
double norm2 (double a[3][3])
 
void normal3points (double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, double n[3])
 
void normal2points (double x0, double y0, double z0, double x1, double y1, double z1, double n[3])
 
int sys2x2 (double mat[2][2], double b[2], double res[2])
 
int sys3x3 (double mat[3][3], double b[3], double res[3], double *det)
 
int sys3x3_with_tol (double mat[3][3], double b[3], double res[3], double *det)
 
double det2x2 (double mat[2][2])
 
double det2x3 (double mat[2][3])
 
double det3x3 (double mat[3][3])
 
double trace3x3 (double mat[3][3])
 
double trace2 (double mat[3][3])
 
double inv3x3 (double mat[3][3], double inv[3][3])
 
double inv2x2 (double mat[2][2], double inv[2][2])
 
double angle_02pi (double A3)
 
double angle_plan (double v[3], double p1[3], double p2[3], double n[3])
 
double triangle_area (double p0[3], double p1[3], double p2[3])
 
double triangle_area2d (double p0[2], double p1[2], double p2[2])
 
void circumCenterXY (double *p1, double *p2, double *p3, double *res)
 
void circumCenterXYZ (double *p1, double *p2, double *p3, double *res, double *uv=nullptr)
 
void planarQuad_xyz2xy (double *x, double *y, double *z, double *xn, double *yn)
 
double computeInnerRadiusForQuad (double *x, double *y, int i)
 
char float2char (float f)
 
float char2float (char c)
 
void eigenvalue2x2 (double mat[2][2], double v[2])
 
void eigenvalue (double mat[3][3], double re[3])
 
void FindCubicRoots (const double coeff[4], double re[3], double im[3])
 
void eigsort (double d[3])
 
void gradSimplex (double *x, double *y, double *z, double *v, double *grad)
 
double ComputeVonMises (double *val)
 
double ComputeScalarRep (int numComp, double *val, int tensorRep=0)
 
void invert_singular_matrix3x3 (double MM[3][3], double II[3][3])
 
bool newton_fd (bool(*func)(fullVector< double > &, fullVector< double > &, void *), fullVector< double > &x, void *data, double relax=1., double tolx=1.e-6)
 
void signedDistancePointTriangle (const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p3, const SPoint3 &p, double &d, SPoint3 &closePt)
 
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 signedDistancePointLine (const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &p, double &distance, SPoint3 &closePt)
 
void signedDistancesPointsLine (std::vector< double > &distances, std::vector< SPoint3 > &closePts, const std::vector< SPoint3 > &pts, const SPoint3 &p1, const SPoint3 &p2)
 
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)
 
int computeDistanceRatio (const double &y, const double &yp, const double &x, const double &xp, double *distance, const double &r1, const double &r2)
 
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 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)
 
int intersection_segments (const SPoint3 &p1, const SPoint3 &p2, const SPoint3 &q1, const SPoint3 &q2, double x[2])
 3D VERSION More...
 
int intersection_segments (const SPoint2 &p1, const SPoint2 &p2, const SPoint2 &q1, const SPoint2 &q2, double x[2])
 
void fillMeanPlane (double res[4], double t1[3], double t2[3], mean_plane &meanPlane)
 
void computeMeanPlaneSimple (const std::vector< SPoint3 > &points, mean_plane &meanPlane)
 
void projectPointToPlane (const SPoint3 &pt, SPoint3 &ptProj, const mean_plane &meanPlane)
 
void projectPointsToPlane (const std::vector< SPoint3 > &pts, std::vector< SPoint3 > &ptsProj, const mean_plane &meanPlane)
 
void transformPointsIntoOrthoBasis (const std::vector< SPoint3 > &ptsProj, std::vector< SPoint3 > &pointsUV, const SPoint3 &ptCG, const mean_plane &meanPlane)
 
bool catenary (double x0, double x1, double y0, double y1, double ys, int N, double *yp)
 

Function Documentation

◆ angle_02pi()

double angle_02pi ( double  A3)

Definition at line 255 of file Numeric.cpp.

Referenced by GFace::computeMeanPlane(), and EndCurve().

Here is the caller graph for this function:

◆ angle_plan()

double angle_plan ( double  v[3],
double  p1[3],
double  p2[3],
double  n[3] 
)

Definition at line 267 of file Numeric.cpp.

Referenced by gmshFace::containsPoint(), myangle(), and gmshFace::normal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ catenary()

bool catenary ( double  x0,
double  x1,
double  y0,
double  y1,
double  ys,
int  N,
double *  yp 
)

Definition at line 1554 of file Numeric.cpp.

Here is the call graph for this function:

◆ changeReferential()

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 
)

Definition at line 942 of file Numeric.cpp.

Referenced by signedDistancesPointsEllipseLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ char2float()

float char2float ( char  c)

Definition at line 464 of file Numeric.cpp.

Referenced by xyzn::angle(), drawArrays(), and smooth_normals::get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ circumCenterXY()

void circumCenterXY ( double *  p1,
double *  p2,
double *  p3,
double *  res 
)

Definition at line 317 of file Numeric.cpp.

Referenced by circumCenterXYZ(), circUV(), and DocRecord::voronoiCell().

Here is the caller graph for this function:

◆ circumCenterXYZ()

void circumCenterXYZ ( double *  p1,
double *  p2,
double *  p3,
double *  res,
double *  uv = nullptr 
)

Definition at line 342 of file Numeric.cpp.

Referenced by MTriangle::circumcenter(), faceCircumCenter(), fourthPoint(), and MTri3::MTri3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeDistanceRatio()

int computeDistanceRatio ( const double &  y,
const double &  yp,
const double &  x,
const double &  xp,
double *  distance,
const double &  r1,
const double &  r2 
)

Definition at line 997 of file Numeric.cpp.

Referenced by signedDistancesPointsEllipseLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeInnerRadiusForQuad()

double computeInnerRadiusForQuad ( double *  x,
double *  y,
int  i 
)

Definition at line 407 of file Numeric.cpp.

Referenced by MQuadrangle::getInnerRadius().

Here is the caller graph for this function:

◆ computeMeanPlaneSimple()

void computeMeanPlaneSimple ( const std::vector< SPoint3 > &  points,
mean_plane meanPlane 
)

Definition at line 1438 of file Numeric.cpp.

Referenced by blyr_manager::add_external_corner(), discreteFace::param::checkPlanar(), and GFace::setMeshMaster().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeScalarRep()

double ComputeScalarRep ( int  numComp,
double *  val,
int  tensorRep = 0 
)

Definition at line 506 of file Numeric.cpp.

Referenced by PViewDataList::_stat(), addVectorElement(), changeCoordinates(), drawNumberGlyphs(), PViewDataGModel::finalize(), getGraphData(), PViewData::getScalarValue(), PViewDataGModel::readMSH(), and saturateVector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ComputeVonMises()

double ComputeVonMises ( double *  val)

Definition at line 496 of file Numeric.cpp.

Referenced by addTensorElement(), and ComputeScalarRep().

Here is the caller graph for this function:

◆ crossProd()

double crossProd ( double  a[3],
double  b[3],
int  i 
)
inline

Definition at line 93 of file Numeric.h.

◆ det2x2()

double det2x2 ( double  mat[2][2])

Definition at line 199 of file Numeric.cpp.

Referenced by intersection_segments(), discreteFace::intersectionWithCircle(), and inv2x2().

Here is the caller graph for this function:

◆ det2x3()

double det2x3 ( double  mat[2][3])

Definition at line 204 of file Numeric.cpp.

Here is the call graph for this function:

◆ det3x3()

double det3x3 ( double  mat[3][3])

Definition at line 126 of file Numeric.cpp.

Referenced by eigenvalue(), MTetrahedron::getVolume(), MPyramid::getVolumeSign(), MHexahedron::getVolumeSign(), MPrism::getVolumeSign(), inv3x3(), inv3x3tran(), and sys3x3().

Here is the caller graph for this function:

◆ eigenvalue()

void eigenvalue ( double  mat[3][3],
double  re[3] 
)

Definition at line 550 of file Numeric.cpp.

Referenced by eigen(), GMSH_EigenvaluesPlugin::execute(), and MaxEigenHessianField::operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eigenvalue2x2()

void eigenvalue2x2 ( double  mat[2][2],
double  v[2] 
)

Definition at line 538 of file Numeric.cpp.

Here is the call graph for this function:

◆ eigsort()

void eigsort ( double  d[3])

Definition at line 634 of file Numeric.cpp.

Referenced by eigenvalue().

Here is the caller graph for this function:

◆ fillMeanPlane()

void fillMeanPlane ( double  res[4],
double  t1[3],
double  t2[3],
mean_plane meanPlane 
)

Definition at line 1412 of file Numeric.cpp.

Referenced by GFace::computeMeanPlane(), and computeMeanPlaneSimple().

Here is the caller graph for this function:

◆ FindCubicRoots()

void FindCubicRoots ( const double  coeff[4],
double  re[3],
double  im[3] 
)

Definition at line 574 of file Numeric.cpp.

Referenced by eigenvalue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ float2char()

char float2char ( float  f)

Definition at line 452 of file Numeric.cpp.

Referenced by VertexArray::_addNormal(), smooth_normals::add(), and smooth_normals::get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gmsh_sign()

template<typename T >
int gmsh_sign ( T const &  value)
inline

◆ gradSimplex()

void gradSimplex ( double *  x,
double *  y,
double *  z,
double *  v,
double *  grad 
)

Definition at line 475 of file Numeric.cpp.

Referenced by GMSH_LevelsetPlugin::_cutAndAddElements(), and IsoSimplex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hypotenuse()

template<class T >
double hypotenuse ( T const &  a,
T const &  b,
T const &  c 
)
inline

Definition at line 23 of file Numeric.h.

Referenced by setLcs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersection_segments() [1/2]

int intersection_segments ( const SPoint2 p1,
const SPoint2 p2,
const SPoint2 q1,
const SPoint2 q2,
double  x[2] 
)

Definition at line 1331 of file Numeric.cpp.

Referenced by recoverEdgeBySwaps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intersection_segments() [2/2]

int intersection_segments ( const SPoint3 p1,
const SPoint3 p2,
const SPoint3 q1,
const SPoint3 q2,
double  x[2] 
)

3D VERSION

Definition at line 1358 of file Numeric.cpp.

Here is the call graph for this function:

◆ inv2x2()

double inv2x2 ( double  mat[2][2],
double  inv[2][2] 
)

Definition at line 214 of file Numeric.cpp.

Referenced by JacobianBasis::getMetricMinAndGradients().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inv3x3()

◆ invert_singular_matrix3x3()

void invert_singular_matrix3x3 ( double  MM[3][3],
double  II[3][3] 
)

Definition at line 650 of file Numeric.cpp.

Referenced by GFace::XYZtoUV().

Here is the caller graph for this function:

◆ matmat()

void matmat ( double  mat1[3][3],
double  mat2[3][3],
double  res[3][3] 
)

Definition at line 54 of file Numeric.cpp.

Referenced by qmTriangle::angles(), and qmTetrahedron::cond().

Here is the caller graph for this function:

◆ matvec()

void matvec ( double  mat[3][3],
double  vec[3],
double  res[3] 
)

Definition at line 47 of file Numeric.cpp.

Referenced by element::interpolateGrad(), and MElement::interpolateGrad().

Here is the caller graph for this function:

◆ myacos()

double myacos ( double  a)

Definition at line 28 of file Numeric.cpp.

Referenced by drawContext::drawArrow3d(), drawContext::drawCylinder(), and drawContext::drawTaperedCylinder().

Here is the caller graph for this function:

◆ myasin()

double myasin ( double  a)

Definition at line 18 of file Numeric.cpp.

Referenced by EndCurve().

Here is the caller graph for this function:

◆ myatan2()

double myatan2 ( double  a,
double  b 
)

Definition at line 12 of file Numeric.cpp.

Referenced by xyzn::angle(), angle_plan(), GFace::computeMeanPlane(), and EndCurve().

Here is the caller graph for this function:

◆ myhypot()

template<class T >
double myhypot ( const T &  a,
const T &  b 
)
inline

Definition at line 18 of file Numeric.h.

◆ newton_fd()

bool newton_fd ( bool(*)(fullVector< double > &, fullVector< double > &, void *)  func,
fullVector< double > &  x,
void *  data,
double  relax = 1.,
double  tolx = 1.e-6 
)

Definition at line 685 of file Numeric.cpp.

Referenced by intersectCurveSurfaceData::apply(), catenary(), IntersectCurvesWithSurface(), and ProjectPointOnSurface().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ norm2()

double norm2 ( double  a[3][3])

Definition at line 38 of file Numeric.cpp.

Referenced by qmTetrahedron::cond(), and edgeSwapTestAngle().

Here is the caller graph for this function:

◆ norm3()

double norm3 ( double  a[3])
inline

Definition at line 119 of file Numeric.h.

Referenced by assemble2d(), assemble3d(), det2x3(), EndCurve(), qmTriangle::gamma(), and norme().

Here is the caller graph for this function:

◆ normal2points()

void normal2points ( double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1,
double  n[3] 
)

Definition at line 85 of file Numeric.cpp.

Referenced by GMSH_NearToFarFieldPlugin::execute(), and MPrism::getEdgeRep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ normal3points()

void normal3points ( double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1,
double  x2,
double  y2,
double  z2,
double  n[3] 
)

Definition at line 76 of file Numeric.cpp.

Referenced by drawSimpleVector(), GMSH_WarpPlugin::execute(), GMSH_NearToFarFieldPlugin::execute(), GFace::fillVertexArray(), MElement::integrateFlux(), MFace::normal(), transferDataStructure(), PViewData::writeSTL(), and writeSTLfaces().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ norme()

◆ planarQuad_xyz2xy()

void planarQuad_xyz2xy ( double *  x,
double *  y,
double *  z,
double *  xn,
double *  yn 
)

Definition at line 376 of file Numeric.cpp.

Referenced by MQuadrangle::getInnerRadius().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pow_int() [1/2]

double pow_int ( const double &  a,
const double &  d 
)
inline

Definition at line 82 of file Numeric.h.

Here is the call graph for this function:

◆ pow_int() [2/2]

◆ prodve()

◆ projectPointsToPlane()

void projectPointsToPlane ( const std::vector< SPoint3 > &  pts,
std::vector< SPoint3 > &  ptsProj,
const mean_plane meanPlane 
)

Definition at line 1514 of file Numeric.cpp.

Referenced by discreteFace::param::checkPlanar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ projectPointToPlane()

void projectPointToPlane ( const SPoint3 pt,
SPoint3 ptProj,
const mean_plane meanPlane 
)

Definition at line 1497 of file Numeric.cpp.

Referenced by blyr_manager::add_external_corner(), and projectPointsToPlane().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prosca()

◆ scalProd()

double scalProd ( double  a[3],
double  b[3] 
)
inline

Definition at line 100 of file Numeric.h.

Referenced by BoxField::computeDistance().

Here is the caller graph for this function:

◆ signedDistancePointLine()

void signedDistancePointLine ( const SPoint3 p1,
const SPoint3 p2,
const SPoint3 p,
double &  distance,
SPoint3 closePt 
)

Definition at line 908 of file Numeric.cpp.

Referenced by backgroundMesh::getAngle(), backgroundMesh::operator()(), signedDistancesPointsEllipseLine(), signedDistancesPointsEllipsePoint(), and signedDistancesPointsLine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signedDistancePointTriangle()

void signedDistancePointTriangle ( const SPoint3 p1,
const SPoint3 p2,
const SPoint3 p3,
const SPoint3 p,
double &  d,
SPoint3 closePt 
)

Definition at line 758 of file Numeric.cpp.

Referenced by discreteFace_rtree_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signedDistancesPointsEllipseLine()

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 
)

Definition at line 1139 of file Numeric.cpp.

Here is the call graph for this function:

◆ signedDistancesPointsEllipsePoint()

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 
)

Definition at line 1105 of file Numeric.cpp.

Here is the call graph for this function:

◆ signedDistancesPointsLine()

void signedDistancesPointsLine ( std::vector< double > &  distances,
std::vector< SPoint3 > &  closePts,
const std::vector< SPoint3 > &  pts,
const SPoint3 p1,
const SPoint3 p2 
)

Definition at line 923 of file Numeric.cpp.

Referenced by GMSH_DistancePlugin::execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ signedDistancesPointsTriangle()

void signedDistancesPointsTriangle ( std::vector< double > &  distances,
std::vector< SPoint3 > &  closePts,
const std::vector< SPoint3 > &  pts,
const SPoint3 p1,
const SPoint3 p2,
const SPoint3 p3 
)

Definition at line 822 of file Numeric.cpp.

Referenced by computeLevelset(), and GMSH_DistancePlugin::execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sys2x2()

int sys2x2 ( double  mat[2][2],
double  b[2],
double  res[2] 
)

◆ sys3x3()

int sys3x3 ( double  mat[3][3],
double  b[3],
double  res[3],
double *  det 
)

Definition at line 147 of file Numeric.cpp.

Referenced by gradSimplex(), sys3x3_with_tol(), MTetrahedron::xyz2uvw(), and tetrahedron::xyz2uvw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sys3x3_with_tol()

int sys3x3_with_tol ( double  mat[3][3],
double  b[3],
double  res[3],
double *  det 
)

Definition at line 177 of file Numeric.cpp.

Referenced by intersectLineTriangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trace2()

double trace2 ( double  mat[3][3])

Definition at line 135 of file Numeric.cpp.

Referenced by eigenvalue().

Here is the caller graph for this function:

◆ trace3x3()

double trace3x3 ( double  mat[3][3])

Definition at line 133 of file Numeric.cpp.

Referenced by eigenvalue().

Here is the caller graph for this function:

◆ transformPointsIntoOrthoBasis()

void transformPointsIntoOrthoBasis ( const std::vector< SPoint3 > &  ptsProj,
std::vector< SPoint3 > &  pointsUV,
const SPoint3 ptCG,
const mean_plane meanPlane 
)

Definition at line 1524 of file Numeric.cpp.

Here is the call graph for this function:

◆ triangle_area()

double triangle_area ( double  p0[3],
double  p1[3],
double  p2[3] 
)

Definition at line 293 of file Numeric.cpp.

Referenced by MFace::approximateArea(), and qmTetrahedron::gamma().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ triangle_area2d()

double triangle_area2d ( double  p0[2],
double  p1[2],
double  p2[2] 
)

Definition at line 309 of file Numeric.cpp.

Referenced by centroidOfPolygon().

Here is the call graph for this function:
Here is the caller graph for this function: