fix IdentifyPeriodic points in mesh in 2d mesh

This commit is contained in:
Christopher Lackner 2024-08-26 11:13:56 +02:00
parent 7f666547c9
commit d72801d19a
2 changed files with 12 additions and 2 deletions

View File

@ -6838,11 +6838,12 @@ namespace netgen
continue; continue;
auto pt = (*this)[pi]; auto pt = (*this)[pi];
auto mapped_pt = mapping(pt); auto mapped_pt = mapping(pt);
auto other_nr = GetElementOfPoint(mapped_pt, lami, true); // auto other_nr = GetElementOfPoint(mapped_pt, lami, true);
auto other_nr = GetSurfaceElementOfPoint(mapped_pt, lami);
int index = -1; int index = -1;
if(other_nr != 0) if(other_nr != 0)
{ {
auto other_el = VolumeElement(other_nr); auto other_el = SurfaceElement(other_nr);
for(auto i : Range(other_el.PNums().Size())) for(auto i : Range(other_el.PNums().Size()))
if((mapped_pt - (*this)[other_el.PNums()[i]]).Length() < pointTolerance) if((mapped_pt - (*this)[other_el.PNums()[i]]).Length() < pointTolerance)
{ {

View File

@ -203,6 +203,15 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
.def("__mul__", [](Transformation<3> a, Transformation<3> b)->Transformation<3> .def("__mul__", [](Transformation<3> a, Transformation<3> b)->Transformation<3>
{ Transformation<3> res; res.Combine(a,b); return res; }) { Transformation<3> res; res.Combine(a,b); return res; })
.def("__call__", [] (Transformation<3> trafo, Point<3> p) { return trafo(p); }) .def("__call__", [] (Transformation<3> trafo, Point<3> p) { return trafo(p); })
.def_property("mat", &Transformation<3>::GetMatrix,
[](Transformation<3>& self, py::array_t<double> np_mat)
{
if(np_mat.size() != 9)
throw Exception("Invalid dimension of input array!");
for(int i = 0; i < 3; i++)
for(int j = 0; j < 3; j++)
self.GetMatrix()(i,j) = np_mat.at(i*3+j);
})
; ;
m.def ("GetTransformation", [] () { return global_trafo; }); m.def ("GetTransformation", [] () { return global_trafo; });