diff options
author | 2023-04-10 16:46:01 -0700 | |
---|---|---|
committer | 2023-04-10 16:46:01 -0700 | |
commit | 84eeef7971c26dd23b242a027a659ec59db26d42 (patch) | |
tree | ce040906664d24c27aca1632a8eae38a74baa067 /Source/Parallelization/WarpXComm.cpp | |
parent | d15f45f19f8b63c748cf5ce037b2251d7b392a66 (diff) | |
download | WarpX-84eeef7971c26dd23b242a027a659ec59db26d42.tar.gz WarpX-84eeef7971c26dd23b242a027a659ec59db26d42.tar.zst WarpX-84eeef7971c26dd23b242a027a659ec59db26d42.zip |
`SyncRho`: Pass References To Charge MultiFabs (#3814)
* `SyncRho`: Pass References To Charge MultiFabs
* Keep a function SyncRho for the Python interface
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'Source/Parallelization/WarpXComm.cpp')
-rw-r--r-- | Source/Parallelization/WarpXComm.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/Parallelization/WarpXComm.cpp b/Source/Parallelization/WarpXComm.cpp index 8585da632..a2b25cbf4 100644 --- a/Source/Parallelization/WarpXComm.cpp +++ b/Source/Parallelization/WarpXComm.cpp @@ -902,20 +902,27 @@ WarpX::SyncCurrent ( } void -WarpX::SyncRho () +WarpX::SyncRho () { + SyncRho(rho_fp, rho_cp); +} + +void +WarpX::SyncRho ( + const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_fp, + const amrex::Vector<std::unique_ptr<amrex::MultiFab>>& charge_cp) { WARPX_PROFILE("WarpX::SyncRho()"); - if (!rho_fp[0]) return; - const int ncomp = rho_fp[0]->nComp(); + if (!charge_fp[0]) return; + const int ncomp = charge_fp[0]->nComp(); // Restrict fine patch onto the coarse patch, // before summing the guard cells of the fine patch for (int lev = 1; lev <= finest_level; ++lev) { - rho_cp[lev]->setVal(0.0); + charge_cp[lev]->setVal(0.0); const IntVect& refinement_ratio = refRatio(lev-1); - ablastr::coarsen::average::Coarsen(*rho_cp[lev], *rho_fp[lev], refinement_ratio ); + ablastr::coarsen::average::Coarsen(*charge_cp[lev], *charge_fp[lev], refinement_ratio ); } // For each level @@ -923,7 +930,7 @@ WarpX::SyncRho () // - add the coarse patch/buffer of `lev+1` into the fine patch of `lev` // - sum guard cells of the coarse patch of `lev+1` and fine patch of `lev` for (int lev=0; lev <= finest_level; ++lev) { - AddRhoFromFineLevelandSumBoundary(rho_fp, rho_cp, lev, 0, ncomp); + AddRhoFromFineLevelandSumBoundary(charge_fp, charge_cp, lev, 0, ncomp); } } |