aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/InjectorMomentum.cpp
diff options
context:
space:
mode:
authorGravatar Weiqun Zhang <weiqunzhang@lbl.gov> 2019-07-24 19:43:18 -0700
committerGravatar Weiqun Zhang <weiqunzhang@lbl.gov> 2019-07-24 19:46:35 -0700
commitd59fa46d24417b67554132bc666e45886160bd09 (patch)
treea4148c8779e5840d35b7a88fe9e4bbad3e70d7f9 /Source/Initialization/InjectorMomentum.cpp
parentdd40a0f5c5a234c27d2ca0b54d2936d6eec9a89c (diff)
downloadWarpX-d59fa46d24417b67554132bc666e45886160bd09.tar.gz
WarpX-d59fa46d24417b67554132bc666e45886160bd09.tar.zst
WarpX-d59fa46d24417b67554132bc666e45886160bd09.zip
Reimplement AddPlasma. Commits related to AddPlasma in hackathon
branch are squashed into one.
Diffstat (limited to 'Source/Initialization/InjectorMomentum.cpp')
-rw-r--r--Source/Initialization/InjectorMomentum.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/Source/Initialization/InjectorMomentum.cpp b/Source/Initialization/InjectorMomentum.cpp
new file mode 100644
index 000000000..4e483fc33
--- /dev/null
+++ b/Source/Initialization/InjectorMomentum.cpp
@@ -0,0 +1,50 @@
+#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;
+ }
+ }
+}
+
+std::size_t
+InjectorMomentum::sharedMemoryNeeded () const noexcept
+{
+ switch (type)
+ {
+ case Type::parser:
+ {
+ return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double);
+ }
+ default:
+ return 0;
+ }
+}
+
+bool
+InjectorMomentum::useRandom () const noexcept
+{
+ switch (type)
+ {
+ case Type::gaussian:
+ {
+ return true;
+ }
+ default:
+ return false;
+ }
+}