mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 14:10:34 +05:00
implement meshsurface in basegeometry
This commit is contained in:
parent
5b45c7a972
commit
b0db24fa83
@ -11,7 +11,7 @@ namespace netgen
|
|||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
void NetgenGeometry :: Analyse(Mesh& mesh,
|
void NetgenGeometry :: Analyse(Mesh& mesh,
|
||||||
const MeshingParameters& mparam)
|
const MeshingParameters& mparam) const
|
||||||
{
|
{
|
||||||
static Timer t1("SetLocalMeshsize"); RegionTimer regt(t1);
|
static Timer t1("SetLocalMeshsize"); RegionTimer regt(t1);
|
||||||
mesh.SetGlobalH(mparam.maxh);
|
mesh.SetGlobalH(mparam.maxh);
|
||||||
@ -25,7 +25,74 @@ namespace netgen
|
|||||||
mesh.LoadLocalMeshSize(mparam.meshsizefilename);
|
mesh.LoadLocalMeshSize(mparam.meshsizefilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetgenGeometry :: OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam)
|
void NetgenGeometry :: FindEdges(Mesh& mesh,
|
||||||
|
const MeshingParameters& mparam) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetgenGeometry :: MeshSurface(Mesh& mesh,
|
||||||
|
const MeshingParameters& mparam) const
|
||||||
|
{
|
||||||
|
static Timer t1("Surface Meshing"); RegionTimer regt(t1);
|
||||||
|
|
||||||
|
Array<int, PointIndex> glob2loc(mesh.GetNP());
|
||||||
|
for(auto k : Range(faces))
|
||||||
|
{
|
||||||
|
const auto& face = *faces[k];
|
||||||
|
auto bb = face.GetBoundingBox();
|
||||||
|
bb.Increase(bb.Diam()/10);
|
||||||
|
Meshing2 meshing(*this, mparam, bb);
|
||||||
|
glob2loc = 0;
|
||||||
|
int cntp = 0;
|
||||||
|
|
||||||
|
for(auto& seg : mesh.LineSegments())
|
||||||
|
{
|
||||||
|
if(seg.si == k+1)
|
||||||
|
{
|
||||||
|
for(auto j : Range(2))
|
||||||
|
{
|
||||||
|
auto pi = seg[j];
|
||||||
|
if(glob2loc[pi] == 0)
|
||||||
|
{
|
||||||
|
meshing.AddPoint(mesh[pi], pi);
|
||||||
|
cntp++;
|
||||||
|
glob2loc[pi] = cntp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(auto & seg : mesh.LineSegments())
|
||||||
|
{
|
||||||
|
if(seg.si == k+1)
|
||||||
|
{
|
||||||
|
PointGeomInfo gi0, gi1;
|
||||||
|
gi0.trignum = gi1.trignum = k+1;
|
||||||
|
gi0.u = seg.epgeominfo[0].u;
|
||||||
|
gi0.v = seg.epgeominfo[0].v;
|
||||||
|
gi1.u = seg.epgeominfo[1].u;
|
||||||
|
gi1.v = seg.epgeominfo[1].v;
|
||||||
|
meshing.AddBoundaryElement(glob2loc[seg[0]],
|
||||||
|
glob2loc[seg[1]],
|
||||||
|
gi0, gi1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Set max area 2* area of face
|
||||||
|
|
||||||
|
auto noldsurfels = mesh.GetNSE();
|
||||||
|
|
||||||
|
|
||||||
|
static Timer t("GenerateMesh"); RegionTimer reg(t);
|
||||||
|
MESHING2_RESULT res = meshing.GenerateMesh(mesh, mparam, mparam.maxh, k+1);
|
||||||
|
|
||||||
|
for(auto i : Range(noldsurfels, mesh.GetNSE()))
|
||||||
|
{
|
||||||
|
mesh.SurfaceElements()[i].SetIndex(k+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetgenGeometry :: OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam) const
|
||||||
{
|
{
|
||||||
const auto savetask = multithread.task;
|
const auto savetask = multithread.task;
|
||||||
multithread.task = "Optimizing surface";
|
multithread.task = "Optimizing surface";
|
||||||
|
@ -12,11 +12,29 @@ struct Tcl_Interp;
|
|||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
class GeometryEdge
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~GeometryEdge() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class GeometryFace
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~GeometryFace() {}
|
||||||
|
virtual size_t GetNBoundaries() const = 0;
|
||||||
|
virtual Array<GeometryEdge> GetBoundary(size_t index) const = 0;
|
||||||
|
// Project point using geo info. Fast if point is close to
|
||||||
|
// parametrization in geo info.
|
||||||
|
virtual bool ProjectPointGI(Point<3>& p, PointGeomInfo& gi) const =0;
|
||||||
|
virtual Box<3> GetBoundingBox() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class DLL_HEADER NetgenGeometry
|
class DLL_HEADER NetgenGeometry
|
||||||
{
|
{
|
||||||
unique_ptr<Refinement> ref;
|
unique_ptr<Refinement> ref;
|
||||||
protected:
|
protected:
|
||||||
|
Array<unique_ptr<GeometryFace>> faces;
|
||||||
Box<3> bounding_box;
|
Box<3> bounding_box;
|
||||||
public:
|
public:
|
||||||
NetgenGeometry()
|
NetgenGeometry()
|
||||||
@ -37,12 +55,12 @@ namespace netgen
|
|||||||
|
|
||||||
virtual Mesh::GEOM_TYPE GetGeomType() const { return Mesh::NO_GEOM; }
|
virtual Mesh::GEOM_TYPE GetGeomType() const { return Mesh::NO_GEOM; }
|
||||||
virtual void Analyse(Mesh& mesh,
|
virtual void Analyse(Mesh& mesh,
|
||||||
const MeshingParameters& mparam);
|
const MeshingParameters& mparam) const;
|
||||||
virtual void RestrictLocalMeshsize(Mesh& mesh,
|
virtual void RestrictLocalMeshsize(Mesh& mesh,
|
||||||
const MeshingParameters& mparam) const {}
|
const MeshingParameters& mparam) const {}
|
||||||
virtual void FindEdges(Mesh& mesh, const MeshingParameters& mparam) {}
|
virtual void FindEdges(Mesh& mesh, const MeshingParameters& mparam) const;
|
||||||
virtual void MeshSurface(Mesh& mesh, const MeshingParameters& mparam) {}
|
virtual void MeshSurface(Mesh& mesh, const MeshingParameters& mparam) const;
|
||||||
virtual void OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam);
|
virtual void OptimizeSurface(Mesh& mesh, const MeshingParameters& mparam) const;
|
||||||
|
|
||||||
virtual void FinalizeMesh(Mesh& mesh) const {}
|
virtual void FinalizeMesh(Mesh& mesh) const {}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OCCFindEdges (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam)
|
void OCCFindEdges (const OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
static Timer t("OCCFindEdges"); RegionTimer r(t);
|
static Timer t("OCCFindEdges"); RegionTimer r(t);
|
||||||
static Timer tsearch("OCCFindEdges - search point");
|
static Timer tsearch("OCCFindEdges - search point");
|
||||||
@ -601,7 +601,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh,
|
void OCCMeshSurface (const OCCGeometry & geom, Mesh & mesh,
|
||||||
const MeshingParameters & mparam)
|
const MeshingParameters & mparam)
|
||||||
{
|
{
|
||||||
static Timer t("OCCMeshSurface"); RegionTimer r(t);
|
static Timer t("OCCMeshSurface"); RegionTimer r(t);
|
||||||
|
@ -75,19 +75,19 @@ void STEP_GetEntityName(const TopoDS_Shape & theShape, STEPCAFControl_Reader * a
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OCCGeometry :: Analyse(Mesh& mesh,
|
void OCCGeometry :: Analyse(Mesh& mesh,
|
||||||
const MeshingParameters& mparam)
|
const MeshingParameters& mparam) const
|
||||||
{
|
{
|
||||||
OCCSetLocalMeshSize(*this, mesh, mparam, occparam);
|
OCCSetLocalMeshSize(*this, mesh, mparam, occparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OCCGeometry :: FindEdges(Mesh& mesh,
|
void OCCGeometry :: FindEdges(Mesh& mesh,
|
||||||
const MeshingParameters& mparam)
|
const MeshingParameters& mparam) const
|
||||||
{
|
{
|
||||||
OCCFindEdges(*this, mesh, mparam);
|
OCCFindEdges(*this, mesh, mparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OCCGeometry :: MeshSurface(Mesh& mesh,
|
void OCCGeometry :: MeshSurface(Mesh& mesh,
|
||||||
const MeshingParameters& mparam)
|
const MeshingParameters& mparam) const
|
||||||
{
|
{
|
||||||
OCCMeshSurface(*this, mesh, mparam);
|
OCCMeshSurface(*this, mesh, mparam);
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ namespace netgen
|
|||||||
Handle_XCAFDoc_ColorTool face_colours;
|
Handle_XCAFDoc_ColorTool face_colours;
|
||||||
|
|
||||||
mutable int changed;
|
mutable int changed;
|
||||||
NgArray<int> facemeshstatus;
|
mutable NgArray<int> facemeshstatus;
|
||||||
|
|
||||||
// Philippose - 15/01/2009
|
// Philippose - 15/01/2009
|
||||||
// Maximum mesh size for a given face
|
// Maximum mesh size for a given face
|
||||||
@ -268,11 +268,11 @@ namespace netgen
|
|||||||
{ occparam = par; }
|
{ occparam = par; }
|
||||||
|
|
||||||
void Analyse(Mesh& mesh,
|
void Analyse(Mesh& mesh,
|
||||||
const MeshingParameters& mparam) override;
|
const MeshingParameters& mparam) const override;
|
||||||
void FindEdges(Mesh& mesh,
|
void FindEdges(Mesh& mesh,
|
||||||
const MeshingParameters& mparam) override;
|
const MeshingParameters& mparam) const override;
|
||||||
void MeshSurface(Mesh& mesh,
|
void MeshSurface(Mesh& mesh,
|
||||||
const MeshingParameters& mparam) override;
|
const MeshingParameters& mparam) const override;
|
||||||
|
|
||||||
void FinalizeMesh(Mesh& mesh) const override;
|
void FinalizeMesh(Mesh& mesh) const override;
|
||||||
|
|
||||||
@ -459,11 +459,11 @@ namespace netgen
|
|||||||
DLL_HEADER extern void OCCSetLocalMeshSize(const OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam,
|
DLL_HEADER extern void OCCSetLocalMeshSize(const OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam,
|
||||||
const OCCParameters& occparam);
|
const OCCParameters& occparam);
|
||||||
|
|
||||||
DLL_HEADER extern void OCCMeshSurface (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
DLL_HEADER extern void OCCMeshSurface (const OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
||||||
|
|
||||||
DLL_HEADER extern void OCCOptimizeSurface (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
DLL_HEADER extern void OCCOptimizeSurface (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
||||||
|
|
||||||
DLL_HEADER extern void OCCFindEdges (OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
DLL_HEADER extern void OCCFindEdges (const OCCGeometry & geom, Mesh & mesh, const MeshingParameters & mparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user