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
|
/* Copyright 2021-2022 The WarpX Community
*
* Authors: Axel Huebl, Remi Lehe
* License: BSD-3-Clause-LBNL
*/
#include "Python/pyWarpX.H"
#include <Particles/MultiParticleContainer.H>
#include <AMReX_GpuContainers.H>
#include <AMReX_REAL.H>
void init_MultiParticleContainer (py::module& m)
{
py::class_<MultiParticleContainer>(m, "MultiParticleContainer")
.def("get_particle_container_from_name",
&MultiParticleContainer::GetParticleContainerFromName,
py::arg("name"),
py::return_value_policy::reference_internal
)
.def("set_plasma_lens_strength",
[](MultiParticleContainer& mpc, int i_lens, amrex::Real strength_E, amrex::Real strength_B) {
mpc.h_repeated_plasma_lens_strengths_E.at(i_lens) = strength_E;
mpc.h_repeated_plasma_lens_strengths_B.at(i_lens) = strength_B;
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
mpc.h_repeated_plasma_lens_strengths_E.begin(), mpc.h_repeated_plasma_lens_strengths_E.end(),
mpc.d_repeated_plasma_lens_strengths_E.begin());
amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice,
mpc.h_repeated_plasma_lens_strengths_B.begin(), mpc.h_repeated_plasma_lens_strengths_B.end(),
mpc.d_repeated_plasma_lens_strengths_B.begin());
amrex::Gpu::synchronize();
},
py::arg("i_lens"), py::arg("strength_E"), py::arg("strength_B"),
R"pbdoc(Set the strength of the `i_lens`-th lens
Parameters
----------
i_lens: int
Index of the lens to be modified
strength_E, strength_B: floats
The electric and magnetic focusing strength of the lens)pbdoc"
)
;
}
|