From: Luca Heltai Date: Thu, 7 Aug 2014 15:12:39 +0000 (+0200) Subject: Made FlatManifold tolerance relative. X-Git-Tag: v8.2.0-rc1~215^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89cbcd997c6ad02c86657a432a8f871816eb1e8e;p=dealii.git Made FlatManifold tolerance relative. --- diff --git a/include/deal.II/grid/manifold.h b/include/deal.II/grid/manifold.h index 6b1b8e3875..096702d639 100644 --- a/include/deal.II/grid/manifold.h +++ b/include/deal.II/grid/manifold.h @@ -259,7 +259,7 @@ public: * pi, but 2*pi (or zero), since, on a periodic manifold, these two * points are at distance 2*eps and not (2*pi-eps). Special cases * are taken into account, to ensure that the behavior is always as - * expected. The third argument is used as a tolerance when + * expected. The third argument is used as a relative tolerance when * computing distances. * * Periodicity will be intended in the following way: the domain is @@ -270,8 +270,7 @@ public: * compute averages is called, an exception will be thrown if one of * the points which you are using for the average lies outside the * periodicity box. The return points are garanteed to lie in the - * perodicity box plus or minus the tolerance you set as the third - * argument. + * perodicity box plus or minus tolerance*periodicity.norm(). */ FlatManifold (const Point periodicity=Point(), const double tolerance=1e-10); @@ -312,13 +311,6 @@ public: virtual Point project_to_manifold (const std::vector > &points, const Point &candidate) const; -protected: - /** - * Tolerance. This tolerance is used to compute distances in double - * precision. Anything below this tolerance is considered zero. - */ - const double tolerance; - private: /** * The periodicity of this Manifold. Periodicity affects the way a @@ -340,6 +332,12 @@ private: << "The component number " << arg1 << " of the point [ " << arg2 << " ] is not in the interval [ " << -arg4 << ", " << arg3[arg4] << "), bailing out."); + + /** + * Relative tolerance. This tolerance is used to compute distances + * in double precision. + */ + const double tolerance; }; diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index ccd7e47c64..a2b1118a25 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -261,8 +261,8 @@ get_new_point_on_hex (const typename Triangulation<3, 3>::hex_iterator &hex) con template FlatManifold::FlatManifold (const Point periodicity, const double tolerance) : - tolerance(tolerance), - periodicity(periodicity) + periodicity(periodicity), + tolerance(tolerance) {} template @@ -277,6 +277,8 @@ get_new_point (const Quadrature &quad) const double sum=0; for (unsigned int i=0; i &quad) const { minP[d] = std::min(minP[d], surrounding_points[i][d]); if (periodicity[d] > 0) - Assert( (surrounding_points[i][d] < periodicity[d]+tolerance) || - (surrounding_points[i][d] >= -tolerance), - ExcPeriodicBox(d, surrounding_points[i], periodicity, tolerance)); + Assert( (surrounding_points[i][d] < periodicity[d]+tolerance*periodicity.norm()) || + (surrounding_points[i][d] >= -tolerance*periodicity.norm()), + ExcPeriodicBox(d, surrounding_points[i], periodicity, tolerance*periodicity.norm())); } for (unsigned int i=0; i