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