aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Particles/MultiParticleContainer.cpp21
-rw-r--r--Source/Particles/PhotonParticleContainer.cpp2
-rw-r--r--Source/QED/Make.package2
-rw-r--r--Source/QED/breit_wheeler_engine_wrapper.h30
-rw-r--r--Source/QED/qed_wrapper_commons.h13
5 files changed, 36 insertions, 32 deletions
diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp
index 74e59867e..e65c0d600 100644
--- a/Source/Particles/MultiParticleContainer.cpp
+++ b/Source/Particles/MultiParticleContainer.cpp
@@ -8,12 +8,7 @@
using namespace amrex;
-#ifdef WARPX_QED
-MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core):
- bw_engine{std::move(init_warpx_breit_wheeler_engine())}
-#else
MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core)
-#endif
{
@@ -495,7 +490,7 @@ MultiParticleContainer::doContinuousInjection () const
}
/* \brief Get ID of product species of each species.
- * The users specifies the name of the product species,
+ * The users specifies the name of the product species,
* this routine get its ID.
*/
void
@@ -503,8 +498,8 @@ MultiParticleContainer::mapSpeciesProduct ()
{
for (int i=0; i<nspecies; i++){
auto& pc = allcontainers[i];
- // If species pc has ionization on, find species with name
- // pc->ionization_product_name and store its ID into
+ // If species pc has ionization on, find species with name
+ // pc->ionization_product_name and store its ID into
// pc->ionization_product.
if (pc->do_field_ionization){
int i_product = getSpeciesID(pc->ionization_product_name);
@@ -615,7 +610,7 @@ namespace
}
// --- product runtime attribs
GpuArray<Real*,6> runtime_attribs_product;
- bool do_boosted_product = WarpX::do_boosted_frame_diagnostic
+ bool do_boosted_product = WarpX::do_boosted_frame_diagnostic
&& pc_product->DoBoostedFrameDiags();
if (do_boosted_product) {
std::map<std::string, int> comps_product = pc_product->getParticleComps();
@@ -662,7 +657,7 @@ namespace
attribs_product[ia][ip] = attribs_source[ia][is];
}
// Update xold etc. if boosted frame diagnostics required
- // for product species. Fill runtime attribs with a copy of
+ // for product species. Fill runtime attribs with a copy of
// current properties (xold = x etc.).
if (do_boosted_product) {
runtime_attribs_product[0][ip] = p_source.pos(0);
@@ -685,7 +680,7 @@ MultiParticleContainer::doFieldIonization ()
// Loop over all species.
// Ionized particles in pc_source create particles in pc_product
for (auto& pc_source : allcontainers){
-
+
// Skip if not ionizable
if (!pc_source->do_field_ionization){ continue; }
@@ -699,7 +694,7 @@ MultiParticleContainer::doFieldIonization ()
// they do not exist (or if they were defined by default, i.e.,
// without runtime component).
#ifdef _OPENMP
- // Touch all tiles of source species in serial if runtime attribs
+ // Touch all tiles of source species in serial if runtime attribs
for (MFIter mfi = pc_source->MakeMFIter(lev); mfi.isValid(); ++mfi) {
const int grid_id = mfi.index();
const int tile_id = mfi.LocalTileIndex();
@@ -721,7 +716,7 @@ MultiParticleContainer::doFieldIonization ()
MFItInfo info;
if (pc_source->do_tiling && Gpu::notInLaunchRegion()) {
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(
- pc_product->do_tiling,
+ pc_product->do_tiling,
"For ionization, either all or none of the "
"particle species must use tiling.");
info.EnableTiling(pc_source->tile_size);
diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp
index e6712657a..5fecaf525 100644
--- a/Source/Particles/PhotonParticleContainer.cpp
+++ b/Source/Particles/PhotonParticleContainer.cpp
@@ -137,7 +137,7 @@ for (int lev=0; lev < num_levels; ++lev)
amrex::ParallelFor(
pti.numParticles(),
[=] AMREX_GPU_DEVICE (long i) {
- taus[i] = warpx_breit_wheeler_get_optical_depth();
+ taus[i] = warpx_breit_wheeler_engine::get_optical_depth();
}
);
}
diff --git a/Source/QED/Make.package b/Source/QED/Make.package
index 6e38efb9e..73ac89228 100644
--- a/Source/QED/Make.package
+++ b/Source/QED/Make.package
@@ -1,6 +1,8 @@
+CEXE_headers += qed_wrapper_commons.h
CEXE_headers += amrex_rng_wrapper.h
CEXE_headers += breit_wheeler_engine_wrapper.h
CEXE_sources += amrex_rng_wrapper.cpp
+CEXE_sources += breit_wheeler_engine_wrapper.cpp
INCLUDE_LOCATIONS += $(WARPX_HOME)/Source/QED
VPATH_LOCATIONS += $(WARPX_HOME)/Source/QED
diff --git a/Source/QED/breit_wheeler_engine_wrapper.h b/Source/QED/breit_wheeler_engine_wrapper.h
index 0e4164423..e4649f3cb 100644
--- a/Source/QED/breit_wheeler_engine_wrapper.h
+++ b/Source/QED/breit_wheeler_engine_wrapper.h
@@ -5,28 +5,22 @@
//provided by the standard template library
//BW ENGINE
-//#define PXRMP_GPU __host__ __device__
-#define PXRMP_WITH_SI_UNITS
+#include "qed_wrapper_commons.h"
#include "breit_wheeler_engine.hpp"
#include "amrex_rng_wrapper.h"
-using warpx_breit_wheeler_engine =
- picsar::multi_physics::breit_wheeler_engine<amrex::Real, amrex_rng_wrapper>;
-
-//Helper function to initialize the engine
-inline warpx_breit_wheeler_engine init_warpx_breit_wheeler_engine(){
- return warpx_breit_wheeler_engine{std::move(amrex_rng_wrapper{})};
-}
-
-//Interface for the get_optical_depth method of the BW engine
-inline
-AMREX_GPU_HOST_DEVICE
-amrex::Real warpx_breit_wheeler_get_optical_depth(){
- return warpx_breit_wheeler_engine::
- internal_get_optical_depth(amrex::Random());
-}
-
+class warpx_breit_wheeler_engine :
+ public picsar::multi_physics::
+ breit_wheeler_engine<amrex::Real, amrex_rng_wrapper>
+{
+public:
+ warpx_breit_wheeler_engine();
+
+ //Interface for the get_optical_depth method of the BW engine
+ static AMREX_GPU_HOST_DEVICE
+ amrex::Real get_optical_depth();
+};
//___________________________________________
diff --git a/Source/QED/qed_wrapper_commons.h b/Source/QED/qed_wrapper_commons.h
new file mode 100644
index 000000000..4a7eab7fa
--- /dev/null
+++ b/Source/QED/qed_wrapper_commons.h
@@ -0,0 +1,13 @@
+#ifndef WARPX_amrex_qed_wrapper_commons_h_
+#define WARPX_amrex_qed_wrapper_commons_h_
+
+//Common definitions for the QED library wrappers
+
+#include <AMReX_AmrCore.H>
+
+//Sets the decorator for GPU
+#define PXRMP_GPU AMREX_GPU_HOST_DEVICE
+//Sets SI units in the library
+#define PXRMP_WITH_SI_UNITS
+
+#endif