gmsh-TingyuanDoc
0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
Go to the documentation of this file.
9 #ifndef GMSH_LEVELSET_H
10 #define GMSH_LEVELSET_H
21 #include "GmshConfig.h"
29 #if defined(HAVE_POST)
48 #define LSPOINTS 11 // don't define 'POINTS' as it's reserved by win32
73 static std::set<gLevelset *, gLevelsetLessThan>
all_;
88 virtual double operator()(
double x,
double y,
double z)
const {
return 0.; }
97 bool isOnBorder(
const double &x,
const double &y,
const double &
z)
const
103 return std::vector<gLevelset *>();
105 virtual double choose(
double d1,
double d2)
const {
return 0.; }
106 virtual int type()
const {
return 0; }
112 void getRPN(std::vector<gLevelset *> &gLsRPN);
113 double H(
const double &x,
const double &y,
const double &
z)
const
122 case SPHERE: printf(
"SPHERE");
break;
123 case PLANE: printf(
"PLANE");
break;
125 case ELLIPS: printf(
"ELLIPS");
break;
126 case CONE: printf(
"CONE");
break;
127 case QUADRIC: printf(
"QUADRIC");
break;
128 case BOX: printf(
"BOX");
break;
129 case CYLINDER: printf(
"CYLINDER");
break;
130 case CONROD: printf(
"CONROD");
break;
131 case CUT: printf(
"CUT");
break;
132 case UNION: printf(
"UNION");
break;
133 case INTER: printf(
"INTER");
break;
134 case LSMESH: printf(
"LSMESH");
break;
135 case LSPOINTS: printf(
"LSPOINTS");
break;
137 printf(
" Tag=%d\n",
getTag());
148 virtual double operator()(
double x,
double y,
double z)
const = 0;
151 std::vector<gLevelset *> p;
154 double choose(
double d1,
double d2)
const
156 Msg::Error(
"Cannot use function \"choose\" with a primitive!\n");
169 const double &R,
int tag = 0);
173 return sqrt((
xc - x) * (
xc - x) + (
yc - y) * (
yc - y) +
176 return (-
r - sqrt((
xc - x) * (
xc - x) + (
yc - y) * (
yc - y) +
179 void gradient(
double x,
double y,
double z,
double &dfdx,
double &dfdy,
181 void hessian(
double x,
double y,
double z,
double &dfdxx,
double &dfdxy,
182 double &dfdxz,
double &dfdyx,
double &dfdyy,
double &dfdyz,
183 double &dfdzx,
double &dfdzy,
double &dfdzz)
const;
194 const double _d,
int tag = 0)
204 gLevelsetPlane(
const double *pt1,
const double *pt2,
const double *pt3,
212 return a * x +
b * y +
c *
z +
d;
223 std::map<SPoint3, double>
mapP;
229 bool isLocal =
false)
const;
245 virtual double operator()(
double x,
double y,
double z)
const;
246 void computeLS(std::vector<MVertex *> &vert);
258 void Ax(
const double x[3],
double res[3],
double fact = 1.0);
259 void xAx(
const double x[3],
double &res,
double fact = 1.0);
266 double operator()(
double x,
double y,
double z)
const;
282 const double &b,
const double &
c,
int tag = 0);
300 const double &y2,
const double &z2,
const double &
z,
301 const double &
c,
int tag = 0);
318 double sigma,
int tag = 0);
320 double operator()(
double x,
double y,
double z)
const;
335 int c = 3,
int tag = 0);
337 double operator()(
double x,
double y,
double z)
const;
347 double operator()(
double x,
double y,
double z)
const;
357 double operator()(
double x,
double y,
double z)
const;
358 void gradient(
double x,
double y,
double z,
double &dfdx,
double &dfdy,
360 void hessian(
double x,
double y,
double z,
double &dfdxx,
double &dfdxy,
361 double &dfdxz,
double &dfdyx,
double &dfdyy,
double &dfdyz,
362 double &dfdzx,
double &dfdzy,
double &dfdzz)
const;
374 return (*
_f)(x, y,
z);
379 #if defined(HAVE_ANN)
382 std::vector<GEntity *> _entities;
383 std::vector<MVertex *> _vertices;
384 std::multimap<MVertex *, MElement *> _v2e;
388 gLevelsetDistMesh(
GModel *gm,
const std::string &physical,
int nbClose = 5,
390 double operator()(
double x,
double y,
double z)
const;
391 ~gLevelsetDistMesh();
396 #if defined(HAVE_POST)
402 gLevelsetPostView(
int index,
int tag = 0);
405 if(_octree)
delete _octree;
407 double operator()(
double x,
double y,
double z)
const;
418 double operator()(
double x,
double y,
double z)
const;
419 void gradient(
double x,
double y,
double z,
double &dfdx,
double &dfdy,
421 void hessian(
double x,
double y,
double z,
double &dfdxx,
double &dfdxy,
422 double &dfdxz,
double &dfdyx,
double &dfdyy,
double &dfdyz,
423 double &dfdzx,
double &dfdzy,
double &dfdzz)
const;
428 double &xb,
double &yb,
double &curvRad,
441 double operator()(
double x,
double y,
double z)
const;
470 for(
int i = 1; i < (int)
children.size(); i++) {
481 virtual double choose(
double d1,
double d2)
const = 0;
490 if(
children.size() != 1)
return false;
508 return -(*ls)(x, y,
z);
512 virtual double choose(
double d1,
double d2)
const
529 double choose(
double d1,
double d2)
const
531 return (d1 > -d2) ? d1 : -d2;
549 double choose(
double d1,
double d2)
const
551 return (d1 < d2) ? d1 : d2;
567 double choose(
double d1,
double d2)
const
569 return (d1 > d2) ? d1 : d2;
580 if(p.size() != 2) printf(
"Error : gLevelsetCrack needs 2 levelsets\n");
586 double choose(
double d1,
double d2)
const
588 return (d1 > d2) ? d1 : d2;
604 return (*
Ls)(x, y,
z);
628 gLevelsetBox(
const double *pt,
const double *dir1,
const double *dir2,
629 const double *dir3,
const double &a,
const double &b,
630 const double &
c,
int tag = 0);
639 gLevelsetBox(
const double *pt1,
const double *pt2,
const double *pt3,
640 const double *pt4,
const double *pt5,
const double *pt6,
641 const double *pt7,
const double *pt8,
int tag = 0);
657 const std::vector<double> &dir,
const double &R,
658 const double &
H,
int tag = 0);
660 const double &
H,
int tag = 0);
671 const double &r,
const double &
H,
int tag = 0);
707 gLevelsetConrod(
const double *pt,
const double *dir1,
const double *dir2,
708 const double &H1,
const double &H2,
const double &H3,
709 const double &R1,
const double &r1,
const double &R2,
710 const double &r2,
const double &L1,
const double &L2,
711 const double &E,
int tag = 0);
void evalRbfDer(int p, int index, const fullMatrix< double > &cntrs, const fullMatrix< double > &nodes, const fullMatrix< double > &fValues, fullMatrix< double > &fApprox, bool isLocal=false) const
virtual gLevelset * clone() const
double choose(double d1, double d2) const
virtual gLevelset * clone() const
void hessian(double x, double y, double z, double &dfdxx, double &dfdxy, double &dfdxz, double &dfdyx, double &dfdyy, double &dfdyz, double &dfdzx, double &dfdzy, double &dfdzz) const
virtual int getTag() const
void computeRotationMatrix(const double dir[3], double t[3][3])
void hessian(double x, double y, double z, double &dfdxx, double &dfdxy, double &dfdxz, double &dfdyx, double &dfdyy, double &dfdyz, double &dfdzx, double &dfdzy, double &dfdzz) const
gLevelsetCylinder(const std::vector< double > &pt, const std::vector< double > &dir, const double &R, const double &H, int tag=0)
std::vector< double > iso_x
gLevelsetGeneralQuadric(const double *pt, const double *dir, const double &x2, const double &y2, const double &z2, const double &z, const double &c, int tag=0)
void getPrimitives(std::vector< gLevelset * > &primitives)
virtual gLevelset * clone() const
virtual gLevelset * clone() const
void computeLS(std::vector< MVertex * > &vert)
std::vector< gLevelset * > getChildren() const
void hessian(double x, double y, double z, double &dfdxx, double &dfdxy, double &dfdxz, double &dfdyx, double &dfdyy, double &dfdyz, double &dfdzx, double &dfdzy, double &dfdzz) const
double angle(const SVector3 &a, const SVector3 &b)
virtual double choose(double d1, double d2) const
gLevelsetNACA00(double x0, double y0, double c, double t)
static double c(int i, int j, fullMatrix< double > &CA, const std::vector< SPoint3 > &P, const std::vector< SPoint3 > &Q)
static void Error(const char *fmt,...)
gLevelsetUnion(const std::vector< gLevelset * > &p, bool delC=false, int tag=0)
void f(int n, double u, double *val)
virtual double operator()(double x, double y, double z) const
gLevelsetQuadric(int tag=0)
double choose(double d1, double d2) const
gLevelsetCut(const std::vector< gLevelset * > &p, bool delC=false, int tag=0)
virtual bool isPrimitive() const
double operator()(double x, double y, double z) const
double operator()(double x, double y, double z) const
double choose(double d1, double d2) const
bool isInsideDomain(const double &x, const double &y, const double &z) const
gLevelsetConrod(const double *pt, const double *dir1, const double *dir2, const double &H1, const double &H2, const double &H3, const double &R1, const double &r1, const double &R2, const double &r2, const double &L1, const double &L2, const double &E, int tag=0)
virtual gLevelset * clone() const
gLevelsetEllipsoid(const double *pt, const double *dir, const double &a, const double &b, const double &c, int tag=0)
void Ax(const double x[3], double res[3], double fact=1.0)
virtual double operator()(double x, double y, double z) const =0
bool operator()(const gLevelset *l1, const gLevelset *l2) const
bool isOnBorder(const double &x, const double &y, const double &z) const
void setup_level_set(const fullMatrix< double > &cntrs, fullMatrix< double > &level_set_nodes, fullMatrix< double > &level_set_funvals)
std::vector< gLevelset * > getChildren() const
static const short insideDomain
double operator()(double x, double y, double z) const
double operator()(double x, double y, double z) const
gLevelsetSimpleFunction(simpleFunction< double > *f, int tag=0)
double operator()(double x, double y, double z) const
fullMatrix< double > points
gLevelsetGenCylinder(const double *pt, const double *dir, const double &R, int tag=0)
void xAx(const double x[3], double &res, double fact=1.0)
virtual double choose(double d1, double d2) const
std::vector< double > iso_y
double choose(double d1, double d2) const
void getClosestBndPoint(const double x, const double y, const double z, double &xb, double &yb, double &curvRad, bool &in) const
virtual gLevelset * clone() const
virtual gLevelset * clone() const
virtual gLevelset * clone() const
double operator()(double x, double y, double z) const
virtual gLevelset * clone() const
gLevelsetMathEvalAll(std::vector< std::string > f, int tag=0)
virtual double operator()(double x, double y, double z) const
static gLevelset * find(int tag)
void norm(const double *vec, double *norm)
fullMatrix< double > generateRbfMat(int p, int index, const fullMatrix< double > &nodes1, const fullMatrix< double > &nodes2) const
fullMatrix< double > matAInv
double operator()(double x, double y, double z) const
virtual int type() const =0
double H(const double &x, const double &y, const double &z) const
gLevelsetIntersection(const std::vector< gLevelset * > &p, bool delC=false, int tag=0)
void RbfOp(int p, int index, const fullMatrix< double > &cntrs, const fullMatrix< double > &nodes, fullMatrix< double > &D, bool isLocal=false) const
double choose(double d1, double d2) const
void gradient(double x, double y, double z, double &dfdx, double &dfdy, double &dfdz) const
gLevelsetMathEval(const std::string &f, int tag=0)
void gradient(double x, double y, double z, double &dfdx, double &dfdy, double &dfdz) const
void getPrimitivesPO(std::vector< gLevelset * > &primitives)
gLevelsetPrimitive(const gLevelsetPrimitive &lv)
virtual std::vector< gLevelset * > getChildren() const
double choose(double d1, double d2) const
gLevelsetReverse(gLevelset *p, int tag=0)
double operator()(double x, double y, double z) const
gLevelsetBox(const double *pt, const double *dir1, const double *dir2, const double *dir3, const double &a, const double &b, const double &c, int tag=0)
gLevelsetPrimitive(int tag)
void getRPN(std::vector< gLevelset * > &gLsRPN)
virtual int type() const =0
std::map< SPoint3, double > mapP
void gradient(double x, double y, double z, double &dfdx, double &dfdy, double &dfdz) const
gLevelsetShamrock(double xmid, double ymid, double zmid, double a, double b, int c=3, int tag=0)
virtual double operator()(double x, double y, double z) const
gLevelsetIntersection(const gLevelsetIntersection &lv)
void translate(const double transl[3])
gLevelsetPopcorn(double xc, double yc, double zc, double r0, double A, double sigma, int tag=0)
double operator()(double x, double y, double z) const
virtual bool isPrimitive() const
gLevelsetPlane(const double _a, const double _b, const double _c, const double _d, int tag=0)
std::vector< gLevelset * > getChildren() const
gLevelsetUnion(const gLevelsetUnion &lv)
gLevelsetCut(const gLevelsetCut &lv)
gLevelsetSphere(const double &x, const double &y, const double &z, const double &R, int tag=0)
gLevelsetCrack(std::vector< gLevelset * > p, bool delC=false, int tag=0)
double operator()(double x, double y, double z) const
virtual double operator()(double x, double y, double z) const
fullMatrix< double > surf
virtual bool isPrimitive() const
~gLevelsetSimpleFunction()
virtual gLevelset * clone() const
virtual gLevelset * clone() const
gLevelsetImproved(int tag=0)
static void add(gLevelset *l)
virtual int type() const =0
std::vector< GEntity * > entities
virtual gLevelset * clone() const
static std::set< gLevelset *, gLevelsetLessThan > all_
gLevelsetCone(const double *pt, const double *dir, const double &angle, int tag=0)
virtual bool isPrimitive() const
gLevelsetYarn(int dim, int phys, double minA, double majA, int type, int tag=0)
void rotate(const double rotate[3][3])
simpleFunction< double > * _f
bool isOutsideDomain(const double &x, const double &y, const double &z) const
gLevelsetPoints(fullMatrix< double > &_centers, int tag=0)
virtual gLevelset * clone() const
virtual ~gLevelsetQuadric()