aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/InjectorMomentum.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-08-19 15:34:52 -0700
committerGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-08-19 15:34:52 -0700
commit863ff56254f5cc93e7030fa0c35481db42aabe2c (patch)
treec45e3cf99053c15a8a3e784bfd45a11fffc63852 /Source/Initialization/InjectorMomentum.cpp
parent9409e1b12c78442323c7181417c811b262d4a694 (diff)
parentc023286720c7ae8aa2913efc461240a81e8b2bd9 (diff)
downloadWarpX-863ff56254f5cc93e7030fa0c35481db42aabe2c.tar.gz
WarpX-863ff56254f5cc93e7030fa0c35481db42aabe2c.tar.zst
WarpX-863ff56254f5cc93e7030fa0c35481db42aabe2c.zip
Merge branch 'dev' into select_fields_in_tests
Diffstat (limited to 'Source/Initialization/InjectorMomentum.cpp')
-rw-r--r--Source/Initialization/InjectorMomentum.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/Initialization/InjectorMomentum.cpp b/Source/Initialization/InjectorMomentum.cpp
new file mode 100644
index 000000000..a197b5bef
--- /dev/null
+++ b/Source/Initialization/InjectorMomentum.cpp
@@ -0,0 +1,40 @@
+#include <PlasmaInjector.H>
+
+using namespace amrex;
+
+InjectorMomentum::~InjectorMomentum ()
+{
+ switch (type)
+ {
+ case Type::parser:
+ {
+ object.parser.m_ux_parser.clear();
+ object.parser.m_uy_parser.clear();
+ object.parser.m_uz_parser.clear();
+ break;
+ }
+ case Type::custom:
+ {
+ object.custom.clear();
+ break;
+ }
+ }
+}
+
+// Compute the amount of memory needed in GPU Shared Memory.
+std::size_t
+InjectorMomentum::sharedMemoryNeeded () const noexcept
+{
+ switch (type)
+ {
+ case Type::parser:
+ {
+ // For parser injector, the 3D position of each particle
+ // is stored in shared memory.
+ return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 3;
+ }
+ default:
+ return 0;
+ }
+}
+