mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-12 00:59:16 +05:00
Merge branch 'geo_restricth' into 'master'
Add NetgenGeometry.RestrictH function See merge request jschoeberl/netgen!410
This commit is contained in:
commit
454b8ea760
@ -220,6 +220,15 @@ namespace netgen
|
||||
|
||||
int CSGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
if(restricted_h.Size())
|
||||
{
|
||||
// copy so that we don't change mparam outside
|
||||
MeshingParameters mp = mparam;
|
||||
for(const auto& [pnt, maxh] : restricted_h)
|
||||
mp.meshsize_points.Append({pnt, maxh});
|
||||
return CSGGenerateMesh (*this, mesh, mp);
|
||||
}
|
||||
else
|
||||
return CSGGenerateMesh (*this, mesh, mparam);
|
||||
}
|
||||
|
||||
|
@ -1058,6 +1058,15 @@ namespace netgen
|
||||
|
||||
int SplineGeometry2d :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
{
|
||||
if(restricted_h.Size())
|
||||
{
|
||||
// copy so that we don't change mparam outside
|
||||
MeshingParameters mp = mparam;
|
||||
for(const auto& [pnt, maxh] : restricted_h)
|
||||
mp.meshsize_points.Append({pnt, maxh});
|
||||
MeshFromSpline2D (*this, mesh, mp);
|
||||
}
|
||||
else
|
||||
MeshFromSpline2D (*this, mesh, mparam);
|
||||
return 0;
|
||||
}
|
||||
|
@ -518,10 +518,16 @@ namespace netgen
|
||||
|
||||
|
||||
|
||||
int NetgenGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam)
|
||||
int NetgenGeometry :: GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mp)
|
||||
{
|
||||
multithread.percent = 0;
|
||||
|
||||
// copy so that we don't change them outside
|
||||
MeshingParameters mparam = mp;
|
||||
if(restricted_h.Size())
|
||||
for(const auto& [pnt, maxh] : restricted_h)
|
||||
mparam.meshsize_points.Append({pnt, maxh});
|
||||
|
||||
if(mparam.perfstepsstart <= MESHCONST_ANALYSE)
|
||||
{
|
||||
if(!mesh)
|
||||
|
@ -109,6 +109,7 @@ namespace netgen
|
||||
Array<unique_ptr<GeometryVertex>> vertices;
|
||||
Array<unique_ptr<GeometryEdge>> edges;
|
||||
Array<unique_ptr<GeometryFace>> faces;
|
||||
Array<std::pair<Point<3>, double>> restricted_h;
|
||||
Box<3> bounding_box;
|
||||
public:
|
||||
NetgenGeometry()
|
||||
@ -119,6 +120,11 @@ namespace netgen
|
||||
|
||||
virtual int GenerateMesh (shared_ptr<Mesh> & mesh, MeshingParameters & mparam);
|
||||
|
||||
void RestrictH(const Point<3>& pnt, double maxh)
|
||||
{
|
||||
restricted_h.Append({pnt, maxh});
|
||||
}
|
||||
|
||||
virtual const Refinement & GetRefinement () const
|
||||
{
|
||||
return *ref;
|
||||
|
@ -611,6 +611,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::implicitly_convertible< int, PointIndex>();
|
||||
|
||||
py::class_<NetgenGeometry, shared_ptr<NetgenGeometry>> (m, "NetgenGeometry", py::dynamic_attr())
|
||||
.def("RestrictH", &NetgenGeometry::RestrictH)
|
||||
;
|
||||
|
||||
py::class_<Mesh,shared_ptr<Mesh>>(m, "Mesh")
|
||||
|
Loading…
Reference in New Issue
Block a user