From b7408ea6e8feca7eab2f7cf30606d066b6699814 Mon Sep 17 00:00:00 2001 From: Edward Basso Date: Mon, 13 Nov 2023 18:56:02 -0800 Subject: [PATCH] solve_cg: use linop.make instead of MF constructor (#3627) ## Summary This PR replaces the explicit use of `MF` constructors in `MLCGSolverT::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`. --- Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H b/Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H index fce7b1d5005..c99d7b319bd 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLCGSolver.H @@ -261,17 +261,13 @@ MLCGSolverT::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);