-
Notifications
You must be signed in to change notification settings - Fork 427
Reserve space in particle redistribution #4731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from 1 commit
c72ac9f
9b04c45
60c3f0c
1e3cbbd
3c0d61a
b060dfe
64500aa
db6a368
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -735,7 +735,7 @@ struct ParticleTile | |
| ParticleType::is_soa_particle, | ||
| ThisParticleTileHasNoAoS, | ||
| ArrayOfStructs<ParticleType, Allocator>>; | ||
| //using ParticleVector = typename AoS::ParticleVector; | ||
| using ParticleVector = typename AoS::ParticleVector; | ||
|
|
||
| using SoA = std::conditional_t< | ||
| ParticleType::is_soa_particle, | ||
|
|
@@ -1351,6 +1351,58 @@ struct ParticleTile | |
| return ptd; | ||
| } | ||
|
|
||
| void collectVectors (Vector<ParticleVector*>& pv, Vector<RealVector*>& rv, | ||
| Vector<IntVector*>& iv, Vector<typename SoA::IdCPU*>& idcpuv) | ||
| { | ||
| if constexpr (!ParticleType::is_soa_particle) { | ||
| m_aos_tile.collectVectors(pv); | ||
| } else { | ||
| amrex::ignore_unused(pv); | ||
| } | ||
| m_soa_tile.collectVectors(rv, iv, idcpuv); | ||
| } | ||
|
|
||
| static void reserve (std::map<ParticleTile<T_ParticleType,NArrayReal,NArrayInt,Allocator>*, int> const& addsizes) | ||
| { | ||
| Vector<std::pair<ParticleVector*,int>> pvs; | ||
| Vector<std::pair<RealVector*,int>> rvs; | ||
| Vector<std::pair<IntVector*,int>> ivs; | ||
| Vector<std::pair<typename SoA::IdCPU*,int>> idcpuvs; | ||
| for (auto [p,s] : addsizes) { | ||
| Vector<ParticleVector*> pv; | ||
| Vector<RealVector*> rv; | ||
| Vector<IntVector*> iv; | ||
| Vector<typename SoA::IdCPU*> idcpuv; | ||
| p->collectVectors(pv, rv, iv, idcpuv); | ||
| for (auto* v : pv) { | ||
| pvs.emplace_back(v, s); | ||
| } | ||
| for (auto* v : rv) { | ||
| rvs.emplace_back(v, s); | ||
| } | ||
| for (auto* v : iv) { | ||
| ivs.emplace_back(v, s); | ||
| } | ||
| for (auto* v : idcpuv) { | ||
| idcpuvs.emplace_back(v, s); | ||
| } | ||
| } | ||
|
|
||
| // xxxxx TODO: Can we come up a better strategy? | ||
|
||
| for (auto [p,s] : pvs) { | ||
| p->reserve(p->size() + s); | ||
| } | ||
| for (auto [p,s] : rvs) { | ||
| p->reserve(p->size() + s); | ||
| } | ||
| for (auto [p,s] : ivs) { | ||
| p->reserve(p->size() + s); | ||
| } | ||
| for (auto [p,s] : idcpuvs) { | ||
| p->reserve(p->size() + s); | ||
| } | ||
| } | ||
|
|
||
| private: | ||
|
|
||
| AoS m_aos_tile; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.