From e30d7f3c8b2163850622fef36978b58d202bbdad Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 1 Apr 2020 14:54:51 -0400 Subject: [PATCH] Remove PointerMatrix* --- doc/doxygen/headers/concepts.h | 2 +- .../incompatibilities/20200402DanielArndt | 5 + include/deal.II/lac/pointer_matrix.h | 959 ------------------ tests/bits/block_sparse_matrix_1.cc | 1 - tests/lac/pointer_matrix.cc | 60 -- tests/lac/pointer_matrix.output | 11 - tests/lac/pointer_matrix_01.cc | 42 - tests/lac/pointer_matrix_01.output | 3 - tests/lac/pointer_matrix_02.cc | 47 - tests/lac/pointer_matrix_02.output | 3 - tests/lac/pointer_matrix_03.cc | 44 - tests/lac/pointer_matrix_03.output | 3 - tests/lac/pointer_matrix_04.cc | 49 - tests/lac/pointer_matrix_04.output | 3 - tests/lac/pointer_matrix_05.cc | 70 -- tests/lac/pointer_matrix_05.output | 5 - tests/lac/pointer_matrix_06.cc | 70 -- tests/lac/pointer_matrix_06.output | 5 - tests/lac/pointer_matrix_07.cc | 79 -- tests/lac/pointer_matrix_07.output | 6 - tests/lac/pointer_matrix_08.cc | 79 -- tests/lac/pointer_matrix_08.output | 6 - tests/lac/pointer_matrix_09.cc | 76 -- tests/lac/pointer_matrix_09.output | 9 - tests/lac/pointer_matrix_10.cc | 107 -- tests/lac/pointer_matrix_10.output | 14 - tests/lac/pointer_matrix_vector.cc | 63 -- tests/lac/pointer_matrix_vector.output | 5 - 28 files changed, 6 insertions(+), 1820 deletions(-) create mode 100644 doc/news/changes/incompatibilities/20200402DanielArndt delete mode 100644 include/deal.II/lac/pointer_matrix.h delete mode 100644 tests/lac/pointer_matrix.cc delete mode 100644 tests/lac/pointer_matrix.output delete mode 100644 tests/lac/pointer_matrix_01.cc delete mode 100644 tests/lac/pointer_matrix_01.output delete mode 100644 tests/lac/pointer_matrix_02.cc delete mode 100644 tests/lac/pointer_matrix_02.output delete mode 100644 tests/lac/pointer_matrix_03.cc delete mode 100644 tests/lac/pointer_matrix_03.output delete mode 100644 tests/lac/pointer_matrix_04.cc delete mode 100644 tests/lac/pointer_matrix_04.output delete mode 100644 tests/lac/pointer_matrix_05.cc delete mode 100644 tests/lac/pointer_matrix_05.output delete mode 100644 tests/lac/pointer_matrix_06.cc delete mode 100644 tests/lac/pointer_matrix_06.output delete mode 100644 tests/lac/pointer_matrix_07.cc delete mode 100644 tests/lac/pointer_matrix_07.output delete mode 100644 tests/lac/pointer_matrix_08.cc delete mode 100644 tests/lac/pointer_matrix_08.output delete mode 100644 tests/lac/pointer_matrix_09.cc delete mode 100644 tests/lac/pointer_matrix_09.output delete mode 100644 tests/lac/pointer_matrix_10.cc delete mode 100644 tests/lac/pointer_matrix_10.output delete mode 100644 tests/lac/pointer_matrix_vector.cc delete mode 100644 tests/lac/pointer_matrix_vector.output diff --git a/doc/doxygen/headers/concepts.h b/doc/doxygen/headers/concepts.h index a0ace10655..56d278e0ab 100644 --- a/doc/doxygen/headers/concepts.h +++ b/doc/doxygen/headers/concepts.h @@ -121,7 +121,7 @@ * Template functions in C++ cannot be virtual (which is the main reason why * this approach is not used in deal.II), so implementing this interface with * inheritance will not work, but it is still a good way to think about this - * template concept. One can use the PointerMatrixAux class to implement + * template concept. One can use the LinearOperator class to implement * vmult_add and Tvmult_add instead of implementing * them manually. * diff --git a/doc/news/changes/incompatibilities/20200402DanielArndt b/doc/news/changes/incompatibilities/20200402DanielArndt new file mode 100644 index 0000000000..43bd3d78f0 --- /dev/null +++ b/doc/news/changes/incompatibilities/20200402DanielArndt @@ -0,0 +1,5 @@ +Removed: The deprecated classes PointerMatrixBase, PointerMatrix, +PointerMatrixVector and PointerMatrixAux and the related function +new_pointer_matrix_base() have been removed. Use LinearOperator instead. +
+(Daniel Arndt, 2020/04/02) diff --git a/include/deal.II/lac/pointer_matrix.h b/include/deal.II/lac/pointer_matrix.h deleted file mode 100644 index 6f3d254b2e..0000000000 --- a/include/deal.II/lac/pointer_matrix.h +++ /dev/null @@ -1,959 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2002 - 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_pointer_matrix_h -#define dealii_pointer_matrix_h - -#include - -#include -#include - -#include -#include - -DEAL_II_NAMESPACE_OPEN - -// Forward declarations -#ifndef DOXYGEN -template -class VectorMemory; - -class IdentityMatrix; -template -class FullMatrix; -template -class LAPACKFullMatrix; -template -class SparseMatrix; -template -class BlockSparseMatrix; -template -class SparseMatrixEZ; -template -class BlockSparseMatrixEZ; -template -class TridiagonalMatrix; -template -class BlockMatrixArray; -#endif - -/*! @addtogroup Matrix2 - *@{ - */ - -/** - * Abstract class for use in iterations. This class provides the interface - * required by LAC solver classes. It allows to use different concrete matrix - * classes in the same context, as long as they apply to the same vector - * class. - * - * @deprecated Use LinearOperator instead - * - * @author Guido Kanschat, 2000, 2001, 2002 - */ -template -class DEAL_II_DEPRECATED PointerMatrixBase : public Subscriptor -{ -public: - /** - * Value type of this matrix. since the matrix itself is unknown, we take - * the value type of the vector. Therefore, matrix entries must be - * convertible to vector entries. - * - * This was defined to make this matrix a possible template argument to - * BlockMatrixArray. - */ - using value_type = typename VectorType::value_type; - - /** - * Virtual destructor. Does nothing except making sure that the destructor - * of any derived class is called whenever a pointer-to-base-class object is - * destroyed. - */ - virtual ~PointerMatrixBase() override = default; - - /** - * Reset the object to its original state. - */ - virtual void - clear() = 0; - - /** - * Matrix-vector product. - */ - virtual void - vmult(VectorType &dst, const VectorType &src) const = 0; - - /** - * Transposed matrix-vector product. - */ - virtual void - Tvmult(VectorType &dst, const VectorType &src) const = 0; - - /** - * Matrix-vector product, adding to dst. - */ - virtual void - vmult_add(VectorType &dst, const VectorType &src) const = 0; - - /** - * Transposed matrix-vector product, adding to dst. - */ - virtual void - Tvmult_add(VectorType &dst, const VectorType &src) const = 0; -}; - - -/** - * A pointer to be used as a matrix. This class stores a pointer to a matrix - * and can be used as a matrix itself in iterative methods. - * - * The main purpose for the existence of this class is its base class, which - * only has a vector as template argument. Therefore, this interface provides - * an abstract base class for matrices. - * - * @deprecated Use LinearOperator instead - * - * @author Guido Kanschat 2000, 2001, 2002 - */ -template -class DEAL_II_DEPRECATED PointerMatrix : public PointerMatrixBase -{ -public: - /** - * Constructor. The pointer in the argument is stored in this class. As - * usual, the lifetime of *M must be longer than the one of the - * PointerMatrix. - * - * If M is zero, no matrix is stored. - */ - PointerMatrix(const MatrixType *M = nullptr); - - /** - * Constructor. - * - * This class internally stores a pointer to a matrix via a SmartPointer - * object. The SmartPointer class allows to associate a name with the object - * pointed to that identifies the object that has the pointer, in order to - * identify objects that still refer to the object pointed to. The @p name - * argument to this function is used to this end, i.e., you can in essence - * assign a name to the current PointerMatrix object. - */ - PointerMatrix(const char *name); - - /** - * Constructor. M points to a matrix which must live longer than - * the PointerMatrix. - * - * This class internally stores a pointer to a matrix via a SmartPointer - * object. The SmartPointer class allows to associate a name with the object - * pointed to that identifies the object that has the pointer, in order to - * identify objects that still refer to the object pointed to. The @p name - * argument to this function is used to this end, i.e., you can in essence - * assign a name to the current PointerMatrix object. - */ - PointerMatrix(const MatrixType *M, const char *name); - - // Use doc from base class - virtual void - clear() override; - - /** - * Return whether the object is empty. - */ - bool - empty() const; - - /** - * Assign a new matrix pointer. Deletes the old pointer and releases its - * matrix. - * @see SmartPointer - */ - const PointerMatrix & - operator=(const MatrixType *M); - - /** - * Matrix-vector product. - */ - virtual void - vmult(VectorType &dst, const VectorType &src) const override; - - /** - * Transposed matrix-vector product. - */ - virtual void - Tvmult(VectorType &dst, const VectorType &src) const override; - - /** - * Matrix-vector product, adding to dst. - */ - virtual void - vmult_add(VectorType &dst, const VectorType &src) const override; - - /** - * Transposed matrix-vector product, adding to dst. - */ - virtual void - Tvmult_add(VectorType &dst, const VectorType &src) const override; - -private: - /** - * The pointer to the actual matrix. - */ - SmartPointer> m; -}; - - -/** - * A pointer to be used as a matrix. This class stores a pointer to a matrix - * and can be used as a matrix itself in iterative methods. - * - * The main purpose for the existence of this class is its base class, which - * only has a vector as template argument. Therefore, this interface provides - * an abstract base class for matrices. - * - * This class differs form PointerMatrix by its additional VectorMemory object - * and by the fact that it implements the functions vmult_add() and - * Tvmult_add() only using vmult() and Tvmult() of the MatrixType. - * - * @deprecated Use LinearOperator instead - * - * @author Guido Kanschat 2006 - */ -template -class DEAL_II_DEPRECATED PointerMatrixAux : public PointerMatrixBase -{ -public: - /** - * Constructor. The pointer in the argument is stored in this class. As - * usual, the lifetime of *M must be longer than the one of the - * PointerMatrixAux. - * - * If M is zero, no matrix is stored. - * - * If mem is zero, then GrowingVectorMemory is used. - */ - PointerMatrixAux(VectorMemory *mem = 0, const MatrixType *M = 0); - - /** - * Constructor not using a matrix. - * - * This class internally stores a pointer to a matrix via a SmartPointer - * object. The SmartPointer class allows to associate a name with the object - * pointed to that identifies the object that has the pointer, in order to - * identify objects that still refer to the object pointed to. The @p name - * argument to this function is used to this end, i.e., you can in essence - * assign a name to the current PointerMatrix object. - */ - PointerMatrixAux(VectorMemory *mem, const char *name); - - /** - * Constructor. M points to a matrix which must live longer than - * the PointerMatrixAux. - * - * This class internally stores a pointer to a matrix via a SmartPointer - * object. The SmartPointer class allows to associate a name with the object - * pointed to that identifies the object that has the pointer, in order to - * identify objects that still refer to the object pointed to. The @p name - * argument to this function is used to this end, i.e., you can in essence - * assign a name to the current PointerMatrix object. - */ - PointerMatrixAux(VectorMemory *mem, - const MatrixType * M, - const char * name); - - // Use doc from base class - virtual void - clear() override; - - /** - * Return whether the object is empty. - */ - bool - empty() const; - - /** - * Assign a new VectorMemory object for getting auxiliary vectors. - */ - void - set_memory(VectorMemory *mem); - - /** - * Assign a new matrix pointer. Deletes the old pointer and releases its - * matrix. - * @see SmartPointer - */ - const PointerMatrixAux & - operator=(const MatrixType *M); - - /** - * Matrix-vector product. - */ - virtual void - vmult(VectorType &dst, const VectorType &src) const override; - - /** - * Transposed matrix-vector product. - */ - virtual void - Tvmult(VectorType &dst, const VectorType &src) const override; - - /** - * Matrix-vector product, adding to dst. - */ - virtual void - vmult_add(VectorType &dst, const VectorType &src) const override; - - /** - * Transposed matrix-vector product, adding to dst. - */ - virtual void - Tvmult_add(VectorType &dst, const VectorType &src) const override; - -private: - /** - * The backup memory if none was provided. - */ - mutable GrowingVectorMemory my_memory; - - /** - * Object for getting the auxiliary vector. - */ - mutable SmartPointer, - PointerMatrixAux> - mem; - - /** - * The pointer to the actual matrix. - */ - SmartPointer> m; -}; - - - -/** - * Implement matrix multiplications for a vector using the PointerMatrixBase - * functionality. Objects of this class can be used in block matrices. - * - * Implements a matrix with image dimension 1 by using the scalar product - * (#vmult()) and scalar multiplication (#Tvmult()) functions of the Vector - * class. - * - * @deprecated Use LinearOperator instead - * - * @author Guido Kanschat, 2006 - */ -template -class DEAL_II_DEPRECATED PointerMatrixVector - : public PointerMatrixBase> -{ -public: - /** - * Constructor. The pointer in the argument is stored in this class. As - * usual, the lifetime of *M must be longer than the one of the - * PointerMatrix. - * - * If M is zero, no matrix is stored. - */ - PointerMatrixVector(const Vector *M = 0); - - /** - * Constructor. - * - * This class internally stores a pointer to a matrix via a SmartPointer - * object. The SmartPointer class allows to associate a name with the object - * pointed to that identifies the object that has the pointer, in order to - * identify objects that still refer to the object pointed to. The @p name - * argument to this function is used to this end, i.e., you can in essence - * assign a name to the current PointerMatrix object. - */ - PointerMatrixVector(const char *name); - - /** - * Constructor. M points to a matrix which must live longer than - * the PointerMatrix. - * - * This class internally stores a pointer to a matrix via a SmartPointer - * object. The SmartPointer class allows to associate a name with the object - * pointed to that identifies the object that has the pointer, in order to - * identify objects that still refer to the object pointed to. The @p name - * argument to this function is used to this end, i.e., you can in essence - * assign a name to the current PointerMatrix object. - */ - PointerMatrixVector(const Vector *M, const char *name); - - // Use doc from base class - virtual void - clear(); - - /** - * Return whether the object is empty. - */ - bool - empty() const; - - /** - * Assign a new matrix pointer. Deletes the old pointer and releases its - * matrix. - * @see SmartPointer - */ - const PointerMatrixVector & - operator=(const Vector *M); - - /** - * Matrix-vector product, actually the scalar product of src and - * the vector representing this matrix. - * - * The dimension of dst is 1, while that of src is the - * size of the vector representing this matrix. - */ - virtual void - vmult(Vector &dst, const Vector &src) const; - - /** - * Transposed matrix-vector product, actually the multiplication of the - * vector representing this matrix with src(0). - * - * The dimension of src is 1, while that of dst is the - * size of the vector representing this matrix. - */ - virtual void - Tvmult(Vector &dst, const Vector &src) const; - - /** - * Matrix-vector product, adding to dst. - * - * The dimension of dst is 1, while that of src is the - * size of the vector representing this matrix. - */ - virtual void - vmult_add(Vector &dst, const Vector &src) const; - - /** - * Transposed matrix-vector product, adding to dst. - * - * The dimension of src is 1, while that of dst is the - * size of the vector representing this matrix. - */ - virtual void - Tvmult_add(Vector &dst, const Vector &src) const; - -private: - /** - * The pointer to the actual matrix. - */ - SmartPointer, PointerMatrixVector> m; -}; - - - -/** - * This function helps you creating a PointerMatrixBase object if you do not - * want to provide the full template arguments of PointerMatrix or - * PointerMatrixAux. - * - * Note that this function by default creates a PointerMatrixAux, emulating - * the functions vmult_add and Tvmult_add, using an - * auxiliary vector. It is overloaded for the library matrix classes - * implementing these functions themselves. If you have such a class, you - * should overload the function in order to save memory and time. - * - * The result is a PointerMatrixBase* pointing to matrix. The - * VectorType argument is a dummy just used to determine the template - * arguments. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrixAux - */ -template -inline PointerMatrixBase * -new_pointer_matrix_base(MatrixType &matrix, - const VectorType &, - const char *name = "PointerMatrixAux") -{ - return new PointerMatrixAux(nullptr, &matrix, name); -} - -/** - * Specialized version for IdentityMatrix. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase> * -new_pointer_matrix_base(const IdentityMatrix &matrix, - const Vector &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix>(&matrix, name); -} - - -/** - * Specialized version for FullMatrix. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase> * -new_pointer_matrix_base(const FullMatrix &matrix, - const Vector &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, Vector>(&matrix, name); -} - - -/** - * Specialized version for LAPACKFullMatrix. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase> * -new_pointer_matrix_base(const LAPACKFullMatrix &matrix, - const Vector &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, Vector>(&matrix, - name); -} - - -/** - * Specialized version for SparseMatrix. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase> * -new_pointer_matrix_base(const SparseMatrix &matrix, - const Vector &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, Vector>(&matrix, - name); -} - - -/** - * Specialized version for BlockSparseMatrix. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase * -new_pointer_matrix_base(const BlockSparseMatrix &matrix, - const VectorType &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, VectorType>(&matrix, - name); -} - - -/** - * Specialized version for SparseMatrixEZ. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase> * -new_pointer_matrix_base(const SparseMatrixEZ &matrix, - const Vector &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, Vector>(&matrix, - name); -} - - -/** - * Specialized version for BlockSparseMatrixEZ. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase * -new_pointer_matrix_base(const BlockSparseMatrixEZ &matrix, - const VectorType &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, VectorType>(&matrix, - name); -} - - -/** - * Specialized version for BlockMatrixArray. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase * -new_pointer_matrix_base( - const BlockMatrixArray &matrix, - const BLOCK_VectorType &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, - BlockVector>(&matrix, name); -} - - -/** - * Specialized version for TridiagonalMatrix. - * - * @relatesalso PointerMatrixBase @relatesalso PointerMatrix - */ -template -PointerMatrixBase> * -new_pointer_matrix_base(const TridiagonalMatrix &matrix, - const Vector &, - const char *name = "PointerMatrix") -{ - return new PointerMatrix, Vector>(&matrix, - name); -} - - - -/*@}*/ -//--------------------------------------------------------------------------- - - -template -PointerMatrix::PointerMatrix(const MatrixType *M) - : m(M, typeid(*this).name()) -{} - - -template -PointerMatrix::PointerMatrix(const char *name) - : m(nullptr, name) -{} - - -template -PointerMatrix::PointerMatrix(const MatrixType *M, - const char * name) - : m(M, name) -{} - - -template -inline void -PointerMatrix::clear() -{ - m = nullptr; -} - - -template -inline const PointerMatrix & -PointerMatrix::operator=(const MatrixType *M) -{ - m = M; - return *this; -} - - -template -inline bool -PointerMatrix::empty() const -{ - if (m == nullptr) - return true; - return m->empty(); -} - -template -inline void -PointerMatrix::vmult(VectorType & dst, - const VectorType &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - m->vmult(dst, src); -} - - -template -inline void -PointerMatrix::Tvmult(VectorType & dst, - const VectorType &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - m->Tvmult(dst, src); -} - - -template -inline void -PointerMatrix::vmult_add(VectorType & dst, - const VectorType &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - m->vmult_add(dst, src); -} - - -template -inline void -PointerMatrix::Tvmult_add(VectorType & dst, - const VectorType &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - m->Tvmult_add(dst, src); -} - - - -//----------------------------------------------------------------------// - - -template -PointerMatrixAux::PointerMatrixAux( - VectorMemory *mem, - const MatrixType * M) - : mem(mem, typeid(*this).name()) - , m(M, typeid(*this).name()) -{ - if (mem == 0) - mem = &my_memory; -} - - -template -PointerMatrixAux::PointerMatrixAux( - VectorMemory *mem, - const char * name) - : mem(mem, name) - , m(0, name) -{ - if (mem == 0) - mem = &my_memory; -} - - -template -PointerMatrixAux::PointerMatrixAux( - VectorMemory *mem, - const MatrixType * M, - const char * name) - : mem(mem, name) - , m(M, name) -{ - if (mem == nullptr) - mem = &my_memory; -} - - -template -inline void -PointerMatrixAux::clear() -{ - m = nullptr; -} - - -template -inline const PointerMatrixAux & -PointerMatrixAux::operator=(const MatrixType *M) -{ - m = M; - return *this; -} - - -template -inline void -PointerMatrixAux::set_memory( - VectorMemory *M) -{ - mem = M; - if (mem == 0) - mem = &my_memory; -} - - -template -inline bool -PointerMatrixAux::empty() const -{ - if (m == 0) - return true; - return m->empty(); -} - -template -inline void -PointerMatrixAux::vmult(VectorType & dst, - const VectorType &src) const -{ - if (mem == nullptr) - mem = &my_memory; - Assert(mem != nullptr, ExcNotInitialized()); - Assert(m != nullptr, ExcNotInitialized()); - m->vmult(dst, src); -} - - -template -inline void -PointerMatrixAux::Tvmult(VectorType & dst, - const VectorType &src) const -{ - if (mem == nullptr) - mem = &my_memory; - Assert(mem != nullptr, ExcNotInitialized()); - Assert(m != nullptr, ExcNotInitialized()); - m->Tvmult(dst, src); -} - - -template -inline void -PointerMatrixAux::vmult_add(VectorType & dst, - const VectorType &src) const -{ - if (mem == nullptr) - mem = &my_memory; - Assert(mem != nullptr, ExcNotInitialized()); - Assert(m != nullptr, ExcNotInitialized()); - VectorType *v = mem->alloc(); - v->reinit(dst); - m->vmult(*v, src); - dst += *v; - mem->free(v); -} - - -template -inline void -PointerMatrixAux::Tvmult_add( - VectorType & dst, - const VectorType &src) const -{ - if (mem == nullptr) - mem = &my_memory; - Assert(mem != nullptr, ExcNotInitialized()); - Assert(m != nullptr, ExcNotInitialized()); - VectorType *v = mem->alloc(); - v->reinit(dst); - m->Tvmult(*v, src); - dst += *v; - mem->free(v); -} - - -//----------------------------------------------------------------------// - - -template -PointerMatrixVector::PointerMatrixVector(const Vector *M) - : m(M, typeid(*this).name()) -{} - - -template -PointerMatrixVector::PointerMatrixVector(const char *name) - : m(0, name) -{} - - -template -PointerMatrixVector::PointerMatrixVector(const Vector *M, - const char * name) - : m(M, name) -{} - - -template -inline void -PointerMatrixVector::clear() -{ - m = nullptr; -} - - -template -inline const PointerMatrixVector & -PointerMatrixVector::operator=(const Vector *M) -{ - m = M; - return *this; -} - - -template -inline bool -PointerMatrixVector::empty() const -{ - if (m == 0) - return true; - return m->empty(); -} - -template -inline void -PointerMatrixVector::vmult(Vector & dst, - const Vector &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - Assert(dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); - - dst(0) = *m * src; -} - - -template -inline void -PointerMatrixVector::Tvmult(Vector & dst, - const Vector &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); - - dst.equ(src(0), *m); -} - - -template -inline void -PointerMatrixVector::vmult_add(Vector & dst, - const Vector &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - Assert(dst.size() == 1, ExcDimensionMismatch(dst.size(), 1)); - - dst(0) += *m * src; -} - - -template -inline void -PointerMatrixVector::Tvmult_add(Vector & dst, - const Vector &src) const -{ - Assert(m != nullptr, ExcNotInitialized()); - Assert(src.size() == 1, ExcDimensionMismatch(src.size(), 1)); - - dst.add(src(0), *m); -} - - -DEAL_II_NAMESPACE_CLOSE - -#endif diff --git a/tests/bits/block_sparse_matrix_1.cc b/tests/bits/block_sparse_matrix_1.cc index dca7043918..748b4898d9 100644 --- a/tests/bits/block_sparse_matrix_1.cc +++ b/tests/bits/block_sparse_matrix_1.cc @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/lac/pointer_matrix.cc b/tests/lac/pointer_matrix.cc deleted file mode 100644 index 770c5e2502..0000000000 --- a/tests/lac/pointer_matrix.cc +++ /dev/null @@ -1,60 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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. -// -// --------------------------------------------------------------------- - - -// Test vmult and Tvmult of PointerMatrix - -#include -#include -#include - -#include "../tests.h" - - -int -main() -{ - initlog(); - - FullMatrix A(5, 5); - unsigned int k = 0; - for (unsigned int i = 0; i < A.m(); ++i) - for (unsigned int j = 0; j < A.n(); ++j) - A(i, j) = ++k; - - PointerMatrix, Vector> P(&A, "P"); - - Vector x(5); - Vector y(5); - Vector y2(5); - Vector diff(5); - - for (unsigned int i = 0; i < x.size(); ++i) - { - x = 0.; - x(i) = 1.; - A.vmult(y, x); - P.vmult(y2, x); - diff = y; - diff.add(-1., y2); - deallog << "P.vmult: diff " << diff.l2_norm() << std::endl; - - A.Tvmult(y, x); - P.Tvmult(y2, x); - diff = y; - diff.add(-1., y2); - deallog << "P.Tvmult: diff " << diff.l2_norm() << std::endl; - } -} diff --git a/tests/lac/pointer_matrix.output b/tests/lac/pointer_matrix.output deleted file mode 100644 index ed5f77b2b5..0000000000 --- a/tests/lac/pointer_matrix.output +++ /dev/null @@ -1,11 +0,0 @@ - -DEAL::P.vmult: diff 0.00000 -DEAL::P.Tvmult: diff 0.00000 -DEAL::P.vmult: diff 0.00000 -DEAL::P.Tvmult: diff 0.00000 -DEAL::P.vmult: diff 0.00000 -DEAL::P.Tvmult: diff 0.00000 -DEAL::P.vmult: diff 0.00000 -DEAL::P.Tvmult: diff 0.00000 -DEAL::P.vmult: diff 0.00000 -DEAL::P.Tvmult: diff 0.00000 diff --git a/tests/lac/pointer_matrix_01.cc b/tests/lac/pointer_matrix_01.cc deleted file mode 100644 index 26aa2f526b..0000000000 --- a/tests/lac/pointer_matrix_01.cc +++ /dev/null @@ -1,42 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkConstructor1 - -#include -#include -#include - -#include "../tests.h" - -template -void -checkConstructor1() -{ - deallog << "Init with empty matrix" << std::endl; - PointerMatrix, Vector> P; - deallog << "Is matrix empty:" << P.empty() << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - checkConstructor1(); -} diff --git a/tests/lac/pointer_matrix_01.output b/tests/lac/pointer_matrix_01.output deleted file mode 100644 index 29ff7b71c0..0000000000 --- a/tests/lac/pointer_matrix_01.output +++ /dev/null @@ -1,3 +0,0 @@ - -DEAL::Init with empty matrix -DEAL::Is matrix empty:1 diff --git a/tests/lac/pointer_matrix_02.cc b/tests/lac/pointer_matrix_02.cc deleted file mode 100644 index 035889457b..0000000000 --- a/tests/lac/pointer_matrix_02.cc +++ /dev/null @@ -1,47 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkConstructor2 - -#include -#include -#include - -#include "../tests.h" - -template -void -checkConstructor2(FullMatrix &A) -{ - deallog << "Init with matrix A" << std::endl; - PointerMatrix, Vector> P(&A); - deallog << "Is matrix empty:" << P.empty() << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - checkConstructor2(A); -} diff --git a/tests/lac/pointer_matrix_02.output b/tests/lac/pointer_matrix_02.output deleted file mode 100644 index 4b02719a99..0000000000 --- a/tests/lac/pointer_matrix_02.output +++ /dev/null @@ -1,3 +0,0 @@ - -DEAL::Init with matrix A -DEAL::Is matrix empty:0 diff --git a/tests/lac/pointer_matrix_03.cc b/tests/lac/pointer_matrix_03.cc deleted file mode 100644 index cd7aa3fdf0..0000000000 --- a/tests/lac/pointer_matrix_03.cc +++ /dev/null @@ -1,44 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkConstructor3 - -#include -#include -#include - -#include "../tests.h" - -template -void -checkConstructor3(char *name) -{ - deallog << "Init with matrix name" << std::endl; - PointerMatrix, Vector> P(name); - deallog << "Is matrix empty:" << P.empty() << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - char name[] = "Matrix A"; - - checkConstructor3(name); -} diff --git a/tests/lac/pointer_matrix_03.output b/tests/lac/pointer_matrix_03.output deleted file mode 100644 index b90ebcb206..0000000000 --- a/tests/lac/pointer_matrix_03.output +++ /dev/null @@ -1,3 +0,0 @@ - -DEAL::Init with matrix name -DEAL::Is matrix empty:1 diff --git a/tests/lac/pointer_matrix_04.cc b/tests/lac/pointer_matrix_04.cc deleted file mode 100644 index a5f0560dad..0000000000 --- a/tests/lac/pointer_matrix_04.cc +++ /dev/null @@ -1,49 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkConstructor4 - -#include -#include -#include - -#include "../tests.h" - -template -void -checkConstructor4(const FullMatrix &A, char *name) -{ - deallog << "Init with matrix name and matrix" << std::endl; - PointerMatrix, Vector> P(&A, name); - deallog << "Is matrix empty:" << P.empty() << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - char name[] = "Matrix A"; - - checkConstructor4(A, name); -} diff --git a/tests/lac/pointer_matrix_04.output b/tests/lac/pointer_matrix_04.output deleted file mode 100644 index eebc2cc092..0000000000 --- a/tests/lac/pointer_matrix_04.output +++ /dev/null @@ -1,3 +0,0 @@ - -DEAL::Init with matrix name and matrix -DEAL::Is matrix empty:0 diff --git a/tests/lac/pointer_matrix_05.cc b/tests/lac/pointer_matrix_05.cc deleted file mode 100644 index 04b406549b..0000000000 --- a/tests/lac/pointer_matrix_05.cc +++ /dev/null @@ -1,70 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkVmult - -#include -#include -#include - -#include "../tests.h" - -template -void -checkVmult(FullMatrix &A, - Vector & V, - const std::string & name = "Test Matrix") -{ - deallog << "vmult" << std::endl; - - PointerMatrix, Vector> P(&A, name.c_str()); - Vector O(A.m()); - P.vmult(O, V); - - // Check the dimensions of the result matrix - Assert(A.m() == O.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=A*V - Vector O_(A.m()); - A.vmult(O_, V); - - Assert(O == O_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < O.size(); ++i) - deallog << O(i) << '\t'; - deallog << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - Vector V(2); - V(0) = 1; - V(1) = 2; - - checkVmult(A, V); -} diff --git a/tests/lac/pointer_matrix_05.output b/tests/lac/pointer_matrix_05.output deleted file mode 100644 index a867192b6d..0000000000 --- a/tests/lac/pointer_matrix_05.output +++ /dev/null @@ -1,5 +0,0 @@ - -DEAL::vmult -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::8.0000 14.0000 diff --git a/tests/lac/pointer_matrix_06.cc b/tests/lac/pointer_matrix_06.cc deleted file mode 100644 index c34dc9b51f..0000000000 --- a/tests/lac/pointer_matrix_06.cc +++ /dev/null @@ -1,70 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkTvmult - -#include -#include -#include - -#include "../tests.h" - -template -void -checkTvmult(FullMatrix &A, - Vector & V, - const std::string & name = "Test Matrix") -{ - deallog << "Tvmult" << std::endl; - - PointerMatrix, Vector> P(&A, name.c_str()); - Vector O(A.m()); - P.Tvmult(O, V); - - // Check the dimensions of the result matrix - Assert(A.m() == O.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=A Transpose*V - Vector O_(A.m()); - A.Tvmult(O_, V); - - Assert(O == O_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < O.size(); ++i) - deallog << O(i) << '\t'; - deallog << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - Vector V(2); - V(0) = 1; - V(1) = 2; - - checkTvmult(A, V); -} diff --git a/tests/lac/pointer_matrix_06.output b/tests/lac/pointer_matrix_06.output deleted file mode 100644 index 510a561c65..0000000000 --- a/tests/lac/pointer_matrix_06.output +++ /dev/null @@ -1,5 +0,0 @@ - -DEAL::Tvmult -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::10.0000 13.0000 diff --git a/tests/lac/pointer_matrix_07.cc b/tests/lac/pointer_matrix_07.cc deleted file mode 100644 index 395fc0e56d..0000000000 --- a/tests/lac/pointer_matrix_07.cc +++ /dev/null @@ -1,79 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkTvmult_add - -#include -#include -#include - -#include "../tests.h" - -template -void -checkTvmult_add(FullMatrix &A, - Vector & V, - const std::string & name = "Test Matrix") -{ - deallog << "Tvmult_add" << std::endl; - - PointerMatrix, Vector> P(&A, name.c_str()); - - deallog << "Result vector set to all ones and to be added with result" - << std::endl; - Vector O(V.size()); - for (unsigned int i = 0; i < O.size(); ++i) - O(i) = 1; - - P.Tvmult_add(O, V); - - // Check the dimensions of the result matrix - Assert(A.m() == O.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=O+A Transpose*V - Vector O_(V.size()); - for (unsigned int i = 0; i < O_.size(); ++i) - O_(i) = 1; - - A.Tvmult_add(O_, V); - - Assert(O == O_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < O.size(); ++i) - deallog << O(i) << '\t'; - deallog << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - Vector V(2); - V(0) = 1; - V(1) = 2; - - checkTvmult_add(A, V); -} diff --git a/tests/lac/pointer_matrix_07.output b/tests/lac/pointer_matrix_07.output deleted file mode 100644 index 71e06a0437..0000000000 --- a/tests/lac/pointer_matrix_07.output +++ /dev/null @@ -1,6 +0,0 @@ - -DEAL::Tvmult_add -DEAL::Result vector set to all ones and to be added with result -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::11.0000 14.0000 diff --git a/tests/lac/pointer_matrix_08.cc b/tests/lac/pointer_matrix_08.cc deleted file mode 100644 index 9c315cdef3..0000000000 --- a/tests/lac/pointer_matrix_08.cc +++ /dev/null @@ -1,79 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkVmult_add - -#include -#include -#include - -#include "../tests.h" - -template -void -checkVmult_add(FullMatrix &A, - Vector & V, - const std::string & name = "Test Matrix") -{ - deallog << "vmult_add" << std::endl; - - PointerMatrix, Vector> P(&A, name.c_str()); - - deallog << "Result vector set to all ones and to be added with result" - << std::endl; - Vector O(V.size()); - for (unsigned int i = 0; i < O.size(); ++i) - O(i) = 1; - - P.vmult_add(O, V); - - // Check the dimensions of the result matrix - Assert(A.m() == O.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=O+A*V - Vector O_(V.size()); - for (unsigned int i = 0; i < O_.size(); ++i) - O_(i) = 1; - - A.vmult_add(O_, V); - - Assert(O == O_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < O.size(); ++i) - deallog << O(i) << '\t'; - deallog << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - Vector V(2); - V(0) = 1; - V(1) = 2; - - checkVmult_add(A, V); -} diff --git a/tests/lac/pointer_matrix_08.output b/tests/lac/pointer_matrix_08.output deleted file mode 100644 index 654ff7f6ad..0000000000 --- a/tests/lac/pointer_matrix_08.output +++ /dev/null @@ -1,6 +0,0 @@ - -DEAL::vmult_add -DEAL::Result vector set to all ones and to be added with result -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::9.0000 15.0000 diff --git a/tests/lac/pointer_matrix_09.cc b/tests/lac/pointer_matrix_09.cc deleted file mode 100644 index 70a643fab7..0000000000 --- a/tests/lac/pointer_matrix_09.cc +++ /dev/null @@ -1,76 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkClear - -#include -#include -#include - -#include "../tests.h" - -template -void -checkClear(FullMatrix &A) -{ - deallog << "clear" << std::endl; - deallog << "Init with matrix 1" << std::endl; - - PointerMatrix, Vector> P(&A); - - deallog << "Multiplying with all ones vector" << std::endl; - Vector V(A.n()); - for (unsigned int i = 0; i < V.size(); ++i) - V(i) = 1; - - Vector O(A.m()); - P.vmult(O, V); - - // Check the dimensions of the result vector - Assert(A.m() == O.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=A*V - Vector O_(A.m()); - A.vmult(O_, V); - - Assert(O == O_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < O.size(); ++i) - deallog << O(i) << '\t'; - deallog << std::endl; - - deallog << "Clearing pointer matrix" << std::endl; - P.clear(); - - deallog << "Is matrix empty:" << P.empty() << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - FullMatrix A(2, 2); - A.fill(Adata); - - checkClear(A); -} diff --git a/tests/lac/pointer_matrix_09.output b/tests/lac/pointer_matrix_09.output deleted file mode 100644 index 0455e79cb6..0000000000 --- a/tests/lac/pointer_matrix_09.output +++ /dev/null @@ -1,9 +0,0 @@ - -DEAL::clear -DEAL::Init with matrix 1 -DEAL::Multiplying with all ones vector -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::5.0000 9.0000 -DEAL::Clearing pointer matrix -DEAL::Is matrix empty:1 diff --git a/tests/lac/pointer_matrix_10.cc b/tests/lac/pointer_matrix_10.cc deleted file mode 100644 index c54bdf56d6..0000000000 --- a/tests/lac/pointer_matrix_10.cc +++ /dev/null @@ -1,107 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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 PointerMatrix:checkAssign - -#include -#include -#include - -#include "../tests.h" - -template -void -checkAssign(FullMatrix &A, FullMatrix &B) -{ - deallog << "=" << std::endl; - deallog << "Init with matrix 1" << std::endl; - - PointerMatrix, Vector> P(&A); - - deallog << "Multiplying with all ones vector" << std::endl; - Vector V(A.n()); - for (unsigned int i = 0; i < V.size(); ++i) - V(i) = 1; - - Vector O(A.m()); - P.vmult(O, V); - - // Check the dimensions of the result vector - Assert(A.m() == O.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=A*V - Vector O_(A.m()); - A.vmult(O_, V); - - Assert(O == O_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < O.size(); ++i) - deallog << O(i) << '\t'; - deallog << std::endl; - - deallog << "Clearing pointer matrix" << std::endl; - P.clear(); - - deallog << "Is matrix empty:" << P.empty() << std::endl; - - deallog << "Assigning pointer matrix to matrix 2" << std::endl; - - P = &B; - - deallog << "Multiplying with all ones vector" << std::endl; - Vector V_(B.n()); - for (unsigned int i = 0; i < V_.size(); ++i) - V_(i) = 1; - - Vector OU(B.m()); - P.vmult(OU, V_); - - // Check the dimensions of the result vector - Assert(B.m() == OU.size(), ExcInternalError()); - deallog << "Dimensions of result vector verified" << std::endl; - - // Verifying results with Method 2: O=B*V - Vector OU_(B.m()); - B.vmult(OU_, V_); - - Assert(OU == OU_, ExcInternalError()); - deallog << "Result vector data verified" << std::endl; - - for (unsigned int i = 0; i < OU.size(); ++i) - deallog << OU(i) << '\t'; - deallog << std::endl; -} - -int -main() -{ - std::ofstream logfile("output"); - deallog << std::fixed; - deallog << std::setprecision(4); - deallog.attach(logfile); - - const double Adata[] = {2, 3, 4, 5}; - - const double Bdata[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; - - FullMatrix A(2, 2); - A.fill(Adata); - FullMatrix B(3, 3); - B.fill(Bdata); - - checkAssign(A, B); -} diff --git a/tests/lac/pointer_matrix_10.output b/tests/lac/pointer_matrix_10.output deleted file mode 100644 index 6b39ca39a4..0000000000 --- a/tests/lac/pointer_matrix_10.output +++ /dev/null @@ -1,14 +0,0 @@ - -DEAL::= -DEAL::Init with matrix 1 -DEAL::Multiplying with all ones vector -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::5.0000 9.0000 -DEAL::Clearing pointer matrix -DEAL::Is matrix empty:1 -DEAL::Assigning pointer matrix to matrix 2 -DEAL::Multiplying with all ones vector -DEAL::Dimensions of result vector verified -DEAL::Result vector data verified -DEAL::6.0000 15.0000 24.0000 diff --git a/tests/lac/pointer_matrix_vector.cc b/tests/lac/pointer_matrix_vector.cc deleted file mode 100644 index 39a8d5a0be..0000000000 --- a/tests/lac/pointer_matrix_vector.cc +++ /dev/null @@ -1,63 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2006 - 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. -// -// --------------------------------------------------------------------- - - -// Test vmult and Tvmult of PointerMatrixVector - -#include -#include - -#include "../tests.h" - - -int -main() -{ - initlog(); - - Vector u(5); - Vector v(5); - Vector w(1); - Vector x(5); - Vector y(5); - Vector z(1); - - - for (unsigned int i = 0; i < u.size(); ++i) - { - u(i) = 1 << i; - x(i) = 1 << i; - v(i) = 6 - i; - y(i) = 6 - i; - } - - PointerMatrixVector Mu(&u); - Mu.vmult(w, v); - deallog << "vmult " << w(0) << std::endl << "Tvmult"; - w(0) = 2.; - Mu.Tvmult(v, w); - for (unsigned int i = 0; i < v.size(); ++i) - deallog << ' ' << v(i); - deallog << std::endl; - - PointerMatrixVector Mx(&x); - Mx.vmult(z, y); - deallog << "vmult " << z(0) << std::endl << "Tvmult"; - z(0) = 2.; - Mx.Tvmult(y, z); - for (unsigned int i = 0; i < y.size(); ++i) - deallog << ' ' << y(i); - deallog << std::endl; -} diff --git a/tests/lac/pointer_matrix_vector.output b/tests/lac/pointer_matrix_vector.output deleted file mode 100644 index f3ce7a81f0..0000000000 --- a/tests/lac/pointer_matrix_vector.output +++ /dev/null @@ -1,5 +0,0 @@ - -DEAL::vmult 88.0000 -DEAL::Tvmult 2.00000 4.00000 8.00000 16.0000 32.0000 -DEAL::vmult 88.0000 -DEAL::Tvmult 2.00000 4.00000 8.00000 16.0000 32.0000 -- 2.39.5