Change some PointNd to Point<N> functions

This commit is contained in:
Christopher Lackner 2019-09-29 14:54:24 +02:00
parent 5c4b0e490a
commit ca2212879e
9 changed files with 96 additions and 97 deletions

View File

@ -23,33 +23,27 @@ Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurf,
}
void Meshing2Surfaces :: DefineTransformation (const Point3d & p1, const Point3d & p2,
void Meshing2Surfaces :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2)
{
((Surface&)surface).DefineTangentialPlane (p1, p2);
}
void Meshing2Surfaces :: TransformToPlain (const Point3d & locpoint,
void Meshing2Surfaces :: TransformToPlain (const Point<3> & locpoint,
const MultiPointGeomInfo & geominfo,
Point2d & planepoint,
Point<2> & planepoint,
double h, int & zone)
{
Point<2> hp;
surface.ToPlane (locpoint, hp, h, zone);
planepoint.X() = hp(0);
planepoint.Y() = hp(1);
surface.ToPlane (locpoint, planepoint, h, zone);
}
int Meshing2Surfaces :: TransformFromPlain (Point2d & planepoint,
Point3d & locpoint,
PointGeomInfo & gi,
double h)
int Meshing2Surfaces :: TransformFromPlain (const Point<2> & planepoint,
Point<3> & locpoint,
PointGeomInfo & gi,
double h)
{
Point<3> hp;
Point<2> hp2 (planepoint.X(), planepoint.Y());
surface.FromPlane (hp2, hp, h);
locpoint = hp;
surface.FromPlane (planepoint, locpoint, h);
gi.trignum = 1;
return 0;
}

View File

@ -21,21 +21,22 @@ namespace netgen
protected:
///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2);
void DefineTransformation(const Point<3> & p1,
const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2) override;
///
virtual void TransformToPlain (const Point3d & locpoint,
const MultiPointGeomInfo & geominfo,
Point2d & plainpoint,
double h, int & zone);
void TransformToPlain(const Point<3> & locpoint,
const MultiPointGeomInfo & geominfo,
Point<2> & plainpoint,
double h, int & zone) override;
///
virtual int TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
PointGeomInfo & gi,
double h);
int TransformFromPlain(const Point<2>& plainpoint,
Point<3>& locpoint,
PointGeomInfo & gi,
double h) override;
///
virtual double CalcLocalH (const Point3d & p, double gh) const;
double CalcLocalH(const Point3d & p, double gh) const override;
};

View File

@ -63,6 +63,9 @@ namespace netgen
T & operator() (int i) { return x[i]; }
const T & operator() (int i) const { return x[i]; }
T& operator[] (int i) { return x[i]; }
const T& operator[] (int i) const { return x[i]; }
operator const T* () const { return x; }
void DoArchive(Archive& archive)
@ -120,6 +123,9 @@ namespace netgen
T & operator() (int i) { return x[i]; }
const T & operator() (int i) const { return x[i]; }
T& operator[] (int i) { return x[i]; }
const T& operator[] (int i) const { return x[i]; }
operator const T* () const { return x; }
void DoArchive(Archive& archive)

View File

@ -122,7 +122,7 @@ namespace netgen
// static Vec3d ex, ey;
// static Point3d globp1;
void Meshing2 :: DefineTransformation (const Point3d & p1, const Point3d & p2,
void Meshing2 :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2)
{
@ -134,28 +134,28 @@ namespace netgen
ey.Z() = 0;
}
void Meshing2 :: TransformToPlain (const Point3d & locpoint,
void Meshing2 :: TransformToPlain (const Point<3> & locpoint,
const MultiPointGeomInfo & geominf,
Point2d & plainpoint, double h, int & zone)
Point<2> & plainpoint, double h, int & zone)
{
Vec3d p1p (globp1, locpoint);
// p1p = locpoint - globp1;
p1p /= h;
plainpoint.X() = p1p * ex;
plainpoint.Y() = p1p * ey;
plainpoint[0] = p1p * ex;
plainpoint[1] = p1p * ey;
zone = 0;
}
int Meshing2 :: TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
int Meshing2 :: TransformFromPlain (const Point<2> & plainpoint,
Point<3> & locpoint,
PointGeomInfo & gi,
double h)
{
Vec3d p1p;
gi.trignum = 1;
p1p = plainpoint.X() * ex + plainpoint.Y() * ey;
p1p = plainpoint[0] * ex + plainpoint[1] * ey;
p1p *= h;
locpoint = globp1 + p1p;
return 0;
@ -545,8 +545,12 @@ namespace netgen
for (size_t i = 0; i < locpoints.Size(); i++)
TransformToPlain (locpoints[i], mpgeominfo[i],
plainpoints[i], h, plainzones[i]);
{
Point<2> pp;
TransformToPlain (locpoints[i], mpgeominfo[i],
pp, h, plainzones[i]);
plainpoints[i] = pp;
}
/*
for (int i = 1; i <= locpoints.Size(); i++)
@ -841,9 +845,11 @@ namespace netgen
for (int i = oldnp+1; i <= plainpoints.Size(); i++)
{
Point<3> locp;
int err =
TransformFromPlain (plainpoints.Elem(i), locpoints.Elem(i),
TransformFromPlain (plainpoints.Elem(i), locp,
upgeominfo.Elem(i), h);
locpoints.Elem(i) = locp;
if (err)
{

View File

@ -84,16 +84,16 @@ protected:
virtual double CalcLocalH (const Point3d & p, double gh) const;
///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
virtual void DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2);
///
virtual void TransformToPlain (const Point3d & locpoint, const MultiPointGeomInfo & geominfo,
Point2d & plainpoint, double h, int & zone);
virtual void TransformToPlain (const Point<3> & locpoint, const MultiPointGeomInfo & geominfo,
Point<2> & plainpoint, double h, int & zone);
/// return 0 .. ok
/// return >0 .. cannot transform point to true surface
virtual int TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
virtual int TransformFromPlain (const Point<2>& plainpoint,
Point<3> & locpoint,
PointGeomInfo & geominfo,
double h);

View File

@ -432,33 +432,27 @@ namespace netgen
}
void Meshing2OCCSurfaces :: DefineTransformation (const Point3d & p1, const Point3d & p2,
void Meshing2OCCSurfaces :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2)
{
((OCCSurface&)surface).DefineTangentialPlane (p1, *geominfo1, p2, *geominfo2);
}
void Meshing2OCCSurfaces :: TransformToPlain (const Point3d & locpoint,
void Meshing2OCCSurfaces :: TransformToPlain (const Point<3>& locpoint,
const MultiPointGeomInfo & geominfo,
Point2d & planepoint,
Point<2> & planepoint,
double h, int & zone)
{
Point<2> hp;
surface.ToPlane (locpoint, geominfo.GetPGI(1), hp, h, zone);
planepoint.X() = hp(0);
planepoint.Y() = hp(1);
surface.ToPlane (locpoint, geominfo.GetPGI(1), planepoint, h, zone);
}
int Meshing2OCCSurfaces :: TransformFromPlain (Point2d & planepoint,
Point3d & locpoint,
int Meshing2OCCSurfaces :: TransformFromPlain (const Point<2> & planepoint,
Point<3> & locpoint,
PointGeomInfo & gi,
double h)
{
Point<3> hp;
Point<2> hp2 (planepoint.X(), planepoint.Y());
surface.FromPlane (hp2, hp, gi, h);
locpoint = hp;
surface.FromPlane (planepoint, locpoint, gi, h);
return 0;
}

View File

@ -122,22 +122,22 @@ public:
protected:
///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2);
void DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2) override;
///
virtual void TransformToPlain (const Point3d & locpoint,
const MultiPointGeomInfo & geominfo,
Point2d & plainpoint,
double h, int & zone);
void TransformToPlain (const Point<3> & locpoint,
const MultiPointGeomInfo & geominfo,
Point<2> & plainpoint,
double h, int & zone) override;
///
virtual int TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
PointGeomInfo & gi,
double h);
int TransformFromPlain (const Point<2> & plainpoint,
Point<3> & locpoint,
PointGeomInfo & gi,
double h) override;
///
virtual double CalcLocalH (const Point3d & p, double gh) const;
double CalcLocalH (const Point3d & p, double gh) const override;
};

View File

@ -884,7 +884,7 @@ MeshingSTLSurface :: MeshingSTLSurface (STLGeometry & ageom,
;
}
void MeshingSTLSurface :: DefineTransformation (const Point3d & p1, const Point3d & p2,
void MeshingSTLSurface :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo,
const PointGeomInfo * geominfo2)
{
@ -893,8 +893,8 @@ void MeshingSTLSurface :: DefineTransformation (const Point3d & p1, const Point3
geom.DefineTangentialPlane(p1, p2, transformationtrig);
}
void MeshingSTLSurface :: TransformToPlain (const Point3d & locpoint, const MultiPointGeomInfo & gi,
Point2d & plainpoint, double h, int & zone)
void MeshingSTLSurface :: TransformToPlain (const Point<3> & locpoint, const MultiPointGeomInfo & gi,
Point<2> & plainpoint, double h, int & zone)
{
int trigs[10000];
@ -910,9 +910,7 @@ void MeshingSTLSurface :: TransformToPlain (const Point3d & locpoint, const Mult
// int trig = gi.trignum;
// (*testout) << "locpoint = " << locpoint;
Point<2> hp2d;
geom.ToPlane (locpoint, trigs, hp2d, h, zone, 1);
plainpoint = hp2d;
geom.ToPlane (locpoint, trigs, plainpoint, h, zone, 1);
// geom.ToPlane (locpoint, NULL, plainpoint, h, zone, 1);
/*
@ -1018,8 +1016,8 @@ GetChartBoundary (NgArray<Point2d > & points,
int MeshingSTLSurface :: TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
int MeshingSTLSurface :: TransformFromPlain (const Point<2> & plainpoint,
Point<3> & locpoint,
PointGeomInfo & gi,
double h)
{

View File

@ -27,40 +27,40 @@ public:
protected:
///
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2);
void DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2) override;
///
virtual void TransformToPlain (const Point3d & locpoint, const MultiPointGeomInfo & geominfo,
Point2d & plainpoint, double h, int & zone);
void TransformToPlain (const Point<3> & locpoint, const MultiPointGeomInfo & geominfo,
Point<2> & plainpoint, double h, int & zone) override;
///
virtual int TransformFromPlain (Point2d & plainpoint,
Point3d & locpoint,
PointGeomInfo & gi,
double h);
int TransformFromPlain (const Point<2>& plainpoint,
Point<3> & locpoint,
PointGeomInfo & gi,
double h) override;
///
virtual int BelongsToActiveChart (const Point3d & p,
const PointGeomInfo & gi);
int BelongsToActiveChart (const Point3d & p,
const PointGeomInfo & gi) override;
///
virtual int ComputePointGeomInfo (const Point3d & p, PointGeomInfo & gi);
int ComputePointGeomInfo (const Point3d & p, PointGeomInfo & gi) override;
///
virtual int ChooseChartPointGeomInfo (const MultiPointGeomInfo & mpgi,
PointGeomInfo & pgi);
int ChooseChartPointGeomInfo (const MultiPointGeomInfo & mpgi,
PointGeomInfo & pgi) override;
///
virtual int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
int endpoint, const PointGeomInfo & gi);
int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
int endpoint, const PointGeomInfo & gi) override;
virtual void GetChartBoundary (NgArray<Point2d > & points,
NgArray<Point3d > & poitns3d,
NgArray<INDEX_2> & lines, double h) const;
void GetChartBoundary (NgArray<Point2d > & points,
NgArray<Point3d > & poitns3d,
NgArray<INDEX_2> & lines, double h) const override;
///
virtual double CalcLocalH (const Point3d & p, double gh) const;
double CalcLocalH (const Point3d & p, double gh) const override;
///
virtual double Area () const;
double Area () const override;
};