ImpactX
Toggle main menu visibility
Loading...
Searching...
No Matches
src
elements
Source.H
Go to the documentation of this file.
1
/* Copyright 2022-2026 The Regents of the University of California, through Lawrence
2
* Berkeley National Laboratory (subject to receipt of any required
3
* approvals from the U.S. Dept. of Energy). All rights reserved.
4
*
5
* This file is part of ImpactX.
6
*
7
* Authors: Axel Huebl
8
* License: BSD-3-Clause-LBNL
9
*/
10
#ifndef IMPACTX_SOURCE_H
11
#define IMPACTX_SOURCE_H
12
13
#include "
particles/ImpactXParticleContainer.H
"
14
#include "
mixin/lineartransport.H
"
15
#include "
mixin/named.H
"
16
#include "
mixin/nofinalize.H
"
17
#include "
mixin/thin.H
"
18
19
#include <stdexcept>
20
#include <string>
21
22
namespace
impactx::elements
23
{
24
struct
Source
25
:
public
mixin::Named
,
26
public
mixin::LinearTransport
<Source>,
27
public
mixin::Thin
,
28
public
mixin::NoFinalize
29
{
30
static
constexpr
auto
type
=
"Source"
;
31
using
PType
=
ImpactXParticleContainer::ParticleType
;
32
33
static
constexpr
bool
DEFAULT_active_once
=
true
;
34
42
Source
(
43
std::string
distribution
,
44
std::string openpmd_path,
45
bool
active_once =
DEFAULT_active_once
,
46
std::optional<std::string>
name
=
DEFAULT_name
47
)
48
:
Named
(std::move(
name
)),
49
m_distribution
(
distribution
),
50
m_series_name
(std::move(openpmd_path)),
51
m_active_once
(active_once)
52
{
53
if
(
distribution
!=
"openPMD"
) {
54
throw
std::runtime_error(
"Only 'openPMD' distribution is supported if openpmd_path is provided!"
);
55
}
56
}
57
59
void
reverse
()
60
{
61
throw
std::runtime_error(
"Source: reverse() is not supported."
);
62
}
63
72
void
operator()
(
73
ImpactXParticleContainer
& pc,
74
[[maybe_unused]]
int
step,
75
int
period
76
);
77
83
AMREX_GPU_HOST
AMREX_FORCE_INLINE
84
Map6x6
85
transport_map
([[maybe_unused]]
RefPart
const
&
AMREX_RESTRICT
refpart)
const
86
{
87
// nothing to do
88
return
Map6x6::Identity
();
89
}
90
92
using
Thin::operator();
93
95
using
LinearTransport::operator();
96
97
std::string
m_distribution
;
98
std::string
m_series_name
;
99
bool
m_active_once
=
true
;
100
};
101
102
}
// namespace impactx
103
104
#endif
// IMPACTX_SOURCE_H
AMREX_FORCE_INLINE
#define AMREX_FORCE_INLINE
AMREX_RESTRICT
#define AMREX_RESTRICT
AMREX_GPU_HOST
#define AMREX_GPU_HOST
ImpactXParticleContainer.H
amrex::ParticleContainer_impl< SoAParticle< T_NArrayReal, T_NArrayInt >, T_NArrayReal, T_NArrayInt, Allocator, CellAssignor >::ParticleType
T_ParticleType ParticleType
impactx::ImpactXParticleContainer
Definition
ImpactXParticleContainer.H:136
lineartransport.H
named.H
impactx::distribution
Definition
All.H:28
impactx::elements
Definition
All.H:55
impactx::Map6x6
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > Map6x6
Definition
CovarianceMatrix.H:20
nofinalize.H
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 >::Identity
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
impactx::RefPart
Definition
ReferenceParticle.H:33
impactx::elements::Source::operator()
void operator()(ImpactXParticleContainer &pc, int step, int period)
Definition
Source.cpp:26
impactx::elements::Source::Source
Source(std::string distribution, std::string openpmd_path, bool active_once=DEFAULT_active_once, std::optional< std::string > name=DEFAULT_name)
Definition
Source.H:42
impactx::elements::Source::m_distribution
std::string m_distribution
Definition
Source.H:97
impactx::elements::Source::type
static constexpr auto type
Definition
Source.H:30
impactx::elements::Source::transport_map
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition
Source.H:85
impactx::elements::Source::m_active_once
bool m_active_once
openPMD filename
Definition
Source.H:99
impactx::elements::Source::reverse
void reverse()
Definition
Source.H:59
impactx::elements::Source::m_series_name
std::string m_series_name
Distribution type of particles in the source.
Definition
Source.H:98
impactx::elements::Source::PType
ImpactXParticleContainer::ParticleType PType
Definition
Source.H:31
impactx::elements::Source::DEFAULT_active_once
static constexpr bool DEFAULT_active_once
Definition
Source.H:33
impactx::elements::mixin::LinearTransport
Definition
lineartransport.H:50
impactx::elements::mixin::Named
Definition
named.H:29
impactx::elements::mixin::Named::DEFAULT_name
static constexpr std::nullopt_t DEFAULT_name
Definition
named.H:30
impactx::elements::mixin::Named::Named
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition
named.H:59
impactx::elements::mixin::Named::name
AMREX_FORCE_INLINE std::string name() const
Definition
named.H:124
impactx::elements::mixin::NoFinalize
Definition
nofinalize.H:22
impactx::elements::mixin::Thin
Definition
thin.H:24
thin.H
Generated by
1.17.0