ImpactX
Loading...
Searching...
No Matches
Source.H
Go to the documentation of this file.
1/* Copyright 2022-2025 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
15#include "mixin/named.H"
16#include "mixin/nofinalize.H"
17#include "mixin/thin.H"
18
19#include <stdexcept>
20#include <string>
21
22
23namespace impactx::elements
24{
25 struct Source
26 : public mixin::Named,
27 public mixin::LinearTransport<Source>,
28 public mixin::Thin,
30 {
31 static constexpr auto type = "Source";
33
41 std::string distribution,
42 std::string openpmd_path,
43 std::optional<std::string> name = std::nullopt
44 )
45 : Named(std::move(name)),
47 m_series_name(std::move(openpmd_path))
48 {
49 if (distribution != "openPMD") {
50 throw std::runtime_error("Only 'openPMD' distribution is supported if openpmd_path is provided!");
51 }
52 }
53
62 void operator() (
64 [[maybe_unused]] int step,
65 [[maybe_unused]] int period
66 );
67
74 Map6x6
75 transport_map ([[maybe_unused]] RefPart const & AMREX_RESTRICT refpart) const
76 {
77 // nothing to do
78 return Map6x6::Identity();
79 }
80
82 using Thin::operator();
83
85 using LinearTransport::operator();
86
87 std::string m_distribution;
88 std::string m_series_name;
89 };
90
91} // namespace impactx
92
93#endif // IMPACTX_SOURCE_H
#define AMREX_FORCE_INLINE
#define AMREX_RESTRICT
#define AMREX_GPU_HOST
Definition ImpactXParticleContainer.H:133
Definition All.H:27
Definition All.H:54
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > Map6x6
Definition CovarianceMatrix.H:20
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
Definition ReferenceParticle.H:31
Source(std::string distribution, std::string openpmd_path, std::optional< std::string > name=std::nullopt)
Definition Source.H:40
void operator()(ImpactXParticleContainer &pc, int step, int period)
Definition Source.cpp:26
std::string m_distribution
Definition Source.H:87
static constexpr auto type
Definition Source.H:31
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition Source.H:75
std::string m_series_name
Distribution type of particles in the source.
Definition Source.H:88
ImpactXParticleContainer::ParticleType PType
Definition Source.H:32
Definition lineartransport.H:29
Definition named.H:29
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:57
AMREX_FORCE_INLINE std::string name() const
Definition named.H:122
Definition nofinalize.H:22
Definition thin.H:24