local mesh-size in MeshingParameters via Python

This commit is contained in:
Joachim Schöberl 2016-09-29 16:44:16 +02:00
parent b7a869b77f
commit ff84375089
4 changed files with 29 additions and 3 deletions

View File

@ -687,6 +687,8 @@ namespace netgen
mparam.grading);
mesh -> LoadLocalMeshSize (mparam.meshsizefilename);
for (auto mspnt : mparam.meshsize_points)
mesh -> RestrictLocalH (mspnt.pnt, mspnt.h);
}
spoints.SetSize(0);

View File

@ -1130,12 +1130,26 @@ namespace netgen
MeshingParameters ();
///
MeshingParameters (const MeshingParameters & mp2) = default;
MeshingParameters (MeshingParameters && mp2) = default;
///
void Print (ostream & ost) const;
///
// 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(bool blocking = false)
{

View File

@ -593,7 +593,13 @@ DLL_HEADER void ExportNetgenMeshing()
.add_property("maxh",
FunctionPointer ([](const MP & mp ) { return mp.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)

View File

@ -14,7 +14,11 @@ def VS (obj):
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