mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
Merge branch 'pointnd_to_point' into 'master'
Pointnd to point See merge request jschoeberl/netgen!255
This commit is contained in:
commit
e4017b84e9
@ -193,8 +193,8 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Meshing2 ::
|
void Meshing2 ::
|
||||||
GetChartBoundary (NgArray<Point2d> & points,
|
GetChartBoundary (NgArray<Point<2>> & points,
|
||||||
NgArray<Point3d> & points3d,
|
NgArray<Point<3>> & points3d,
|
||||||
NgArray<INDEX_2> & lines, double h) const
|
NgArray<INDEX_2> & lines, double h) const
|
||||||
{
|
{
|
||||||
points.SetSize (0);
|
points.SetSize (0);
|
||||||
@ -279,8 +279,8 @@ namespace netgen
|
|||||||
|
|
||||||
StartMesh();
|
StartMesh();
|
||||||
|
|
||||||
NgArray<Point2d> chartboundpoints;
|
NgArray<Point<2>> chartboundpoints;
|
||||||
NgArray<Point3d> chartboundpoints3d;
|
NgArray<Point<3>> chartboundpoints3d;
|
||||||
NgArray<INDEX_2> chartboundlines;
|
NgArray<INDEX_2> chartboundlines;
|
||||||
|
|
||||||
// illegal points: points with more then 50 elements per node
|
// illegal points: points with more then 50 elements per node
|
||||||
@ -519,7 +519,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Point2d p12d, p22d;
|
// Point2d p12d, p22d;
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
{
|
{
|
||||||
@ -571,8 +571,8 @@ namespace netgen
|
|||||||
*testout << "2d points: " << endl << plainpoints << endl;
|
*testout << "2d points: " << endl << plainpoints << endl;
|
||||||
|
|
||||||
|
|
||||||
p12d = plainpoints.Get(1);
|
// p12d = plainpoints.Get(1);
|
||||||
p22d = plainpoints.Get(2);
|
// p22d = plainpoints.Get(2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// last idea on friday
|
// last idea on friday
|
||||||
@ -625,15 +625,12 @@ namespace netgen
|
|||||||
if (!morerisc)
|
if (!morerisc)
|
||||||
{
|
{
|
||||||
// use one end of line
|
// use one end of line
|
||||||
int pini, pouti;
|
int pini = loclines.Get(i).I(innerp);
|
||||||
Vec2d v;
|
int pouti = loclines.Get(i).I(3-innerp);
|
||||||
|
|
||||||
pini = loclines.Get(i).I(innerp);
|
const auto& pin = plainpoints.Get(pini);
|
||||||
pouti = loclines.Get(i).I(3-innerp);
|
const auto& pout = plainpoints.Get(pouti);
|
||||||
|
auto v = pout - pin;
|
||||||
Point2d pin (plainpoints.Get(pini));
|
|
||||||
Point2d pout (plainpoints.Get(pouti));
|
|
||||||
v = pout - pin;
|
|
||||||
double len = v.Length();
|
double len = v.Length();
|
||||||
if (len <= 1e-6)
|
if (len <= 1e-6)
|
||||||
(*testout) << "WARNING(js): inner-outer: short vector" << endl;
|
(*testout) << "WARNING(js): inner-outer: short vector" << endl;
|
||||||
@ -647,12 +644,12 @@ namespace netgen
|
|||||||
v *= -1;
|
v *= -1;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Point2d newpout = pin + 1000 * v;
|
Point<2> newpout = pin + 1000. * v;
|
||||||
newpout = pout;
|
newpout = pout;
|
||||||
|
|
||||||
|
|
||||||
plainpoints.Append (newpout);
|
plainpoints.Append (newpout);
|
||||||
Point3d pout3d = locpoints.Get(pouti);
|
const auto& pout3d = locpoints.Get(pouti);
|
||||||
locpoints.Append (pout3d);
|
locpoints.Append (pout3d);
|
||||||
|
|
||||||
plainzones.Append (0);
|
plainzones.Append (0);
|
||||||
@ -706,7 +703,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
if (plainzones[i] < 0)
|
if (plainzones[i] < 0)
|
||||||
{
|
{
|
||||||
plainpoints[i] = Point2d (1e4, 1e4);
|
plainpoints[i] = {1e4, 1e4};
|
||||||
legalpoints[i] = 0;
|
legalpoints[i] = 0;
|
||||||
}
|
}
|
||||||
if (pindex[i] == -1)
|
if (pindex[i] == -1)
|
||||||
@ -1780,12 +1777,12 @@ namespace netgen
|
|||||||
|
|
||||||
if (pi1 >= 1 && pi2 >= 1)
|
if (pi1 >= 1 && pi2 >= 1)
|
||||||
{
|
{
|
||||||
Point2d p1 = plainpoints.Get(pi1);
|
const auto& p1 = plainpoints.Get(pi1);
|
||||||
Point2d p2 = plainpoints.Get(pi2);
|
const auto& p2 = plainpoints.Get(pi2);
|
||||||
|
|
||||||
glBegin (GL_LINES);
|
glBegin (GL_LINES);
|
||||||
glVertex3f (scalex * p1.X() + shiftx, scaley * p1.Y() + shifty, -5);
|
glVertex3f (scalex * p1[0] + shiftx, scaley * p1[1] + shifty, -5);
|
||||||
glVertex3f (scalex * p2.X() + shiftx, scaley * p2.Y() + shifty, -5);
|
glVertex3f (scalex * p2[0] + shiftx, scaley * p2[1] + shifty, -5);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1796,8 +1793,8 @@ namespace netgen
|
|||||||
glBegin (GL_POINTS);
|
glBegin (GL_POINTS);
|
||||||
for (int i = 1; i <= plainpoints.Size(); i++)
|
for (int i = 1; i <= plainpoints.Size(); i++)
|
||||||
{
|
{
|
||||||
Point2d p = plainpoints.Get(i);
|
const auto& p = plainpoints.Get(i);
|
||||||
glVertex3f (scalex * p.X() + shiftx, scaley * p.Y() + shifty, -5);
|
glVertex3f (scalex * p[0] + shiftx, scaley * p[1] + shifty, -5);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ protected:
|
|||||||
/*
|
/*
|
||||||
get (projected) boundary of current chart
|
get (projected) boundary of current chart
|
||||||
*/
|
*/
|
||||||
virtual void GetChartBoundary (NgArray<Point2d> & points,
|
virtual void GetChartBoundary (NgArray<Point<2>> & points,
|
||||||
NgArray<Point3d> & points3d,
|
NgArray<Point<3>> & points3d,
|
||||||
NgArray<INDEX_2> & lines, double p) const;
|
NgArray<INDEX_2> & lines, double p) const;
|
||||||
|
|
||||||
virtual double Area () const;
|
virtual double Area () const;
|
||||||
|
@ -409,7 +409,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Element2d ::
|
void Element2d ::
|
||||||
GetIntegrationPoint (int ip, Point2d & p, double & weight) const
|
GetIntegrationPoint (int ip, Point<2> & p, double & weight) const
|
||||||
{
|
{
|
||||||
static double eltriqp[1][3] =
|
static double eltriqp[1][3] =
|
||||||
{
|
{
|
||||||
@ -433,8 +433,8 @@ namespace netgen
|
|||||||
PrintSysError ("Element2d::GetIntegrationPoint, illegal type ", int(typ));
|
PrintSysError ("Element2d::GetIntegrationPoint, illegal type ", int(typ));
|
||||||
}
|
}
|
||||||
|
|
||||||
p.X() = pp[0];
|
p[0] = pp[0];
|
||||||
p.Y() = pp[1];
|
p[1] = pp[1];
|
||||||
weight = pp[2];
|
weight = pp[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ namespace netgen
|
|||||||
pmat.SetSize (2, np);
|
pmat.SetSize (2, np);
|
||||||
dshape.SetSize (2, np);
|
dshape.SetSize (2, np);
|
||||||
|
|
||||||
Point2d p;
|
Point<2> p;
|
||||||
double w;
|
double w;
|
||||||
|
|
||||||
GetPointMatrix (points, pmat);
|
GetPointMatrix (points, pmat);
|
||||||
@ -492,7 +492,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Element2d :: GetShape (const Point2d & p, Vector & shape) const
|
void Element2d :: GetShape (const Point<2> & p, Vector & shape) const
|
||||||
{
|
{
|
||||||
if (shape.Size() != GetNP())
|
if (shape.Size() != GetNP())
|
||||||
{
|
{
|
||||||
@ -503,15 +503,15 @@ namespace netgen
|
|||||||
switch (typ)
|
switch (typ)
|
||||||
{
|
{
|
||||||
case TRIG:
|
case TRIG:
|
||||||
shape(0) = 1 - p.X() - p.Y();
|
shape(0) = 1 - p[0] - p[1];
|
||||||
shape(1) = p.X();
|
shape(1) = p[0];
|
||||||
shape(2) = p.Y();
|
shape(2) = p[1];
|
||||||
break;
|
break;
|
||||||
case QUAD:
|
case QUAD:
|
||||||
shape(0) = (1-p.X()) * (1-p.Y());
|
shape(0) = (1-p[0]) * (1-p[1]);
|
||||||
shape(1) = p.X() * (1-p.Y());
|
shape(1) = p[0] * (1-p[1]);
|
||||||
shape(2) = p.X() * p.Y();
|
shape(2) = p[0] * p[1];
|
||||||
shape(3) = (1-p.X()) * p.Y();
|
shape(3) = (1-p[0]) * p[1];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintSysError ("Element2d::GetShape, illegal type ", int(typ));
|
PrintSysError ("Element2d::GetShape, illegal type ", int(typ));
|
||||||
@ -581,7 +581,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
void Element2d ::
|
void Element2d ::
|
||||||
GetDShape (const Point2d & p, DenseMatrix & dshape) const
|
GetDShape (const Point<2> & p, DenseMatrix & dshape) const
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (dshape.Height() != 2 || dshape.Width() != np)
|
if (dshape.Height() != 2 || dshape.Width() != np)
|
||||||
@ -602,14 +602,14 @@ namespace netgen
|
|||||||
dshape.Elem(2, 3) = 1;
|
dshape.Elem(2, 3) = 1;
|
||||||
break;
|
break;
|
||||||
case QUAD:
|
case QUAD:
|
||||||
dshape.Elem(1, 1) = -(1-p.Y());
|
dshape.Elem(1, 1) = -(1-p[1]);
|
||||||
dshape.Elem(1, 2) = (1-p.Y());
|
dshape.Elem(1, 2) = (1-p[1]);
|
||||||
dshape.Elem(1, 3) = p.Y();
|
dshape.Elem(1, 3) = p[1];
|
||||||
dshape.Elem(1, 4) = -p.Y();
|
dshape.Elem(1, 4) = -p[1];
|
||||||
dshape.Elem(2, 1) = -(1-p.X());
|
dshape.Elem(2, 1) = -(1-p[0]);
|
||||||
dshape.Elem(2, 2) = -p.X();
|
dshape.Elem(2, 2) = -p[0];
|
||||||
dshape.Elem(2, 3) = p.X();
|
dshape.Elem(2, 3) = p[0];
|
||||||
dshape.Elem(2, 4) = (1-p.X());
|
dshape.Elem(2, 4) = (1-p[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -728,7 +728,7 @@ namespace netgen
|
|||||||
|
|
||||||
double Element2d ::
|
double Element2d ::
|
||||||
CalcJacobianBadnessDirDeriv (const NgArray<Point<2>> & points,
|
CalcJacobianBadnessDirDeriv (const NgArray<Point<2>> & points,
|
||||||
int pi, Vec2d & dir, double & dd) const
|
int pi, Vec<2> & dir, double & dd) const
|
||||||
{
|
{
|
||||||
if (typ == QUAD)
|
if (typ == QUAD)
|
||||||
{
|
{
|
||||||
@ -737,14 +737,14 @@ namespace netgen
|
|||||||
|
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
{
|
{
|
||||||
const Point2d & p = points.Get( (*this)[j] );
|
const auto& p = points.Get( (*this)[j] );
|
||||||
pmat(0, j) = p.X();
|
pmat(0, j) = p[0];
|
||||||
pmat(1, j) = p.Y();
|
pmat(1, j) = p[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
vmat = 0.0;
|
vmat = 0.0;
|
||||||
vmat(0, pi-1) = dir.X();
|
vmat(0, pi-1) = dir[0];
|
||||||
vmat(1, pi-1) = dir.Y();
|
vmat(1, pi-1) = dir[1];
|
||||||
|
|
||||||
double err = 0;
|
double err = 0;
|
||||||
dd = 0;
|
dd = 0;
|
||||||
@ -814,8 +814,8 @@ namespace netgen
|
|||||||
GetPointMatrix (points, pmat);
|
GetPointMatrix (points, pmat);
|
||||||
|
|
||||||
vmat = 0.0;
|
vmat = 0.0;
|
||||||
vmat.Elem(1, pi) = dir.X();
|
vmat.Elem(1, pi) = dir[0];
|
||||||
vmat.Elem(2, pi) = dir.Y();
|
vmat.Elem(2, pi) = dir[1];
|
||||||
|
|
||||||
|
|
||||||
double err = 0;
|
double err = 0;
|
||||||
@ -879,9 +879,9 @@ namespace netgen
|
|||||||
|
|
||||||
for (i = 1; i <= GetNP(); i++)
|
for (i = 1; i <= GetNP(); i++)
|
||||||
{
|
{
|
||||||
Point3d p = points[PNum(i)];
|
const auto& p = points[PNum(i)];
|
||||||
pmat.Elem(1, i) = p.X() * t1(0) + p.Y() * t1(1) + p.Z() * t1(2);
|
pmat.Elem(1, i) = p[0] * t1(0) + p[1] * t1(1) + p[2] * t1(2);
|
||||||
pmat.Elem(2, i) = p.X() * t2(0) + p.Y() * t2(1) + p.Z() * t2(2);
|
pmat.Elem(2, i) = p[0] * t2(0) + p[1] * t2(1) + p[2] * t2(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
double err = 0;
|
double err = 0;
|
||||||
@ -921,10 +921,10 @@ namespace netgen
|
|||||||
for (int i = 1; i <= GetNIP(); i++)
|
for (int i = 1; i <= GetNIP(); i++)
|
||||||
{
|
{
|
||||||
IntegrationPointData * ipd = new IntegrationPointData;
|
IntegrationPointData * ipd = new IntegrationPointData;
|
||||||
Point2d hp;
|
Point<2> hp;
|
||||||
GetIntegrationPoint (i, hp, ipd->weight);
|
GetIntegrationPoint (i, hp, ipd->weight);
|
||||||
ipd->p(0) = hp.X();
|
ipd->p(0) = hp[0];
|
||||||
ipd->p(1) = hp.Y();
|
ipd->p(1) = hp[1];
|
||||||
ipd->p(2) = 0;
|
ipd->p(2) = 0;
|
||||||
|
|
||||||
ipd->shape.SetSize(GetNP());
|
ipd->shape.SetSize(GetNP());
|
||||||
@ -1828,8 +1828,6 @@ namespace netgen
|
|||||||
|
|
||||||
void Element :: GetShape (const Point<3> & hp, Vector & shape) const
|
void Element :: GetShape (const Point<3> & hp, Vector & shape) const
|
||||||
{
|
{
|
||||||
Point3d p = hp;
|
|
||||||
|
|
||||||
if (shape.Size() != GetNP())
|
if (shape.Size() != GetNP())
|
||||||
{
|
{
|
||||||
cerr << "Element::GetShape: Length not fitting" << endl;
|
cerr << "Element::GetShape: Length not fitting" << endl;
|
||||||
@ -1840,18 +1838,18 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
case TET:
|
case TET:
|
||||||
{
|
{
|
||||||
shape(0) = 1 - p.X() - p.Y() - p.Z();
|
shape(0) = 1 - hp[0] - hp[1] - hp[2];
|
||||||
shape(1) = p.X();
|
shape(1) = hp[0];
|
||||||
shape(2) = p.Y();
|
shape(2) = hp[1];
|
||||||
shape(3) = p.Z();
|
shape(3) = hp[2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TET10:
|
case TET10:
|
||||||
{
|
{
|
||||||
double lam1 = 1 - p.X() - p.Y() - p.Z();
|
double lam1 = 1 - hp[0] - hp[1] - hp[2];
|
||||||
double lam2 = p.X();
|
double lam2 = hp[0];
|
||||||
double lam3 = p.Y();
|
double lam3 = hp[1];
|
||||||
double lam4 = p.Z();
|
double lam4 = hp[2];
|
||||||
|
|
||||||
shape(4) = 4 * lam1 * lam2;
|
shape(4) = 4 * lam1 * lam2;
|
||||||
shape(5) = 4 * lam1 * lam3;
|
shape(5) = 4 * lam1 * lam3;
|
||||||
@ -1869,7 +1867,6 @@ namespace netgen
|
|||||||
|
|
||||||
case PRISM:
|
case PRISM:
|
||||||
{
|
{
|
||||||
Point<3> hp = p;
|
|
||||||
shape(0) = hp(0) * (1-hp(2));
|
shape(0) = hp(0) * (1-hp(2));
|
||||||
shape(1) = hp(1) * (1-hp(2));
|
shape(1) = hp(1) * (1-hp(2));
|
||||||
shape(2) = (1-hp(0)-hp(1)) * (1-hp(2));
|
shape(2) = (1-hp(0)-hp(1)) * (1-hp(2));
|
||||||
@ -1880,7 +1877,6 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
case HEX:
|
case HEX:
|
||||||
{
|
{
|
||||||
Point<3> hp = p;
|
|
||||||
shape(0) = (1-hp(0))*(1-hp(1))*(1-hp(2));
|
shape(0) = (1-hp(0))*(1-hp(1))*(1-hp(2));
|
||||||
shape(1) = ( hp(0))*(1-hp(1))*(1-hp(2));
|
shape(1) = ( hp(0))*(1-hp(1))*(1-hp(2));
|
||||||
shape(2) = ( hp(0))*( hp(1))*(1-hp(2));
|
shape(2) = ( hp(0))*( hp(1))*(1-hp(2));
|
||||||
@ -2071,8 +2067,6 @@ namespace netgen
|
|||||||
void Element ::
|
void Element ::
|
||||||
GetDShape (const Point<3> & hp, DenseMatrix & dshape) const
|
GetDShape (const Point<3> & hp, DenseMatrix & dshape) const
|
||||||
{
|
{
|
||||||
Point3d p = hp;
|
|
||||||
|
|
||||||
int np = GetNP();
|
int np = GetNP();
|
||||||
if (dshape.Height() != 3 || dshape.Width() != np)
|
if (dshape.Height() != 3 || dshape.Width() != np)
|
||||||
{
|
{
|
||||||
@ -2083,16 +2077,16 @@ namespace netgen
|
|||||||
double eps = 1e-6;
|
double eps = 1e-6;
|
||||||
Vector shaper(np), shapel(np);
|
Vector shaper(np), shapel(np);
|
||||||
|
|
||||||
for (int i = 1; i <= 3; i++)
|
for (auto i : Range(3))
|
||||||
{
|
{
|
||||||
Point3d pr(p), pl(p);
|
Point<3> pr(hp), pl(hp);
|
||||||
pr.X(i) += eps;
|
pr[i] += eps;
|
||||||
pl.X(i) -= eps;
|
pl[i] -= eps;
|
||||||
|
|
||||||
GetShape (pr, shaper);
|
GetShape (pr, shaper);
|
||||||
GetShape (pl, shapel);
|
GetShape (pl, shapel);
|
||||||
for (int j = 0; j < np; j++)
|
for (int j = 0; j < np; j++)
|
||||||
dshape(i-1, j) = (shaper(j) - shapel(j)) / (2 * eps);
|
dshape(i, j) = (shaper(j) - shapel(j)) / (2 * eps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2179,10 +2173,10 @@ namespace netgen
|
|||||||
int np = GetNP();
|
int np = GetNP();
|
||||||
for (int i = 1; i <= np; i++)
|
for (int i = 1; i <= np; i++)
|
||||||
{
|
{
|
||||||
const Point3d & p = points[PNum(i)];
|
const auto& p = points[PNum(i)];
|
||||||
pmat.Elem(1, i) = p.X();
|
pmat.Elem(1, i) = p[0];
|
||||||
pmat.Elem(2, i) = p.Y();
|
pmat.Elem(2, i) = p[1];
|
||||||
pmat.Elem(3, i) = p.Z();
|
pmat.Elem(3, i) = p[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2513,8 +2507,7 @@ namespace netgen
|
|||||||
void FaceDescriptor :: DoArchive (Archive & ar)
|
void FaceDescriptor :: DoArchive (Archive & ar)
|
||||||
{
|
{
|
||||||
ar & surfnr & domin & domout & tlosurf & bcprop
|
ar & surfnr & domin & domout & tlosurf & bcprop
|
||||||
& surfcolour.X() & surfcolour.Y() & surfcolour.Z()
|
& surfcolour & bcname
|
||||||
& bcname
|
|
||||||
& domin_singular & domout_singular ;
|
& domin_singular & domout_singular ;
|
||||||
// don't need: firstelement
|
// don't need: firstelement
|
||||||
}
|
}
|
||||||
|
@ -578,19 +578,19 @@ namespace netgen
|
|||||||
|
|
||||||
/// get number of 'integration points'
|
/// get number of 'integration points'
|
||||||
int GetNIP () const;
|
int GetNIP () const;
|
||||||
void GetIntegrationPoint (int ip, Point2d & p, double & weight) const;
|
void GetIntegrationPoint (int ip, Point<2> & p, double & weight) const;
|
||||||
|
|
||||||
void GetTransformation (int ip, const NgArray<Point<2>> & points,
|
void GetTransformation (int ip, const NgArray<Point<2>> & points,
|
||||||
class DenseMatrix & trans) const;
|
class DenseMatrix & trans) const;
|
||||||
void GetTransformation (int ip, class DenseMatrix & pmat,
|
void GetTransformation (int ip, class DenseMatrix & pmat,
|
||||||
class DenseMatrix & trans) const;
|
class DenseMatrix & trans) const;
|
||||||
|
|
||||||
void GetShape (const Point2d & p, class Vector & shape) const;
|
void GetShape (const Point<2> & p, class Vector & shape) const;
|
||||||
void GetShapeNew (const Point<2> & p, class FlatVector & shape) const;
|
void GetShapeNew (const Point<2> & p, class FlatVector & shape) const;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void GetShapeNew (const Point<2,T> & p, TFlatVector<T> shape) const;
|
void GetShapeNew (const Point<2,T> & p, TFlatVector<T> shape) const;
|
||||||
/// matrix 2 * np
|
/// matrix 2 * np
|
||||||
void GetDShape (const Point2d & p, class DenseMatrix & dshape) const;
|
void GetDShape (const Point<2> & p, class DenseMatrix & dshape) const;
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void GetDShapeNew (const Point<2,T> & p, class MatrixFixWidth<2,T> & dshape) const;
|
void GetDShapeNew (const Point<2,T> & p, class MatrixFixWidth<2,T> & dshape) const;
|
||||||
|
|
||||||
@ -605,7 +605,7 @@ namespace netgen
|
|||||||
double CalcJacobianBadness (const T_POINTS & points,
|
double CalcJacobianBadness (const T_POINTS & points,
|
||||||
const Vec<3> & n) const;
|
const Vec<3> & n) const;
|
||||||
double CalcJacobianBadnessDirDeriv (const NgArray<Point<2>> & points,
|
double CalcJacobianBadnessDirDeriv (const NgArray<Point<2>> & points,
|
||||||
int pi, Vec2d & dir, double & dd) const;
|
int pi, Vec<2> & dir, double & dd) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1128,7 +1128,7 @@ namespace netgen
|
|||||||
// Add capability to store surface colours along with
|
// Add capability to store surface colours along with
|
||||||
// other face data
|
// other face data
|
||||||
/// surface colour (Default: R=0.0 ; G=1.0 ; B=0.0)
|
/// surface colour (Default: R=0.0 ; G=1.0 ; B=0.0)
|
||||||
Vec3d surfcolour;
|
Vec<3> surfcolour;
|
||||||
|
|
||||||
///
|
///
|
||||||
static string default_bcname;
|
static string default_bcname;
|
||||||
|
@ -79,10 +79,10 @@ void netrule :: SetFreeZoneTransformation (const Vector & devp, int tolclass)
|
|||||||
|
|
||||||
for (int i = 0; i < fzs; i++)
|
for (int i = 0; i < fzs; i++)
|
||||||
{
|
{
|
||||||
Point2d p1 = transfreezone[i];
|
const auto& p1 = transfreezone[i];
|
||||||
Point2d p2 = transfreezone[(i+1) % fzs];
|
const auto& p2 = transfreezone[(i+1) % fzs];
|
||||||
|
|
||||||
Vec2d vn (p2.Y() - p1.Y(), p1.X() - p2.X());
|
Vec<2> vn = { p2[1] - p1[1], p1[0] - p2[0] };
|
||||||
|
|
||||||
double len2 = vn.Length2();
|
double len2 = vn.Length2();
|
||||||
|
|
||||||
@ -96,9 +96,9 @@ void netrule :: SetFreeZoneTransformation (const Vector & devp, int tolclass)
|
|||||||
{
|
{
|
||||||
vn /= sqrt (len2); // scaling necessary ?
|
vn /= sqrt (len2); // scaling necessary ?
|
||||||
|
|
||||||
freesetinequ(i,0) = vn.X();
|
freesetinequ(i,0) = vn[0];
|
||||||
freesetinequ(i,1) = vn.Y();
|
freesetinequ(i,1) = vn[1];
|
||||||
freesetinequ(i,2) = -(p1.X() * vn.X() + p1.Y() * vn.Y());
|
freesetinequ(i,2) = -(p1[0] * vn[0] + p1[1] * vn[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,37 +110,37 @@ int netrule :: IsInFreeZone2 (const Point2d & p) const
|
|||||||
for (int i = 0; i < transfreezone.Size(); i++)
|
for (int i = 0; i < transfreezone.Size(); i++)
|
||||||
{
|
{
|
||||||
if (freesetinequ(i, 0) * p.X() +
|
if (freesetinequ(i, 0) * p.X() +
|
||||||
freesetinequ(i, 1) * p.Y() +
|
freesetinequ(i, 1) * p[1] +
|
||||||
freesetinequ(i, 2) > 0) return 0;
|
freesetinequ(i, 2) > 0) return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int netrule :: IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const
|
int netrule :: IsLineInFreeZone2 (const Point<2> & p1, const Point<2> & p2) const
|
||||||
{
|
{
|
||||||
if ( (p1.X() > fzmaxx && p2.X() > fzmaxx) ||
|
if ( (p1[0] > fzmaxx && p2[0] > fzmaxx) ||
|
||||||
(p1.X() < fzminx && p2.X() < fzminx) ||
|
(p1[0] < fzminx && p2[0] < fzminx) ||
|
||||||
(p1.Y() > fzmaxy && p2.Y() > fzmaxy) ||
|
(p1[1] > fzmaxy && p2[1] > fzmaxy) ||
|
||||||
(p1.Y() < fzminy && p2.Y() < fzminy) ) return 0;
|
(p1[1] < fzminy && p2[1] < fzminy) ) return 0;
|
||||||
|
|
||||||
for (int i = 1; i <= transfreezone.Size(); i++)
|
for (int i = 1; i <= transfreezone.Size(); i++)
|
||||||
{
|
{
|
||||||
if (freesetinequ.Get(i, 1) * p1.X() + freesetinequ.Get(i, 2) * p1.Y() +
|
if (freesetinequ.Get(i, 1) * p1[0] + freesetinequ.Get(i, 2) * p1[1] +
|
||||||
freesetinequ.Get(i, 3) > -1e-8 && // -1e-6
|
freesetinequ.Get(i, 3) > -1e-8 && // -1e-6
|
||||||
freesetinequ.Get(i, 1) * p2.X() + freesetinequ.Get(i, 2) * p2.Y() +
|
freesetinequ.Get(i, 1) * p2[0] + freesetinequ.Get(i, 2) * p2[1] +
|
||||||
freesetinequ.Get(i, 3) > -1e-8 // -1e-6
|
freesetinequ.Get(i, 3) > -1e-8 // -1e-6
|
||||||
) return 0;
|
) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double nx = (p2.Y() - p1.Y());
|
double nx = (p2[1] - p1[1]);
|
||||||
double ny = -(p2.X() - p1.X());
|
double ny = -(p2[0] - p1[0]);
|
||||||
double nl = sqrt (nx * nx + ny * ny);
|
double nl = sqrt (nx * nx + ny * ny);
|
||||||
if (nl > 1e-8)
|
if (nl > 1e-8)
|
||||||
{
|
{
|
||||||
nx /= nl;
|
nx /= nl;
|
||||||
ny /= nl;
|
ny /= nl;
|
||||||
double c = - (p1.X() * nx + p1.Y() * ny);
|
double c = - (p1[0] * nx + p1[1] * ny);
|
||||||
|
|
||||||
bool allleft = true;
|
bool allleft = true;
|
||||||
bool allright = true;
|
bool allright = true;
|
||||||
|
@ -42,7 +42,7 @@ void netrule :: LoadRule (istream & ist)
|
|||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char ch;
|
char ch;
|
||||||
Point2d p;
|
Point<2> p;
|
||||||
INDEX_2 lin;
|
INDEX_2 lin;
|
||||||
int i, j;
|
int i, j;
|
||||||
DenseMatrix tempoldutonewu(20, 20), tempoldutofreearea(20, 20),
|
DenseMatrix tempoldutonewu(20, 20), tempoldutofreearea(20, 20),
|
||||||
@ -85,9 +85,9 @@ void netrule :: LoadRule (istream & ist)
|
|||||||
|
|
||||||
while (ch == '(')
|
while (ch == '(')
|
||||||
{
|
{
|
||||||
ist >> p.X();
|
ist >> p[0];
|
||||||
ist >> ch; // ','
|
ist >> ch; // ','
|
||||||
ist >> p.Y();
|
ist >> p[1];
|
||||||
ist >> ch; // ')'
|
ist >> ch; // ')'
|
||||||
|
|
||||||
points.Append (p);
|
points.Append (p);
|
||||||
@ -188,9 +188,9 @@ void netrule :: LoadRule (istream & ist)
|
|||||||
|
|
||||||
while (ch == '(')
|
while (ch == '(')
|
||||||
{
|
{
|
||||||
ist >> p.X();
|
ist >> p[0];
|
||||||
ist >> ch; // ','
|
ist >> ch; // ','
|
||||||
ist >> p.Y();
|
ist >> p[1];
|
||||||
ist >> ch; // ')'
|
ist >> ch; // ')'
|
||||||
|
|
||||||
points.Append (p);
|
points.Append (p);
|
||||||
@ -249,9 +249,9 @@ void netrule :: LoadRule (istream & ist)
|
|||||||
|
|
||||||
while (ch == '(')
|
while (ch == '(')
|
||||||
{
|
{
|
||||||
ist >> p.X();
|
ist >> p[0];
|
||||||
ist >> ch; // ','
|
ist >> ch; // ','
|
||||||
ist >> p.Y();
|
ist >> p[1];
|
||||||
ist >> ch; // ')'
|
ist >> ch; // ')'
|
||||||
|
|
||||||
freezone.Append (p);
|
freezone.Append (p);
|
||||||
@ -294,9 +294,9 @@ void netrule :: LoadRule (istream & ist)
|
|||||||
{
|
{
|
||||||
freepi++;
|
freepi++;
|
||||||
|
|
||||||
ist >> p.X();
|
ist >> p[0];
|
||||||
ist >> ch; // ','
|
ist >> ch; // ','
|
||||||
ist >> p.Y();
|
ist >> p[1];
|
||||||
ist >> ch; // ')'
|
ist >> ch; // ')'
|
||||||
|
|
||||||
freezonelimit.Elem(freepi) = p;
|
freezonelimit.Elem(freepi) = p;
|
||||||
|
@ -592,9 +592,9 @@ namespace netgen
|
|||||||
int oldnp = rule->GetNOldP();
|
int oldnp = rule->GetNOldP();
|
||||||
for (int i = oldnp + 1; i <= rule->GetNP(); i++)
|
for (int i = oldnp + 1; i <= rule->GetNP(); i++)
|
||||||
{
|
{
|
||||||
Point2d np = rule->GetPoint(i);
|
auto np = rule->GetPoint(i);
|
||||||
np.X() += newu (2 * (i-oldnp) - 2);
|
np[0] += newu (2 * (i-oldnp) - 2);
|
||||||
np.Y() += newu (2 * (i-oldnp) - 1);
|
np[1] += newu (2 * (i-oldnp) - 1);
|
||||||
|
|
||||||
lpoints.Append (np);
|
lpoints.Append (np);
|
||||||
pmap.Elem(i) = lpoints.Size();
|
pmap.Elem(i) = lpoints.Size();
|
||||||
|
@ -98,13 +98,13 @@ public:
|
|||||||
///
|
///
|
||||||
const NgArray<int> & GetDelLines() const { return dellines; }
|
const NgArray<int> & GetDelLines() const { return dellines; }
|
||||||
///
|
///
|
||||||
void GetFreeZone (NgArray<Point2d> & afreearea);
|
void GetFreeZone (NgArray<Point<2>> & afreearea);
|
||||||
///
|
///
|
||||||
|
|
||||||
double CalcPointDist (int pi, const Point2d & p) const
|
double CalcPointDist (int pi, const Point<2> & p) const
|
||||||
{
|
{
|
||||||
double dx = p.X() - points.Get(pi)[0];
|
double dx = p[0] - points.Get(pi)[0];
|
||||||
double dy = p.Y() - points.Get(pi)[1];
|
double dy = p[1] - points.Get(pi)[1];
|
||||||
const threefloat * tfp = &tolerances.Get(pi);
|
const threefloat * tfp = &tolerances.Get(pi);
|
||||||
return tfp->f1 * dx * dx + tfp->f2 * dx * dy + tfp->f3 * dy * dy;
|
return tfp->f1 * dx * dx + tfp->f2 * dx * dy + tfp->f3 * dy * dy;
|
||||||
}
|
}
|
||||||
@ -116,31 +116,31 @@ public:
|
|||||||
void SetFreeZoneTransformation (const Vector & u, int tolclass);
|
void SetFreeZoneTransformation (const Vector & u, int tolclass);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool IsInFreeZone (const Point2d & p) const
|
bool IsInFreeZone (const Point<2> & p) const
|
||||||
{
|
{
|
||||||
if (p.X() < fzminx || p.X() > fzmaxx ||
|
if (p[0] < fzminx || p[0] > fzmaxx ||
|
||||||
p.Y() < fzminy || p.Y() > fzmaxy) return 0;
|
p[1] < fzminy || p[1] > fzmaxy) return 0;
|
||||||
|
|
||||||
for (int i = 0; i < transfreezone.Size(); i++)
|
for (int i = 0; i < transfreezone.Size(); i++)
|
||||||
{
|
{
|
||||||
if (freesetinequ(i, 0) * p.X() +
|
if (freesetinequ(i, 0) * p[0] +
|
||||||
freesetinequ(i, 1) * p.Y() +
|
freesetinequ(i, 1) * p[1] +
|
||||||
freesetinequ(i, 2) > 0) return 0;
|
freesetinequ(i, 2) > 0) return 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
int IsLineInFreeZone (const Point2d & p1, const Point2d & p2) const
|
int IsLineInFreeZone (const Point<2> & p1, const Point<2> & p2) const
|
||||||
{
|
{
|
||||||
if ( (p1.X() > fzmaxx && p2.X() > fzmaxx) ||
|
if ( (p1[0] > fzmaxx && p2[0] > fzmaxx) ||
|
||||||
(p1.X() < fzminx && p2.X() < fzminx) ||
|
(p1[0] < fzminx && p2[0] < fzminx) ||
|
||||||
(p1.Y() > fzmaxy && p2.Y() > fzmaxy) ||
|
(p1[1] > fzmaxy && p2[1] > fzmaxy) ||
|
||||||
(p1.Y() < fzminy && p2.Y() < fzminy) ) return 0;
|
(p1[1] < fzminy && p2[1] < fzminy) ) return 0;
|
||||||
return IsLineInFreeZone2 (p1, p2);
|
return IsLineInFreeZone2 (p1, p2);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
int IsLineInFreeZone2 (const Point2d & p1, const Point2d & p2) const;
|
int IsLineInFreeZone2 (const Point<2> & p1, const Point<2> & p2) const;
|
||||||
///
|
///
|
||||||
int ConvexFreeZone () const;
|
int ConvexFreeZone () const;
|
||||||
///
|
///
|
||||||
|
@ -571,7 +571,7 @@ namespace netgen
|
|||||||
int lpi, gpi;
|
int lpi, gpi;
|
||||||
Vec<3> n, vgrad;
|
Vec<3> n, vgrad;
|
||||||
Point<3> pp1;
|
Point<3> pp1;
|
||||||
Vec2d g1, vdir;
|
Vec<2> g1, vdir;
|
||||||
double badness, hbad, hderiv;
|
double badness, hbad, hderiv;
|
||||||
|
|
||||||
vgrad = 0;
|
vgrad = 0;
|
||||||
@ -603,15 +603,15 @@ namespace netgen
|
|||||||
pts2d.Elem(pi) = Point2d (ld.t1 * (mesh.Point(pi) - ld.sp1),
|
pts2d.Elem(pi) = Point2d (ld.t1 * (mesh.Point(pi) - ld.sp1),
|
||||||
ld.t2 * (mesh.Point(pi) - ld.sp1));
|
ld.t2 * (mesh.Point(pi) - ld.sp1));
|
||||||
}
|
}
|
||||||
pts2d.Elem(gpi) = Point2d (x(0), x(1));
|
pts2d.Elem(gpi) = { x(0), x(1) };
|
||||||
|
|
||||||
|
|
||||||
for (int k = 1; k <= 2; k++)
|
for (int k = 1; k <= 2; k++)
|
||||||
{
|
{
|
||||||
if (k == 1)
|
if (k == 1)
|
||||||
vdir = Vec2d (1, 0);
|
vdir = {1., 0.};
|
||||||
else
|
else
|
||||||
vdir = Vec2d (0, 1);
|
vdir = {0., 1.};
|
||||||
|
|
||||||
hbad = bel.
|
hbad = bel.
|
||||||
CalcJacobianBadnessDirDeriv (pts2d, lpi, vdir, hderiv);
|
CalcJacobianBadnessDirDeriv (pts2d, lpi, vdir, hderiv);
|
||||||
@ -643,7 +643,7 @@ namespace netgen
|
|||||||
int j, k, lpi, gpi;
|
int j, k, lpi, gpi;
|
||||||
Vec<3> n, vgrad;
|
Vec<3> n, vgrad;
|
||||||
Point<3> pp1;
|
Point<3> pp1;
|
||||||
Vec2d g1, vdir;
|
Vec<2> g1, vdir;
|
||||||
double badness, hbad, hderiv;
|
double badness, hbad, hderiv;
|
||||||
|
|
||||||
vgrad = 0;
|
vgrad = 0;
|
||||||
@ -677,7 +677,7 @@ namespace netgen
|
|||||||
pts2d.Elem(gpi) = Point2d (x(0), x(1));
|
pts2d.Elem(gpi) = Point2d (x(0), x(1));
|
||||||
|
|
||||||
|
|
||||||
vdir = Vec2d (dir(0), dir(1));
|
vdir = { dir(0), dir(1) };
|
||||||
|
|
||||||
hbad = bel.
|
hbad = bel.
|
||||||
CalcJacobianBadnessDirDeriv (pts2d, lpi, vdir, hderiv);
|
CalcJacobianBadnessDirDeriv (pts2d, lpi, vdir, hderiv);
|
||||||
|
@ -1006,8 +1006,8 @@ IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MeshingSTLSurface ::
|
void MeshingSTLSurface ::
|
||||||
GetChartBoundary (NgArray<Point2d > & points,
|
GetChartBoundary (NgArray<Point<2>> & points,
|
||||||
NgArray<Point3d > & points3d,
|
NgArray<Point<3>> & points3d,
|
||||||
NgArray<INDEX_2> & lines, double h) const
|
NgArray<INDEX_2> & lines, double h) const
|
||||||
{
|
{
|
||||||
points.SetSize (0);
|
points.SetSize (0);
|
||||||
|
@ -52,8 +52,8 @@ protected:
|
|||||||
int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
|
int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
|
||||||
int endpoint, const PointGeomInfo & gi) override;
|
int endpoint, const PointGeomInfo & gi) override;
|
||||||
|
|
||||||
void GetChartBoundary (NgArray<Point2d > & points,
|
void GetChartBoundary (NgArray<Point<2>> & points,
|
||||||
NgArray<Point3d > & poitns3d,
|
NgArray<Point<3>> & poitns3d,
|
||||||
NgArray<INDEX_2> & lines, double h) const override;
|
NgArray<INDEX_2> & lines, double h) const override;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -407,8 +407,8 @@ namespace netgen
|
|||||||
|
|
||||||
//FOR MESHING
|
//FOR MESHING
|
||||||
int GetMeshChartNr () { return meshchart; }
|
int GetMeshChartNr () { return meshchart; }
|
||||||
void GetMeshChartBoundary (NgArray<Point2d > & points,
|
void GetMeshChartBoundary (NgArray<Point<2>> & points,
|
||||||
NgArray<Point3d > & points3d,
|
NgArray<Point<3>> & points3d,
|
||||||
NgArray<INDEX_2> & lines, double h);
|
NgArray<INDEX_2> & lines, double h);
|
||||||
|
|
||||||
|
|
||||||
|
@ -300,8 +300,8 @@ void STLGeometry :: PrepareSurfaceMeshing()
|
|||||||
meshcharttrigs = 0;
|
meshcharttrigs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STLGeometry::GetMeshChartBoundary (NgArray<Point2d > & apoints,
|
void STLGeometry::GetMeshChartBoundary (NgArray<Point<2>> & apoints,
|
||||||
NgArray<Point3d > & points3d,
|
NgArray<Point<3>> & points3d,
|
||||||
NgArray<INDEX_2> & alines, double h)
|
NgArray<INDEX_2> & alines, double h)
|
||||||
{
|
{
|
||||||
twoint seg, newseg;
|
twoint seg, newseg;
|
||||||
@ -520,14 +520,9 @@ void STLGeometry :: ToPlane (const Point<3> & locpoint, int * trigs,
|
|||||||
int STLGeometry :: FromPlane (const Point<2> & plainpoint,
|
int STLGeometry :: FromPlane (const Point<2> & plainpoint,
|
||||||
Point<3> & locpoint, double h)
|
Point<3> & locpoint, double h)
|
||||||
{
|
{
|
||||||
Point2d plainpoint2 (plainpoint);
|
Vec<3> p1p = h * plainpoint[0] * ex + h * plainpoint[1] * ey;
|
||||||
|
|
||||||
plainpoint2.X() *= h;
|
|
||||||
plainpoint2.Y() *= h;
|
|
||||||
Vec3d p1p = plainpoint2.X() * ex + plainpoint2.Y() * ey;
|
|
||||||
locpoint = p1 + p1p;
|
locpoint = p1 + p1p;
|
||||||
|
|
||||||
|
|
||||||
int rv = Project(locpoint);
|
int rv = Project(locpoint);
|
||||||
if (!rv) {return 1;} //project nicht gegangen
|
if (!rv) {return 1;} //project nicht gegangen
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user