From: Denis Davydov Date: Sun, 4 Nov 2018 21:44:26 +0000 (+0100) Subject: set components correctly in IncrementalFunction X-Git-Tag: v9.1.0-rc1~580^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7415%2Fhead;p=dealii.git set components correctly in IncrementalFunction --- 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