aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp3
-rw-r--r--Source/Diagnostics/ParticleIO.cpp1
-rw-r--r--Source/Diagnostics/WarpXOpenPMD.H5
-rw-r--r--Source/Diagnostics/WarpXOpenPMD.cpp2
-rw-r--r--Source/Particles/ParticleBoundaryBuffer.H8
-rw-r--r--Source/Particles/ParticleBoundaryBuffer.cpp8
-rw-r--r--Source/Particles/ParticleBuffer.H33
7 files changed, 13 insertions, 47 deletions
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
index 4e9fe41cb..2a2af1d95 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
@@ -3,7 +3,6 @@
#include "Diagnostics/ParticleDiag/ParticleDiag.H"
#include "Particles/Filter/FilterFunctors.H"
#include "Particles/WarpXParticleContainer.H"
-#include "Particles/ParticleBuffer.H"
#include "Particles/PinnedMemoryParticleContainer.H"
#include "Utils/Interpolate.H"
#include "Utils/WarpXProfilerWrapper.H"
@@ -302,7 +301,7 @@ FlushFormatPlotfile::WriteParticles(const std::string& dir,
for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
WarpXParticleContainer* pc = particle_diags[i].getParticleContainer();
- auto tmp = ParticleBuffer::getTmpPC<amrex::PinnedArenaAllocator>(pc);
+ auto tmp = pc->make_alike<amrex::PinnedArenaAllocator>();
if (isBTD) {
PinnedMemoryParticleContainer* pinned_pc = particle_diags[i].getPinnedParticleContainer();
tmp.SetParticleGeometry(0,pinned_pc->Geom(0));
diff --git a/Source/Diagnostics/ParticleIO.cpp b/Source/Diagnostics/ParticleIO.cpp
index 344df624d..ed705d28c 100644
--- a/Source/Diagnostics/ParticleIO.cpp
+++ b/Source/Diagnostics/ParticleIO.cpp
@@ -9,7 +9,6 @@
#include "Particles/ParticleIO.H"
#include "Particles/MultiParticleContainer.H"
-#include "Particles/ParticleBuffer.H"
#include "Particles/PhysicalParticleContainer.H"
#include "Particles/LaserParticleContainer.H"
#include "Particles/RigidInjectedParticleContainer.H"
diff --git a/Source/Diagnostics/WarpXOpenPMD.H b/Source/Diagnostics/WarpXOpenPMD.H
index 21c52ef10..08b81b075 100644
--- a/Source/Diagnostics/WarpXOpenPMD.H
+++ b/Source/Diagnostics/WarpXOpenPMD.H
@@ -9,7 +9,6 @@
#define WARPX_OPEN_PMD_H_
#include "Particles/WarpXParticleContainer.H"
-#include "Particles/ParticleBuffer.H"
#include "Diagnostics/FlushFormats/FlushFormat.H"
#include "Diagnostics/ParticleDiag/ParticleDiag_fwd.H"
@@ -60,7 +59,7 @@ private:
class WarpXParticleCounter
{
public:
- using ParticleContainer = typename ParticleBuffer::BufferType<amrex::PinnedArenaAllocator>;
+ using ParticleContainer = typename WarpXParticleContainer::ContainerLike<amrex::PinnedArenaAllocator>;
using ParticleIter = typename amrex::ParIter<0, 0, PIdx::nattribs, 0, amrex::PinnedArenaAllocator>;
WarpXParticleCounter (ParticleContainer* pc);
@@ -96,7 +95,7 @@ private:
class WarpXOpenPMDPlot
{
public:
- using ParticleContainer = typename amrex::AmrParticleContainer<0, 0, PIdx::nattribs, 0, amrex::PinnedArenaAllocator>;
+ using ParticleContainer = typename WarpXParticleContainer::ContainerLike<amrex::PinnedArenaAllocator>;
using ParticleIter = typename amrex::ParConstIter<0, 0, PIdx::nattribs, 0, amrex::PinnedArenaAllocator>;
/** Initialize openPMD I/O routines
diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp
index daf5fbefc..ada56da36 100644
--- a/Source/Diagnostics/WarpXOpenPMD.cpp
+++ b/Source/Diagnostics/WarpXOpenPMD.cpp
@@ -495,7 +495,7 @@ WarpXOpenPMDPlot::WriteOpenPMDParticles (const amrex::Vector<ParticleDiag>& part
for (unsigned i = 0, n = particle_diags.size(); i < n; ++i) {
WarpXParticleContainer* pc = particle_diags[i].getParticleContainer();
- auto tmp = ParticleBuffer::getTmpPC<amrex::PinnedArenaAllocator>(pc);
+ auto tmp = pc->make_alike<amrex::PinnedArenaAllocator>();
// names of amrex::Real and int particle attributes in SoA data
amrex::Vector<std::string> real_names;
amrex::Vector<std::string> int_names;
diff --git a/Source/Particles/ParticleBoundaryBuffer.H b/Source/Particles/ParticleBoundaryBuffer.H
index d2ac9f035..171b74701 100644
--- a/Source/Particles/ParticleBoundaryBuffer.H
+++ b/Source/Particles/ParticleBoundaryBuffer.H
@@ -7,8 +7,8 @@
#ifndef PARTICLEBOUNDARYBUFFER_H_
#define PARTICLEBOUNDARYBUFFER_H_
-#include "Particles/ParticleBuffer.H"
#include "Particles/MultiParticleContainer_fwd.H"
+#include "Particles/WarpXParticleContainer.H"
#include <vector>
@@ -18,6 +18,8 @@
class ParticleBoundaryBuffer
{
public:
+ using BufferType = typename WarpXParticleContainer::ContainerLike<amrex::PinnedArenaAllocator>;
+
ParticleBoundaryBuffer ();
int numSpecies() const { return getSpeciesNames().size(); }
@@ -43,7 +45,7 @@ public:
int getNumParticlesInContainer(const std::string species_name, int boundary);
- ParticleBuffer::BufferType<amrex::PinnedArenaAllocator>& getParticleBuffer(const std::string species_name, int boundary);
+ BufferType& getParticleBuffer(const std::string species_name, int boundary);
static constexpr int numBoundaries () {
return AMREX_SPACEDIM*2
@@ -55,7 +57,7 @@ public:
private:
// over boundary, then number of species
- std::vector<std::vector<ParticleBuffer::BufferType<amrex::PinnedArenaAllocator> > > m_particle_containers;
+ std::vector<std::vector<BufferType> > m_particle_containers;
// over boundary, then number of species
std::vector<std::vector<int> > m_do_boundary_buffer;
diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp
index 48d0a270a..431357aa2 100644
--- a/Source/Particles/ParticleBoundaryBuffer.cpp
+++ b/Source/Particles/ParticleBoundaryBuffer.cpp
@@ -5,7 +5,7 @@
* License: BSD-3-Clause-LBNL
*/
-
+#include "WarpX.H"
#include "EmbeddedBoundary/DistanceToEB.H"
#include "Particles/ParticleBoundaryBuffer.H"
#include "Particles/MultiParticleContainer.H"
@@ -164,7 +164,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc,
const auto& pc = mypc.GetParticleContainer(i);
if (!buffer[i].isDefined())
{
- buffer[i] = ParticleBuffer::getTmpPC<amrex::PinnedArenaAllocator>(&pc);
+ buffer[i] = pc.make_alike<amrex::PinnedArenaAllocator>();
buffer[i].AddIntComp(false); // for timestamp
}
auto& species_buffer = buffer[i];
@@ -205,7 +205,7 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc,
const auto& pc = mypc.GetParticleContainer(i);
if (!buffer[i].isDefined())
{
- buffer[i] = ParticleBuffer::getTmpPC<amrex::PinnedArenaAllocator>(&pc);
+ buffer[i] = pc.make_alike<amrex::PinnedArenaAllocator>();
buffer[i].AddIntComp(false); // for timestamp
}
auto& species_buffer = buffer[i];
@@ -263,7 +263,7 @@ int ParticleBoundaryBuffer::getNumParticlesInContainer(
else return 0;
}
-ParticleBuffer::BufferType<amrex::PinnedArenaAllocator>&
+WarpXParticleContainer::ContainerLike<amrex::PinnedArenaAllocator> &
ParticleBoundaryBuffer::getParticleBuffer(const std::string species_name, int boundary) {
auto& buffer = m_particle_containers[boundary];
diff --git a/Source/Particles/ParticleBuffer.H b/Source/Particles/ParticleBuffer.H
deleted file mode 100644
index 50bcf1129..000000000
--- a/Source/Particles/ParticleBuffer.H
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2021 Andrew Myers
- *
- * This file is part of WarpX.
- *
- * License: BSD-3-Clause-LBNL
- */
-#ifndef PARTICLEBUFFER_H_
-#define PARTICLEBUFFER_H_
-
-#include "Particles/MultiParticleContainer.H"
-#include "WarpX.H"
-
-#include <AMReX_AmrParticles.H>
-
-namespace ParticleBuffer {
- template <template<class> class Allocator>
- using BufferType = amrex::AmrParticleContainer<0, 0, PIdx::nattribs, 0, Allocator>;
-
- template <template<class> class Allocator>
- BufferType<Allocator> getTmpPC (const WarpXParticleContainer* pc)
- {
- BufferType<Allocator> tmp(&WarpX::GetInstance());
- // add runtime real comps to tmp
- for (int ic = 0; ic < pc->NumRuntimeRealComps(); ++ic) { tmp.AddRealComp(false); }
-
- // add runtime int comps to tmp
- for (int ic = 0; ic < pc->NumRuntimeIntComps(); ++ic) { tmp.AddIntComp(false); }
-
- return tmp;
- }
-}
-
-#endif /*PARTICLEBUFFER_H_*/