Merge branch 'fix_identify_periodic_2d' into 'master'

fix IdentifyPeriodic points in mesh in 2d mesh

See merge request ngsolve/netgen!660
This commit is contained in:
Lackner, Christopher 2024-08-26 11:34:54 +02:00
commit 4f399675ce
2 changed files with 12 additions and 2 deletions

View File

@ -6838,11 +6838,12 @@ namespace netgen
continue;
auto pt = (*this)[pi];
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;
if(other_nr != 0)
{
auto other_el = VolumeElement(other_nr);
auto other_el = SurfaceElement(other_nr);
for(auto i : Range(other_el.PNums().Size()))
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>
{ Transformation<3> res; res.Combine(a,b); return res; })
.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; });