aboutsummaryrefslogtreecommitdiff
path: root/Source/Parallelization
diff options
context:
space:
mode:
authorGravatar Michael E Rowan <38045958+mrowan137@users.noreply.github.com> 2020-05-05 17:40:24 -0700
committerGravatar GitHub <noreply@github.com> 2020-05-05 17:40:24 -0700
commitf1fcac8a018c46fe0ae587469b2bf92862110f7a (patch)
tree425d8d92dbca75ebe5413b0499d601cef36f33dc /Source/Parallelization
parentbc76960209c232fd2e47f19099470156320f16c7 (diff)
downloadWarpX-f1fcac8a018c46fe0ae587469b2bf92862110f7a.tar.gz
WarpX-f1fcac8a018c46fe0ae587469b2bf92862110f7a.tar.zst
WarpX-f1fcac8a018c46fe0ae587469b2bf92862110f7a.zip
Switch costs to LayoutData (#970)
Cleanup Cleanup
Diffstat (limited to 'Source/Parallelization')
-rw-r--r--Source/Parallelization/WarpXRegrid.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/Source/Parallelization/WarpXRegrid.cpp b/Source/Parallelization/WarpXRegrid.cpp
index f04c59c78..6c6710121 100644
--- a/Source/Parallelization/WarpXRegrid.cpp
+++ b/Source/Parallelization/WarpXRegrid.cpp
@@ -35,12 +35,6 @@ WarpX::LoadBalance ()
const int nLevels = finestLevel();
for (int lev = 0; lev <= nLevels; ++lev)
{
- LayoutData<Real> costsLayoutData(boxArray(lev), DistributionMap(lev));
- for (auto i : costsLayoutData.IndexArray())
- {
- costsLayoutData[i] = (*costs[lev])[i];
- }
-
// Compute the new distribution mapping
DistributionMapping newdm;
const amrex::Real nboxes = costs[lev]->size();
@@ -52,11 +46,11 @@ WarpX::LoadBalance ()
amrex::Real proposedEfficiency = 0.0;
newdm = (load_balance_with_sfc)
- ? DistributionMapping::makeSFC(costsLayoutData,
+ ? DistributionMapping::makeSFC(*costs[lev],
currentEfficiency, proposedEfficiency,
false,
ParallelDescriptor::IOProcessorNumber())
- : DistributionMapping::makeKnapSack(costsLayoutData,
+ : DistributionMapping::makeKnapSack(*costs[lev],
currentEfficiency, proposedEfficiency,
nmax,
false,
@@ -283,9 +277,11 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
if (costs[lev] != nullptr)
{
- costs[lev].reset(new amrex::Vector<Real>);
- const int nboxes = Efield_fp[lev][0].get()->size();
- costs[lev]->resize(nboxes, 0.0);
+ costs[lev].reset(new amrex::LayoutData<Real>(ba, dm));
+ for (int i : costs[lev]->IndexArray())
+ {
+ (*costs[lev])[i] = 0.0;
+ }
}
SetDistributionMap(lev, dm);
@@ -299,7 +295,7 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
}
void
-WarpX::ComputeCostsHeuristic (amrex::Vector<std::unique_ptr<amrex::Vector<amrex::Real> > >& a_costs)
+WarpX::ComputeCostsHeuristic (amrex::Vector<std::unique_ptr<amrex::LayoutData<amrex::Real> > >& a_costs)
{
for (int lev = 0; lev <= finest_level; ++lev)
{
@@ -333,6 +329,9 @@ WarpX::ResetCosts ()
{
for (int lev = 0; lev <= finest_level; ++lev)
{
- costs[lev]->assign((*costs[lev]).size(), 0.0);
+ for (int i : costs[lev]->IndexArray())
+ {
+ (*costs[lev])[i] = 0.0;
+ }
}
}