aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Python/WarpXWrappers.H4
-rw-r--r--Source/Python/WarpXWrappers.cpp24
2 files changed, 28 insertions, 0 deletions
diff --git a/Source/Python/WarpXWrappers.H b/Source/Python/WarpXWrappers.H
index 71eb5b4fd..dd7a648fc 100644
--- a/Source/Python/WarpXWrappers.H
+++ b/Source/Python/WarpXWrappers.H
@@ -114,6 +114,10 @@ extern "C" {
const char* species_name, int boundary, int lev,
int* num_tiles, int** particles_per_tile, const char* comp_name);
+ amrex::ParticleReal** warpx_getParticleBoundaryBufferStructs(
+ const char* species_name, int boundary, int lev,
+ int* num_tiles, int** particles_per_tile);
+
void warpx_clearParticleBoundaryBuffer ();
void warpx_ComputeDt ();
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index 9ee99e8ab..66db34497 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -607,6 +607,30 @@ extern "C"
return data;
}
+ amrex::ParticleReal** warpx_getParticleBoundaryBufferStructs(const char* species_name, int boundary, int lev,
+ int* num_tiles, int** particles_per_tile)
+ {
+ const std::string name(species_name);
+ auto& particle_buffers = WarpX::GetInstance().GetParticleBoundaryBuffer();
+ auto& particle_buffer = particle_buffers.getParticleBuffer(species_name, boundary);
+
+ int i = 0;
+ for (amrex::ParIter<0,0,PIdx::nattribs, 0, amrex::PinnedArenaAllocator> pti(particle_buffer, lev); pti.isValid(); ++pti, ++i) {}
+
+ // *num_tiles = myspc.numLocalTilesAtLevel(lev);
+ *num_tiles = i;
+ *particles_per_tile = (int*) malloc(*num_tiles*sizeof(int));
+
+ amrex::ParticleReal** data = (amrex::ParticleReal**) malloc(*num_tiles*sizeof(typename WarpXParticleContainer::ParticleType*));
+ i = 0;
+ for (amrex::ParIter<0,0,PIdx::nattribs, 0, amrex::PinnedArenaAllocator> pti(particle_buffer, lev); pti.isValid(); ++pti, ++i) {
+ auto& aos = pti.GetArrayOfStructs();
+ data[i] = (amrex::ParticleReal*) aos.data();
+ (*particles_per_tile)[i] = pti.numParticles();
+ }
+ return data;
+ }
+
void warpx_clearParticleBoundaryBuffer () {
auto& particle_buffers = WarpX::GetInstance().GetParticleBoundaryBuffer();
particle_buffers.clearParticles();