implement meshing2 functionality for 3d geometries

This commit is contained in:
Christopher Lackner 2019-10-28 13:44:51 +01:00
parent 8f779b815a
commit 5b45c7a972
10 changed files with 60 additions and 42 deletions

View File

@ -422,7 +422,7 @@ namespace netgen
geom.GetSurface((mesh.GetFaceDescriptor(k).SurfNr()));
Meshing2Surfaces meshing(*surf, mparam, geom.BoundingBox());
Meshing2Surfaces meshing(geom, *surf, mparam, geom.BoundingBox());
meshing.SetStartTime (starttime);
double eps = 1e-8 * geom.MaxSize();

View File

@ -14,13 +14,14 @@ Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurface)
;
}
*/
Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurf,
const MeshingParameters & mp,
const Box<3> & abb)
: Meshing2(mp, abb), surface(asurf), mparam (mp)
{
;
}
Meshing2Surfaces :: Meshing2Surfaces (const CSGeometry& geo,
const Surface & asurf,
const MeshingParameters & mp,
const Box<3> & abb)
: Meshing2(geo, mp, abb), surface(asurf), mparam (mp)
{
;
}
void Meshing2Surfaces :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,

View File

@ -16,7 +16,9 @@ namespace netgen
///
// Meshing2Surfaces (const Surface & asurf);
///
Meshing2Surfaces (const Surface & asurf, const MeshingParameters & mp,
Meshing2Surfaces (const CSGeometry& geo,
const Surface & asurf,
const MeshingParameters & mp,
const Box<3> & aboundingbox);
protected:

View File

@ -565,7 +565,7 @@ namespace netgen
mp.quad = hquad || geometry.GetDomainQuadMeshing (domnr);
Meshing2 meshing (mp, Box<3> (pmin, pmax));
Meshing2 meshing (geometry, mp, Box<3> (pmin, pmax));
NgArray<int, PointIndex::BASE> compress(bnp);
compress = -1;

View File

@ -38,8 +38,10 @@ namespace netgen
static Array<unique_ptr<netrule>> global_quad_rules;
Meshing2 :: Meshing2 (const MeshingParameters & mp, const Box<3> & aboundingbox)
: adfront(aboundingbox), boundingbox(aboundingbox)
Meshing2 :: Meshing2 (const NetgenGeometry& ageo,
const MeshingParameters & mp,
const Box<3> & aboundingbox)
: geo(ageo), adfront(aboundingbox), boundingbox(aboundingbox)
{
static Timer t("Mesing2::Meshing2"); RegionTimer r(t);
@ -133,29 +135,38 @@ namespace netgen
// static Vec3d ex, ey;
// static Point3d globp1;
void Meshing2 :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
const PointGeomInfo * geominfo1,
const PointGeomInfo * geominfo2)
void Meshing2 :: DefineTransformation (const Point<3> & ap1,
const Point<3> & ap2,
const PointGeomInfo * gi1,
const PointGeomInfo * gi2)
{
globp1 = p1;
ex = p2 - p1;
ex /= ex.Length();
ey.X() = -ex.Y();
ey.Y() = ex.X();
ey.Z() = 0;
p1 = ap1;
p2 = ap2;
auto n1 = geo.GetNormal(gi1->trignum, p1, *gi1);
auto n2 = geo.GetNormal(gi2->trignum, p2, *gi2);
ez = 0.5 * (n1+n2);
ez.Normalize();
ex = (p2-p1).Normalize();
ez -= (ez*ex)*ex;
ez.Normalize();
ey = Cross(ez, ex);
}
void Meshing2 :: TransformToPlain (const Point<3> & locpoint,
const MultiPointGeomInfo & geominf,
const MultiPointGeomInfo & geominfo,
Point<2> & plainpoint, double h, int & zone)
{
Vec3d p1p (globp1, locpoint);
auto& gi = geominfo.GetPGI(1);
auto n = geo.GetNormal(gi.trignum, locpoint, gi);
auto p1p = locpoint - p1;
plainpoint(0) = (p1p * ex) / h;
plainpoint(1) = (p1p * ey) / h;
// p1p = locpoint - globp1;
p1p /= h;
plainpoint[0] = p1p * ex;
plainpoint[1] = p1p * ey;
zone = 0;
if(n*ez < 0)
zone = -1;
else
zone = 0;
}
int Meshing2 :: TransformFromPlain (const Point<2> & plainpoint,
@ -163,12 +174,9 @@ namespace netgen
PointGeomInfo & gi,
double h)
{
Vec3d p1p;
gi.trignum = 1;
p1p = plainpoint[0] * ex + plainpoint[1] * ey;
p1p *= h;
locpoint = globp1 + p1p;
locpoint = p1 + (h*plainpoint(0)) * ex + (h* plainpoint(1)) * ey;
if (!geo.ProjectPointGI(gi.trignum, locpoint, gi))
geo.ProjectPoint(gi.trignum, locpoint);
return 0;
}

View File

@ -41,12 +41,16 @@ class Meshing2
///
double maxarea;
Vec3d ex, ey;
Point3d globp1;
Vec3d ex, ey, ez;
Point<3> p1, p2;
const NetgenGeometry& geo;
public:
///
DLL_HEADER Meshing2 (const MeshingParameters & mp, const Box<3> & aboundingbox);
DLL_HEADER Meshing2 (const NetgenGeometry& geo,
const MeshingParameters & mp,
const Box<3> & aboundingbox);
///
DLL_HEADER virtual ~Meshing2 ();

View File

@ -651,7 +651,7 @@ namespace netgen
static Timer tinit("init");
tinit.Start();
Meshing2OCCSurfaces meshing(TopoDS::Face(geom.fmap(k)), bb, projecttype, mparam);
Meshing2OCCSurfaces meshing(geom, TopoDS::Face(geom.fmap(k)), bb, projecttype, mparam);
tinit.Stop();

View File

@ -492,10 +492,12 @@ namespace netgen
}
Meshing2OCCSurfaces :: Meshing2OCCSurfaces (const TopoDS_Shape & asurf,
Meshing2OCCSurfaces :: Meshing2OCCSurfaces (const NetgenGeometry& geo,
const TopoDS_Shape & asurf,
const Box<3> & abb, int aprojecttype,
const MeshingParameters & mparam)
: Meshing2(mparam, Box<3>(abb.PMin(), abb.PMax())), surface(TopoDS::Face(asurf), aprojecttype)
: Meshing2(geo, mparam, Box<3>(abb.PMin(), abb.PMax())),
surface(TopoDS::Face(asurf), aprojecttype)
{
;
}

View File

@ -113,7 +113,8 @@ class Meshing2OCCSurfaces : public Meshing2
public:
///
Meshing2OCCSurfaces (const TopoDS_Shape & asurf, const Box<3> & aboundingbox,
Meshing2OCCSurfaces (const NetgenGeometry& geo,
const TopoDS_Shape & asurf, const Box<3> & aboundingbox,
int aprojecttype, const MeshingParameters & mparam);
///

View File

@ -897,7 +897,7 @@ void STLSurfaceOptimization (STLGeometry & geom,
MeshingSTLSurface :: MeshingSTLSurface (STLGeometry & ageom,
const MeshingParameters & mp)
: Meshing2(mp, ageom.GetBoundingBox()), geom(ageom)
: Meshing2(ageom, mp, ageom.GetBoundingBox()), geom(ageom)
{
;
}