From caf15e25f8dfbc90d06035f392e8029745cc19af Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Wed, 26 Oct 2011 09:42:27 +0000 Subject: [PATCH] make sure diameter of test set is bounded [[Imported from SVN: r8043]] --- test/localgeodesicfefunctiontest.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/localgeodesicfefunctiontest.cc b/test/localgeodesicfefunctiontest.cc index 1d398eae..1d1186f3 100644 --- a/test/localgeodesicfefunctiontest.cc +++ b/test/localgeodesicfefunctiontest.cc @@ -20,6 +20,18 @@ const double eps = 1e-6; using namespace Dune; +/** \brief Computes the diameter of a set */ +template <class TargetSpace> +double diameter(const std::vector<TargetSpace>& v) +{ + double d = 0; + for (size_t i=0; i<v.size(); i++) + for (size_t j=0; j<v.size(); j++) + d = std::max(d, TargetSpace::distance(v[i],v[j])); + return d; +} + + template <int domainDim> void testDerivativeTangentiality(const RealTuple<1>& x, const FieldMatrix<double,1,domainDim>& derivative) @@ -354,6 +366,9 @@ void test() for (int j=0; j<domainDim+1; j++) corners[j] = testPoints[index[j]]; + + if (diameter(corners) > 0.5*M_PI) + continue; //testPermutationInvariance(corners); testDerivative<domainDim>(corners); -- GitLab