--- /dev/null
+Removed: The deprecated class MGCoarseGridLACIteration has been removed.
+<br>
+(Daniel Arndt, 2020/06/12)
};
-/**
- * Coarse grid solver using LAC iterative methods. This is a little wrapper,
- * transforming a triplet of iterative solver, matrix and preconditioner into
- * a coarse grid solver.
- *
- * The type of the matrix (i.e. the template parameter @p MatrixType) should
- * be derived from @p Subscriptor to allow for the use of a smart pointer to
- * it.
- *
- * @deprecated Use MGCoarseGridIterativeSolver instead.
- */
-template <typename SolverType, class VectorType = Vector<double>>
-class DEAL_II_DEPRECATED MGCoarseGridLACIteration
- : public MGCoarseGridBase<VectorType>
-{
-public:
- /**
- * Default constructor.
- */
- MGCoarseGridLACIteration();
-
- /**
- * Constructor. Store solver, matrix and preconditioning method for later
- * use.
- */
- template <typename MatrixType, typename PreconditionerType>
- MGCoarseGridLACIteration(SolverType &,
- const MatrixType &,
- const PreconditionerType &);
-
- /**
- * Destructor freeing the pointers.
- */
- ~MGCoarseGridLACIteration();
-
- /**
- * Initialize new data.
- */
- template <typename MatrixType, typename PreconditionerType>
- void
- initialize(SolverType &, const MatrixType &, const PreconditionerType &);
-
- /**
- * Clear all pointers.
- */
- void
- clear();
-
- /**
- * Implementation of the abstract function. Calls the solver method with
- * matrix, vectors and preconditioner.
- */
- void
- operator()(const unsigned int level,
- VectorType & dst,
- const VectorType & src) const;
-
- /**
- * Set the matrix. This gives the possibility to replace the matrix that
- * was given to the constructor by a new matrix.
- */
- template <typename MatrixType>
- void
- set_matrix(const MatrixType &);
-
-private:
- /**
- * Reference to the solver.
- */
- SmartPointer<SolverType, MGCoarseGridLACIteration<SolverType, VectorType>>
- solver;
-
- /**
- * LinearOperator wrapping a reference to the matrix.
- */
- LinearOperator<VectorType> matrix;
-
- /**
- * LinearOperator wrapping a reference to the preconditioner.
- */
- LinearOperator<VectorType> precondition;
-};
-
-
/**
* Coarse grid multigrid operator for an iterative solver.
coarse_smooth->smooth(level, dst, src);
}
-/* ------------------ Functions for MGCoarseGridLACIteration ------------ */
-
-
-template <typename SolverType, class VectorType>
-MGCoarseGridLACIteration<SolverType, VectorType>::MGCoarseGridLACIteration()
- : solver(0, typeid(*this).name())
- , matrix(0)
- , precondition(0)
-{}
-
-
-template <typename SolverType, class VectorType>
-template <typename MatrixType, typename PreconditionerType>
-MGCoarseGridLACIteration<SolverType, VectorType>::MGCoarseGridLACIteration(
- SolverType & s,
- const MatrixType & m,
- const PreconditionerType &p)
- : solver(&s, typeid(*this).name())
-{
- // Workaround: Unfortunately, not every "m" object has a rich enough
- // interface to populate reinit_(domain|range)_vector. Thus, supply an
- // empty LinearOperator exemplar.
- matrix = linear_operator<VectorType>(LinearOperator<VectorType>(), m);
- precondition = linear_operator<VectorType>(matrix, p);
-}
-
-
-template <typename SolverType, class VectorType>
-MGCoarseGridLACIteration<SolverType, VectorType>::~MGCoarseGridLACIteration()
-{
- clear();
-}
-
-
-template <typename SolverType, class VectorType>
-template <typename MatrixType, typename PreconditionerType>
-void
-MGCoarseGridLACIteration<SolverType, VectorType>::initialize(
- SolverType & s,
- const MatrixType & m,
- const PreconditionerType &p)
-{
- solver = &s;
- // Workaround: Unfortunately, not every "m" object has a rich enough
- // interface to populate reinit_(domain|range)_vector. Thus, supply an
- // empty LinearOperator exemplar.
- matrix = linear_operator<VectorType>(LinearOperator<VectorType>(), m);
- precondition = linear_operator<VectorType>(matrix, p);
-}
-
-
-template <typename SolverType, class VectorType>
-void
-MGCoarseGridLACIteration<SolverType, VectorType>::clear()
-{
- solver = nullptr;
- matrix = LinearOperator<VectorType>();
- precondition = LinearOperator<VectorType>();
-}
-
-
-template <typename SolverType, class VectorType>
-void
-MGCoarseGridLACIteration<SolverType, VectorType>::
-operator()(const unsigned int /* level */,
- VectorType & dst,
- const VectorType &src) const
-{
- Assert(solver != nullptr, ExcNotInitialized());
- solver->solve(matrix, dst, src, precondition);
-}
-
-
-template <typename SolverType, class VectorType>
-template <typename MatrixType>
-void
-MGCoarseGridLACIteration<SolverType, VectorType>::set_matrix(
- const MatrixType &m)
-{
- // Workaround: Unfortunately, not every "m" object has a rich enough
- // interface to populate reinit_(domain|range)_vector. Thus, supply an
- // empty LinearOperator exemplar.
- matrix = linear_operator<VectorType>(LinearOperator<VectorType>(), m);
-}
-
-
-
/* ------------------ Functions for MGCoarseGridIterativeSolver ------------ */
template <class VectorType,
SolverControl coarse_solver_control(1000, 1e-10, false, false);
SolverGMRES<vector_t> coarse_solver(coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverGMRES<vector_t>, vector_t>
+ MGCoarseGridIterativeSolver<vector_t,
+ SolverGMRES<vector_t>,
+ matrix_t,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, coarse_matrix, id);
typedef TrilinosWrappers::PreconditionJacobi Smoother;
SolverControl coarse_solver_control(1000, 1e-10, false, false);
SolverGMRES<vector_t> coarse_solver(coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverGMRES<vector_t>, vector_t>
+ MGCoarseGridIterativeSolver<vector_t,
+ SolverGMRES<vector_t>,
+ matrix_t,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, coarse_matrix, id);
typedef TrilinosWrappers::PreconditionJacobi Smoother;
coarse_solver_control);
PreconditionIdentity identity;
TrilinosWrappers::SparseMatrix &coarse_matrix = mg_matrix[0];
- MGCoarseGridLACIteration<SolverCG<TrilinosWrappers::MPI::Vector>,
- TrilinosWrappers::MPI::Vector>
+ MGCoarseGridIterativeSolver<TrilinosWrappers::MPI::Vector,
+ SolverCG<TrilinosWrappers::MPI::Vector>,
+ TrilinosWrappers::SparseMatrix,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, coarse_matrix, identity);
typedef RelaxationBlockJacobi<TrilinosWrappers::SparseMatrix,
coarse_solver_control);
PreconditionIdentity identity;
TrilinosWrappers::SparseMatrix &coarse_matrix = mg_matrix[0];
- MGCoarseGridLACIteration<SolverCG<TrilinosWrappers::MPI::Vector>,
- TrilinosWrappers::MPI::Vector>
+ MGCoarseGridIterativeSolver<TrilinosWrappers::MPI::Vector,
+ SolverCG<TrilinosWrappers::MPI::Vector>,
+ TrilinosWrappers::SparseMatrix,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, coarse_matrix, identity);
typedef TrilinosWrappers::PreconditionJacobi Smoother;
SolverCG<LinearAlgebra::distributed::Vector<double>> coarse_solver(
coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<LinearAlgebra::distributed::Vector<double>>,
- LinearAlgebra::distributed::Vector<double>>
+ MGCoarseGridIterativeSolver<
+ LinearAlgebra::distributed::Vector<double>,
+ SolverCG<LinearAlgebra::distributed::Vector<double>>,
+ SparseMatrix<double>,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, mg_matrices[min_level], id);
deallog << " Size of coarse grid matrix: " << mg_matrices[min_level].m()
<< std::endl;
SolverCG<LinearAlgebra::distributed::Vector<double>> coarse_solver(
coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<LinearAlgebra::distributed::Vector<double>>,
- LinearAlgebra::distributed::Vector<double>>
+ MGCoarseGridIterativeSolver<
+ LinearAlgebra::distributed::Vector<double>,
+ SolverCG<LinearAlgebra::distributed::Vector<double>>,
+ SparseMatrix<double>,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, mg_matrices[min_level], id);
deallog << " Size of coarse grid matrix: " << mg_matrices[min_level].m()
<< std::endl;
SolverCG<LinearAlgebra::distributed::Vector<double>> coarse_solver(
coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<LinearAlgebra::distributed::Vector<double>>,
- LinearAlgebra::distributed::Vector<double>>
+ MGCoarseGridIterativeSolver<
+ LinearAlgebra::distributed::Vector<double>,
+ SolverCG<LinearAlgebra::distributed::Vector<double>>,
+ SparseMatrix<double>,
+ PreconditionIdentity>
coarse_grid_solver(coarse_solver, mg_matrices[min_level], id);
deallog << " Size of coarse grid matrix: " << mg_matrices[min_level].m()
<< std::endl;
SolverControl coarse_solver_control(1000, 1e-10, false, false);
SolverCG<vector_t> coarse_solver(coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<vector_t>, vector_t> coarse_grid_solver(
- coarse_solver, coarse_matrix, id);
+ MGCoarseGridIterativeSolver<vector_t,
+ SolverCG<vector_t>,
+ matrix_t,
+ PreconditionIdentity>
+ coarse_grid_solver(coarse_solver, coarse_matrix, id);
typedef LA::MPI::PreconditionJacobi Smoother;
MGSmootherPrecondition<matrix_t, Smoother, vector_t> mg_smoother;
// Same as step-16-50, but use Jacobi smoother at the coarsest grid via
// MGCoarseGridApplySmoother. In this particular case, the number of iterations
-// until convergence is exactly the same as for MGCoarseGridLACIteration.
+// until convergence is exactly the same as for MGCoarseGridIterativeSolver.
#include <deal.II/base/conditional_ostream.h>
#include <deal.II/base/function.h>
SolverControl coarse_solver_control(1000, 1e-10, false, false);
SolverCG<vector_t> coarse_solver(coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<vector_t>, vector_t> coarse_grid_solver(
- coarse_solver, coarse_matrix, id);
+ MGCoarseGridIterativeSolver<vector_t,
+ SolverCG<vector_t>,
+ matrix_t,
+ PreconditionIdentity>
+ coarse_grid_solver(coarse_solver, coarse_matrix, id);
typedef LA::MPI::PreconditionJacobi Smoother;
MGSmootherPrecondition<matrix_t, Smoother, vector_t> mg_smoother;
SolverControl coarse_solver_control(1000, 1e-10, false, false);
SolverCG<vector_t> coarse_solver(coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<vector_t>, vector_t> coarse_grid_solver(
- coarse_solver, coarse_matrix, id);
+ MGCoarseGridIterativeSolver<vector_t,
+ SolverCG<vector_t>,
+ matrix_t,
+ PreconditionIdentity>
+ coarse_grid_solver(coarse_solver, coarse_matrix, id);
typedef PreconditionJacobi<matrix_t> Smoother;
MGSmootherPrecondition<matrix_t, Smoother, vector_t> mg_smoother;
SolverControl coarse_solver_control(1000, 1e-10, false, false);
SolverCG<vector_t> coarse_solver(coarse_solver_control);
PreconditionIdentity id;
- MGCoarseGridLACIteration<SolverCG<vector_t>, vector_t> coarse_grid_solver(
- coarse_solver, coarse_matrix, id);
+ MGCoarseGridIterativeSolver<vector_t,
+ SolverCG<vector_t>,
+ matrix_t,
+ PreconditionIdentity>
+ coarse_grid_solver(coarse_solver, coarse_matrix, id);
typedef LA::MPI::PreconditionJacobi Smoother;
MGSmootherPrecondition<matrix_t, Smoother, vector_t> mg_smoother;