40 std::string(
"The \"VARIABLE_RF_CAVITY_FRINGE_FIELD\" element defines an RF cavity ")+
41 std::string(
"with time dependent frequency, phase and amplitude.");
44 OpalElement(
SIZE,
"VARIABLE_RF_CAVITY_FRINGE_FIELD", doc_string.c_str()) {
46 "The name of the phase time dependence model, which should give the phase in [rad].");
48 "The name of the amplitude time dependence model, which should give the field in [MV/m]");
50 "The name of the frequency time dependence model, which should give the field in [MHz].");
52 "Full width of the cavity [m].");
54 "Full height of the cavity [m].");
56 "Length of the cavity field flat top [m].");
58 "Length of the cavity fringe fields [m].");
60 "Offset of the cavity centre from the beginning of the cavity [m].");
62 "Maximum power of y that will be evaluated in field calculations.");
81 const std::string &
name,
93 const std::string &
name) {
106 if (cavity == NULL) {
107 throw OpalException(
"OpalVariableRFCavityFringeField::fillRegisteredAttributes",
108 "Failed to cast ElementBase to a VariableRFCavityFringeField");
110 std::shared_ptr<endfieldmodel::EndFieldModel> model = cavity->
getEndField();
113 throw OpalException(
"OpalVariableRFCavityFringeField::fillRegisteredAttributes",
114 "Failed to cast EndField to a Tanh model");
119 std::shared_ptr<AbstractTimeDependence> phase_model = cavity->
getPhaseModel();
120 std::shared_ptr<AbstractTimeDependence> freq_model = cavity->
getFrequencyModel();
167 std::shared_ptr<endfieldmodel::EndFieldModel> end(tanh);
178 throw OpalException(
"OpalVariableRFCavityFringeField::convertToUnsigned",
180 " should be an unsigned int but a real value was found");
182 if (
floor(value) < -0.5) {
183 throw OpalException(
"OpalVariableRFCavityFringeField::convertToUnsigned",
184 "Value for "+name+
" should be 0 or more");
186 size_t ret(
floor(value));
virtual void setFrequencyName(std::string frequency)
virtual std::shared_ptr< endfieldmodel::EndFieldModel > getEndField() const
virtual std::shared_ptr< AbstractTimeDependence > getFrequencyModel() const
static AttCell * registerStringAttribute(const std::string &name)
Register a ``string'' element attribute.
OpalVariableRFCavityFringeField * clone()
virtual void setCavityCentre(double zCentre)
Interface for basic beam line object.
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
Fill in all registered attributes.
virtual void setMaxOrder(size_t maxOrder)
ValueFlag
Switch for value desired on ATTLIST command.
virtual std::shared_ptr< AbstractTimeDependence > getAmplitudeModel() const
PETE_TUTree< FnFabs, typename T::PETE_Expr_t > fabs(const PETE_Expr< T > &l)
The base class for all OPAL exceptions.
virtual ElementBase * removeWrappers()
Return the design element.
virtual void setLength(double length)
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
static std::map< std::string, OwnPtr< AttCell > > attributeRegistry
The registry for named attributes.
const std::string & getOpalName() const
Return object name.
virtual void setWidth(double fullWidth)
static size_t convertToUnsigned(double value, std::string name)
virtual double getHeight() const
OpalVariableRFCavityFringeField()
virtual void fillRegisteredAttributes(const ElementBase &, ValueFlag)
virtual void setAmplitudeName(std::string amplitude)
Base class for all beam line elements.
virtual double getLength() const
virtual double getCavityCentre() const
void setElement(ElementBase *)
Assign new CLASSIC element.
virtual void setEndField(std::shared_ptr< endfieldmodel::EndFieldModel > endField)
virtual std::shared_ptr< AbstractTimeDependence > getPhaseModel() const
void registerOwnership() const
virtual void update()
Update the embedded CLASSIC element.
static std::string getName(std::shared_ptr< AbstractTimeDependence > time_dep)
virtual void setPhaseName(std::string phase)
ElementBase * getElement() const
Return the embedded CLASSIC element.
virtual size_t getMaxOrder() const
virtual double getWidth() const
virtual ElementBase * makeAlignWrapper()
Allow misalignment.
virtual ~OpalVariableRFCavityFringeField()
static const std::string doc_string
virtual void setHeight(double fullHeight)
double getReal(const Attribute &attr)
Return real value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Tps< T > tanh(const Tps< T > &x)
Hyperbolic tangent.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
static AttCell * registerRealAttribute(const std::string &name)
Register a ``real'' element attribute.
PETE_TUTree< FnFloor, typename T::PETE_Expr_t > floor(const PETE_Expr< T > &l)
std::string getString(const Attribute &attr)
Get string value.
static constexpr double unsignedTolerance