aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/InjectorMomentum.cpp
blob: 255883a34d8edb511e065da73ef2819939959062 (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
#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;
    }
}