export Mesh.SecondOrder

This commit is contained in:
Joachim Schöberl 2017-05-31 23:44:50 +02:00
parent c9ac332971
commit e8712aa8ae
3 changed files with 21 additions and 3 deletions

View File

@ -237,6 +237,14 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
li.append (py::cast(self[i]));
return li;
}))
.def_property_readonly("points",
FunctionPointer ([](const Element & self) -> py::list
{
py::list li;
for (int i = 0; i < self.GetNP(); i++)
li.append (py::cast(self[i]));
return li;
}))
;
py::class_<Element2d>(m, "Element2D")
@ -601,6 +609,15 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
Refinement().Refine(self);
}))
.def ("SecondOrder", FunctionPointer
([](Mesh & self)
{
if (self.GetGeometry())
self.GetGeometry()->GetRefinement().MakeSecondOrder(self);
else
Refinement().MakeSecondOrder(self);
}))
.def ("SetGeometry", FunctionPointer
([](Mesh & self, shared_ptr<NetgenGeometry> geo)
{

View File

@ -17,8 +17,8 @@ def Export (mesh, filename):
print (len(volels), file=f)
for el in volels:
print (el.index, end=" ", file=f)
for j in el.vertices:
print (j.nr, end=" ", file=f)
for p in el.points:
print (p.nr, end=" ", file=f)
print(file=f)

View File

@ -8,7 +8,7 @@ param.maxh = 10
print (param)
m1 = GenerateMesh (geo, param)
m1.SecondOrder()
import exportNeutral
exportNeutral.Export (m1, "shaft.mesh")
@ -16,3 +16,4 @@ exportNeutral.Export (m1, "shaft.mesh")
Save (m1, "mesh.vol", geo)