From: Matthias Maier Date: Thu, 3 May 2018 03:00:24 +0000 (-0500) Subject: add a test X-Git-Tag: v9.0.0-rc1~28^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d241c19b2b16f0a36d7b0b164b2a6987e296c71e;p=dealii.git add a test --- diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index a08b89cb76..54ab1370f5 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -910,7 +910,7 @@ template LinearOperator mean_value_filter(const LinearOperator &op) { - auto return_op = mean_value_operator(op.reinit_range_vector); + auto return_op = mean_value_filter(op.reinit_range_vector); static_cast(return_op) = op.identity_payload(); return return_op; diff --git a/tests/lac/linear_operator_17a.cc b/tests/lac/linear_operator_17a.cc new file mode 100644 index 0000000000..a2eeb15f41 --- /dev/null +++ b/tests/lac/linear_operator_17a.cc @@ -0,0 +1,64 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2015 - 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// Test the LinearOperator template on a trivial vector implementation +// :: RightVector -> LeftVector + +#include "../tests.h" + +#include +#include +#include + + +using namespace dealii; + + +int main() +{ + initlog(); + + const std::function &, bool)> reinit_vector = + [](Vector &v, bool omit_zeroing_entries) { + v.reinit(3, omit_zeroing_entries); + }; + + auto id = identity_operator(reinit_vector); + const auto filter = mean_value_filter(id); + + const auto block_filter = block_diagonal_operator<3>(filter); + + BlockVector block_vector(3, 3); + block_vector.block(0)[0] = 1; + block_vector.block(0)[1] = 2; + block_vector.block(0)[2] = 3; + block_vector.block(1)[0] = 4; + block_vector.block(1)[1] = 6; + block_vector.block(1)[2] = 8; + block_vector.block(2)[0] = 9; + block_vector.block(2)[1] = 12; + block_vector.block(2)[2] = 15; + + deallog << block_vector.block(0) << std::endl; + deallog << block_vector.block(1) << std::endl; + deallog << block_vector.block(2) << std::endl; + + BlockVector block_vector_2(3, 3); + block_filter.vmult(block_vector_2, block_vector); + + deallog << block_vector_2.block(0) << std::endl; + deallog << block_vector_2.block(1) << std::endl; + deallog << block_vector_2.block(2) << std::endl; +} diff --git a/tests/lac/linear_operator_17a.output b/tests/lac/linear_operator_17a.output new file mode 100644 index 0000000000..cff73c69b7 --- /dev/null +++ b/tests/lac/linear_operator_17a.output @@ -0,0 +1,13 @@ + +DEAL::1.00000 2.00000 3.00000 +DEAL:: +DEAL::4.00000 6.00000 8.00000 +DEAL:: +DEAL::9.00000 12.0000 15.0000 +DEAL:: +DEAL::-1.00000 0.00000 1.00000 +DEAL:: +DEAL::-2.00000 0.00000 2.00000 +DEAL:: +DEAL::-3.00000 0.00000 3.00000 +DEAL::