change pointers to const references

This commit is contained in:
Tobias Meyer Andersen 2024-04-12 15:39:35 +02:00
parent 24ec3c25ff
commit 2a7251efc5
2 changed files with 8 additions and 8 deletions

View File

@ -177,8 +177,8 @@ struct StandardPreconditioners {
const int n = prm.get<int>("ilulevel", 0);
const double w = prm.get<double>("relaxation", 1.0);
const bool resort = prm.get<bool>("resort", false);
return wrapBlockPreconditioner<RebuildOnUpdatePreconditioner<Dune::SeqILU<M, V, V>, const M*>>(
comm, &op.getmat(), n, w, resort);
return wrapBlockPreconditioner<RebuildOnUpdatePreconditioner<Dune::SeqILU<M, V, V>, const M&>>(
comm, op.getmat(), n, w, resort);
});
F::addCreator("DILU", [](const O& op, const P& prm, const std::function<V()>&, std::size_t, const C& comm) {
DUNE_UNUSED_PARAMETER(prm);
@ -425,7 +425,7 @@ struct StandardPreconditioners<Operator, Dune::Amg::SequentialInformation> {
const double w = prm.get<double>("relaxation", 1.0);
const int n = prm.get<int>("ilulevel", 0);
const bool resort = prm.get<bool>("resort", false);
return getRebuildOnUpdateWrapper<Dune::SeqILU<M, V, V>, const M*>(&op.getmat(), n, w, resort);
return getRebuildOnUpdateWrapper<Dune::SeqILU<M, V, V>, const M&>(op.getmat(), n, w, resort);
});
F::addCreator("ParOverILU0", [](const O& op, const P& prm, const std::function<V()>&, std::size_t) {
const double w = prm.get<double>("relaxation", 1.0);

View File

@ -89,8 +89,8 @@ class RebuildOnUpdatePreconditioner : public PreconditionerWithUpdate<typename O
typename OriginalPreconditioner::range_type>
{
public:
RebuildOnUpdatePreconditioner(MatrixPtr mat_ptr, const int n, const double w, const bool resort)
: orig_precond_(std::make_unique<OriginalPreconditioner>(*mat_ptr, n, w, resort))
RebuildOnUpdatePreconditioner(const MatrixPtr &mat_ptr, const int n, const double w, const bool resort)
: orig_precond_(std::make_unique<OriginalPreconditioner>(mat_ptr, n, w, resort))
, mat_ptr_(mat_ptr)
, n_(n)
, w_(w)
@ -124,12 +124,12 @@ public:
// Rebuild the preconditioner on update
void update() override
{
orig_precond_ = std::make_unique<OriginalPreconditioner>(*mat_ptr_, n_, w_, resort_);
orig_precond_ = std::make_unique<OriginalPreconditioner>(mat_ptr_, n_, w_, resort_);
}
private:
std::unique_ptr<OriginalPreconditioner> orig_precond_;
const MatrixPtr mat_ptr_;
const MatrixPtr &mat_ptr_;
const int n_;
const double w_;
const bool resort_;
@ -137,7 +137,7 @@ private:
template <class OriginalPreconditioner, class MatrixPtr>
std::shared_ptr<RebuildOnUpdatePreconditioner<OriginalPreconditioner, MatrixPtr>>
getRebuildOnUpdateWrapper(MatrixPtr mat_ptr, const int n, const double w, const bool resort)
getRebuildOnUpdateWrapper(const MatrixPtr &mat_ptr, const int n, const double w, const bool resort)
{
return std::make_shared<RebuildOnUpdatePreconditioner<OriginalPreconditioner, MatrixPtr>>(mat_ptr, n, w, resort);
}