diff --git a/libsrc/csg/edgeflw.cpp b/libsrc/csg/edgeflw.cpp index 6b742ff0..afa8184f 100644 --- a/libsrc/csg/edgeflw.cpp +++ b/libsrc/csg/edgeflw.cpp @@ -1714,12 +1714,12 @@ namespace netgen if (oldseg.seginfo == 0) continue; - int pi1 = oldseg[0]; - int pi2 = oldseg[1]; + PointIndex pi1 = oldseg[0]; + PointIndex pi2 = oldseg[1]; - int npi1 = geometry.identifications.Get(copyedgeidentification) + PointIndex npi1 = geometry.identifications.Get(copyedgeidentification) -> GetIdentifiedPoint (mesh, pi1); - int npi2 = geometry.identifications.Get(copyedgeidentification) + PointIndex npi2 = geometry.identifications.Get(copyedgeidentification) -> GetIdentifiedPoint (mesh, pi2); //(*testout) << "copy edge, pts = " << npi1 << " - " << npi2 << endl; diff --git a/libsrc/csg/identify.cpp b/libsrc/csg/identify.cpp index 8878c695..e87a6679 100644 --- a/libsrc/csg/identify.cpp +++ b/libsrc/csg/identify.cpp @@ -289,14 +289,14 @@ GetIdentifiedPoint (class Mesh & mesh, PointIndex pi) // project to other surface snew->Project (hp); - int newpi = 0; - for (int i = 1; i <= mesh.GetNP(); i++) - if (Dist2 (mesh.Point(i), hp) < 1e-12) + PointIndex newpi(PointIndex::INVALID); + for (PointIndex pi : Range(mesh.Points())) + if (Dist2 (mesh.Point(pi), hp) < 1e-12) { - newpi = i; + newpi = pi; break; } - if (!newpi) + if (!newpi.IsValid()) newpi = mesh.AddPoint (hp); if (snew == s2) @@ -322,6 +322,7 @@ void PeriodicIdentification :: IdentifyPoints (class Mesh & mesh) mesh.GetBox(p1, p2); auto eps = 1e-6 * (p2-p1).Length(); + /* for (int i = 1; i <= mesh.GetNP(); i++) { Point<3> p = mesh.Point(i); @@ -334,13 +335,24 @@ void PeriodicIdentification :: IdentifyPoints (class Mesh & mesh) if (Dist2(mesh.Point(j), pp) < eps) { mesh.GetIdentifications().Add (i, j, nr); - /* - (*testout) << "Identify points(periodic:), nr = " << nr << ": " - << mesh.Point(i) << " - " << mesh.Point(j) << endl; - */ } } } + */ + + for (auto pi : Range(mesh.Points())) + { + Point<3> p = mesh[pi]; + if (s1->PointOnSurface (p)) + { + Point<3> pp = p; + pp = trafo(pp); + s2->Project (pp); + for (PointIndex pj : Range(mesh.Points())) + if (Dist2(mesh[pj], pp) < eps) + mesh.GetIdentifications().Add (pi, pj, nr); + } + } mesh.GetIdentifications().SetType(nr,Identifications::PERIODIC); } diff --git a/libsrc/meshing/secondorder.cpp b/libsrc/meshing/secondorder.cpp index 56dc7583..a29c1271 100644 --- a/libsrc/meshing/secondorder.cpp +++ b/libsrc/meshing/secondorder.cpp @@ -174,8 +174,8 @@ namespace netgen int nnp = newel.GetNP(); for (int j = 0; j < nnp-onp; j++) { - int pi1 = newel[betw[j][0]]; - int pi2 = newel[betw[j][1]]; + PointIndex pi1 = newel[betw[j][0]]; + PointIndex pi2 = newel[betw[j][1]]; INDEX_2 i2 = INDEX_2::Sort (pi1, pi2);