OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
VariableRFCavityFringeField.h
Go to the documentation of this file.
1//
2// Class VariableRFCavityFringeField
3// Defines the abstract interface for a soft-edged RF Cavity
4// with Time Dependent Parameters.
5//
6// Copyright (c) 2014 - 2023, Chris Rogers, STFC Rutherford Appleton Laboratory, Didcot, UK
7// All rights reserved
8//
9// This file is part of OPAL.
10//
11// OPAL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation, either version 3 of the License, or
14// (at your option) any later version.
15//
16// You should have received a copy of the GNU General Public License
17// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
18//
19#ifndef CLASSIC_ABSBEAMLINE_VariableRFCavityFringeField_HH
20#define CLASSIC_ABSBEAMLINE_VariableRFCavityFringeField_HH
21
23#include "Fields/Definitions.h"
24
25#include <iostream>
26
27namespace endfieldmodel {
28 class EndFieldModel;
29}
30
51
52public:
54 explicit VariableRFCavityFringeField(const std::string& name);
66
72 virtual void accept(BeamlineVisitor&) const override;
73
79 inline void initialise() const;
80
82 virtual ElementBase* clone() const override;
83
93 virtual bool apply(const size_t& i, const double& t,
94 Vector_t& E, Vector_t& B) override;
95
106 virtual bool apply(const Vector_t& R, const Vector_t& P,
107 const double& t, Vector_t& E, Vector_t& B) override;
108
119 virtual bool applyToReferenceParticle(const Vector_t& R, const Vector_t& P,
120 const double& t, Vector_t& E, Vector_t& B) override;
121
127 virtual void setEndField
128 (std::shared_ptr<endfieldmodel::EndFieldModel> endField);
129
135 virtual inline std::shared_ptr<endfieldmodel::EndFieldModel>
136 getEndField() const;
137
142 virtual void initialise(PartBunchBase<double, 3>* bunch,
143 double& startField, double& endField) override;
144
146 virtual inline void setCavityCentre(double zCentre);
148 virtual inline double getCavityCentre() const;
150 virtual inline void setMaxOrder(size_t maxOrder);
152 virtual inline size_t getMaxOrder() const;
156 void printCoefficients(std::ostream& out) const;
158 inline std::vector<std::vector<double> > getEzCoefficients() const;
160 inline std::vector<std::vector<double> > getEyCoefficients() const;
162 inline std::vector<std::vector<double> > getBxCoefficients() const;
163
164protected:
165 double zCentre_m; // offsets this element
167 std::shared_ptr<endfieldmodel::EndFieldModel> endField_m;
168 std::vector<std::vector<double> > f_m;
169 std::vector<std::vector<double> > g_m;
170 std::vector<std::vector<double> > h_m;
171
172private:
173 void initNull();
174};
175
177 zCentre_m = zCentre;
178}
179
183
185 maxOrder_m = maxOrder;
187}
188
192
194 return maxOrder_m;
195}
196
197std::shared_ptr<endfieldmodel::EndFieldModel> VariableRFCavityFringeField::getEndField() const {
198 return endField_m;
199}
200
201std::vector<std::vector<double> > VariableRFCavityFringeField::getEzCoefficients() const {
202 return f_m;
203}
204
205std::vector<std::vector<double> > VariableRFCavityFringeField::getEyCoefficients() const {
206 return g_m;
207}
208
209std::vector<std::vector<double> > VariableRFCavityFringeField::getBxCoefficients() const {
210 return h_m;
211}
212
213#endif // #ifdef CLASSIC_VirtualRFCavityFringeField_HH
const std::string name
ElementBase(const std::string &name)
Constructor with given name.
VariableRFCavity(const std::string &name)
Constructor with given name.
std::shared_ptr< endfieldmodel::EndFieldModel > endField_m
std::vector< std::vector< double > > getBxCoefficients() const
std::vector< std::vector< double > > f_m
VariableRFCavityFringeField & operator=(const VariableRFCavityFringeField &)
virtual bool apply(const size_t &i, const double &t, Vector_t &E, Vector_t &B) override
std::vector< std::vector< double > > getEzCoefficients() const
VariableRFCavityFringeField(const std::string &name)
Constructor with given name.
virtual void setMaxOrder(size_t maxOrder)
std::vector< std::vector< double > > getEyCoefficients() const
virtual std::shared_ptr< endfieldmodel::EndFieldModel > getEndField() const
std::vector< std::vector< double > > h_m
std::vector< std::vector< double > > g_m
void printCoefficients(std::ostream &out) const
virtual void accept(BeamlineVisitor &) const override
virtual ElementBase * clone() const override
virtual void setCavityCentre(double zCentre)
virtual bool applyToReferenceParticle(const Vector_t &R, const Vector_t &P, const double &t, Vector_t &E, Vector_t &B) override
virtual void setEndField(std::shared_ptr< endfieldmodel::EndFieldModel > endField)
Vektor< double, 3 > Vector_t