mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-25 21:40:33 +05:00
implement meshing2 functionality for 3d geometries
This commit is contained in:
parent
8f779b815a
commit
5b45c7a972
@ -422,7 +422,7 @@ namespace netgen
|
|||||||
geom.GetSurface((mesh.GetFaceDescriptor(k).SurfNr()));
|
geom.GetSurface((mesh.GetFaceDescriptor(k).SurfNr()));
|
||||||
|
|
||||||
|
|
||||||
Meshing2Surfaces meshing(*surf, mparam, geom.BoundingBox());
|
Meshing2Surfaces meshing(geom, *surf, mparam, geom.BoundingBox());
|
||||||
meshing.SetStartTime (starttime);
|
meshing.SetStartTime (starttime);
|
||||||
|
|
||||||
double eps = 1e-8 * geom.MaxSize();
|
double eps = 1e-8 * geom.MaxSize();
|
||||||
|
@ -14,13 +14,14 @@ Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurface)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurf,
|
Meshing2Surfaces :: Meshing2Surfaces (const CSGeometry& geo,
|
||||||
const MeshingParameters & mp,
|
const Surface & asurf,
|
||||||
const Box<3> & abb)
|
const MeshingParameters & mp,
|
||||||
: Meshing2(mp, abb), surface(asurf), mparam (mp)
|
const Box<3> & abb)
|
||||||
{
|
: Meshing2(geo, mp, abb), surface(asurf), mparam (mp)
|
||||||
;
|
{
|
||||||
}
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Meshing2Surfaces :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
|
void Meshing2Surfaces :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
|
||||||
|
@ -16,7 +16,9 @@ namespace netgen
|
|||||||
///
|
///
|
||||||
// Meshing2Surfaces (const Surface & asurf);
|
// 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);
|
const Box<3> & aboundingbox);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -565,7 +565,7 @@ namespace netgen
|
|||||||
|
|
||||||
mp.quad = hquad || geometry.GetDomainQuadMeshing (domnr);
|
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);
|
NgArray<int, PointIndex::BASE> compress(bnp);
|
||||||
compress = -1;
|
compress = -1;
|
||||||
|
@ -38,8 +38,10 @@ namespace netgen
|
|||||||
static Array<unique_ptr<netrule>> global_quad_rules;
|
static Array<unique_ptr<netrule>> global_quad_rules;
|
||||||
|
|
||||||
|
|
||||||
Meshing2 :: Meshing2 (const MeshingParameters & mp, const Box<3> & aboundingbox)
|
Meshing2 :: Meshing2 (const NetgenGeometry& ageo,
|
||||||
: adfront(aboundingbox), boundingbox(aboundingbox)
|
const MeshingParameters & mp,
|
||||||
|
const Box<3> & aboundingbox)
|
||||||
|
: geo(ageo), adfront(aboundingbox), boundingbox(aboundingbox)
|
||||||
{
|
{
|
||||||
static Timer t("Mesing2::Meshing2"); RegionTimer r(t);
|
static Timer t("Mesing2::Meshing2"); RegionTimer r(t);
|
||||||
|
|
||||||
@ -133,29 +135,38 @@ namespace netgen
|
|||||||
// static Vec3d ex, ey;
|
// static Vec3d ex, ey;
|
||||||
// static Point3d globp1;
|
// static Point3d globp1;
|
||||||
|
|
||||||
void Meshing2 :: DefineTransformation (const Point<3> & p1, const Point<3> & p2,
|
void Meshing2 :: DefineTransformation (const Point<3> & ap1,
|
||||||
const PointGeomInfo * geominfo1,
|
const Point<3> & ap2,
|
||||||
const PointGeomInfo * geominfo2)
|
const PointGeomInfo * gi1,
|
||||||
|
const PointGeomInfo * gi2)
|
||||||
{
|
{
|
||||||
globp1 = p1;
|
p1 = ap1;
|
||||||
ex = p2 - p1;
|
p2 = ap2;
|
||||||
ex /= ex.Length();
|
auto n1 = geo.GetNormal(gi1->trignum, p1, *gi1);
|
||||||
ey.X() = -ex.Y();
|
auto n2 = geo.GetNormal(gi2->trignum, p2, *gi2);
|
||||||
ey.Y() = ex.X();
|
|
||||||
ey.Z() = 0;
|
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,
|
void Meshing2 :: TransformToPlain (const Point<3> & locpoint,
|
||||||
const MultiPointGeomInfo & geominf,
|
const MultiPointGeomInfo & geominfo,
|
||||||
Point<2> & plainpoint, double h, int & zone)
|
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;
|
if(n*ez < 0)
|
||||||
p1p /= h;
|
zone = -1;
|
||||||
plainpoint[0] = p1p * ex;
|
else
|
||||||
plainpoint[1] = p1p * ey;
|
zone = 0;
|
||||||
zone = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Meshing2 :: TransformFromPlain (const Point<2> & plainpoint,
|
int Meshing2 :: TransformFromPlain (const Point<2> & plainpoint,
|
||||||
@ -163,12 +174,9 @@ namespace netgen
|
|||||||
PointGeomInfo & gi,
|
PointGeomInfo & gi,
|
||||||
double h)
|
double h)
|
||||||
{
|
{
|
||||||
Vec3d p1p;
|
locpoint = p1 + (h*plainpoint(0)) * ex + (h* plainpoint(1)) * ey;
|
||||||
gi.trignum = 1;
|
if (!geo.ProjectPointGI(gi.trignum, locpoint, gi))
|
||||||
|
geo.ProjectPoint(gi.trignum, locpoint);
|
||||||
p1p = plainpoint[0] * ex + plainpoint[1] * ey;
|
|
||||||
p1p *= h;
|
|
||||||
locpoint = globp1 + p1p;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,12 +41,16 @@ class Meshing2
|
|||||||
///
|
///
|
||||||
double maxarea;
|
double maxarea;
|
||||||
|
|
||||||
Vec3d ex, ey;
|
Vec3d ex, ey, ez;
|
||||||
Point3d globp1;
|
Point<3> p1, p2;
|
||||||
|
|
||||||
|
const NetgenGeometry& geo;
|
||||||
|
|
||||||
public:
|
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 ();
|
DLL_HEADER virtual ~Meshing2 ();
|
||||||
|
@ -651,7 +651,7 @@ namespace netgen
|
|||||||
|
|
||||||
static Timer tinit("init");
|
static Timer tinit("init");
|
||||||
tinit.Start();
|
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();
|
tinit.Stop();
|
||||||
|
|
||||||
|
|
||||||
|
@ -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 Box<3> & abb, int aprojecttype,
|
||||||
const MeshingParameters & mparam)
|
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)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,8 @@ class Meshing2OCCSurfaces : public Meshing2
|
|||||||
|
|
||||||
public:
|
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);
|
int aprojecttype, const MeshingParameters & mparam);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -897,7 +897,7 @@ void STLSurfaceOptimization (STLGeometry & geom,
|
|||||||
|
|
||||||
MeshingSTLSurface :: MeshingSTLSurface (STLGeometry & ageom,
|
MeshingSTLSurface :: MeshingSTLSurface (STLGeometry & ageom,
|
||||||
const MeshingParameters & mp)
|
const MeshingParameters & mp)
|
||||||
: Meshing2(mp, ageom.GetBoundingBox()), geom(ageom)
|
: Meshing2(ageom, mp, ageom.GetBoundingBox()), geom(ageom)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user