mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 13:20:34 +05:00
local mesh-size in MeshingParameters via Python
This commit is contained in:
parent
b7a869b77f
commit
ff84375089
@ -687,6 +687,8 @@ namespace netgen
|
|||||||
mparam.grading);
|
mparam.grading);
|
||||||
|
|
||||||
mesh -> LoadLocalMeshSize (mparam.meshsizefilename);
|
mesh -> LoadLocalMeshSize (mparam.meshsizefilename);
|
||||||
|
for (auto mspnt : mparam.meshsize_points)
|
||||||
|
mesh -> RestrictLocalH (mspnt.pnt, mspnt.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
spoints.SetSize(0);
|
spoints.SetSize(0);
|
||||||
|
@ -1130,12 +1130,26 @@ namespace netgen
|
|||||||
MeshingParameters ();
|
MeshingParameters ();
|
||||||
///
|
///
|
||||||
MeshingParameters (const MeshingParameters & mp2) = default;
|
MeshingParameters (const MeshingParameters & mp2) = default;
|
||||||
|
MeshingParameters (MeshingParameters && mp2) = default;
|
||||||
///
|
///
|
||||||
void Print (ostream & ost) const;
|
void Print (ostream & ost) const;
|
||||||
///
|
///
|
||||||
// void CopyFrom(const MeshingParameters & other);
|
// void CopyFrom(const MeshingParameters & other);
|
||||||
|
|
||||||
|
|
||||||
|
class MeshSizePoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Point<3> pnt;
|
||||||
|
double h;
|
||||||
|
MeshSizePoint (Point<3> _pnt, double _h) : pnt(_pnt), h(_h) { ; }
|
||||||
|
MeshSizePoint () = default;
|
||||||
|
MeshSizePoint (const MeshSizePoint &) = default;
|
||||||
|
MeshSizePoint (MeshSizePoint &&) = default;
|
||||||
|
MeshSizePoint & operator= (const MeshSizePoint &) = default;
|
||||||
|
MeshSizePoint & operator= (MeshSizePoint &&) = default;
|
||||||
|
};
|
||||||
|
Array<MeshSizePoint> meshsize_points;
|
||||||
|
|
||||||
void (*render_function)(bool) = NULL;
|
void (*render_function)(bool) = NULL;
|
||||||
void Render(bool blocking = false)
|
void Render(bool blocking = false)
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,13 @@ DLL_HEADER void ExportNetgenMeshing()
|
|||||||
.add_property("maxh",
|
.add_property("maxh",
|
||||||
FunctionPointer ([](const MP & mp ) { return mp.maxh; }),
|
FunctionPointer ([](const MP & mp ) { return mp.maxh; }),
|
||||||
FunctionPointer ([](MP & mp, double maxh) { return mp.maxh = maxh; }))
|
FunctionPointer ([](MP & mp, double maxh) { return mp.maxh = maxh; }))
|
||||||
|
.def("RestrictH", FunctionPointer
|
||||||
|
([](MP & mp, double x, double y, double z, double h)
|
||||||
|
{
|
||||||
|
mp.meshsize_points.Append ( MeshingParameters::MeshSizePoint (Point<3> (x,y,z), h));
|
||||||
|
}),
|
||||||
|
(bp::arg("x"), bp::arg("y"), bp::arg("z"), bp::arg("h"))
|
||||||
|
)
|
||||||
;
|
;
|
||||||
|
|
||||||
bp::def("SetTestoutFile", FunctionPointer ([] (const string & filename)
|
bp::def("SetTestoutFile", FunctionPointer ([] (const string & filename)
|
||||||
|
@ -14,7 +14,11 @@ def VS (obj):
|
|||||||
|
|
||||||
|
|
||||||
def csg_meshing_func (geom, **args):
|
def csg_meshing_func (geom, **args):
|
||||||
return GenerateMesh (geom, MeshingParameters (**args))
|
if "mp" in args:
|
||||||
|
return GenerateMesh (geom, args["mp"])
|
||||||
|
else:
|
||||||
|
return GenerateMesh (geom, MeshingParameters (**args))
|
||||||
|
# return GenerateMesh (geom, MeshingParameters (**args))
|
||||||
|
|
||||||
CSGeometry.GenerateMesh = csg_meshing_func
|
CSGeometry.GenerateMesh = csg_meshing_func
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user