This class was deprecated before the 9.0 release.
--- /dev/null
+Changed: The class VectorView has been removed. The suggested replacements are
+to either use an ArrayView, a BlockVector, or to copy the relevant subset into a
+Vector.
+<br>
+(David Wells, 2019/01/11)
template <typename>
class BlockVector;
-template <typename>
-class VectorView;
-
namespace parallel
{
namespace internal
template <typename Number2>
friend class LAPACKFullMatrix;
- /**
- * VectorView will access the pointer.
- */
- friend class VectorView<Number>;
-
private:
/**
* Allocate and align @p values along 64-byte boundaries. The size of the
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2009 - 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.
-//
-// ---------------------------------------------------------------------
-
-#ifndef dealii_vector_view_h
-#define dealii_vector_view_h
-
-
-#include <deal.II/base/config.h>
-
-#include <deal.II/base/exceptions.h>
-#include <deal.II/base/subscriptor.h>
-
-#include <deal.II/lac/vector.h>
-
-#include <cstdio>
-
-DEAL_II_NAMESPACE_OPEN
-
-
-/*! @addtogroup Vectors
- *@{
- */
-
-/**
- * View of a numerical vector of data. This class provides an interface
- * compatible with the Vector<double> class (from which it is inherited), that
- * allows fast access to locations of memory already allocated with arrays of
- * type Number.
- *
- * This is in the same style of the vector view in the Trilinos library.
- *
- * You should consider using the VectorView object ONLY when ALL of the
- * following requirements are met:
- *
- * 1. Your application requires a Vector<Number> object.
- *
- * 2. All you have at your disposal is a Number* pointer.
- *
- * 3. You are ABSOLUTELY SURE that the above pointer points to a valid area of
- * memory of the correct size.
- *
- * 4. You really believe that making a copy of that memory would be too
- * expensive.
- *
- * 5. You really know what you are doing.
- *
- * Notice that NO CHECKS are performed on the actual memory, and if you try to
- * access illegal areas of memory, your computer will suffer from it. Once
- * again, use this class ONLY if you know exactly what you are doing.
- *
- * Two constructors are provided. One for read-write access, and one for read
- * only access, and you are allowed to use this class on objects of type const
- * Number*. However you should be aware of the fact that the constness of the
- * array pointed to is ignored, which means that you should only use the const
- * constructor when the actual object you are constructing is itself a
- * constant object. As a corollary, you will be allowed to call even functions
- * of the base class that change data of the array; this being a violation of
- * the C++ type model, you should make sure that this only happens if it is
- * really valid and, in general, if you know what you are doing.
- *
- * Since this class does not own the memory that you are accessing, you have
- * to make sure that the lifetime of the section of memory you are viewing is
- * longer than this object. No attempt is made to ensure that this is the
- * case.
- *
- * An example usage of this class is the following:
- *
- * @code
- * // Create an array of length 5;
- * double * array = new double[5];
- * // Now create a view of the above array that is compatible with the
- * // Vector<double> class
- * VectorView<double> view(5, array);
- *
- * view(1) = 4;
- *
- * // The following line should output 4.
- * cout << array[1] << endl;
- *
- * // If debug mode is on, then the following triggers an exception:
- * view(6) = 4;
- *
- * // But notice that no checks are performed, so this is legal but WILL
- * // NOT work
- * VectorView<double> wrong_view(10, array);
- *
- * // Now no assert will be thrown if you type wrong_view(6), but most
- * // likely a segfault will occur.
- * view(6) = 4;
- *
- * // Notice that this construction is legal. It will create a copy of
- * // the array.
- * const Vector<double> const_copy(view);
- *
- * // Now this is the correct way to instantiate a constant view of the
- * // above vector:
- * const VectorView<double> correct_const_copy_view(5, const_copy.begin());
- *
- * // While this will compile, BUT WILL NOT COMPLAIN if you try to write
- * // on it!
- * VectorView<double> wrong_const_copy_view(5, const_copy.begin());
- *
- * // Now writing to elements of wrong_const_copy_view is allowed, and
- * // will change the same memory as the const_copy object.
- * wrong_const_copy_view(1) = 5;
- *
- * if(copy_view(1) == wrong_const_copy_view(1)) cout << "Tautology";
- *
- * @endcode
- *
- *
- * @note Instantiations for this template are provided for <tt>@<float@>,
- * @<double@>, @<std::complex@<float@>@>, @<std::complex@<double@>@></tt>;
- * others can be generated in application programs (see the section on
- * @ref Instantiations
- * in the manual).
- *
- * @author Luca Heltai, 2009
- *
- * @deprecated Use ArrayView instead.
- */
-template <typename Number>
-class DEAL_II_DEPRECATED VectorView : public Vector<Number>
-{
-public:
- /**
- * Declare type for container size.
- */
- using size_type = types::global_dof_index;
-
- /**
- * Read write constructor. Takes the size of the vector, just like the
- * standard one, but the data is picked starting from the location of the
- * pointer @p ptr.
- */
- VectorView(const size_type new_size, Number *ptr);
-
- /**
- * The constant constructor is the same as above, however you will not be
- * able to access the data for write access.
- *
- * You should only use this class by constructing it as a const
- * VectorView<double>(size, ptr) object.
- *
- * Undefined behavior will occur if you construct it as a non const object
- * or attempt to write on it.
- */
- VectorView(const size_type new_size, const Number *ptr);
-
- /**
- * This destructor will only reset the internal sizes and the internal
- * pointers, but it will NOT clear the memory.
- */
- ~VectorView() override;
-
- /**
- * The reinit function of this object has a behavior which is different from
- * the one of the base class. VectorView does not handle memory, and you
- * should not attempt to resize the memory that is pointed to by this object
- * using the reinit function. You can, however, resize the view that you
- * have of the original object. Notice that it is your own responsibility to
- * ensure that the memory you are pointing to is big enough.
- *
- * Similarly to what happens in the base class, if 'omit_zeroing_entries' is
- * false, then the entire content of the vector is set to 0, otherwise the
- * content of the memory is left unchanged.
- *
- * Notice that the following snippet of code may not produce what you
- * expect:
- *
- * @code
- * // Create a vector of length 1.
- * Vector<double> long_vector(1);
- *
- * // Make a view of it
- * VectorView<double> view_of_long_vector(1, long_vector.begin());
- *
- * // Resize the original vector to a bigger size
- * long_vector.reinit(100);
- *
- * // And the view, leaving the memory untouched
- * view_of_long_vector.reinit(100, true);
- * @endcode
- *
- * In the above case, the Vector<double>::reinit method is called, and a NEW
- * area of memory is reserved, possibly not starting at the same place as
- * before. However, the VectorView<double> object keeps pointing to the same
- * old area. After the two reinits, any call to view_of_long_vector(i), with
- * i>0 might cause an attempt to access invalid areas of memory, or might
- * function properly, depending on whether or not the system was able to
- * allocate some memory consecutively after the original allocation.
- *
- * In any case, you should not rely on this behavior, and you should only
- * call this reinit function if you really know what you are doing.
- */
- virtual void
- reinit(const size_type N, const bool omit_zeroing_entries = false) override;
-
- /**
- * This reinit function is equivalent to constructing a new object with the
- * given size, starting from the pointer ptr.
- */
- void
- reinit(const size_type N, Number *ptr);
-
- /**
- * This reinit function is equivalent to constructing a new object with the
- * given size, starting from the pointer ptr. The same considerations made
- * for the constructor apply here.
- */
- void
- reinit(const size_type N, const Number *ptr);
-
- /**
- * This function is here to prevent memory corruption. It should never be
- * called, and will throw an exception if you try to do so.
- */
- virtual void
- swap(Vector<Number> &v) override;
-};
-
-
-
-/*@}*/
-/*----------------------- Inline functions ----------------------------------*/
-
-#ifndef DOXYGEN
-
-template <typename Number>
-inline VectorView<Number>::VectorView(const size_type new_size, Number *ptr)
-{
- this->vec_size = new_size;
- this->max_vec_size = new_size;
- // release the pointer, but do not delete the object pointed to
- this->values.release();
- this->values.reset(ptr);
-}
-
-
-
-template <typename Number>
-inline VectorView<Number>::VectorView(const size_type new_size,
- const Number * ptr)
-{
- this->vec_size = new_size;
- this->max_vec_size = new_size;
- this->values.reset(const_cast<Number *>(ptr));
-}
-
-
-
-template <typename Number>
-inline VectorView<Number>::~VectorView()
-{
- // avoid that the base class releases
- // memory it doesn't own
- this->vec_size = 0;
- this->max_vec_size = 0;
-
- // release the pointer, but do not delete the object pointed to
- this->values.release();
-}
-
-
-template <typename Number>
-inline void
-VectorView<Number>::reinit(const size_type N, const bool omit_zeroing_entries)
-{
- this->vec_size = N;
- this->max_vec_size = N;
- if (omit_zeroing_entries == false)
- Vector<Number>::operator=(static_cast<Number>(0));
-}
-
-
-template <typename Number>
-inline void
-VectorView<Number>::reinit(const size_type new_size, Number *ptr)
-{
- this->vec_size = new_size;
- this->max_vec_size = new_size;
- // release the pointer, but do not delete the object pointed to
- this->values.release();
- this->values.reset(ptr);
-}
-
-
-template <typename Number>
-inline void
-VectorView<Number>::reinit(const size_type new_size, const Number *ptr)
-{
- this->vec_size = new_size;
- this->max_vec_size = new_size;
- // release the pointer, but do not delete the object pointed to
- this->values.release();
- this->values.reset(const_cast<Number *>(ptr));
-}
-
-
-template <typename Number>
-inline void
-VectorView<Number>::swap(Vector<Number> &)
-{
- AssertThrow(false, ExcMessage("Can't swap a VectorView with a Vector!"));
-}
-
-#endif
-
-DEAL_II_NAMESPACE_CLOSE
-
-#endif
#include <deal.II/lac/sparse_matrix.h>
#include <deal.II/lac/trilinos_epetra_vector.h>
#include <deal.II/lac/trilinos_vector.h>
-#include <deal.II/lac/vector_view.h>
#include <deal.II/multigrid/mg_base.h>
#include <deal.II/multigrid/mg_tools.h>
tridiagonal_matrix.cc
vector.cc
vector_memory.cc
- vector_view.cc
)
SET(_separate_src
vector.inst.in
vector_memory.inst.in
vector_memory_release.inst.in
- vector_view.inst.in
)
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1999 - 2014 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.
-//
-// ---------------------------------------------------------------------
-
-#include <deal.II/lac/vector_view.h>
-
-DEAL_II_NAMESPACE_OPEN
-
-#include "vector_view.inst"
-
-DEAL_II_NAMESPACE_CLOSE
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1999 - 2016 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-for (SCALAR : REAL_SCALARS)
- {
- template class VectorView<SCALAR>;
- }
-
-for (SCALAR : COMPLEX_SCALARS)
- {
- template class VectorView<SCALAR>;
- }
// check that the inner product is exactly the same down to roundoff for
-// various vectors. Due to vectorization and its requirements for alignment,
-// we also test that the result does not depend on the alignment of any of the
-// vectors by choosing among several start locations of a vector relative to a
-// data array allocated as usual.
+// various vectors.
+//
+// It was previously possible to create an unaligned view (a VectorView
+// object) into a Vector: an original goal of this test was to verify that
+// unaligned dot products were identical to aligned ones, but since Vector now
+// uses AlignedVector to store its data it is no longer possible to test this.
#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
+#include <deal.II/lac/vector.templates.h>
#include "../tests.h"
for (unsigned int shift1 = 0; shift1 < 8; ++shift1)
for (unsigned int shift2 = 0; shift2 < 8; ++shift2)
{
- VectorView<number> v1(size, larger1.begin() + shift1);
- VectorView<number> v2(size, larger2.begin() + shift2);
+ Vector<number> v1(larger1.begin() + shift1,
+ larger1.begin() + shift1 + size);
+ Vector<number> v2(larger2.begin() + shift2,
+ larger2.begin() + shift2 + size);
for (unsigned int i = 0; i < size; ++i)
{
v1(i) = in1(i);
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 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.
-//
-// ---------------------------------------------------------------------
-
-
-
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
-
-#include "../tests.h"
-
-const unsigned int N = 10;
-unsigned int check_point = 0;
-
-template <typename number>
-void
-print(const Vector<number> &v)
-{
- for (unsigned int i = 0; i < v.size(); ++i)
- deallog << v(i) << '\t';
- deallog << std::endl;
-}
-
-template <typename T>
-void
-fill(T &a)
-{
- for (unsigned int i = 0; i < a.size(); ++i)
- a(i) = i;
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- Vector<double> v1(N);
- fill(v1);
-
- deallog << "Vector" << std::endl;
- print(v1);
-
- VectorView<double> 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<double> v3(v1);
-
- deallog << "const Vector" << std::endl;
- print(v3);
-
- VectorView<double> v4(N, v3.begin());
- deallog << "const Vector View" << std::endl;
- print(v4);
-
- v4.reinit(N, v1.begin());
- v4.reinit(N, v3.begin());
-}
+++ /dev/null
-
-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
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 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 VectorView::checkReadOnlyConstructor
-
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
-
-#include "../tests.h"
-
-template <typename number>
-void
-checkReadOnlyConstructor(const Vector<number> &V)
-{
- deallog << "Read-only constructor" << std::endl;
- VectorView<number> VV(V.size(), V.begin());
-
- deallog << "Printing Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- /* deallog << "Incrementing Vector<number> elements using Read-only handle of
- VectorView<number>" << std::endl; deallog << "Function fails beyond this
- point" << std::endl; for (unsigned int i=0; i<VV.size(); ++i)
- VV(i)=VV(i)+1; */
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- Vector<double> V1(5);
- V1(0) = 1;
- V1(1) = 2;
- V1(2) = 3;
- V1(3) = 4;
- V1(4) = 5;
-
- const Vector<double> V2(V1);
-
- checkReadOnlyConstructor<double>(V2);
-}
+++ /dev/null
-
-DEAL::Read-only constructor
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00
-DEAL::Printing VectorView<number> pointing to Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 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 VectorView::checkReinit1
-
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
-
-#include "../tests.h"
-
-template <typename number, typename size_type>
-void
-checkReinit1(const size_type N, const bool fast = false)
-{
- deallog << "Reinit with const size and fast" << std::endl;
-
- deallog
- << "Creating Vector<number> of size N+10 and filling with values 1 to N+10"
- << std::endl;
-
- Vector<number> V(N + 10);
- for (unsigned int i = 0; i < V.size(); i++)
- V(i) = i + 1;
-
- deallog
- << "Creating VectorView<number> of size N+10 pointing to Vector<number>"
- << std::endl;
- VectorView<number> VV(V.size(), V.begin());
-
- deallog << "Printing Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- deallog << "Reinit VectorView<number> to size N from N+10 with fast=" << fast
- << std::endl;
- VV.reinit(N, fast);
-
- deallog << "Printing Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- checkReinit1<double, int>(10, false);
- checkReinit1<double, int>(10, true);
-}
+++ /dev/null
-
-DEAL::Reinit with const size and fast
-DEAL::Creating Vector<number> of size N+10 and filling with values 1 to N+10
-DEAL::Creating VectorView<number> of size N+10 pointing to Vector<number>
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00
-DEAL::Printing VectorView<number> pointing to Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00
-DEAL::Reinit VectorView<number> to size N from N+10 with fast=0
-DEAL::Printing Vector<number>
-DEAL::0 0 0 0 0 0 0 0 0 0 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00
-DEAL::Printing VectorView<number> pointing to Vector<number>
-DEAL::0 0 0 0 0 0 0 0 0 0
-DEAL::Reinit with const size and fast
-DEAL::Creating Vector<number> of size N+10 and filling with values 1 to N+10
-DEAL::Creating VectorView<number> of size N+10 pointing to Vector<number>
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00
-DEAL::Printing VectorView<number> pointing to Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00
-DEAL::Reinit VectorView<number> to size N from N+10 with fast=1
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 20.00
-DEAL::Printing VectorView<number> pointing to Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 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 VectorView::checkReinit3
-
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
-
-#include "../tests.h"
-
-template <typename number>
-void
-checkReinit3(const Vector<number> &V)
-{
- deallog
- << "Reinit a ReadOnly VectorView<number> with const Vector<number> and const size"
- << std::endl;
-
- deallog
- << "Creating dummy Vector<number> of size V.size() and filling with zeros"
- << std::endl;
-
- Vector<number> _V(V.size());
- for (unsigned int i = 0; i < _V.size(); i++)
- _V(i) = 0;
-
- deallog << "Creating VectorView<number> pointing to dummy Vector<number>"
- << std::endl;
- VectorView<number> VV(_V.size(), _V.begin());
-
- deallog << "Printing dummy Vector<number>" << std::endl;
- for (unsigned int i = 0; i < _V.size(); ++i)
- deallog << _V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to dummy Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- deallog << "Reinit VectorView<number> to half of Vector<number>" << std::endl;
- VV.reinit(V.size() / 2, V.begin());
-
- deallog << "Printing Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to half of Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- /* deallog << "Incrementing Vector<number> elements using Read-only handle of
- VectorView<number>" << std::endl; deallog << "Function fails beyond this
- point" << std::endl; for (unsigned int i=0; i<VV.size(); ++i)
- VV(i)=VV(i)+1; */
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- Vector<double> V1(5);
- V1(0) = 1;
- V1(1) = 2;
- V1(2) = 3;
- V1(3) = 4;
- V1(4) = 5;
-
- const Vector<double> V2(V1);
-
- checkReinit3<double>(V2);
-}
+++ /dev/null
-
-DEAL::Reinit a ReadOnly VectorView<number> with const Vector<number> and const size
-DEAL::Creating dummy Vector<number> of size V.size() and filling with zeros
-DEAL::Creating VectorView<number> pointing to dummy Vector<number>
-DEAL::Printing dummy Vector<number>
-DEAL::0 0 0 0 0
-DEAL::Printing VectorView<number> pointing to dummy Vector<number>
-DEAL::0 0 0 0 0
-DEAL::Reinit VectorView<number> to half of Vector<number>
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00
-DEAL::Printing VectorView<number> pointing to half of Vector<number>
-DEAL::1.00 2.00
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 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 VectorView::checkReinit2
-
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
-
-#include "../tests.h"
-
-template <typename number>
-void
-checkReinit2(Vector<number> &V)
-{
- deallog
- << "Reinit a ReadWrite VectorView<number> with Vector<number> and const size"
- << std::endl;
-
- deallog
- << "Creating dummy Vector<number> of size V.size() and filling with zeros"
- << std::endl;
-
- Vector<number> _V(V.size());
- for (unsigned int i = 0; i < _V.size(); i++)
- _V(i) = 0;
-
- deallog << "Creating VectorView<number> pointing to dummy Vector<number>"
- << std::endl;
- VectorView<number> VV(_V.size(), _V.begin());
-
- deallog << "Printing dummy Vector<number>" << std::endl;
- for (unsigned int i = 0; i < _V.size(); ++i)
- deallog << _V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to dummy Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- deallog << "Reinit VectorView<number> to half of Vector<number>" << std::endl;
- VV.reinit(V.size() / 2, V.begin());
-
- deallog << "Printing Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to half of Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- deallog
- << "Incrementing Vector<number> elements using Read-write handle of VectorView<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- VV(i) = VV(i) + 1;
-
- deallog << "Printing modified Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- Vector<double> V1(5);
- V1(0) = 1;
- V1(1) = 2;
- V1(2) = 3;
- V1(3) = 4;
- V1(4) = 5;
-
- checkReinit2<double>(V1);
-}
+++ /dev/null
-
-DEAL::Reinit a ReadWrite VectorView<number> with Vector<number> and const size
-DEAL::Creating dummy Vector<number> of size V.size() and filling with zeros
-DEAL::Creating VectorView<number> pointing to dummy Vector<number>
-DEAL::Printing dummy Vector<number>
-DEAL::0 0 0 0 0
-DEAL::Printing VectorView<number> pointing to dummy Vector<number>
-DEAL::0 0 0 0 0
-DEAL::Reinit VectorView<number> to half of Vector<number>
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00
-DEAL::Printing VectorView<number> pointing to half of Vector<number>
-DEAL::1.00 2.00
-DEAL::Incrementing Vector<number> elements using Read-write handle of VectorView<number>
-DEAL::Printing modified Vector<number>
-DEAL::2.00 3.00 3.00 4.00 5.00
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 1998 - 2017 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 VectorView::checkReadWriteConstructor
-
-#include <deal.II/lac/vector.h>
-#include <deal.II/lac/vector_view.h>
-
-#include "../tests.h"
-
-template <typename number>
-void
-checkReadWriteConstructor(Vector<number> &V)
-{
- deallog << "Read-write constructor" << std::endl;
- VectorView<number> VV(V.size(), V.begin());
-
- deallog << "Printing Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-
- deallog << "Printing VectorView<number> pointing to Vector<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- deallog << VV(i) << '\t';
- deallog << std::endl;
-
- deallog
- << "Incrementing Vector<number> elements using Read-write handle of VectorView<number>"
- << std::endl;
- for (unsigned int i = 0; i < VV.size(); ++i)
- VV(i) = VV(i) + 1;
-
- deallog << "Printing modified Vector<number>" << std::endl;
- for (unsigned int i = 0; i < V.size(); ++i)
- deallog << V(i) << '\t';
- deallog << std::endl;
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(2);
- deallog.attach(logfile);
-
- Vector<double> V1(5);
- V1(0) = 1;
- V1(1) = 2;
- V1(2) = 3;
- V1(3) = 4;
- V1(4) = 5;
-
- checkReadWriteConstructor<double>(V1);
-}
+++ /dev/null
-
-DEAL::Read-write constructor
-DEAL::Printing Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00
-DEAL::Printing VectorView<number> pointing to Vector<number>
-DEAL::1.00 2.00 3.00 4.00 5.00
-DEAL::Incrementing Vector<number> elements using Read-write handle of VectorView<number>
-DEAL::Printing modified Vector<number>
-DEAL::2.00 3.00 4.00 5.00 6.00