From 3aa64f983d4aba6737aed2c2b99f4bbb28dd7931 Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 3 May 2017 20:52:10 -0400 Subject: [PATCH] Remove deprecated PETSc vector classes. --- cmake/config/template-arguments.in | 7 - examples/step-36/step-36.cc | 2 +- .../fe/fe_tools_extrapolate.templates.h | 1 - .../fe/fe_tools_interpolate.templates.h | 1 - .../deal.II/lac/constraint_matrix.templates.h | 1 - .../deal.II/lac/petsc_block_sparse_matrix.h | 354 ------------ include/deal.II/lac/petsc_block_vector.h | 516 ------------------ include/deal.II/lac/petsc_matrix_free.h | 4 +- .../deal.II/lac/petsc_parallel_block_vector.h | 19 - include/deal.II/lac/petsc_parallel_vector.h | 20 - include/deal.II/lac/petsc_sparse_matrix.h | 1 + include/deal.II/lac/petsc_vector.h | 440 --------------- .../numerics/error_estimator.templates.h | 4 +- .../numerics/matrix_creator.templates.h | 2 +- .../deal.II/numerics/vector_tools.templates.h | 4 +- source/algorithms/operator.cc | 4 +- source/base/mpi.cc | 12 +- source/base/time_stepping.cc | 2 - source/distributed/grid_refinement.cc | 2 - source/distributed/solution_transfer.cc | 4 +- source/distributed/solution_transfer.inst.in | 4 - source/dofs/dof_accessor_get.cc | 4 +- source/dofs/dof_accessor_set.cc | 4 +- source/fe/fe_values.cc | 4 +- source/fe/mapping_fe_field.cc | 4 +- source/fe/mapping_q1_eulerian.cc | 4 +- source/fe/mapping_q_eulerian.cc | 4 +- source/grid/grid_refinement.cc | 42 -- source/lac/CMakeLists.txt | 2 - source/lac/block_matrix_array.cc | 1 - source/lac/constraint_matrix.cc | 7 - source/lac/petsc_block_sparse_matrix.cc | 104 ---- source/lac/petsc_parallel_block_vector.cc | 17 - source/lac/petsc_parallel_sparse_matrix.cc | 2 +- source/lac/petsc_parallel_vector.cc | 47 -- source/lac/petsc_vector.cc | 133 ----- source/lac/petsc_vector_base.cc | 40 +- source/lac/slepc_solver.cc | 1 - source/lac/slepc_spectral_transformation.cc | 2 - source/lac/solver.cc | 4 +- source/lac/vector_memory.cc | 2 - source/meshworker/mesh_worker_info.cc | 3 - .../meshworker/mesh_worker_vector_selector.cc | 4 +- source/multigrid/mg_base.cc | 3 +- source/multigrid/mg_level_global_transfer.cc | 2 - source/multigrid/mg_transfer_prebuilt.cc | 2 - source/multigrid/multigrid.cc | 4 +- source/numerics/data_out_dof_data.cc | 4 +- source/numerics/derivative_approximation.cc | 4 +- source/numerics/dof_output_operator.cc | 4 +- source/numerics/error_estimator_1d.cc | 4 +- source/numerics/fe_field_function.cc | 4 +- source/numerics/matrix_tools.cc | 1 - source/numerics/point_value_history.cc | 4 +- source/numerics/solution_transfer.cc | 4 +- 55 files changed, 55 insertions(+), 1824 deletions(-) delete mode 100644 include/deal.II/lac/petsc_block_sparse_matrix.h delete mode 100644 include/deal.II/lac/petsc_block_vector.h delete mode 100644 include/deal.II/lac/petsc_vector.h delete mode 100644 source/lac/petsc_block_sparse_matrix.cc delete mode 100644 source/lac/petsc_vector.cc diff --git a/cmake/config/template-arguments.in b/cmake/config/template-arguments.in index 312a009259..7db400bd5d 100644 --- a/cmake/config/template-arguments.in +++ b/cmake/config/template-arguments.in @@ -47,12 +47,10 @@ SERIAL_VECTORS := { Vector; @DEAL_II_EXPAND_TRILINOS_VECTOR@; @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@; @DEAL_II_EXPAND_EPETRA_VECTOR@; - @DEAL_II_EXPAND_PETSC_VECTOR@; @DEAL_II_EXPAND_PETSC_MPI_VECTOR@; @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@; @DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@; - @DEAL_II_EXPAND_PETSC_BLOCKVECTOR@; @DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR@; } @@ -75,12 +73,10 @@ REAL_SERIAL_VECTORS := { Vector; @DEAL_II_EXPAND_TRILINOS_VECTOR@; @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@; @DEAL_II_EXPAND_EPETRA_VECTOR@; - @DEAL_II_EXPAND_PETSC_VECTOR_REAL@; @DEAL_II_EXPAND_PETSC_MPI_VECTOR_REAL@; @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@; @DEAL_II_EXPAND_TRILINOS_MPI_BLOCKVECTOR@; - @DEAL_II_EXPAND_PETSC_BLOCKVECTOR_REAL@; @DEAL_II_EXPAND_PETSC_MPI_BLOCKVECTOR_REAL@; } @@ -97,15 +93,12 @@ REAL_NONBLOCK_VECTORS := { Vector; @DEAL_II_EXPAND_TRILINOS_VECTOR@; @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@; @DEAL_II_EXPAND_EPETRA_VECTOR@; - @DEAL_II_EXPAND_PETSC_VECTOR_REAL@; @DEAL_II_EXPAND_PETSC_MPI_VECTOR_REAL@; } // wrappers for non-MPI vectors (PETSc/Trilinos) EXTERNAL_SEQUENTIAL_VECTORS := { @DEAL_II_EXPAND_TRILINOS_VECTOR@; @DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR@; - @DEAL_II_EXPAND_PETSC_VECTOR@; - @DEAL_II_EXPAND_PETSC_BLOCKVECTOR@ } // wrappers for MPI vectors (PETSc/Trilinos) diff --git a/examples/step-36/step-36.cc b/examples/step-36/step-36.cc index f0635a2cf4..420435c694 100644 --- a/examples/step-36/step-36.cc +++ b/examples/step-36/step-36.cc @@ -44,7 +44,7 @@ #include #include -// IndexSet is used to set the size of PETScWrappers::Vector: +// IndexSet is used to set the size of each PETScWrappers::MPI::Vector: #include // PETSc appears here because SLEPc depends on this library: diff --git a/include/deal.II/fe/fe_tools_extrapolate.templates.h b/include/deal.II/fe/fe_tools_extrapolate.templates.h index cea9bffec0..d1011b9b4d 100644 --- a/include/deal.II/fe/fe_tools_extrapolate.templates.h +++ b/include/deal.II/fe/fe_tools_extrapolate.templates.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/include/deal.II/fe/fe_tools_interpolate.templates.h b/include/deal.II/fe/fe_tools_interpolate.templates.h index 9b5819b661..2eddceae25 100644 --- a/include/deal.II/fe/fe_tools_interpolate.templates.h +++ b/include/deal.II/fe/fe_tools_interpolate.templates.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/include/deal.II/lac/constraint_matrix.templates.h b/include/deal.II/lac/constraint_matrix.templates.h index 5f5f979fb7..f809b665e2 100644 --- a/include/deal.II/lac/constraint_matrix.templates.h +++ b/include/deal.II/lac/constraint_matrix.templates.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/include/deal.II/lac/petsc_block_sparse_matrix.h b/include/deal.II/lac/petsc_block_sparse_matrix.h deleted file mode 100644 index c57484c497..0000000000 --- a/include/deal.II/lac/petsc_block_sparse_matrix.h +++ /dev/null @@ -1,354 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 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 at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#ifndef dealii__petsc_block_sparse_matrix_h -#define dealii__petsc_block_sparse_matrix_h - - -#include - -#ifdef DEAL_II_WITH_PETSC - -# include -# include -# include -# include -# include - -# include - -DEAL_II_NAMESPACE_OPEN - - - -namespace PETScWrappers -{ - - /*! @addtogroup PETScWrappers - *@{ - */ - - /** - * Blocked sparse matrix based on the PETScWrappers::SparseMatrix class. - * This class implements the functions that are specific to the PETSc - * SparseMatrix base objects for a blocked sparse matrix, and leaves the - * actual work relaying most of the calls to the individual blocks to the - * functions implemented in the base class. See there also for a description - * of when this class is useful. - * - * In contrast to the deal.II-type SparseMatrix class, the PETSc matrices do - * not have external objects for the sparsity patterns. Thus, one does not - * determine the size of the individual blocks of a block matrix of this - * type by attaching a block sparsity pattern, but by calling reinit() to - * set the number of blocks and then by setting the size of each block - * separately. In order to fix the data structures of the block matrix, it - * is then necessary to let it know that we have changed the sizes of the - * underlying matrices. For this, one has to call the collect_sizes() - * function, for much the same reason as is documented with the - * BlockSparsityPattern class. - * - * @ingroup Matrix1 @see - * @ref GlossBlockLA "Block (linear algebra)" - * @author Wolfgang Bangerth, 2004 - */ - class BlockSparseMatrix : public BlockMatrixBase - { - public: - /** - * Typedef the base class for simpler access to its own typedefs. - */ - typedef BlockMatrixBase BaseClass; - - /** - * Typedef the type of the underlying matrix. - */ - typedef BaseClass::BlockType BlockType; - - /** - * Import the typedefs from the base class. - */ - typedef BaseClass::value_type value_type; - typedef BaseClass::pointer pointer; - typedef BaseClass::const_pointer const_pointer; - typedef BaseClass::reference reference; - typedef BaseClass::const_reference const_reference; - typedef BaseClass::size_type size_type; - typedef BaseClass::iterator iterator; - typedef BaseClass::const_iterator const_iterator; - - /** - * Constructor; initializes the matrix to be empty, without any structure, - * i.e. the matrix is not usable at all. This constructor is therefore - * only useful for matrices which are members of a class. All other - * matrices should be created at a point in the data flow where all - * necessary information is available. - * - * You have to initialize the matrix before usage with - * reinit(BlockSparsityPattern). The number of blocks per row and column - * are then determined by that function. - */ - BlockSparseMatrix (); - - /** - * Destructor. - */ - ~BlockSparseMatrix (); - - /** - * Pseudo copy operator only copying empty objects. The sizes of the block - * matrices need to be the same. - */ - BlockSparseMatrix & - operator = (const BlockSparseMatrix &); - - /** - * This operator assigns a scalar to a matrix. Since this does usually not - * make much sense (should we set all matrix entries to this value? Only - * the nonzero entries of the sparsity pattern?), this operation is only - * allowed if the actual value to be assigned is zero. This operator only - * exists to allow for the obvious notation matrix=0, which sets - * all elements of the matrix to zero, but keep the sparsity pattern - * previously used. - */ - BlockSparseMatrix & - operator = (const double d); - - /** - * Resize the matrix, by setting the number of block rows and columns. - * This deletes all blocks and replaces them by uninitialized ones, i.e. - * ones for which also the sizes are not yet set. You have to do that by - * calling the @p reinit functions of the blocks themselves. Do not forget - * to call collect_sizes() after that on this object. - * - * The reason that you have to set sizes of the blocks yourself is that - * the sizes may be varying, the maximum number of elements per row may be - * varying, etc. It is simpler not to reproduce the interface of the @p - * SparsityPattern class here but rather let the user call whatever - * function she desires. - */ - void reinit (const size_type n_block_rows, - const size_type n_block_columns); - - /** - * This function collects the sizes of the sub-objects and stores them in - * internal arrays, in order to be able to relay global indices into the - * matrix to indices into the subobjects. You *must* call this function - * each time after you have changed the size of the sub-objects. - */ - void collect_sizes (); - - /** - * Matrix-vector multiplication: let $dst = M*src$ with $M$ being this - * matrix. - */ - void vmult (BlockVector &dst, - const BlockVector &src) const; - - /** - * Matrix-vector multiplication. Just like the previous function, but only - * applicable if the matrix has only one block column. - */ - void vmult (BlockVector &dst, - const Vector &src) const; - - /** - * Matrix-vector multiplication. Just like the previous function, but only - * applicable if the matrix has only one block row. - */ - void vmult (Vector &dst, - const BlockVector &src) const; - - /** - * Matrix-vector multiplication. Just like the previous function, but only - * applicable if the matrix has only one block. - */ - void vmult (Vector &dst, - const Vector &src) const; - - /** - * Matrix-vector multiplication: let $dst = M^T*src$ with $M$ being this - * matrix. This function does the same as vmult() but takes the transposed - * matrix. - */ - void Tvmult (BlockVector &dst, - const BlockVector &src) const; - - /** - * Matrix-vector multiplication. Just like the previous function, but only - * applicable if the matrix has only one block row. - */ - void Tvmult (BlockVector &dst, - const Vector &src) const; - - /** - * Matrix-vector multiplication. Just like the previous function, but only - * applicable if the matrix has only one block column. - */ - void Tvmult (Vector &dst, - const BlockVector &src) const; - - /** - * Matrix-vector multiplication. Just like the previous function, but only - * applicable if the matrix has only one block. - */ - void Tvmult (Vector &dst, - const Vector &src) const; - - /** - * Return the partitioning of the domain space of this matrix, i.e., the - * partitioning of the vectors this matrix has to be multiplied with. - */ - std::vector< size_type > locally_owned_domain_sizes() const; - - /** - * Return the partitioning of the range space of this matrix, i.e., the - * partitioning of the vectors that are result from matrix-vector - * products. - */ - std::vector< size_type > locally_owned_range_sizes() const; - - /** - * Make the clear() function in the base class visible, though it is - * protected. - */ - using BlockMatrixBase::clear; - - /** - * @addtogroup Exceptions - * @{ - */ - - /** - * Exception - */ - DeclException4 (ExcIncompatibleRowNumbers, - int, int, int, int, - << "The blocks [" << arg1 << ',' << arg2 << "] and [" - << arg3 << ',' << arg4 << "] have differing row numbers."); - /** - * Exception - */ - DeclException4 (ExcIncompatibleColNumbers, - int, int, int, int, - << "The blocks [" << arg1 << ',' << arg2 << "] and [" - << arg3 << ',' << arg4 << "] have differing column numbers."); - ///@} - }; - - - - /*@}*/ - -// ------------- inline and template functions ----------------- - - inline - BlockSparseMatrix & - BlockSparseMatrix::operator = (const double d) - { - Assert (d==0, ExcScalarAssignmentOnlyForZeroValue()); - - for (size_type r=0; rn_block_rows(); ++r) - for (size_type c=0; cn_block_cols(); ++c) - this->block(r,c) = d; - - return *this; - } - - - - inline - void - BlockSparseMatrix::vmult (BlockVector &dst, - const BlockVector &src) const - { - BaseClass::vmult_block_block (dst, src); - } - - - - inline - void - BlockSparseMatrix::vmult (BlockVector &dst, - const Vector &src) const - { - BaseClass::vmult_block_nonblock (dst, src); - } - - - - inline - void - BlockSparseMatrix::vmult (Vector &dst, - const BlockVector &src) const - { - BaseClass::vmult_nonblock_block (dst, src); - } - - - - inline - void - BlockSparseMatrix::vmult (Vector &dst, - const Vector &src) const - { - BaseClass::vmult_nonblock_nonblock (dst, src); - } - - - inline - void - BlockSparseMatrix::Tvmult (BlockVector &dst, - const BlockVector &src) const - { - BaseClass::Tvmult_block_block (dst, src); - } - - - - inline - void - BlockSparseMatrix::Tvmult (BlockVector &dst, - const Vector &src) const - { - BaseClass::Tvmult_block_nonblock (dst, src); - } - - - - inline - void - BlockSparseMatrix::Tvmult (Vector &dst, - const BlockVector &src) const - { - BaseClass::Tvmult_nonblock_block (dst, src); - } - - - - inline - void - BlockSparseMatrix::Tvmult (Vector &dst, - const Vector &src) const - { - BaseClass::Tvmult_nonblock_nonblock (dst, src); - } - -} - -DEAL_II_NAMESPACE_CLOSE - -#endif // DEAL_II_WITH_PETSC - -#endif // dealii__petsc_block_sparse_matrix_h diff --git a/include/deal.II/lac/petsc_block_vector.h b/include/deal.II/lac/petsc_block_vector.h deleted file mode 100644 index 5a9c18247c..0000000000 --- a/include/deal.II/lac/petsc_block_vector.h +++ /dev/null @@ -1,516 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 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 at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#ifndef dealii__petsc_block_vector_h -#define dealii__petsc_block_vector_h - - -#include - -#ifdef DEAL_II_WITH_PETSC - -# include -# include -# include -# include -# include -# include - -DEAL_II_NAMESPACE_OPEN - - - -namespace PETScWrappers -{ - /*! @addtogroup PETScWrappers - *@{ - */ - - /** - * An implementation of block vectors based on the vector class implemented - * in PETScWrappers. While the base class provides for most of the - * interface, this class handles the actual allocation of vectors and - * provides functions that are specific to the underlying vector type. - * - * This class is deprecated, use PETScWrappers::MPI::BlockVector. - * - * @ingroup Vectors - * - * @see - * @ref GlossBlockLA "Block (linear algebra)" - * @author Wolfgang Bangerth, 2004 - */ - class BlockVector : public BlockVectorBase - { - public: - /** - * Typedef the base class for simpler access to its own typedefs. - */ - typedef BlockVectorBase BaseClass; - - /** - * Typedef the type of the underlying vector. - */ - typedef BaseClass::BlockType BlockType; - - /** - * Import the typedefs from the base class. - */ - typedef BaseClass::value_type value_type; - typedef BaseClass::pointer pointer; - typedef BaseClass::const_pointer const_pointer; - typedef BaseClass::reference reference; - typedef BaseClass::const_reference const_reference; - typedef BaseClass::size_type size_type; - typedef BaseClass::iterator iterator; - typedef BaseClass::const_iterator const_iterator; - - /** - * Constructor. There are three ways to use this constructor. First, - * without any arguments, it generates an object with no blocks. Given one - * argument, it initializes num_blocks blocks, but these blocks - * have size zero. The third variant finally initializes all blocks to the - * same size block_size. - * - * Confer the other constructor further down if you intend to use blocks - * of different sizes. - */ - explicit BlockVector (const unsigned int num_blocks = 0, - const size_type block_size = 0); - - /** - * Copy-Constructor. Dimension set to that of V, all components are copied - * from V - */ - BlockVector (const BlockVector &V); - - /** - * Copy-constructor: copy the values from a PETSc wrapper parallel block - * vector class. - * - * - * Note that due to the communication model of MPI, @em all processes have - * to actually perform this operation, even if they do not use the result. - * It is not sufficient if only one processor tries to copy the elements - * from the other processors over to its own process space. - */ - explicit BlockVector (const MPI::BlockVector &v); - - /** - * Constructor. Set the number of blocks to n.size() and - * initialize each block with n[i] zero elements. - */ - BlockVector (const std::vector &n); - - /** - * Constructor. Set the number of blocks to n.size(). Initialize - * the vector with the elements pointed to by the range of iterators given - * as second and third argument. Apart from the first argument, this - * constructor is in complete analogy to the respective constructor of the - * std::vector class, but the first argument is needed in order - * to know how to subdivide the block vector into different blocks. - */ - template - BlockVector (const std::vector &n, - const InputIterator first, - const InputIterator end); - - /** - * Destructor. Clears memory - */ - ~BlockVector (); - - /** - * Copy operator: fill all components of the vector with the given scalar - * value. - */ - BlockVector &operator = (const value_type s); - - /** - * Copy operator for arguments of the same type. - */ - BlockVector & - operator= (const BlockVector &V); - - /** - * Copy all the elements of the parallel block vector @p v into this local - * vector. Note that due to the communication model of MPI, @em all - * processes have to actually perform this operation, even if they do not - * use the result. It is not sufficient if only one processor tries to - * copy the elements from the other processors over to its own process - * space. - */ - BlockVector & - operator = (const MPI::BlockVector &v); - - /** - * Reinitialize the BlockVector to contain num_blocks blocks of - * size block_size each. - * - * If omit_zeroing_entries==false, the vector is filled with - * zeros. - */ - void reinit (const unsigned int num_blocks, - const size_type block_size, - const bool omit_zeroing_entries = false); - - /** - * Reinitialize the BlockVector such that it contains - * block_sizes.size() blocks. Each block is reinitialized to - * dimension block_sizes[i]. - * - * If the number of blocks is the same as before this function was called, - * all vectors remain the same and reinit() is called for each vector. - * - * If omit_zeroing_entries==false, the vector is filled with - * zeros. - * - * Note that you must call this (or the other reinit() functions) - * function, rather than calling the reinit() functions of an individual - * block, to allow the block vector to update its caches of vector sizes. - * If you call reinit() on one of the blocks, then subsequent actions on - * this object may yield unpredictable results since they may be routed to - * the wrong block. - */ - void reinit (const std::vector &N, - const bool omit_zeroing_entries=false); - - /** - * Change the dimension to that of the vector V. The same applies - * as for the other reinit() function. - * - * The elements of V are not copied, i.e. this function is the - * same as calling reinit (V.size(), omit_zeroing_entries). - * - * Note that you must call this (or the other reinit() functions) - * function, rather than calling the reinit() functions of an individual - * block, to allow the block vector to update its caches of vector sizes. - * If you call reinit() of one of the blocks, then subsequent actions of - * this object may yield unpredictable results since they may be routed to - * the wrong block. - */ - void reinit (const BlockVector &V, - const bool omit_zeroing_entries=false); - - /** - * Change the number of blocks to num_blocks. The individual - * blocks will get initialized with zero size, so it is assumed that the - * user resizes the individual blocks by herself in an appropriate way, - * and calls collect_sizes afterwards. - */ - void reinit (const unsigned int num_blocks); - - /** - * Swap the contents of this vector and the other vector v. One - * could do this operation with a temporary variable and copying over the - * data elements, but this function is significantly more efficient since - * it only swaps the pointers to the data of the two vectors and therefore - * does not need to allocate temporary storage and move data around. - * - * Limitation: right now this function only works if both vectors have the - * same number of blocks. If needed, the numbers of blocks should be - * exchanged, too. - * - * This function is analogous to the the swap() function of all C++ - * standard containers. Also, there is a global function swap(u,v) that - * simply calls u.swap(v), again in analogy to standard - * functions. - */ - void swap (BlockVector &v); - - /** - * Print to a stream. - */ - void print (std::ostream &out, - const unsigned int precision = 3, - const bool scientific = true, - const bool across = true) const; - - /** - * @addtogroup Exceptions - * @{ - */ - - /** - * Exception - */ - DeclException0 (ExcIteratorRangeDoesNotMatchVectorSize); - ///@} - } DEAL_II_DEPRECATED; - - /*@}*/ - - /*----------------------- Inline functions ----------------------------------*/ - - - - inline - BlockVector::BlockVector (const unsigned int n_blocks, - const size_type block_size) - { - reinit (n_blocks, block_size); - } - - - - inline - BlockVector::BlockVector (const std::vector &n) - { - reinit (n, false); - } - - - inline - BlockVector::BlockVector (const BlockVector &v) - : - BlockVectorBase () - { - this->components.resize (v.n_blocks()); - block_indices = v.block_indices; - - for (unsigned int i=0; in_blocks(); ++i) - this->components[i] = v.components[i]; - } - - - - inline - BlockVector::BlockVector (const MPI::BlockVector &v) - : - BlockVectorBase () - { - this->components.resize (v.get_block_indices().size()); - block_indices = v.get_block_indices(); - - for (unsigned int i=0; in_blocks(); ++i) - this->components[i] = v.block(i); - } - - - - template - BlockVector::BlockVector (const std::vector &n, - const InputIterator first, - const InputIterator end) - { - // first set sizes of blocks, but - // don't initialize them as we will - // copy elements soon - (void)end; - reinit (n, true); - InputIterator start = first; - for (unsigned int b=0; b(n[b])); - - for (size_type i=0; iblock(b)(i) = *start; - } - Assert (start == end, ExcIteratorRangeDoesNotMatchVectorSize()); - } - - - - inline - BlockVector & - BlockVector::operator = (const value_type s) - { - BaseClass::operator = (s); - return *this; - } - - - - inline - BlockVector & - BlockVector::operator = (const BlockVector &v) - { - BaseClass::operator = (v); - return *this; - } - - - - inline - BlockVector & - BlockVector::operator = (const MPI::BlockVector &v) - { - BaseClass::operator = (v); - return *this; - } - - - - inline - BlockVector::~BlockVector () - {} - - - inline - void - BlockVector::reinit (const unsigned int n_bl, - const size_type bl_sz, - const bool omit_zeroing_entries) - { - std::vector n(n_bl, bl_sz); - reinit(n, omit_zeroing_entries); - } - - - - inline - void - BlockVector::reinit (const std::vector &n, - const bool omit_zeroing_entries) - { - block_indices.reinit (n); - if (this->components.size() != this->n_blocks()) - this->components.resize(this->n_blocks()); - - for (unsigned int i=0; in_blocks(); ++i) - this->components[i].reinit(n[i], omit_zeroing_entries); - } - - - inline - void - BlockVector::reinit (const BlockVector &v, - const bool omit_zeroing_entries) - { - block_indices = v.get_block_indices(); - if (this->components.size() != this->n_blocks()) - this->components.resize(this->n_blocks()); - - for (unsigned int i=0; in_blocks(); ++i) - block(i).reinit(v.block(i), omit_zeroing_entries); - } - - - - inline - void - BlockVector::reinit (const unsigned int num_blocks) - { - reinit (num_blocks, 0, true); - } - - - - inline - void - BlockVector::swap (BlockVector &v) - { - Assert (this->n_blocks() == v.n_blocks(), - ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); - - for (unsigned int i=0; in_blocks(); ++i) - this->components[i].swap (v.components[i]); - ::dealii::swap (this->block_indices, v.block_indices); - } - - - - inline - void - BlockVector::print (std::ostream &out, - const unsigned int precision, - const bool scientific, - const bool across) const - { - for (unsigned int i=0; in_blocks(); ++i) - { - if (across) - out << 'C' << i << ':'; - else - out << "Component " << i << std::endl; - this->components[i].print(out, precision, scientific, across); - } - } - - - - - /** - * Global function which overloads the default implementation of the C++ - * standard library which uses a temporary object. The function simply - * exchanges the data of the two vectors. - * - * @relates PETScWrappers::BlockVector - * @author Wolfgang Bangerth, 2000 - */ - inline - void swap (BlockVector &u, - BlockVector &v) - { - u.swap (v); - } - -} - - -namespace internal -{ - namespace LinearOperator - { - template class ReinitHelper; - - /** - * A helper class used internally in linear_operator.h. Specialization for - * PETScWrappers::BlockVector. - */ - template<> - class ReinitHelper - { - public: - template - static - void reinit_range_vector (const Matrix &matrix, - PETScWrappers::BlockVector &v, - bool omit_zeroing_entries) - { - v.reinit(matrix.locally_owned_range_sizes(), omit_zeroing_entries); - } - - template - static - void reinit_domain_vector(const Matrix &matrix, - PETScWrappers::BlockVector &v, - bool omit_zeroing_entries) - { - v.reinit(matrix.locally_owned_domain_sizes(), omit_zeroing_entries); - } - }; - - } /* namespace LinearOperator */ -} /* namespace internal */ - - -/** - * Declare dealii::PETScWrappers::BlockVector as serial vector. - * - * @author Uwe Koecher, 2017 - */ -template <> -struct is_serial_vector< PETScWrappers::BlockVector > : std::true_type -{ -}; - - -DEAL_II_NAMESPACE_CLOSE - -#endif // DEAL_II_WITH_PETSC - -#endif diff --git a/include/deal.II/lac/petsc_matrix_free.h b/include/deal.II/lac/petsc_matrix_free.h index fee301373f..b256a533fc 100644 --- a/include/deal.II/lac/petsc_matrix_free.h +++ b/include/deal.II/lac/petsc_matrix_free.h @@ -20,11 +20,9 @@ #include #ifdef DEAL_II_WITH_PETSC - # include # include -# include - +# include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/lac/petsc_parallel_block_vector.h b/include/deal.II/lac/petsc_parallel_block_vector.h index 3a4a547c48..8c5731900b 100644 --- a/include/deal.II/lac/petsc_parallel_block_vector.h +++ b/include/deal.II/lac/petsc_parallel_block_vector.h @@ -150,25 +150,6 @@ namespace PETScWrappers BlockVector & operator= (const BlockVector &V); - /** - * Copy the given sequential (non-distributed) block vector into the - * present parallel block vector. It is assumed that they have the same - * size, and this operation does not change the partitioning of the - * parallel vectors by which its elements are distributed across several - * MPI processes. What this operation therefore does is to copy that - * chunk of the given vector @p v that corresponds to elements of the - * target vector that are stored locally, and copies them, for each of - * the individual blocks of this object. Elements that are not stored - * locally are not touched. - * - * This being a parallel vector, you must make sure that @em all - * processes call this function at the same time. It is not possible to - * change the local part of a parallel vector on only one process, - * independent of what other processes do, with this function. - */ - BlockVector & - operator= (const PETScWrappers::BlockVector &v); - /** * Reinitialize the BlockVector to contain @p n_blocks of size @p * block_size, each of which stores @p local_size elements locally. The diff --git a/include/deal.II/lac/petsc_parallel_vector.h b/include/deal.II/lac/petsc_parallel_vector.h index 2f07585ff3..07fb0857e8 100644 --- a/include/deal.II/lac/petsc_parallel_vector.h +++ b/include/deal.II/lac/petsc_parallel_vector.h @@ -36,9 +36,6 @@ DEAL_II_NAMESPACE_OPEN */ namespace PETScWrappers { - // forward declaration for copy constructor from sequential vector - class Vector; - /** * Namespace for PETSc classes that work in parallel over MPI, such as * distributed vectors and matrices. @@ -263,23 +260,6 @@ namespace PETScWrappers */ Vector &operator= (const Vector &v); - /** - * Copy the given sequential (non-distributed) vector into the present - * parallel vector. It is assumed that they have the same size, and this - * operation does not change the partitioning of the parallel vector by - * which its elements are distributed across several MPI processes. What - * this operation therefore does is to copy that chunk of the given - * vector @p v that corresponds to elements of the target vector that - * are stored locally, and copies them. Elements that are not stored - * locally are not touched. - * - * This being a parallel vector, you must make sure that @em all - * processes call this function at the same time. It is not possible to - * change the local part of a parallel vector on only one process, - * independent of what other processes do, with this function. - */ - Vector &operator= (const PETScWrappers::Vector &v); - /** * Set all components of the vector to the given number @p s. Simply * pass this down to the base class, but we still need to declare this diff --git a/include/deal.II/lac/petsc_sparse_matrix.h b/include/deal.II/lac/petsc_sparse_matrix.h index ce88ecc780..ff1f27aed3 100644 --- a/include/deal.II/lac/petsc_sparse_matrix.h +++ b/include/deal.II/lac/petsc_sparse_matrix.h @@ -23,6 +23,7 @@ # include # include +# include # include DEAL_II_NAMESPACE_OPEN diff --git a/include/deal.II/lac/petsc_vector.h b/include/deal.II/lac/petsc_vector.h deleted file mode 100644 index 28305a8cb0..0000000000 --- a/include/deal.II/lac/petsc_vector.h +++ /dev/null @@ -1,440 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 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 at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#ifndef dealii__petsc_vector_h -#define dealii__petsc_vector_h - - -#include - -#ifdef DEAL_II_WITH_PETSC - -# include -# include -# include -# include -# include -# include - -DEAL_II_NAMESPACE_OPEN - - -namespace PETScWrappers -{ - /*! @addtogroup PETScWrappers - *@{ - */ - - /** - * Implementation of a sequential vector class based on PETSC. All the - * functionality is actually in the base class, except for the calls to - * generate a sequential vector. This is possible since PETSc only works on - * an abstract vector type and internally distributes to functions that do - * the actual work depending on the actual vector type (much like using - * virtual functions). Only the functions creating a vector of specific type - * differ, and are implemented in this particular class. - * - * This class is deprecated, use PETScWrappers::MPI::Vector instead. - * - * @ingroup Vectors - * @author Wolfgang Bangerth, 2004 - */ - class Vector : public VectorBase - { - public: - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; - - /** - * Default constructor. Initialize the vector as empty. - */ - Vector (); - - /** - * Constructor. Set dimension to @p n and initialize all elements with - * zero. - * - * The constructor is made explicit to avoid accidents like this: - * v=0;. Presumably, the user wants to set every element of the - * vector to zero, but instead, what happens is this call: - * v=Vector@(0);, i.e. the vector is replaced by one of - * length zero. - */ - explicit Vector (const size_type n); - - /** - * Copy-constructor from deal.II vectors. Sets the dimension to that of - * the given vector, and copies all elements. - */ - template - explicit Vector (const dealii::Vector &v); - - /** - * Construct it from an existing PETSc Vector of type Vec. Note: this does - * not copy the contents and just keeps a pointer. You need to make sure - * the vector is not used twice at the same time or destroyed while in - * use. This class does not destroy the PETSc object. Handle with care! - */ - explicit Vector (const Vec &v); - - /** - * Copy-constructor the values from a PETSc wrapper vector class. - */ - Vector (const Vector &v); - - /** - * Copy-constructor: copy the values from a PETSc wrapper parallel vector - * class. - * - * Note that due to the communication model of MPI, @em all processes have - * to actually perform this operation, even if they do not use the result. - * It is not sufficient if only one processor tries to copy the elements - * from the other processors over to its own process space. - */ - explicit Vector (const MPI::Vector &v); - - /** - * Release all memory and return to a state just like after having called - * the default constructor. - */ - void clear (); - - /** - * Copy the given vector. Resize the present vector if necessary. - */ - Vector &operator = (const Vector &v); - - /** - * Copy all the elements of the parallel vector @p v into this local - * vector. Note that due to the communication model of MPI, @em all - * processes have to actually perform this operation, even if they do not - * use the result. It is not sufficient if only one processor tries to - * copy the elements from the other processors over to its own process - * space. - */ - Vector &operator = (const MPI::Vector &v); - - /** - * Set all components of the vector to the given number @p s. Simply pass - * this down to the base class, but we still need to declare this function - * to make the example given in the discussion about making the - * constructor explicit work. - * - * Since the semantics of assigning a scalar to a vector are not - * immediately clear, this operator should really only be used if you want - * to set the entire vector to zero. This allows the intuitive notation - * v=0. Assigning other values is deprecated and may be - * disallowed in the future. - */ - Vector &operator = (const PetscScalar s); - - /** - * Copy the values of a deal.II vector (as opposed to those of the PETSc - * vector wrapper class) into this object. - */ - template - Vector &operator = (const dealii::Vector &v); - - /** - * Change the dimension of the vector to @p N. It is unspecified how - * resizing the vector affects the memory allocation of this object; i.e., - * it is not guaranteed that resizing it to a smaller size actually also - * reduces memory consumption, or if for efficiency the same amount of - * memory is used for less data. - * - * If @p omit_zeroing_entries is false, the vector is filled by zeros. - * Otherwise, the elements are left an unspecified state. - */ - void reinit (const size_type N, - const bool omit_zeroing_entries = false); - - /** - * Change the dimension to that of the vector @p v. The same applies as - * for the other reinit() function. - * - * The elements of @p v are not copied, i.e. this function is the same as - * calling reinit (v.size(), omit_zeroing_entries). - */ - void reinit (const Vector &v, - const bool omit_zeroing_entries = false); - - protected: - /** - * Create a vector of length @p n. For this class, we create a sequential - * vector. @p n denotes the total size of the vector to be created. - */ - void create_vector (const size_type n); - } DEAL_II_DEPRECATED; - - /*@}*/ - -// ------------------ template and inline functions ------------- - - - /** - * Global function @p swap which overloads the default implementation of the - * C++ standard library which uses a temporary object. The function simply - * exchanges the data of the two vectors. - * - * @relates PETScWrappers::Vector - * @author Wolfgang Bangerth, 2004 - */ - inline - void swap (Vector &u, Vector &v) - { - u.swap (v); - } - - -#ifndef DOXYGEN - - template - Vector::Vector (const dealii::Vector &v) - { - Vector::create_vector (v.size()); - - *this = v; - } - - - - inline - Vector::Vector (const Vec &v) - : - VectorBase(v) - {} - - - inline - Vector & - Vector::operator = (const PetscScalar s) - { - VectorBase::operator = (s); - - return *this; - } - - - inline - Vector & - Vector::operator = (const Vector &v) - { - // if the vectors have different sizes, - // then first resize the present one - if (size() != v.size()) - reinit (v.size(), true); - - const PetscErrorCode ierr = VecCopy (v.vector, vector); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - return *this; - } - - - - inline - Vector & - Vector::operator = (const MPI::Vector &v) - { - PetscErrorCode ierr; - if (attained_ownership) - { - // the petsc function we call wants to - // generate the vector itself, so destroy - // the old one first -#if DEAL_II_PETSC_VERSION_LT(3,2,0) - ierr = VecDestroy (vector); -#else - ierr = VecDestroy (&vector); -#endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); - } - - attained_ownership = true; - - // then do the gather - // operation. petsc has changed its - // interface again, and replaced a single - // function call by several calls that - // are hard to understand. gets me all - // annoyed at their development - // model -#if DEAL_II_PETSC_VERSION_LT(2,2,0) - ierr = VecConvertMPIToSeqAll (static_cast(v), - &vector); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - -#else - - VecScatter ctx; - - ierr = VecScatterCreateToAll (static_cast(v), &ctx, &vector); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - -#if ((PETSC_VERSION_MAJOR == 2) && \ - ((PETSC_VERSION_MINOR < 3) || \ - ((PETSC_VERSION_MINOR == 3) && \ - (PETSC_VERSION_SUBMINOR < 3)))) - ierr = VecScatterBegin (static_cast(v), vector, - INSERT_VALUES, SCATTER_FORWARD, ctx); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - ierr = VecScatterEnd (static_cast(v), vector, - INSERT_VALUES, SCATTER_FORWARD, ctx); - -#else - - ierr = VecScatterBegin (ctx,static_cast(v), vector, - INSERT_VALUES, SCATTER_FORWARD); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - ierr = VecScatterEnd (ctx, static_cast(v), vector, - INSERT_VALUES, SCATTER_FORWARD); - -#endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); - -#if DEAL_II_PETSC_VERSION_LT(3,2,0) - ierr = VecScatterDestroy (ctx); -#else - ierr = VecScatterDestroy (&ctx); -#endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); -#endif - - return *this; - } - - - - template - inline - Vector & - Vector::operator = (const dealii::Vector &v) - { - reinit (v.size(), true); - // the following isn't necessarily fast, - // but this is due to the fact that PETSc - // doesn't offer an inlined access - // operator. - // - // if someone wants to contribute some - // code: to make this code faster, one - // could either first convert all values - // to PetscScalar, and then set them all - // at once using VecSetValues. This has - // the drawback that it could take quite - // some memory, if the vector is large, - // and it would in addition allocate - // memory on the heap, which is - // expensive. an alternative would be to - // split the vector into chunks of, say, - // 128 elements, convert a chunk at a - // time and set it in the output vector - // using VecSetValues. since 128 elements - // is small enough, this could easily be - // allocated on the stack (as a local - // variable) which would make the whole - // thing much more efficient. - // - // a second way to make things faster is - // for the special case that - // number==PetscScalar. we could then - // declare a specialization of this - // template, and omit the conversion. the - // problem with this is that the best we - // can do is to use VecSetValues, but - // this isn't very efficient either: it - // wants to see an array of indices, - // which in this case a) again takes up a - // whole lot of memory on the heap, and - // b) is totally dumb since its content - // would simply be the sequence - // 0,1,2,3,...,n. the best of all worlds - // would probably be a function in Petsc - // that would take a pointer to an array - // of PetscScalar values and simply copy - // n elements verbatim into the vector... - for (size_type i=0; i class ReinitHelper; - - /** - * A helper class used internally in linear_operator.h. Specialization for - * PETScWrappers::Vector. - */ - template<> - class ReinitHelper - { - public: - template - static - void reinit_range_vector (const Matrix &matrix, - PETScWrappers::Vector &v, - bool omit_zeroing_entries) - { - v.reinit( matrix.m(), - omit_zeroing_entries); - } - - template - static - void reinit_domain_vector(const Matrix &matrix, - PETScWrappers::Vector &v, - bool omit_zeroing_entries) - { - v.reinit( matrix.n(), - omit_zeroing_entries); - } - }; - - } /* namespace LinearOperator */ -} /* namespace internal */ - - -/** - * Declare dealii::PETScWrappers::Vector as serial vector. - * - * @author Uwe Koecher, 2017 - */ -template <> -struct is_serial_vector< PETScWrappers::Vector > : std::true_type -{ -}; - - -DEAL_II_NAMESPACE_CLOSE - -#endif // DEAL_II_WITH_PETSC - -/*---------------------------- petsc_vector.h ---------------------------*/ - -#endif -/*---------------------------- petsc_vector.h ---------------------------*/ diff --git a/include/deal.II/numerics/error_estimator.templates.h b/include/deal.II/numerics/error_estimator.templates.h index 780b9c2544..8c46da764b 100644 --- a/include/deal.II/numerics/error_estimator.templates.h +++ b/include/deal.II/numerics/error_estimator.templates.h @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/include/deal.II/numerics/matrix_creator.templates.h b/include/deal.II/numerics/matrix_creator.templates.h index fb0ae2e85d..03655e4354 100644 --- a/include/deal.II/numerics/matrix_creator.templates.h +++ b/include/deal.II/numerics/matrix_creator.templates.h @@ -41,7 +41,7 @@ # include # include # include -# include +# include # include #endif diff --git a/include/deal.II/numerics/vector_tools.templates.h b/include/deal.II/numerics/vector_tools.templates.h index 9da2b52a79..7ee26717ae 100644 --- a/include/deal.II/numerics/vector_tools.templates.h +++ b/include/deal.II/numerics/vector_tools.templates.h @@ -28,9 +28,9 @@ #include #include #include -#include -#include #include +#include +#include #include #include #include diff --git a/source/algorithms/operator.cc b/source/algorithms/operator.cc index 884778c336..7f1487b271 100644 --- a/source/algorithms/operator.cc +++ b/source/algorithms/operator.cc @@ -27,8 +27,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/source/base/mpi.cc b/source/base/mpi.cc index b2bd554b18..9e83208967 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -35,11 +35,9 @@ #endif #ifdef DEAL_II_WITH_PETSC -# include -# include -# include -# include -# include +# include +# include +# include #endif #ifdef DEAL_II_WITH_SLEPC @@ -470,10 +468,6 @@ namespace Utilities ::release_unused_memory (); GrowingVectorMemory ::release_unused_memory (); - GrowingVectorMemory - ::release_unused_memory (); - GrowingVectorMemory - ::release_unused_memory (); # ifdef DEAL_II_WITH_SLEPC // and now end SLEPc (with PETSc) diff --git a/source/base/time_stepping.cc b/source/base/time_stepping.cc index 372c4dce94..fa8c69ecb8 100644 --- a/source/base/time_stepping.cc +++ b/source/base/time_stepping.cc @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/source/distributed/grid_refinement.cc b/source/distributed/grid_refinement.cc index da791ed39a..efd9a05fe4 100644 --- a/source/distributed/grid_refinement.cc +++ b/source/distributed/grid_refinement.cc @@ -17,8 +17,6 @@ #include #include #include -#include -#include #include #include diff --git a/source/distributed/solution_transfer.cc b/source/distributed/solution_transfer.cc index d5a1acbbaf..27481365db 100644 --- a/source/distributed/solution_transfer.cc +++ b/source/distributed/solution_transfer.cc @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/source/distributed/solution_transfer.inst.in b/source/distributed/solution_transfer.inst.in index 0363a7f6da..a5f6505c6d 100644 --- a/source/distributed/solution_transfer.inst.in +++ b/source/distributed/solution_transfer.inst.in @@ -31,10 +31,6 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) #ifdef DEAL_II_WITH_PETSC - template class SolutionTransfer >; - - template class SolutionTransfer >; - template class SolutionTransfer >; template class SolutionTransfer >; diff --git a/source/dofs/dof_accessor_get.cc b/source/dofs/dof_accessor_get.cc index 6015c62374..c4d8ca4ec3 100644 --- a/source/dofs/dof_accessor_get.cc +++ b/source/dofs/dof_accessor_get.cc @@ -18,8 +18,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index 33e885e5c5..99bc584562 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -18,8 +18,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 8b0b59f345..34f0eaee3c 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index cf56a5d51c..b612064a07 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/fe/mapping_q1_eulerian.cc b/source/fe/mapping_q1_eulerian.cc index 8649325814..5534097355 100644 --- a/source/fe/mapping_q1_eulerian.cc +++ b/source/fe/mapping_q1_eulerian.cc @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/fe/mapping_q_eulerian.cc b/source/fe/mapping_q_eulerian.cc index 5f650acf88..d46f57a6d9 100644 --- a/source/fe/mapping_q_eulerian.cc +++ b/source/fe/mapping_q_eulerian.cc @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/grid/grid_refinement.cc b/source/grid/grid_refinement.cc index 6b6b0933f5..870e3de68d 100644 --- a/source/grid/grid_refinement.cc +++ b/source/grid/grid_refinement.cc @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include @@ -62,46 +60,6 @@ namespace // functions being unused: DEAL_II_DISABLE_EXTRA_DIAGNOSTICS -#ifdef DEAL_II_WITH_PETSC - inline - PetscScalar - max_element (const PETScWrappers::Vector &criteria) - { - // this is horribly slow (since we have - // to get the array of values from PETSc - // in every iteration), but works - PetscScalar m = 0; -#ifndef PETSC_USE_COMPLEX - for (unsigned int i=0; i #include -#include #include DEAL_II_NAMESPACE_OPEN diff --git a/source/lac/constraint_matrix.cc b/source/lac/constraint_matrix.cc index 2db76e807f..11c69edb1e 100644 --- a/source/lac/constraint_matrix.cc +++ b/source/lac/constraint_matrix.cc @@ -26,10 +26,7 @@ #include #include #include -#include -#include #include -#include #include #include #include @@ -1360,11 +1357,8 @@ MATRIX_FUNCTIONS(ChunkSparseMatrix); #ifdef DEAL_II_WITH_PETSC MATRIX_FUNCTIONS(PETScWrappers::SparseMatrix); -BLOCK_MATRIX_FUNCTIONS(PETScWrappers::BlockSparseMatrix); MATRIX_FUNCTIONS(PETScWrappers::MPI::SparseMatrix); BLOCK_MATRIX_FUNCTIONS(PETScWrappers::MPI::BlockSparseMatrix); -MATRIX_VECTOR_FUNCTIONS(PETScWrappers::SparseMatrix, PETScWrappers::Vector); -BLOCK_MATRIX_VECTOR_FUNCTIONS(PETScWrappers::BlockSparseMatrix, PETScWrappers::BlockVector); MATRIX_VECTOR_FUNCTIONS(PETScWrappers::MPI::SparseMatrix, PETScWrappers::MPI::Vector); BLOCK_MATRIX_VECTOR_FUNCTIONS(PETScWrappers::MPI::BlockSparseMatrix ,PETScWrappers::MPI::BlockVector); #endif @@ -1440,7 +1434,6 @@ ONLY_MATRIX_FUNCTIONS(TrilinosWrappers::BlockSparseMatrix); #ifdef DEAL_II_WITH_PETSC ONLY_MATRIX_FUNCTIONS(PETScWrappers::SparseMatrix); -ONLY_MATRIX_FUNCTIONS(PETScWrappers::BlockSparseMatrix); ONLY_MATRIX_FUNCTIONS(PETScWrappers::MPI::SparseMatrix); ONLY_MATRIX_FUNCTIONS(PETScWrappers::MPI::BlockSparseMatrix); #endif diff --git a/source/lac/petsc_block_sparse_matrix.cc b/source/lac/petsc_block_sparse_matrix.cc deleted file mode 100644 index 0681c7f005..0000000000 --- a/source/lac/petsc_block_sparse_matrix.cc +++ /dev/null @@ -1,104 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 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 at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#include - -#ifdef DEAL_II_WITH_PETSC - -DEAL_II_NAMESPACE_OPEN - -namespace PETScWrappers -{ - BlockSparseMatrix::BlockSparseMatrix () - {} - - - - BlockSparseMatrix::~BlockSparseMatrix () - {} - - - - BlockSparseMatrix & - BlockSparseMatrix::operator = (const BlockSparseMatrix &m) - { - BaseClass::operator = (m); - - return *this; - } - - - void - BlockSparseMatrix:: - reinit (const size_type n_block_rows, - const size_type n_block_columns) - { - // first delete previous content of - // the subobjects array - clear (); - - // then resize. set sizes of blocks to - // zero. user will later have to call - // collect_sizes for this - this->sub_objects.reinit (n_block_rows, - n_block_columns); - this->row_block_indices.reinit (n_block_rows, 0); - this->column_block_indices.reinit (n_block_columns, 0); - - // and reinitialize the blocks - for (size_type r=0; rn_block_rows(); ++r) - for (size_type c=0; cn_block_cols(); ++c) - { - BlockType *p = new BlockType(); - this->sub_objects[r][c] = p; - } - } - - std::vector - BlockSparseMatrix:: - locally_owned_domain_sizes() const - { - std::vector< size_type > index_sets; - - for ( unsigned int i=0; in_block_cols(); ++i) - index_sets.push_back(this->block(0,i).n()); - - return index_sets; - } - - std::vector - BlockSparseMatrix:: - locally_owned_range_sizes() const - { - std::vector< size_type > index_sets; - - for ( unsigned int i=0; in_block_rows(); ++i) - index_sets.push_back(this->block(i,0).m()); - - return index_sets; - } - - void - BlockSparseMatrix::collect_sizes () - { - BaseClass::collect_sizes (); - } - -} - - -DEAL_II_NAMESPACE_CLOSE - -#endif diff --git a/source/lac/petsc_parallel_block_vector.cc b/source/lac/petsc_parallel_block_vector.cc index 5c66680de4..71f55dddf3 100644 --- a/source/lac/petsc_parallel_block_vector.cc +++ b/source/lac/petsc_parallel_block_vector.cc @@ -17,8 +17,6 @@ #ifdef DEAL_II_WITH_PETSC -# include - DEAL_II_NAMESPACE_OPEN namespace PETScWrappers @@ -27,21 +25,6 @@ namespace PETScWrappers { typedef types::global_dof_index size_type; - BlockVector & - BlockVector::operator = (const PETScWrappers::BlockVector &v) - { - this->block_indices = v.get_block_indices(); - - if (this->components.size() != this->n_blocks()) - this->components.resize(this->n_blocks()); - - for (unsigned int i=0; in_blocks(); ++i) - this->block(i) = v.block(i); - - return *this; - } - - void BlockVector::reinit (const unsigned int num_blocks) { diff --git a/source/lac/petsc_parallel_sparse_matrix.cc b/source/lac/petsc_parallel_sparse_matrix.cc index c2478f7146..1ae9dc3de7 100644 --- a/source/lac/petsc_parallel_sparse_matrix.cc +++ b/source/lac/petsc_parallel_sparse_matrix.cc @@ -20,7 +20,7 @@ # include # include # include -# include +# include # include # include diff --git a/source/lac/petsc_parallel_vector.cc b/source/lac/petsc_parallel_vector.cc index a296d7ef9f..ba2f8ee41d 100644 --- a/source/lac/petsc_parallel_vector.cc +++ b/source/lac/petsc_parallel_vector.cc @@ -18,7 +18,6 @@ #ifdef DEAL_II_WITH_PETSC -# include # include # include @@ -250,52 +249,6 @@ namespace PETScWrappers } - Vector & - Vector::operator = (const PETScWrappers::Vector &v) - { - Assert(last_action==VectorOperation::unknown, - ExcMessage("Call to compress() required before calling operator=.")); - //TODO [TH]: can not access v.last_action here. Implement is_compressed()? - //Assert(v.last_action==VectorOperation::unknown, - // ExcMessage("Call to compress() required before calling operator=.")); - - // get a pointer to the local memory of - // this vector - PetscScalar *dest_array; - PetscErrorCode ierr = VecGetArray (vector, &dest_array); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - // then also a pointer to the source - // vector - PetscScalar *src_array; - ierr = VecGetArray (static_cast(v), &src_array); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - // then copy: - const std::pair - local_elements = local_range (); - std::copy (src_array + local_elements.first, - src_array + local_elements.second, - dest_array); - - // finally restore the arrays - ierr = VecRestoreArray (vector, &dest_array); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - ierr = VecRestoreArray (static_cast(v), &src_array); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - - if (has_ghost_elements()) - { - ierr = VecGhostUpdateBegin(vector, INSERT_VALUES, SCATTER_FORWARD); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - ierr = VecGhostUpdateEnd(vector, INSERT_VALUES, SCATTER_FORWARD); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - } - return *this; - } - - void Vector::create_vector (const size_type n, const size_type local_size) diff --git a/source/lac/petsc_vector.cc b/source/lac/petsc_vector.cc deleted file mode 100644 index 3de9764fab..0000000000 --- a/source/lac/petsc_vector.cc +++ /dev/null @@ -1,133 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 2004 - 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 at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#include - -#ifdef DEAL_II_WITH_PETSC - -#include - -# include - -DEAL_II_NAMESPACE_OPEN - -namespace PETScWrappers -{ - - - Vector::Vector () - { - Vector::create_vector (0); - } - - - - Vector::Vector (const size_type n) - { - Vector::create_vector (n); - } - - - - Vector::Vector (const Vector &v) - : - VectorBase () - { - // first create a dummy vector, then copy - // over the other one - Vector::create_vector (1); - Vector::operator = (v); - } - - - - Vector::Vector (const MPI::Vector &v) - { - // first create a dummy vector, then copy - // over the other one - Vector::create_vector (1); - Vector::operator = (v); - } - - - - void - Vector::clear () - { - VectorBase::clear (); - Vector::create_vector (0); - } - - - - void - Vector::reinit (const size_type n, - const bool omit_zeroing_entries) - { - // only do something if the sizes - // mismatch - if (size() != n) - { - // FIXME: I'd like to use this here, - // but somehow it leads to odd errors - // somewhere down the line in some of - // the tests: -// const PetscErrorCode ierr = VecSetSizes (vector, n, n); -// AssertThrow (ierr == 0, ExcPETScError(ierr)); - - // so let's go the slow way: - if (attained_ownership) - { -#if DEAL_II_PETSC_VERSION_LT(3,2,0) - PetscErrorCode ierr = VecDestroy (vector); -#else - PetscErrorCode ierr = VecDestroy (&vector); -#endif - AssertThrow (ierr == 0, ExcPETScError(ierr)); - } - - create_vector (n); - } - - // finally clear the new vector if so - // desired - if (omit_zeroing_entries == false) - *this = 0; - } - - - - void - Vector::reinit (const Vector &v, - const bool omit_zeroing_entries) - { - reinit (v.size(), omit_zeroing_entries); - } - - - - void - Vector::create_vector (const size_type n) - { - const PetscErrorCode ierr - = VecCreateSeq (PETSC_COMM_SELF, n, &vector); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - attained_ownership = true; - } -} - -DEAL_II_NAMESPACE_CLOSE - -#endif // DEAL_II_WITH_PETSC diff --git a/source/lac/petsc_vector_base.cc b/source/lac/petsc_vector_base.cc index ceddd323d8..2b63c29b19 100644 --- a/source/lac/petsc_vector_base.cc +++ b/source/lac/petsc_vector_base.cc @@ -20,7 +20,6 @@ # include # include # include -# include # include # include # include @@ -36,35 +35,12 @@ namespace PETScWrappers Assert (index < vector.size(), ExcIndexRange (index, 0, vector.size())); - // if the vector is local, then - // simply access the element we - // are interested in - if (dynamic_cast(&vector) != nullptr) - { - PetscInt idx = index; - PetscScalar value; - PetscErrorCode ierr = VecGetValues(vector.vector, 1, &idx, &value); - AssertThrow (ierr == 0, ExcPETScError(ierr)); - return value; - } - - // there is the possibility - // that the vector has - // ghost elements. in that - // case, we first need to - // figure out which - // elements we own locally, - // then get a pointer to - // the elements that are - // stored here (both the - // ones we own as well as - // the ghost elements). in - // this array, the locally - // owned elements come - // first followed by the - // ghost elements whose - // position we can get from - // an index set + // The vector may have ghost entries. In that case, we first need to + // figure out which elements we own locally, then get a pointer to the + // elements that are stored here (both the ones we own as well as the + // ghost elements). In this array, the locally owned elements come first + // followed by the ghost elements whose position we can get from an + // index set. if (vector.ghosted) { PetscInt begin, end; @@ -120,14 +96,10 @@ namespace PETScWrappers PetscErrorCode ierr = VecGetOwnershipRange (vector.vector, &begin, &end); AssertThrow (ierr == 0, ExcPETScError(ierr)); - - AssertThrow ((index >= static_cast(begin)) && (index < static_cast(end)), ExcAccessToNonlocalElement (index, begin, end-1)); - // old version which only work with - // VecGetArray()... PetscInt idx = index; PetscScalar value; ierr = VecGetValues(vector.vector, 1, &idx, &value); diff --git a/source/lac/slepc_solver.cc b/source/lac/slepc_solver.cc index e7f434c5f2..31d9ea86c2 100644 --- a/source/lac/slepc_solver.cc +++ b/source/lac/slepc_solver.cc @@ -19,7 +19,6 @@ # include # include -# include # include # include diff --git a/source/lac/slepc_spectral_transformation.cc b/source/lac/slepc_spectral_transformation.cc index da0087a096..bc7c59a126 100644 --- a/source/lac/slepc_spectral_transformation.cc +++ b/source/lac/slepc_spectral_transformation.cc @@ -19,8 +19,6 @@ # include # include -# include -# include # include # include diff --git a/source/lac/solver.cc b/source/lac/solver.cc index b57404dfd1..141e317af1 100644 --- a/source/lac/solver.cc +++ b/source/lac/solver.cc @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/source/lac/vector_memory.cc b/source/lac/vector_memory.cc index dde669ca02..3cbd37ae29 100644 --- a/source/lac/vector_memory.cc +++ b/source/lac/vector_memory.cc @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/source/meshworker/mesh_worker_info.cc b/source/meshworker/mesh_worker_info.cc index 288946d155..d9982c46ca 100644 --- a/source/meshworker/mesh_worker_info.cc +++ b/source/meshworker/mesh_worker_info.cc @@ -16,8 +16,6 @@ #include #include -#include -#include #include #include @@ -31,4 +29,3 @@ DEAL_II_NAMESPACE_OPEN DEAL_II_NAMESPACE_CLOSE - diff --git a/source/meshworker/mesh_worker_vector_selector.cc b/source/meshworker/mesh_worker_vector_selector.cc index 271eceab65..a40a97a77d 100644 --- a/source/meshworker/mesh_worker_vector_selector.cc +++ b/source/meshworker/mesh_worker_vector_selector.cc @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/source/multigrid/mg_base.cc b/source/multigrid/mg_base.cc index 4a6b89add5..640eef3b8c 100644 --- a/source/multigrid/mg_base.cc +++ b/source/multigrid/mg_base.cc @@ -18,8 +18,7 @@ #include #include #include -#include -#include +#include #include #include #include diff --git a/source/multigrid/mg_level_global_transfer.cc b/source/multigrid/mg_level_global_transfer.cc index 1ef738e193..65ccf6223a 100644 --- a/source/multigrid/mg_level_global_transfer.cc +++ b/source/multigrid/mg_level_global_transfer.cc @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/source/multigrid/mg_transfer_prebuilt.cc b/source/multigrid/mg_transfer_prebuilt.cc index d2c1883847..8f2a04178b 100644 --- a/source/multigrid/mg_transfer_prebuilt.cc +++ b/source/multigrid/mg_transfer_prebuilt.cc @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/source/multigrid/multigrid.cc b/source/multigrid/multigrid.cc index 19adb5148a..32f49db7e8 100644 --- a/source/multigrid/multigrid.cc +++ b/source/multigrid/multigrid.cc @@ -18,8 +18,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/numerics/data_out_dof_data.cc b/source/numerics/data_out_dof_data.cc index 3b8ffea364..d3500b1278 100644 --- a/source/numerics/data_out_dof_data.cc +++ b/source/numerics/data_out_dof_data.cc @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index f760e06ab6..b612b576f4 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/numerics/dof_output_operator.cc b/source/numerics/dof_output_operator.cc index 02ee200098..f8d61c6f83 100644 --- a/source/numerics/dof_output_operator.cc +++ b/source/numerics/dof_output_operator.cc @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/source/numerics/error_estimator_1d.cc b/source/numerics/error_estimator_1d.cc index 8ab52414bc..df6e3a2a41 100644 --- a/source/numerics/error_estimator_1d.cc +++ b/source/numerics/error_estimator_1d.cc @@ -22,8 +22,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/numerics/fe_field_function.cc b/source/numerics/fe_field_function.cc index 229b389cfa..817af94c38 100644 --- a/source/numerics/fe_field_function.cc +++ b/source/numerics/fe_field_function.cc @@ -24,8 +24,8 @@ #include #include #include -#include -#include +#include +#include #include #include diff --git a/source/numerics/matrix_tools.cc b/source/numerics/matrix_tools.cc index c61582aa1b..7e11e2fe0d 100644 --- a/source/numerics/matrix_tools.cc +++ b/source/numerics/matrix_tools.cc @@ -38,7 +38,6 @@ # include # include # include -# include # include #endif diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index 43e12f367f..1a2148bab6 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -19,8 +19,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/source/numerics/solution_transfer.cc b/source/numerics/solution_transfer.cc index fc31234f26..41c4f00da2 100644 --- a/source/numerics/solution_transfer.cc +++ b/source/numerics/solution_transfer.cc @@ -25,11 +25,11 @@ #include #include #include -#include +#include +#include #include #include #include -#include #include #include -- 2.39.5