Skip to content

Commit

Permalink
Fix: Names in PC::make_alike
Browse files Browse the repository at this point in the history
The ParticleContainer's `make_alike` function forgot the names
of the SoA components.
  • Loading branch information
ax3l committed Feb 4, 2025
1 parent 779df09 commit c1be6b8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Src/Particle/AMReX_ParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -1374,11 +1374,25 @@ public:
{
ContainerLike<NewAllocator> tmp(m_gdb);

std::vector<std::string> const real_names = this->GetRealSoANames();
std::vector<std::string> real_ct_names;
for (int ic = 0; ic < NArrayReal; ++ic) { real_ct_names.push_back(real_names[ic]); }

std::vector<std::string> const int_names = this->GetIntSoANames();
std::vector<std::string> int_ct_names;
for (int ic = 0; ic < NArrayInt; ++ic) { int_ct_names.push_back(int_names[ic]); }

tmp.SetSoACompileTimeNames(real_ct_names, int_ct_names);

// add runtime real comps to tmp
for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) { tmp.AddRealComp(false); }
for (int ic = 0; ic < this->NumRuntimeRealComps(); ++ic) {
tmp.AddRealComp(real_names.at(ic + NArrayReal), false);
}

// add runtime int comps to tmp
for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) { tmp.AddIntComp(false); }
for (int ic = 0; ic < this->NumRuntimeIntComps(); ++ic) {
tmp.AddIntComp(int_names.at(ic + NArrayInt), false);
}

return tmp;
}
Expand Down

0 comments on commit c1be6b8

Please sign in to comment.