Use overloading instead of template specialization.

This seems to be necessary for older compilers.
This commit is contained in:
Atgeirr Flø Rasmussen committed 2019-06-06 10:36:17 +02:00
1 parent 72ae444566
commit d5c3c93c7d
3 files changed
+9 -12

No files matched your search

+2 -4
View File
@@ -100,10 +100,8 @@ private:
= Dune::PreconditionerFactory<ParOperatorType, Comm>::create(*linop, prm.get_child("preconditioner"), comm);
scalarproduct_ = Dune::createScalarProduct<VectorType, Comm>(comm, linearoperator_->category());
}
template <>
void initOpPrecSp<Dune::Amg::SequentialInformation>(const MatrixType& matrix,
const boost::property_tree::ptree& prm,
const Dune::Amg::SequentialInformation&)
void initOpPrecSp(const MatrixType& matrix, const boost::property_tree::ptree& prm, const Dune::Amg::SequentialInformation&)
{
// Sequential case.
using SeqOperatorType = Dune::MatrixAdapter<MatrixType, VectorType, VectorType>;
@@ -134,7 +134,7 @@ public:
{
Opm::Amg::getQuasiImpesWeights<MatrixType, VectorType>(
linear_operator_.getmat(), prm_.get<int>("pressure_var_index"), transpose, weights_);
updateImpl<Communication>();
updateImpl(comm_);
}
virtual Dune::SolverCategory::Category category() const override
@@ -160,15 +160,14 @@ private:
// Handling parallel vs serial instantiation of preconditioner factory.
template <class Comm>
void updateImpl()
void updateImpl(const Comm*)
{
// Parallel case.
finesmoother_ = PrecFactory::create(linear_operator_, prm_.get_child("finesmoother"), *comm_);
twolevel_method_.updatePreconditioner(finesmoother_, coarseSolverPolicy_);
}
template <>
void updateImpl<Dune::Amg::SequentialInformation>()
void updateImpl(const Dune::Amg::SequentialInformation*)
{
// Serial case.
finesmoother_ = PrecFactory::create(linear_operator_, prm_.get_child("finesmoother"));
@@ -146,7 +146,7 @@ private:
// This is the default template, used for parallel preconditioners.
// (Serial specialization below).
template <class CommArg>
void addStandardPreconditioners()
void addStandardPreconditioners(const CommArg*)
{
using namespace Dune;
using O = Operator;
@@ -212,8 +212,7 @@ private:
// Add a useful default set of preconditioners to the factory.
// This is the specialization for the serial case.
template <>
void addStandardPreconditioners<Dune::Amg::SequentialInformation>()
void addStandardPreconditioners(const Dune::Amg::SequentialInformation*)
{
using namespace Dune;
using O = Operator;
@@ -303,7 +302,8 @@ private:
// Private constructor, to keep users from creating a PreconditionerFactory.
PreconditionerFactory()
{
addStandardPreconditioners<Comm>();
Comm* dummy = nullptr;
addStandardPreconditioners(dummy);
}
// Actually creates the product object.