]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove deprecated variables in PreconditionChebyshev::AdditionalData
authorDaniel Arndt <arndtd@ornl.gov>
Thu, 11 Jul 2019 20:56:22 +0000 (16:56 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Thu, 11 Jul 2019 21:02:38 +0000 (17:02 -0400)
include/deal.II/lac/precondition.h
tests/lac/precondition_chebyshev_01.cc
tests/matrix_free/multigrid_dg_periodic.cc
tests/matrix_free/multigrid_dg_sip_01.cc
tests/matrix_free/multigrid_dg_sip_02.cc
tests/matrix_free/parallel_multigrid_mf.cc

index b840a8087d3f80c91042ced3dacddf64a9652770..52a518b1417a25d2c2bad8bf32e4cee713db60b7 100644 (file)
@@ -1024,7 +1024,6 @@ public:
      */
     AdditionalData(const unsigned int degree              = 1,
                    const double       smoothing_range     = 0.,
-                   const bool         nonzero_starting    = false,
                    const unsigned int eig_cg_n_iterations = 8,
                    const double       eig_cg_residual     = 1e-2,
                    const double       max_eigenvalue      = 1);
@@ -1055,20 +1054,6 @@ public:
      */
     double smoothing_range;
 
-    /**
-     * When this flag is set to <tt>true</tt>, it enables the method
-     * <tt>vmult(dst, src)</tt> to use non-zero data in the vector
-     * <tt>dst</tt>, appending to it the Chebyshev corrections. This can be
-     * useful in some situations (e.g. when used for high-frequency error
-     * smoothing in a multigrid algorithm), but not the way the solver classes
-     * expect a preconditioner to work (where one ignores the content in
-     * <tt>dst</tt> for the preconditioner application).
-     *
-     * @deprecated For non-zero starting, use the step() and Tstep()
-     * interfaces, whereas vmult() provides the preconditioner interface.
-     */
-    bool nonzero_starting DEAL_II_DEPRECATED;
-
     /**
      * Maximum number of CG iterations performed for finding the maximum
      * eigenvalue. If set to zero, no computations are performed. Instead, the
@@ -1090,13 +1075,6 @@ public:
      */
     double max_eigenvalue;
 
-    /**
-     * Stores the inverse of the diagonal of the underlying matrix.
-     *
-     * @deprecated Set the variable @p preconditioner defined below instead.
-     */
-    VectorType matrix_diagonal_inverse DEAL_II_DEPRECATED;
-
     /**
      * Stores the preconditioner object that the Chebyshev is wrapped around.
      */
@@ -2008,14 +1986,11 @@ namespace internal
         solution.swap(solution_old);
     }
 
-    template <typename MatrixType,
-              typename VectorType,
-              typename PreconditionerType>
+    template <typename MatrixType, typename PreconditionerType>
     inline void
     initialize_preconditioner(
       const MatrixType &                   matrix,
-      std::shared_ptr<PreconditionerType> &preconditioner,
-      VectorType &)
+      std::shared_ptr<PreconditionerType> &preconditioner)
     {
       (void)matrix;
       (void)preconditioner;
@@ -2026,8 +2001,7 @@ namespace internal
     inline void
     initialize_preconditioner(
       const MatrixType &                           matrix,
-      std::shared_ptr<DiagonalMatrix<VectorType>> &preconditioner,
-      VectorType &                                 diagonal_inverse)
+      std::shared_ptr<DiagonalMatrix<VectorType>> &preconditioner)
     {
       if (preconditioner.get() == nullptr || preconditioner->m() != matrix.m())
         {
@@ -2039,14 +2013,6 @@ namespace internal
             ExcMessage(
               "Preconditioner appears to be initialized but not sized correctly"));
 
-          // Check if we can initialize from vector that then gets set to zero
-          // as the matrix will own the memory
-          preconditioner->reinit(diagonal_inverse);
-          {
-            VectorType empty_vector;
-            diagonal_inverse.reinit(empty_vector);
-          }
-
           // This part only works in serial
           if (preconditioner->m() != matrix.m())
             {
@@ -2118,19 +2084,15 @@ namespace internal
 
 
 
-// avoid warning about deprecated variable nonzero_starting
-
 template <typename MatrixType, class VectorType, typename PreconditionerType>
 inline PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::
   AdditionalData::AdditionalData(const unsigned int degree,
                                  const double       smoothing_range,
-                                 const bool         nonzero_starting,
                                  const unsigned int eig_cg_n_iterations,
                                  const double       eig_cg_residual,
                                  const double       max_eigenvalue)
   : degree(degree)
   , smoothing_range(smoothing_range)
-  , nonzero_starting(nonzero_starting)
   , eig_cg_n_iterations(eig_cg_n_iterations)
   , eig_cg_residual(eig_cg_residual)
   , max_eigenvalue(max_eigenvalue)
@@ -2151,8 +2113,6 @@ inline PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::
 }
 
 
-// avoid warning about deprecated variable
-// AdditionalData::matrix_diagonal_inverse
 
 template <typename MatrixType, typename VectorType, typename PreconditionerType>
 inline void
@@ -2165,7 +2125,7 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::initialize(
   Assert(data.degree > 0,
          ExcMessage("The degree of the Chebyshev method must be positive."));
   internal::PreconditionChebyshevImplementation::initialize_preconditioner(
-    matrix, data.preconditioner, data.matrix_diagonal_inverse);
+    matrix, data.preconditioner);
   eigenvalues_are_initialized = false;
 }
 
@@ -2180,7 +2140,6 @@ PreconditionChebyshev<MatrixType, VectorType, PreconditionerType>::clear()
   matrix_ptr    = nullptr;
   {
     VectorType empty_vector;
-    data.matrix_diagonal_inverse.reinit(empty_vector);
     solution_old.reinit(empty_vector);
     temp_vector1.reinit(empty_vector);
     temp_vector2.reinit(empty_vector);
index 929065b16b1aeee5372a9834c236c9b8f76794dc..7af71d4388357bfafec90ed535ba1a5f75bdf202 100644 (file)
@@ -77,8 +77,10 @@ check()
   deallog << std::endl;
 
   Vector<double> matrix_diagonal(size);
-  matrix_diagonal              = 1;
-  data.matrix_diagonal_inverse = matrix_diagonal;
+  matrix_diagonal     = 1;
+  auto preconditioner = std::make_shared<DiagonalMatrix<Vector<double>>>();
+  preconditioner->reinit(matrix_diagonal);
+  data.preconditioner = std::move(preconditioner);
   prec.initialize(m, data);
 
   deallog << "Check  vmult diag: ";
index 79199c7c12e23c2c97d1b6cbbac961f66f4f2bbd..853d5e0fe4c5522b88c15f0fb48f4430e48003e9 100644 (file)
@@ -572,8 +572,10 @@ do_test(const DoFHandler<dim> &dof)
       smoother_data[level].smoothing_range     = 20.;
       smoother_data[level].degree              = 5;
       smoother_data[level].eig_cg_n_iterations = 15;
-      smoother_data[level].matrix_diagonal_inverse =
-        mg_matrices[level].get_matrix_diagonal_inverse();
+      auto preconditioner                      = std::make_shared<
+        DiagonalMatrix<LinearAlgebra::distributed::Vector<number>>>();
+      preconditioner->reinit(mg_matrices[level].get_matrix_diagonal_inverse());
+      smoother_data[level].preconditioner = std::move(preconditioner);
     }
   mg_smoother.initialize(mg_matrices, smoother_data);
 
index 5c65da9159dc4943cf86bf75fe0d8f7f1d82461f..23096ad0bfeb97343a0ad32d42f26520bf0e3acb 100644 (file)
@@ -582,8 +582,10 @@ do_test(const DoFHandler<dim> &dof, const bool also_test_parallel = false)
       smoother_data[level].smoothing_range     = 20.;
       smoother_data[level].degree              = 5;
       smoother_data[level].eig_cg_n_iterations = 15;
-      smoother_data[level].matrix_diagonal_inverse =
-        mg_matrices[level].get_matrix_diagonal_inverse();
+      auto preconditioner                      = std::make_shared<
+        DiagonalMatrix<LinearAlgebra::distributed::Vector<number>>>();
+      preconditioner->reinit(mg_matrices[level].get_matrix_diagonal_inverse());
+      smoother_data[level].preconditioner = std::move(preconditioner);
     }
   mg_smoother.initialize(mg_matrices, smoother_data);
 
index 3afcea7283054ca36bbb7be7b3fc66716232ac58..52181a93348855575eb57bb3c61fcfe5a95c214b 100644 (file)
@@ -494,8 +494,10 @@ do_test(const DoFHandler<dim> &dof, const bool also_test_parallel = false)
       smoother_data[level].smoothing_range     = 20.;
       smoother_data[level].degree              = 5;
       smoother_data[level].eig_cg_n_iterations = 15;
-      smoother_data[level].matrix_diagonal_inverse =
-        mg_matrices[level].get_matrix_diagonal_inverse();
+      auto preconditioner                      = std::make_shared<
+        DiagonalMatrix<LinearAlgebra::distributed::Vector<number>>>();
+      preconditioner->reinit(mg_matrices[level].get_matrix_diagonal_inverse());
+      smoother_data[level].preconditioner = std::move(preconditioner);
     }
   mg_smoother.initialize(mg_matrices, smoother_data);
 
index 44952edee969c0d52fa05a5c717032ed78d2499b..5d4dc67743a84b79ff3ecabd2ea8decb00b53c5c 100644 (file)
@@ -405,8 +405,10 @@ do_test(const DoFHandler<dim> &dof)
       smoother_data[level].smoothing_range     = 15.;
       smoother_data[level].degree              = 5;
       smoother_data[level].eig_cg_n_iterations = 15;
-      smoother_data[level].matrix_diagonal_inverse =
-        mg_matrices[level].get_matrix_diagonal_inverse();
+      auto preconditioner                      = std::make_shared<
+        DiagonalMatrix<LinearAlgebra::distributed::Vector<number>>>();
+      preconditioner->reinit(mg_matrices[level].get_matrix_diagonal_inverse());
+      smoother_data[level].preconditioner = std::move(preconditioner);
     }
 
   // temporarily disable deallog for the setup of the preconditioner that

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.