Skip to content

Commit

Permalink
CP/Restart & Int Id Constants
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jun 6, 2023
1 parent ff8776e commit 5a82912
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
5 changes: 2 additions & 3 deletions Source/Diagnostics/FlushFormats/FlushFormatCheckpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,8 @@ FlushFormatCheckpoint::CheckpointParticles (
auto runtime_inames = pc->getParticleRuntimeiComps();
for (auto const& x : runtime_inames) { int_names[x.second+0] = x.first; }

// TODO
//pc->Checkpoint(dir, part_diag.getSpeciesName(), true,
// real_names, int_names);
pc->Checkpoint(dir, part_diag.getSpeciesName(), true,
real_names, int_names);
}
}

Expand Down
9 changes: 4 additions & 5 deletions Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,10 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir,
}
// real_names contains a list of all particle attributes.
// real_flags & int_flags are 1 or 0, whether quantity is dumped or not.
// TODO
//tmp.WritePlotFile(
// dir, part_diag.getSpeciesName(),
// real_flags, int_flags,
// real_names, int_names);
tmp.WritePlotFile(
dir, part_diag.getSpeciesName(),
real_flags, int_flags,
real_names, int_names);
}
}

Expand Down
4 changes: 2 additions & 2 deletions Source/Diagnostics/ParticleIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ MultiParticleContainer::Restart (const std::string& dir)
}
}

//pc->Restart(dir, species_names.at(i)); // TODO
pc->Restart(dir, species_names.at(i));
}
for (unsigned i = species_names.size(); i < species_names.size()+lasers_names.size(); ++i) {
//allcontainers.at(i)->Restart(dir, lasers_names.at(i-species_names.size())); // TODO
allcontainers.at(i)->Restart(dir, lasers_names.at(i-species_names.size()));
}
}

Expand Down
12 changes: 6 additions & 6 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
int max_new_particles = Scan::ExclusiveSum(counts.size(), counts.data(), offset.data());

// Update NextID to include particles created in this function
Long pid;
int pid;
#ifdef AMREX_USE_OMP
#pragma omp critical (add_plasma_nextid)
#endif
Expand All @@ -1068,7 +1068,7 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
ParticleType::NextID(pid+max_new_particles);
}
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
static_cast<Long>(pid + max_new_particles) < LastParticleID,
static_cast<int>(pid + max_new_particles) < IntParticleIds::LastParticleID,
"ERROR: overflow on particle id numbers");

const int cpuid = ParallelDescriptor::MyProc();
Expand Down Expand Up @@ -1615,7 +1615,7 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt)
int max_new_particles = Scan::ExclusiveSum(counts.size(), counts.data(), offset.data());

// Update NextID to include particles created in this function
Long pid;
int pid;
#ifdef AMREX_USE_OMP
#pragma omp critical (add_plasma_nextid)
#endif
Expand All @@ -1624,7 +1624,7 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt)
ParticleType::NextID(pid+max_new_particles);
}
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
static_cast<Long>(pid + max_new_particles) < LastParticleID,
static_cast<int>(pid + max_new_particles) < IntParticleIds::LastParticleID,
"overflow on particle id numbers");

const int cpuid = ParallelDescriptor::MyProc();
Expand Down Expand Up @@ -2307,7 +2307,7 @@ PhysicalParticleContainer::SplitParticles (int lev)
ParticleReal xp, yp, zp;
GetPosition(i, xp, yp, zp);
auto& p = particles[i];
if (p.id() == DoSplitParticleID){
if (p.id() == IntParticleIds::DoSplitParticleID){
// If particle is tagged, split it and put the
// split particles in local arrays psplit_x etc.
np_split_to_add += np_split;
Expand Down Expand Up @@ -2433,7 +2433,7 @@ PhysicalParticleContainer::SplitParticles (int lev)
1,
psplit_w.dataPtr(),
0, nullptr,
1, NoSplitParticleID);
1, IntParticleIds::NoSplitParticleID);
// Copy particles from tmp to current particle container
addParticles(pctmp_split,1);
// Clear tmp container
Expand Down
4 changes: 2 additions & 2 deletions Source/Particles/WarpXParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1350,11 +1350,11 @@ WarpXParticleContainer::particlePostLocate(ParticleType& p, // TODO
// Tag particle if goes to higher level.
// It will be split later in the loop
if (pld.m_lev == lev+1
and p.id() != NoSplitParticleID
and p.id() != amrex::IntParticleIds::NoSplitParticleID
and p.id() >= 0)
{
// warning: overflow in conversion from 'long int' to 'int' changes value from '549755813884' to '-4' [-Woverflow]
p.id() = DoSplitParticleID; // TODO
p.id() = amrex::IntParticleIds::DoSplitParticleID; // TODO
}

if (pld.m_lev == lev-1){
Expand Down

0 comments on commit 5a82912

Please sign in to comment.