mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add property tree to constructor
This commit is contained in:
parent
6d22b4f72a
commit
9d47aa605e
@ -31,11 +31,11 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
|
|
||||||
namespace Dune {
|
namespace Hypre {
|
||||||
|
|
||||||
/// Wrapper for Hypre's BoomerAMG preconditioner
|
/// Wrapper for Hypre's BoomerAMG preconditioner
|
||||||
template<class M, class X, class Y>
|
template<class M, class X, class Y>
|
||||||
class HyprePreconditioner : public PreconditionerWithUpdate<X,Y> {
|
class HyprePreconditioner : public Dune::PreconditionerWithUpdate<X,Y> {
|
||||||
public:
|
public:
|
||||||
//! \brief The matrix type the preconditioner is for
|
//! \brief The matrix type the preconditioner is for
|
||||||
using matrix_type = M;
|
using matrix_type = M;
|
||||||
@ -47,8 +47,8 @@ public:
|
|||||||
using field_type = typename X::field_type;
|
using field_type = typename X::field_type;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
HyprePreconditioner (const M& A)
|
HyprePreconditioner (const M& A, const Opm::PropertyTree& prm)
|
||||||
: A_(A)
|
: A_(A), prm_(prm)
|
||||||
{
|
{
|
||||||
OPM_TIMEBLOCK(prec_construct);
|
OPM_TIMEBLOCK(prec_construct);
|
||||||
|
|
||||||
@ -129,8 +129,8 @@ public:
|
|||||||
DUNE_UNUSED_PARAMETER(x);
|
DUNE_UNUSED_PARAMETER(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
SolverCategory::Category category() const override {
|
Dune::SolverCategory::Category category() const override {
|
||||||
return SolverCategory::sequential;
|
return Dune::SolverCategory::sequential;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasPerfectUpdate() const override
|
bool hasPerfectUpdate() const override
|
||||||
@ -194,6 +194,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const M& A_;
|
const M& A_;
|
||||||
|
const Opm::PropertyTree& prm_;
|
||||||
|
|
||||||
HYPRE_Solver solver_ = nullptr;
|
HYPRE_Solver solver_ = nullptr;
|
||||||
HYPRE_IJMatrix A_hypre_ = nullptr;
|
HYPRE_IJMatrix A_hypre_ = nullptr;
|
||||||
HYPRE_ParCSRMatrix parcsr_A_ = nullptr;
|
HYPRE_ParCSRMatrix parcsr_A_ = nullptr;
|
||||||
|
@ -549,9 +549,8 @@ struct StandardPreconditioners<Operator, Dune::Amg::SequentialInformation> {
|
|||||||
});
|
});
|
||||||
// Only add Hypre for scalar matrices
|
// Only add Hypre for scalar matrices
|
||||||
if constexpr (M::block_type::rows == 1 && M::block_type::cols == 1) {
|
if constexpr (M::block_type::rows == 1 && M::block_type::cols == 1) {
|
||||||
F::addCreator("HypreBoomerAMG", [](const O& op, const P& prm, const std::function<V()>&, std::size_t) {
|
F::addCreator("hypre", [](const O& op, const P& prm, const std::function<V()>&, std::size_t) {
|
||||||
DUNE_UNUSED_PARAMETER(prm);
|
return std::make_shared<Hypre::HyprePreconditioner<M, V, V>>(op.getmat(), prm);
|
||||||
return std::make_shared<HyprePreconditioner<M, V, V>>(op.getmat());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user