Commit a10dc4ca authored by Timo Koch's avatar Timo Koch Committed by Bernd Flemisch
Browse files

[istlsolvers] Simplify new AMG solver impl by renaming class to AMGBiCGSTABIstlSolver

parent deebda56
......@@ -25,6 +25,8 @@
#ifndef DUMUX_PARALLEL_AMGBACKEND_HH
#define DUMUX_PARALLEL_AMGBACKEND_HH
#warning "This header is deprecated. Use the AMG solver from dumux/linear/istlsolvers.hh"
#include <memory>
#include <dune/common/exceptions.hh>
......@@ -39,14 +41,12 @@
#include <dumux/linear/solver.hh>
#include <dumux/linear/parallelhelpers.hh>
#include <dumux/linear/solvercategory.hh>
#include <dumux/linear/istlsolvers.hh>
namespace Dumux {
namespace Detail {
// OLD AMG Backend. Use the new one from dumux/linear/istlsolvers.hh
template <class LinearSolverTraits>
class OldAMGBiCGSTABBackend : public LinearSolver
class AMGBiCGSTABBackend : public LinearSolver
{
public:
/*!
......@@ -54,8 +54,8 @@ public:
*
* \param paramGroup the parameter group for parameter lookup
*/
[[deprecated("Use new AMGBiCGSTABBackend<LinearSolverTraits, LinearAlgebraTraits> with 2nd template parameter.")]]
OldAMGBiCGSTABBackend(const std::string& paramGroup = "")
[[deprecated("Use new AMGBiCGSTABIstlSolver<LinearSolverTraits, LinearAlgebraTraits> with 2nd template parameter from dumux/linear/istlsolvers.hh.")]]
AMGBiCGSTABBackend(const std::string& paramGroup = "")
: LinearSolver(paramGroup)
, isParallel_(Dune::MPIHelper::getCommunication().size() > 1)
{
......@@ -72,10 +72,10 @@ public:
* \param dofMapper an index mapper for dof entities
* \param paramGroup the parameter group for parameter lookup
*/
[[deprecated("Use new AMGBiCGSTABBackend<LinearSolverTraits, LinearAlgebraTraits> with 2nd template parameter.")]]
OldAMGBiCGSTABBackend(const typename LinearSolverTraits::GridView& gridView,
const typename LinearSolverTraits::DofMapper& dofMapper,
const std::string& paramGroup = "")
[[deprecated("Use new AMGBiCGSTABIstlSolver<LinearSolverTraits, LinearAlgebraTraits> with 2nd template parameter from dumux/linear/istlsolvers.hh.")]]
AMGBiCGSTABBackend(const typename LinearSolverTraits::GridView& gridView,
const typename LinearSolverTraits::DofMapper& dofMapper,
const std::string& paramGroup = "")
: LinearSolver(paramGroup)
#if HAVE_MPI
, isParallel_(Dune::MPIHelper::getCommunication().size() > 1)
......@@ -237,41 +237,6 @@ private:
bool isParallel_ = false;
};
/*!
* \ingroup Linear
* \brief An AMG preconditioned BiCGSTAB solver using dune-istl
*/
template<class LSTraits, class LATraits>
using NewAMGBiCGSTABBackend =
IstlLinearSolver<LSTraits, LATraits,
Dune::BiCGSTABSolver<typename LATraits::SingleTypeVector>,
Detail::IstlAmgPreconditionerFactory
>;
template<int i>
struct AMGImplHelper
{
template<class LSTraits, class LATraits>
using type = NewAMGBiCGSTABBackend<LSTraits, LATraits>;
};
template<>
struct AMGImplHelper<1>
{
template<class T>
using type = OldAMGBiCGSTABBackend<T>;
};
} // end namespace Detail
/*!
* \ingroup Linear
* \brief A linear solver based on the ISTL AMG preconditioner
* and the ISTL BiCGSTAB solver.
*/
template<class ...T>
using AMGBiCGSTABBackend = typename Detail::AMGImplHelper<sizeof...(T)>::template type<T...>;
} // end namespace Dumux
#endif
......@@ -31,11 +31,11 @@
#include <dune/common/parallel/indexset.hh>
#include <dune/common/parallel/mpicommunication.hh>
#include <dune/grid/common/capabilities.hh>
#include <dune/istl/paamg/amg.hh>
#include <dune/istl/paamg/pinfo.hh>
#include <dune/istl/solvers.hh>
#include <dune/istl/owneroverlapcopy.hh>
#include <dune/istl/scalarproducts.hh>
#include <dune/istl/paamg/amg.hh>
#include <dune/istl/paamg/pinfo.hh>
#include <dumux/common/typetraits/matrix.hh>
#include <dumux/common/typetraits/vector.hh>
......@@ -362,6 +362,17 @@ using ILUBiCGSTABIstlSolver =
Detail::IstlDefaultBlockLevelPreconditionerFactory<Dune::SeqILU>
>;
/*!
* \ingroup Linear
* \brief An AMG preconditioned BiCGSTAB solver using dune-istl
*/
template<class LSTraits, class LATraits>
using AMGBiCGSTABIstlSolver =
IstlIterativeLinearSolver<LSTraits, LATraits,
Dune::BiCGSTABSolver<typename LATraits::SingleTypeVector>,
Detail::IstlAmgPreconditionerFactory
>;
} // end namespace Dumux
#endif
......@@ -32,7 +32,7 @@
#include <dumux/common/parameters.hh>
#include <dumux/common/dumuxmessage.hh>
#include <dumux/linear/amgbackend.hh>
#include <dumux/linear/istlsolvers.hh>
#include <dumux/linear/linearsolvertraits.hh>
#include <dumux/linear/algebratraits.hh>
#include <dumux/nonlinear/newtonsolver.hh>
......@@ -112,8 +112,8 @@ int main(int argc, char** argv)
auto assembler = std::make_shared<Assembler>(problem, gridGeometry, gridVariables, timeLoop, xOld);
// the linear solver
using LinearSolver = AMGBiCGSTABBackend<LinearSolverTraits<GridGeometry>,
LinearAlgebraTraitsFromAssembler<Assembler>>;
using LinearSolver = AMGBiCGSTABIstlSolver<LinearSolverTraits<GridGeometry>,
LinearAlgebraTraitsFromAssembler<Assembler>>;
auto linearSolver = std::make_shared<LinearSolver>(leafGridView, gridGeometry->dofMapper());
// the non-linear solver
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment