ImpactX
Loading...
Searching...
No Matches
ISRBendElement.H
Go to the documentation of this file.
1/* Copyright 2022-2023 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: Alex Bojanich, Chad Mitchell, Axel Huebl
8 * License: BSD-3-Clause-LBNL
9 */
10#ifndef IMPACTX_PARTICLES_WAKEFIELDS_ISRBENDELEMENT_H
11#define IMPACTX_PARTICLES_WAKEFIELDS_ISRBENDELEMENT_H
12
13#include "elements/ExactSbend.H"
14#include "elements/Sbend.H"
15#include "elements/CFbend.H"
17
18#include <AMReX_REAL.H>
19
20#include <cmath>
21#include <tuple>
22#include <variant>
23
24
26{
33 template <typename VariantType>
34 std::tuple<bool, amrex::Real>
36 VariantType const& element_variant,
37 RefPart const & refpart
38 )
39 {
40 amrex::Real R = 0;
41 bool element_has_isr = false;
42
43 if (std::holds_alternative<elements::Sbend>(element_variant))
44 {
45 auto& element = std::get<elements::Sbend>(element_variant);
46 R = std::abs(element.m_rc);
47 element_has_isr = true;
48 }
49 else if (std::holds_alternative<elements::CFbend>(element_variant))
50 {
51 auto& element = std::get<elements::CFbend>(element_variant);
52 R = std::abs(element.m_rc);
53 element_has_isr = true;
54 }
55 else if (std::holds_alternative<elements::ExactSbend>(element_variant))
56 {
57 auto& element = std::get<elements::ExactSbend>(element_variant);
58 R = std::abs(element.rc(refpart));
59 element_has_isr = true;
60 }
61
62 return {element_has_isr, R};
63 }
64
65} // namespace impactx::particles::wakefields
66
67#endif // IMPACTX_PARTICLES_WAKEFIELDS_ISRBENDELEMENT_H
Definition ChargeBinning.cpp:17
std::tuple< bool, amrex::Real > ISRBendElement(VariantType const &element_variant, RefPart const &refpart)
Definition ISRBendElement.H:35
Definition ReferenceParticle.H:31