blob: edbba8ac5e16d0f7430565f133022fbb7fa6b3cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* Copyright 2019-2020 Axel Huebl, Maxence Thevenet, Revathi Jambunathan
* Weiqun Zhang
*
* This file is part of WarpX.
*
* License: BSD-3-Clause-LBNL
*/
#include <InjectorMomentum.H>
#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 and time, t,
// is stored in shared memory.
return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 4;
}
default:
return 0;
}
}
|