mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-24 03:40:34 +05:00
Setting refinement flags and adaptive refinement in Netgen
This commit is contained in:
parent
e8c4c6c4c7
commit
7e560e157d
@ -10,8 +10,8 @@ public:
|
||||
const char * femcode;
|
||||
int maxlevel;
|
||||
int usemarkedelements;
|
||||
bool refine_hp;
|
||||
bool refine_p;
|
||||
bool refine_hp = false;
|
||||
bool refine_p = false;
|
||||
bool onlyonce = false;
|
||||
NgTaskManager task_manager = &DummyTaskManager;
|
||||
NgTracer tracer = &DummyTracer;
|
||||
|
@ -416,6 +416,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
.def("__repr__", &ToString<Element>)
|
||||
.def_property("index", &Element::GetIndex, &Element::SetIndex)
|
||||
.def_property("curved", &Element::IsCurved, &Element::SetCurved)
|
||||
.def_property("refine", &Element::TestRefinementFlag, &Element::SetRefinementFlag)
|
||||
.def_property_readonly("vertices",
|
||||
FunctionPointer ([](const Element & self) -> py::list
|
||||
{
|
||||
@ -451,7 +452,11 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::detail::field_descriptor {
|
||||
"np", data_layout["np"], sizeof(int8_t),
|
||||
py::format_descriptor<signed char>::format(),
|
||||
pybind11::dtype("int8") }
|
||||
pybind11::dtype("int8") },
|
||||
py::detail::field_descriptor {
|
||||
"refine", data_layout["refine"], sizeof(bool),
|
||||
py::format_descriptor<bool>::format(),
|
||||
py::detail::npy_format_descriptor<bool>::dtype() }
|
||||
});
|
||||
}
|
||||
|
||||
@ -496,6 +501,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
)
|
||||
.def_property("index", &Element2d::GetIndex, &Element2d::SetIndex)
|
||||
.def_property("curved", &Element2d::IsCurved, &Element2d::SetCurved)
|
||||
.def_property("refine", &Element2d::TestRefinementFlag, &Element2d::SetRefinementFlag)
|
||||
.def_property_readonly("vertices",
|
||||
FunctionPointer([](const Element2d & self) -> py::list
|
||||
{
|
||||
@ -530,7 +536,11 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
py::detail::field_descriptor {
|
||||
"np", data_layout["np"], sizeof(int8_t),
|
||||
py::format_descriptor<signed char>::format(),
|
||||
pybind11::dtype("int8") }
|
||||
pybind11::dtype("int8") },
|
||||
py::detail::field_descriptor {
|
||||
"refine", data_layout["refine"], sizeof(bool),
|
||||
py::format_descriptor<bool>::format(),
|
||||
py::detail::npy_format_descriptor<bool>::dtype() }
|
||||
});
|
||||
}
|
||||
|
||||
@ -1220,11 +1230,31 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
}, py::arg("mp")=nullptr, py::call_guard<py::gil_scoped_release>())
|
||||
|
||||
.def ("Refine", FunctionPointer
|
||||
([](Mesh & self)
|
||||
([](Mesh & self, bool adaptive)
|
||||
{
|
||||
if (!adaptive)
|
||||
{
|
||||
self.GetGeometry()->GetRefinement().Refine(self);
|
||||
self.UpdateTopology();
|
||||
}),py::call_guard<py::gil_scoped_release>())
|
||||
}
|
||||
else
|
||||
{
|
||||
BisectionOptions biopt;
|
||||
biopt.usemarkedelements = 1;
|
||||
biopt.refine_p = 0;
|
||||
biopt.refine_hp = 0;
|
||||
/*
|
||||
biopt.onlyonce = onlyonce;
|
||||
if (reftype == NG_REFINE_P)
|
||||
biopt.refine_p = 1;
|
||||
if (reftype == NG_REFINE_HP)
|
||||
biopt.refine_hp = 1;
|
||||
*/
|
||||
self.GetGeometry()->GetRefinement().Bisect (self, biopt);
|
||||
self.UpdateTopology();
|
||||
self.GetCurvedElements().SetIsHighOrder (false);
|
||||
}
|
||||
}), py::arg("adaptive")=false, py::call_guard<py::gil_scoped_release>())
|
||||
|
||||
.def("ZRefine", &Mesh::ZRefine)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user