]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove a lot of deprecated PETSc things. 12288/head
authorDavid Wells <drwells@email.unc.edu>
Sat, 22 May 2021 17:57:31 +0000 (13:57 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 22 May 2021 19:36:56 +0000 (15:36 -0400)
include/deal.II/lac/petsc_matrix_base.h
include/deal.II/lac/petsc_sparse_matrix.h
source/lac/petsc_matrix_base.cc
source/lac/petsc_parallel_sparse_matrix.cc

index 036cf8fee630ed9346e782743da060e2bb2cfb43..0f97ba8fd3f46a762ab37b199fd2b973b5fc151d 100644 (file)
@@ -754,16 +754,6 @@ namespace PETScWrappers
     MatrixBase &
     add(const PetscScalar factor, const MatrixBase &other);
 
-
-    /**
-     * Add the matrix @p other scaled by the factor @p factor to the current
-     * matrix.
-     * @deprecated Use the function with order of arguments reversed instead.
-     */
-    DEAL_II_DEPRECATED
-    MatrixBase &
-    add(const MatrixBase &other, const PetscScalar factor);
-
     /**
      * Matrix-vector multiplication: let <i>dst = M*src</i> with <i>M</i>
      * being this matrix.
index 13ccb55809f6d0a89fbdd39c450a3e527b02b283..3b4daed7706369fbc77f986963332e478cce5429 100644 (file)
@@ -399,72 +399,6 @@ namespace PETScWrappers
        */
       ~SparseMatrix() override;
 
-      /**
-       * Create a sparse matrix of dimensions @p m times @p n, with an initial
-       * guess of @p n_nonzero_per_row and @p n_offdiag_nonzero_per_row
-       * nonzero elements per row (see documentation of the MatCreateAIJ PETSc
-       * function for more information about these parameters). PETSc is able
-       * to cope with the situation that more than this number of elements are
-       * later allocated for a row, but this involves copying data, and is
-       * thus expensive.
-       *
-       * For the meaning of the @p local_row and @p local_columns parameters,
-       * see the class documentation.
-       *
-       * The @p is_symmetric flag determines whether we should tell PETSc that
-       * the matrix is going to be symmetric (as indicated by the call
-       * <tt>MatSetOption(mat, MAT_SYMMETRIC)</tt>. Note that the PETSc
-       * documentation states that one cannot form an ILU decomposition of a
-       * matrix for which this flag has been set to @p true, only an ICC. The
-       * default value of this flag is @p false.
-       *
-       * @deprecated This constructor is deprecated: please use the
-       * constructor with a sparsity pattern argument instead.
-       */
-      DEAL_II_DEPRECATED
-      SparseMatrix(const MPI_Comm &communicator,
-                   const size_type m,
-                   const size_type n,
-                   const size_type local_rows,
-                   const size_type local_columns,
-                   const size_type n_nonzero_per_row,
-                   const bool      is_symmetric              = false,
-                   const size_type n_offdiag_nonzero_per_row = 0);
-
-      /**
-       * Initialize a rectangular matrix with @p m rows and @p n columns. The
-       * maximal number of nonzero entries for diagonal and off- diagonal
-       * blocks of each row is given by the @p row_lengths and @p
-       * offdiag_row_lengths arrays.
-       *
-       * For the meaning of the @p local_row and @p local_columns parameters,
-       * see the class documentation.
-       *
-       * Just as for the other constructors: PETSc is able to cope with the
-       * situation that more than this number of elements are later allocated
-       * for a row, but this involves copying data, and is thus expensive.
-       *
-       * The @p is_symmetric flag determines whether we should tell PETSc that
-       * the matrix is going to be symmetric (as indicated by the call
-       * <tt>MatSetOption(mat, MAT_SYMMETRIC)</tt>. Note that the PETSc
-       * documentation states that one cannot form an ILU decomposition of a
-       * matrix for which this flag has been set to @p true, only an ICC. The
-       * default value of this flag is @p false.
-       *
-       * @deprecated This constructor is deprecated: please use the
-       * constructor with a sparsity pattern argument instead.
-       */
-      DEAL_II_DEPRECATED
-      SparseMatrix(const MPI_Comm &              communicator,
-                   const size_type               m,
-                   const size_type               n,
-                   const size_type               local_rows,
-                   const size_type               local_columns,
-                   const std::vector<size_type> &row_lengths,
-                   const bool                    is_symmetric = false,
-                   const std::vector<size_type> &offdiag_row_lengths =
-                     std::vector<size_type>());
-
       /**
        * Initialize using the given sparsity pattern with communication
        * happening over the provided @p communicator.
@@ -515,45 +449,6 @@ namespace PETScWrappers
       void
       copy_from(const SparseMatrix &other);
 
-      /**
-       * Throw away the present matrix and generate one that has the same
-       * properties as if it were created by the constructor of this class
-       * with the same argument list as the present function.
-       *
-       * @deprecated This overload of <code>reinit</code> is deprecated:
-       * please use the overload with a sparsity pattern argument instead.
-       */
-      DEAL_II_DEPRECATED
-      void
-      reinit(const MPI_Comm &communicator,
-             const size_type m,
-             const size_type n,
-             const size_type local_rows,
-             const size_type local_columns,
-             const size_type n_nonzero_per_row,
-             const bool      is_symmetric              = false,
-             const size_type n_offdiag_nonzero_per_row = 0);
-
-      /**
-       * Throw away the present matrix and generate one that has the same
-       * properties as if it were created by the constructor of this class
-       * with the same argument list as the present function.
-       *
-       * @deprecated This overload of <code>reinit</code> is deprecated:
-       * please use the overload with a sparsity pattern argument instead.
-       */
-      DEAL_II_DEPRECATED
-      void
-      reinit(const MPI_Comm &              communicator,
-             const size_type               m,
-             const size_type               n,
-             const size_type               local_rows,
-             const size_type               local_columns,
-             const std::vector<size_type> &row_lengths,
-             const bool                    is_symmetric = false,
-             const std::vector<size_type> &offdiag_row_lengths =
-               std::vector<size_type>());
-
       /**
        * Initialize using the given sparsity pattern with communication
        * happening over the provided @p communicator.
@@ -698,41 +593,6 @@ namespace PETScWrappers
        */
       MPI_Comm communicator;
 
-      /**
-       * Do the actual work for the respective reinit() function and the
-       * matching constructor, i.e. create a matrix. Getting rid of the
-       * previous matrix is left to the caller.
-       *
-       * @deprecated This overload of <code>do_reinit</code> is deprecated:
-       * please use the overload with a sparsity pattern argument instead.
-       */
-      DEAL_II_DEPRECATED
-      void
-      do_reinit(const size_type m,
-                const size_type n,
-                const size_type local_rows,
-                const size_type local_columns,
-                const size_type n_nonzero_per_row,
-                const bool      is_symmetric              = false,
-                const size_type n_offdiag_nonzero_per_row = 0);
-
-      /**
-       * Same as previous function.
-       *
-       * @deprecated This overload of <code>do_reinit</code> is deprecated:
-       * please use the overload with a sparsity pattern argument instead.
-       */
-      DEAL_II_DEPRECATED
-      void
-      do_reinit(const size_type               m,
-                const size_type               n,
-                const size_type               local_rows,
-                const size_type               local_columns,
-                const std::vector<size_type> &row_lengths,
-                const bool                    is_symmetric = false,
-                const std::vector<size_type> &offdiag_row_lengths =
-                  std::vector<size_type>());
-
       /**
        * Same as previous functions.
        */
index 3d05e782a81e2bbab6c415b1590a45da5ea91e0d..0e473c0adba3d9ad20f0f0abf4fa91e5be9cd243 100644 (file)
@@ -437,14 +437,6 @@ namespace PETScWrappers
   }
 
 
-
-  MatrixBase &
-  MatrixBase::add(const MatrixBase &other, const PetscScalar factor)
-  {
-    return add(factor, other);
-  }
-
-
   void
   MatrixBase::vmult(VectorBase &dst, const VectorBase &src) const
   {
index 383c8d11f809787e3a599f4e68989f2ccadfb974..adfe10b85e55b4f49d33e757466a3214c84f6858 100644 (file)
@@ -49,47 +49,6 @@ namespace PETScWrappers
       destroy_matrix(matrix);
     }
 
-    SparseMatrix::SparseMatrix(const MPI_Comm &communicator,
-                               const size_type m,
-                               const size_type n,
-                               const size_type local_rows,
-                               const size_type local_columns,
-                               const size_type n_nonzero_per_row,
-                               const bool      is_symmetric,
-                               const size_type n_offdiag_nonzero_per_row)
-      : communicator(communicator)
-    {
-      do_reinit(m,
-                n,
-                local_rows,
-                local_columns,
-                n_nonzero_per_row,
-                is_symmetric,
-                n_offdiag_nonzero_per_row);
-    }
-
-
-
-    SparseMatrix::SparseMatrix(
-      const MPI_Comm &              communicator,
-      const size_type               m,
-      const size_type               n,
-      const size_type               local_rows,
-      const size_type               local_columns,
-      const std::vector<size_type> &row_lengths,
-      const bool                    is_symmetric,
-      const std::vector<size_type> &offdiag_row_lengths)
-      : communicator(communicator)
-    {
-      do_reinit(m,
-                n,
-                local_rows,
-                local_columns,
-                row_lengths,
-                is_symmetric,
-                offdiag_row_lengths);
-    }
-
 
 
     template <typename SparsityPatternType>
@@ -110,6 +69,7 @@ namespace PETScWrappers
     }
 
 
+
     void
     SparseMatrix::reinit(const SparseMatrix &other)
     {
@@ -146,59 +106,6 @@ namespace PETScWrappers
       AssertThrow(ierr == 0, ExcPETScError(ierr));
     }
 
-    void
-    SparseMatrix::reinit(const MPI_Comm &communicator,
-                         const size_type m,
-                         const size_type n,
-                         const size_type local_rows,
-                         const size_type local_columns,
-                         const size_type n_nonzero_per_row,
-                         const bool      is_symmetric,
-                         const size_type n_offdiag_nonzero_per_row)
-    {
-      this->communicator = communicator;
-
-      // get rid of old matrix and generate a new one
-      const PetscErrorCode ierr = destroy_matrix(matrix);
-      AssertThrow(ierr == 0, ExcPETScError(ierr));
-
-      do_reinit(m,
-                n,
-                local_rows,
-                local_columns,
-                n_nonzero_per_row,
-                is_symmetric,
-                n_offdiag_nonzero_per_row);
-    }
-
-
-
-    void
-    SparseMatrix::reinit(const MPI_Comm &              communicator,
-                         const size_type               m,
-                         const size_type               n,
-                         const size_type               local_rows,
-                         const size_type               local_columns,
-                         const std::vector<size_type> &row_lengths,
-                         const bool                    is_symmetric,
-                         const std::vector<size_type> &offdiag_row_lengths)
-    {
-      this->communicator = communicator;
-
-      // get rid of old matrix and generate a
-      // new one
-      const PetscErrorCode ierr = destroy_matrix(matrix);
-      AssertThrow(ierr == 0, ExcPETScError(ierr));
-
-      do_reinit(m,
-                n,
-                local_rows,
-                local_columns,
-                row_lengths,
-                is_symmetric,
-                offdiag_row_lengths);
-    }
-
 
 
     template <typename SparsityPatternType>
@@ -241,110 +148,6 @@ namespace PETScWrappers
       do_reinit(local_rows, local_columns, sparsity_pattern);
     }
 
-    void
-    SparseMatrix::do_reinit(const size_type m,
-                            const size_type n,
-                            const size_type local_rows,
-                            const size_type local_columns,
-                            const size_type n_nonzero_per_row,
-                            const bool      is_symmetric,
-                            const size_type n_offdiag_nonzero_per_row)
-    {
-      Assert(local_rows <= m, ExcLocalRowsTooLarge(local_rows, m));
-
-      // use the call sequence indicating only
-      // a maximal number of elements per row
-      // for all rows globally
-      const PetscErrorCode ierr = MatCreateAIJ(communicator,
-                                               local_rows,
-                                               local_columns,
-                                               m,
-                                               n,
-                                               n_nonzero_per_row,
-                                               nullptr,
-                                               n_offdiag_nonzero_per_row,
-                                               nullptr,
-                                               &matrix);
-      set_matrix_option(matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
-      AssertThrow(ierr == 0, ExcPETScError(ierr));
-
-      // set symmetric flag, if so requested
-      if (is_symmetric == true)
-        {
-          set_matrix_option(matrix, MAT_SYMMETRIC, PETSC_TRUE);
-        }
-    }
-
-
-
-    void
-    SparseMatrix::do_reinit(const size_type               m,
-                            const size_type               n,
-                            const size_type               local_rows,
-                            const size_type               local_columns,
-                            const std::vector<size_type> &row_lengths,
-                            const bool                    is_symmetric,
-                            const std::vector<size_type> &offdiag_row_lengths)
-    {
-      Assert(local_rows <= m, ExcLocalRowsTooLarge(local_rows, m));
-
-      Assert(row_lengths.size() == m,
-             ExcDimensionMismatch(row_lengths.size(), m));
-
-      // For the case that local_columns is smaller than one of the row lengths
-      // MatCreateMPIAIJ throws an error. In this case use a
-      // PETScWrappers::SparseMatrix
-      for (const size_type row_length : row_lengths)
-        {
-          (void)row_length;
-          Assert(row_length <= local_columns,
-                 ExcIndexRange(row_length, 1, local_columns + 1));
-        }
-
-      // use the call sequence indicating a
-      // maximal number of elements for each
-      // row individually. annoyingly, we
-      // always use unsigned ints for cases
-      // like this, while PETSc wants to see
-      // signed integers. so we have to
-      // convert, unless we want to play dirty
-      // tricks with conversions of pointers
-      const std::vector<PetscInt> int_row_lengths(row_lengths.begin(),
-                                                  row_lengths.end());
-      const std::vector<PetscInt> int_offdiag_row_lengths(
-        offdiag_row_lengths.begin(), offdiag_row_lengths.end());
-
-      // TODO: There must be a significantly better way to provide information
-      // about the off-diagonal blocks of the matrix. this way, petsc keeps
-      // allocating tiny chunks of memory, and gets completely hung up over this
-      const PetscErrorCode ierr =
-        MatCreateAIJ(communicator,
-                     local_rows,
-                     local_columns,
-                     m,
-                     n,
-                     0,
-                     int_row_lengths.data(),
-                     0,
-                     offdiag_row_lengths.size() ?
-                       int_offdiag_row_lengths.data() :
-                       nullptr,
-                     &matrix);
-
-      // TODO: Sometimes the actual number of nonzero entries allocated is
-      // greater than the number of nonzero entries, which petsc will complain
-      // about unless explicitly disabled with MatSetOption. There is probably a
-      // way to prevent a different number nonzero elements being allocated in
-      // the first place. (See also previous TODO).
-      set_matrix_option(matrix, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE);
-      AssertThrow(ierr == 0, ExcPETScError(ierr));
-
-      // set symmetric flag, if so requested
-      if (is_symmetric == true)
-        {
-          set_matrix_option(matrix, MAT_SYMMETRIC, PETSC_TRUE);
-        }
-    }
 
 
     template <typename SparsityPatternType>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.