From 52757f01b8fa367980a9fbdbf994ca68a16eb8c5 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Wed, 2 May 2018 21:48:47 -0500 Subject: [PATCH] add a test --- tests/lac/linear_operator_17.cc | 51 +++++++++++++++++++++++++++++ tests/lac/linear_operator_17.output | 7 ++++ 2 files changed, 58 insertions(+) create mode 100644 tests/lac/linear_operator_17.cc create mode 100644 tests/lac/linear_operator_17.output diff --git a/tests/lac/linear_operator_17.cc b/tests/lac/linear_operator_17.cc new file mode 100644 index 0000000000..6c2ad6679d --- /dev/null +++ b/tests/lac/linear_operator_17.cc @@ -0,0 +1,51 @@ +// --------------------------------------------------------------------- +// +// 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 + + +using namespace dealii; + + +int main() +{ + initlog(); + + const std::function &, bool)> reinit_vector = + [](Vector &v, bool omit_zeroing_entries) { + v.reinit(3, omit_zeroing_entries); + }; + + const auto filter = mean_value_filter(reinit_vector); + + Vector vec (3); + vec[0] = 1.; + vec[1] = 2.; + vec[2] = 3.; + + deallog << vec << std::endl; + + filter.vmult_add(vec, vec); + deallog << vec << std::endl; + + filter.vmult(vec, vec); + deallog << vec << std::endl; +} diff --git a/tests/lac/linear_operator_17.output b/tests/lac/linear_operator_17.output new file mode 100644 index 0000000000..16f08000f1 --- /dev/null +++ b/tests/lac/linear_operator_17.output @@ -0,0 +1,7 @@ + +DEAL::1.00000 2.00000 3.00000 +DEAL:: +DEAL::0.00000 2.00000 4.00000 +DEAL:: +DEAL::-2.00000 0.00000 2.00000 +DEAL:: -- 2.39.5