Skip to content

Commit

Permalink
solve_cg: use linop.make instead of MF constructor (AMReX-Codes#3627)
Browse files Browse the repository at this point in the history
## Summary

This PR replaces the explicit use of `MF` constructors in
`MLCGSolverT<MF>::solve_cg` with calls to the make method of the linear
operator associated with the `MLCGSolverT` object.

## Additional background

This is a similar to the PR on `solve_bicgstab`.
  • Loading branch information
eebasso authored Nov 14, 2023
1 parent fa3743f commit b7408ea
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,13 @@ MLCGSolverT<MF>::solve_cg (MF& sol, const MF& rhs, RT eps_rel, RT eps_abs)

const int ncomp = sol.nComp();

const BoxArray& ba = sol.boxArray();
const DistributionMapping& dm = sol.DistributionMap();
const auto& factory = sol.Factory();

MF p(ba, dm, ncomp, sol.nGrowVect(), MFInfo(), factory);
MF p = Lp.make(amrlev, mglev, sol.nGrowVect());
p.setVal(RT(0.0));

MF sorig(ba, dm, ncomp, nghost, MFInfo(), factory);
MF r (ba, dm, ncomp, nghost, MFInfo(), factory);
MF z (ba, dm, ncomp, nghost, MFInfo(), factory);
MF q (ba, dm, ncomp, nghost, MFInfo(), factory);
MF sorig = Lp.make(amrlev, mglev, nghost);
MF r = Lp.make(amrlev, mglev, nghost);
MF z = Lp.make(amrlev, mglev, nghost);
MF q = Lp.make(amrlev, mglev, nghost);

sorig.LocalCopy(sol,0,0,ncomp,nghost);

Expand Down

0 comments on commit b7408ea

Please sign in to comment.