From f3a6cac99bffeae4a0f9343cc460a430d77ccdbb Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Sun, 4 Nov 2018 22:44:26 +0100 Subject: [PATCH] set components correctly in IncrementalFunction --- source/base/incremental_function.cc | 3 +- tests/base/functions_incremental_03.cc | 41 ++++++++++++++++++++++ tests/base/functions_incremental_03.output | 2 ++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 tests/base/functions_incremental_03.cc create mode 100644 tests/base/functions_incremental_03.output diff --git a/source/base/incremental_function.cc b/source/base/incremental_function.cc index 18091c358d..38739f9bd3 100644 --- a/source/base/incremental_function.cc +++ b/source/base/incremental_function.cc @@ -25,7 +25,8 @@ namespace Functions template IncrementalFunction::IncrementalFunction( Function &base) - : base(base) + : Function(base.n_components) + , base(base) , delta_t(numbers::signaling_nan()) , values_old(base.n_components) {} diff --git a/tests/base/functions_incremental_03.cc b/tests/base/functions_incremental_03.cc new file mode 100644 index 0000000000..3284f106ee --- /dev/null +++ b/tests/base/functions_incremental_03.cc @@ -0,0 +1,41 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Check that IncrementalFunction use correct number of components + +#include + +#include "../tests.h" + +template +void +check(const unsigned int n_comp = 3) +{ + Functions::ZeroFunction func(n_comp); + Functions::IncrementalFunction inc(func); + + AssertThrow(inc.n_components == n_comp, ExcInternalError()); + + deallog << "OK" << std::endl; +} + +int +main() +{ + initlog(); + + check<2>(); +} diff --git a/tests/base/functions_incremental_03.output b/tests/base/functions_incremental_03.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/functions_incremental_03.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5