Commit 4510549a authored by Timo Koch's avatar Timo Koch
Browse files

[linear] Free AMGTraits from TypeTag

parent dfb6bd54
......@@ -224,7 +224,9 @@ namespace Dumux {
* \note This is an adaptor using a TypeTag
*/
template<class TypeTag>
using AMGBackend = ParallelAMGBackend<typename GET_PROP_TYPE(TypeTag, GridView), AmgTraits<TypeTag>>;
using AMGBackend = ParallelAMGBackend<typename GET_PROP_TYPE(TypeTag, GridView), AmgTraits<typename GET_PROP_TYPE(TypeTag, JacobianMatrix),
typename GET_PROP_TYPE(TypeTag, SolutionVector),
typename GET_PROP_TYPE(TypeTag, FVGridGeometry)>>;
} // namespace Dumux
......
......@@ -32,17 +32,16 @@
#include <dune/istl/preconditioners.hh>
#include <dune/grid/common/capabilities.hh>
#include <dumux/common/properties.hh>
#include <dumux/discretization/methods.hh>
namespace Dumux {
//! The implementation is specialized for the different discretizations
template<class TypeTag, DiscretizationMethod discMethod> struct AmgTraitsImpl;
template<class MType, class VType, class FVGridGeometry, DiscretizationMethod discMethod> struct AmgTraitsImpl;
//! The type traits required for using the AMG backend
template<class TypeTag>
using AmgTraits = AmgTraitsImpl<TypeTag, GET_PROP_TYPE(TypeTag, FVGridGeometry)::discMethod>;
template<class MType, class VType, class FVGridGeometry>
using AmgTraits = AmgTraitsImpl<MType, VType, FVGridGeometry, FVGridGeometry::discMethod>;
//! NonoverlappingSolverTraits used by discretization with non-overlapping parallel model
template <class MType, class VType, bool isParallel>
......@@ -68,27 +67,24 @@ public:
#endif
//! Box: use the non-overlapping AMG
template<class TypeTag>
struct AmgTraitsImpl<TypeTag, DiscretizationMethod::box>
template<class Matrix, class Vector, class FVGridGeometry>
struct AmgTraitsImpl<Matrix, Vector, FVGridGeometry, DiscretizationMethod::box>
{
using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix);
using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
using Grid = typename FVGridGeometry::GridView::Traits::Grid;
enum {
numEq = JacobianMatrix::block_type::rows,
dofCodim = Grid::dimension,
isNonOverlapping = true,
isParallel = Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
};
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using MType = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,numEq,numEq> >;
using VType = Dune::BlockVector<Dune::FieldVector<Scalar,numEq> >;
using MType = Matrix;
using VType = Dune::BlockVector<Dune::FieldVector<typename Vector::block_type::value_type, Vector::block_type::dimension>>;
using SolverTraits = NonoverlappingSolverTraits<MType, VType, isParallel>;
using Comm = typename SolverTraits::Comm;
using LinearOperator = typename SolverTraits::LinearOperator;
using ScalarProduct = typename SolverTraits::ScalarProduct;
using Smoother = typename SolverTraits::Smoother;
using DofMapper = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::VertexMapper;
using DofMapper = typename FVGridGeometry::VertexMapper;
};
//! OverlappingSolverTraits used by discretization with overlapping parallel model
......@@ -115,33 +111,29 @@ public:
#endif
//! Cell-centered tpfa: use the overlapping AMG
template<class TypeTag>
struct AmgTraitsImpl<TypeTag, DiscretizationMethod::cctpfa>
template<class Matrix, class Vector, class FVGridGeometry>
struct AmgTraitsImpl<Matrix, Vector, FVGridGeometry, DiscretizationMethod::cctpfa>
{
using JacobianMatrix = typename GET_PROP_TYPE(TypeTag, JacobianMatrix);
using Grid = typename GET_PROP_TYPE(TypeTag, Grid);
using Grid = typename FVGridGeometry::GridView::Traits::Grid;
enum {
numEq = JacobianMatrix::block_type::rows,
dofCodim = 0,
isNonOverlapping = false,
isParallel = Dune::Capabilities::canCommunicate<Grid, dofCodim>::v
};
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using MType = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar,numEq,numEq> >;
using VType = Dune::BlockVector<Dune::FieldVector<Scalar,numEq> >;
using MType = Matrix;
using VType = Dune::BlockVector<Dune::FieldVector<typename Vector::block_type::value_type, Vector::block_type::dimension>>;
using SolverTraits = OverlappingSolverTraits<MType, VType, isParallel>;
using Comm = typename SolverTraits::Comm;
using LinearOperator = typename SolverTraits::LinearOperator;
using ScalarProduct = typename SolverTraits::ScalarProduct;
using Smoother = typename SolverTraits::Smoother;
using DofMapper = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::ElementMapper;
using DofMapper = typename FVGridGeometry::ElementMapper;
};
template<class TypeTag>
struct AmgTraitsImpl<TypeTag, DiscretizationMethod::ccmpfa>
: public AmgTraitsImpl<TypeTag, DiscretizationMethod::cctpfa> {};
template<class Matrix, class Vector, class FVGridGeometry>
struct AmgTraitsImpl<Matrix, Vector, FVGridGeometry, DiscretizationMethod::ccmpfa>
: public AmgTraitsImpl<Matrix, Vector, FVGridGeometry, DiscretizationMethod::cctpfa> {};
} // end namespace Dumux
......
......@@ -133,12 +133,20 @@ SET_PROP(SequentialModel, FVGridGeometry)
: public DefaultMapperTraits<typename GET_PROP_TYPE(TypeTag, GridView)>
{
static constexpr DiscretizationMethod discMethod = DiscretizationMethod::cctpfa;
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
};
public:
using type = FVGridGeometry;
};
//! For compatibility with new style models we need a solution vector type
SET_PROP(SequentialModel, SolutionVector)
{
public:
using type = typename GET_PROP(TypeTag, SolutionTypes)::ScalarSolution;
};
/*!
* \brief Specifies the types which are assoicated with a solution.
*
......
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