Add specialization for ParallelOverlappingILU0.

This commit is contained in:
Atgeirr Flø Rasmussen 2020-05-11 16:05:21 +02:00
parent 1e56b8f907
commit ebce35b318

View File

@ -137,8 +137,19 @@ private:
return criterion;
}
/// Helper struct to explicitly overload amgSmootherArgs() version for
/// ParallelOverlappingILU0, since in-class specialization is not allowed.
template <typename X> struct Id { using Type = X; };
template <typename Smoother>
static auto amgSmootherArgs(const boost::property_tree::ptree& prm)
{
return amgSmootherArgs(prm, Id<Smoother>());
}
template <typename Smoother>
static auto amgSmootherArgs(const boost::property_tree::ptree& prm,
Id<Smoother>)
{
using SmootherArgs = typename Dune::Amg::SmootherTraits<Smoother>::Arguments;
SmootherArgs smootherArgs;
@ -150,6 +161,24 @@ private:
return smootherArgs;
}
static auto amgSmootherArgs(const boost::property_tree::ptree& prm,
Id<Opm::ParallelOverlappingILU0<Matrix, Vector, Vector, Comm>>)
{
using Smoother = Opm::ParallelOverlappingILU0<Matrix, Vector, Vector, Comm>;
using SmootherArgs = typename Dune::Amg::SmootherTraits<Smoother>::Arguments;
SmootherArgs smootherArgs;
smootherArgs.iterations = prm.get<int>("iterations", 1);
const int iluwitdh = prm.get<int>("iluwidth", 0);
smootherArgs.setN(iluwitdh);
const MILU_VARIANT milu = convertString2Milu(prm.get<std::string>("milutype", std::string("ilu")));
smootherArgs.setMilu(milu);
// smootherArgs.overlap=SmootherArgs::vertex;
// smootherArgs.overlap=SmootherArgs::none;
// smootherArgs.overlap=SmootherArgs::aggregate;
smootherArgs.relaxationFactor = prm.get<double>("relaxation", 0.9);
return smootherArgs;
}
template <class Smoother>
static PrecPtr makeAmgPreconditioner(const Operator& op, const boost::property_tree::ptree& prm, bool useKamg = false)
{