Skip to content
Snippets Groups Projects
Commit 0d442a5a authored by René Fritze's avatar René Fritze
Browse files

[fem] cleverer getMinMaxOfDiscreteFunction

parent 33432552
No related branches found
No related tags found
No related merge requests found
...@@ -194,8 +194,6 @@ protected: ...@@ -194,8 +194,6 @@ protected:
typedef boost::accumulators::stats<boost::accumulators::tag::max, boost::accumulators::tag::min, typedef boost::accumulators::stats<boost::accumulators::tag::max, boost::accumulators::tag::min,
boost::accumulators::tag::mean> StatsType; boost::accumulators::tag::mean> StatsType;
boost::accumulators::accumulator_set<ElementType, StatsType> acc_; boost::accumulators::accumulator_set<ElementType, StatsType> acc_;
MinMaxAvg(const ThisType& other);
}; };
//! bound \param var in [\param min,\param max] //! bound \param var in [\param min,\param max]
......
...@@ -84,6 +84,14 @@ struct MinMaxAvgTest : public testing::Test ...@@ -84,6 +84,14 @@ struct MinMaxAvgTest : public testing::Test
{ {
}; };
template <class MMType, class TypeParam>
void mmCheck(const MMType& mma)
{
EXPECT_TRUE(Dune::FloatCmp::eq(mma.min(), TypeParam(-4.0)));
EXPECT_TRUE(Dune::FloatCmp::eq(mma.max(), TypeParam(1.0)));
EXPECT_TRUE(Dune::FloatCmp::eq(mma.average(), TypeParam(-1.0)));
}
TYPED_TEST_CASE(MinMaxAvgTest, TestTypes); TYPED_TEST_CASE(MinMaxAvgTest, TestTypes);
TYPED_TEST(MinMaxAvgTest, All) TYPED_TEST(MinMaxAvgTest, All)
{ {
...@@ -98,9 +106,9 @@ TYPED_TEST(MinMaxAvgTest, All) ...@@ -98,9 +106,9 @@ TYPED_TEST(MinMaxAvgTest, All)
EXPECT_TRUE(Dune::FloatCmp::eq(mma.max(), TypeParam(1.0))); EXPECT_TRUE(Dune::FloatCmp::eq(mma.max(), TypeParam(1.0)));
EXPECT_TRUE(Dune::FloatCmp::eq(mma.average(), TypeParam(0.0))); EXPECT_TRUE(Dune::FloatCmp::eq(mma.average(), TypeParam(0.0)));
mma(-4); mma(-4);
EXPECT_TRUE(Dune::FloatCmp::eq(mma.min(), TypeParam(-4.0))); mmCheck<MinMaxAvg<TypeParam>, TypeParam>(mma);
EXPECT_TRUE(Dune::FloatCmp::eq(mma.max(), TypeParam(1.0))); mmb = mma;
EXPECT_TRUE(Dune::FloatCmp::eq(mma.average(), TypeParam(-1.0))); mmCheck<MinMaxAvg<TypeParam>, TypeParam>(mmb);
} }
TEST(OtherMath, Range) TEST(OtherMath, Range)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment