fix Periodic with trafo

This commit is contained in:
Joachim Schöberl 2018-03-11 16:27:58 +01:00
parent aa8dbac6be
commit 777b5ed216
2 changed files with 29 additions and 20 deletions

View File

@ -226,20 +226,29 @@ Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
if ( fabs(n2 * hsp2.v) > 1e-3) if ( fabs(n2 * hsp2.v) > 1e-3)
continue; continue;
if ((trafo(hsp1.v)-hsp2.v).Length2() > 1e-12)
return false;
double d2typ = Dist2(hsp1.p, hsp2.p);
if (Dist2 (trafo(hsp1.p),hsp2.p) < 1e-18*d2typ)
return true;
if (Dist2 (hsp1.p, trafo(hsp1.p)) < 1e-18*d2typ)
{ // old style without trafo, but normal projection
Vec<3> v = hsp2.p - hsp1.p; Vec<3> v = hsp2.p - hsp1.p;
double vl = v.Length(); double vl = v.Length();
double cl = fabs (v*n1); double cl = fabs (v*n1);
double val1 = 1 - cl*cl/(vl*vl); double val1 = 1 - cl*cl/(vl*vl);
double val2 = (hsp1.v - hsp2.v).Length(); double val2 = (hsp1.v - hsp2.v).Length();
if (val1 < 1e-10 && val2 < 1e-6) if (val1 < 1e-10 && val2 < 1e-6)
return 1; return true;
}
} }
return 0; return false;
} }
int PeriodicIdentification :: int PeriodicIdentification ::

View File

@ -86,23 +86,23 @@ namespace netgen
const Surface * as1, const Surface * as1,
const Surface * as2, const Surface * as2,
Transformation<3> atrafo = Vec<3>(0,0,0)); Transformation<3> atrafo = Vec<3>(0,0,0));
virtual ~PeriodicIdentification (); virtual ~PeriodicIdentification () override;
virtual void Print (ostream & ost) const; virtual void Print (ostream & ost) const override;
virtual void GetData (ostream & ost) const; virtual void GetData (ostream & ost) const override;
// virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points); // virtual void IdentifySpecialPoints (Array<class SpecialPoint> & points);
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2, virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
const TABLE<int> & specpoint2solid, const TABLE<int> & specpoint2solid,
const TABLE<int> & specpoint2surface) const; const TABLE<int> & specpoint2surface) const override;
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const; virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const override;
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1); virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1) override;
virtual void IdentifyPoints (class Mesh & mesh); virtual void IdentifyPoints (class Mesh & mesh) override;
virtual void IdentifyFaces (class Mesh & mesh); virtual void IdentifyFaces (class Mesh & mesh) override;
virtual void BuildSurfaceElements (Array<class Segment> & segs, virtual void BuildSurfaceElements (Array<class Segment> & segs,
class Mesh & mesh, class Mesh & mesh,
const Surface * surf); const Surface * surf) override;
}; };