From 581d8bd965195e0d4ae2c2d2358fe02790def852 Mon Sep 17 00:00:00 2001 From: heltai Date: Sun, 5 Apr 2009 22:55:59 +0000 Subject: [PATCH] Added test for VectorView class git-svn-id: https://svn.dealii.org/trunk@18554 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/lac/Makefile | 3 +- tests/lac/vector_view.cc | 78 +++++++++++++++++++++++++++++++ tests/lac/vector_view/cmp/generic | 14 ++++++ 3 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/lac/vector_view.cc create mode 100644 tests/lac/vector_view/cmp/generic diff --git a/tests/lac/Makefile b/tests/lac/Makefile index d2966ac58d..4fd1b76b01 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -54,7 +54,8 @@ tests_x = vector-vector vector_memory \ trace \ print_formatted_* \ bicgstab_early \ - complex* + complex* \ + vector_view* # from above list of regular expressions, generate the real set of diff --git a/tests/lac/vector_view.cc b/tests/lac/vector_view.cc new file mode 100644 index 0000000000..703023e986 --- /dev/null +++ b/tests/lac/vector_view.cc @@ -0,0 +1,78 @@ +//---------------------------- solver.cc --------------------------- +// $Id: vector-vector.cc 15661 2008-01-24 04:59:09Z kanschat $ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//---------------------------- solver.cc --------------------------- + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include + +const unsigned int N=10; +unsigned int check_point = 0; + +template +void print (const Vector &v) +{ + for (unsigned int i=0; i +void fill( T &a) { + for(unsigned int i=0; i v1(N); + fill(v1); + + deallog << "Vector" << std::endl; + print(v1); + + VectorView v2(N, v1.begin() ); + deallog << "Vector View" << std::endl; + print(v2); + + v2(4) = 0; + deallog << "Modified element 4" << std::endl; + deallog << "Vector" << std::endl; + print(v1); + + deallog << "Vector View" << std::endl; + print(v2); + + // Const vector. + const Vector v3(v1); + + deallog << "const Vector" << std::endl; + print(v3); + + VectorView v4(N, v3.begin()); + deallog << "const Vector View" << std::endl; + print(v4); +} + + diff --git a/tests/lac/vector_view/cmp/generic b/tests/lac/vector_view/cmp/generic new file mode 100644 index 0000000000..0d4e0c9df6 --- /dev/null +++ b/tests/lac/vector_view/cmp/generic @@ -0,0 +1,14 @@ + +DEAL::Vector +DEAL::0 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 +DEAL::Vector View +DEAL::0 1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 +DEAL::Modified element 4 +DEAL::Vector +DEAL::0 1.00 2.00 3.00 0 5.00 6.00 7.00 8.00 9.00 +DEAL::Vector View +DEAL::0 1.00 2.00 3.00 0 5.00 6.00 7.00 8.00 9.00 +DEAL::const Vector +DEAL::0 1.00 2.00 3.00 0 5.00 6.00 7.00 8.00 9.00 +DEAL::const Vector View +DEAL::0 1.00 2.00 3.00 0 5.00 6.00 7.00 8.00 9.00 -- 2.39.5