BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
cavitymodel.h
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2023.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef CAVITYMODEL_H
20#define CAVITYMODEL_H
21
22#include <iomanip>
23#include <iostream>
24#include <string>
25
26#include "published.h"
27
28namespace GMAD
29{
35 class CavityModel: public Published<CavityModel> {
36 public:
37 std::string name;
38 std::string type;
39 std::string material;
40 double irisRadius;
48 double thickness;
49
53
55
59 void clear();
61 void PublishMembers();
63 void print()const;
64
66 template <typename T>
67 void set_value(std::string property, T value);
68 };
69 template <typename T>
70 void CavityModel::set_value(std::string property, T value)
71 {
72#ifdef BDSDEBUG
73 std::cout << "cavitymodel> Setting value " << std::setw(25) << std::left << property << value << std::endl;
74#endif
75 // member method can throw runtime_error, catch and exit gracefully
76 try
77 {set(this,property,value);}
78 catch(const std::runtime_error&)
79 {
80 std::cerr << "Error: cavitymodel> unknown option \"" << property << "\" with value \"" << value << "\"" << std::endl;
81 exit(1);
82 }
83 }
84}
85
86#endif
RF CavityModel class for parser.
Definition: cavitymodel.h:35
double equatorRadius
equator radius
Definition: cavitymodel.h:41
double thickness
thickness
Definition: cavitymodel.h:48
double irisHorizontalAxis
iris horizontal axis
Definition: cavitymodel.h:45
double irisRadius
iris radius
Definition: cavitymodel.h:40
void set_value(std::string property, T value)
set methods by property name and value
Definition: cavitymodel.h:70
double tangentLineAngle
tangent angle
Definition: cavitymodel.h:47
double equatorHorizontalAxis
equator ellipse vertical semi axis;
Definition: cavitymodel.h:43
double irisVerticalAxis
Iris axis.
Definition: cavitymodel.h:46
double equatorVerticalAxis
equator ellipse horizontal semi axis;
Definition: cavitymodel.h:44
double halfCellLength
half cell length
Definition: cavitymodel.h:42
std::string name
name
Definition: cavitymodel.h:37
CavityModel()
constructor
Definition: cavitymodel.cc:23
std::string material
material name
Definition: cavitymodel.h:39
std::string type
geometry type
Definition: cavitymodel.h:38
void print() const
print some properties
Definition: cavitymodel.cc:65
void PublishMembers()
publish members
Definition: cavitymodel.cc:47
void clear()
reset
Definition: cavitymodel.cc:29
int numberOfCells
number of cells per cavity
Definition: cavitymodel.h:54
Class that provides introspection to its members.
Definition: published.h:47
void set(CavityModel *instance, const std::string &name, double value)
Definition: published.h:99
Parser namespace for GMAD language. Combination of Geant4 and MAD.