BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
__w
bdsim
bdsim
parser
parserROOT.cc
1
/*
2
Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3
University of London 2001 - 2024.
4
5
This file is part of BDSIM.
6
7
BDSIM is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published
9
by the Free Software Foundation version 3 of the License.
10
11
BDSIM is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
#include "parserROOT.h"
20
21
#include "parser.h"
22
23
#include <cstdio>
24
#include <list>
25
27
int
GMAD::GmadParser_c
(
char
*name)
28
{
29
Parser::Instance(std::string(name));
30
return
0;
31
}
32
33
int
GMAD::GetNElements
()
34
{
35
return
Parser::Instance()->GetBeamline().size();
36
}
37
38
const
char
*
GMAD::GetName
(
int
i)
39
{
40
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
41
std::advance(it, i);
42
return
(it->name).c_str();
43
}
44
45
int
GMAD::GetType
(
int
i)
46
{
47
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
48
std::advance(it, i);
49
return
static_cast<
int
>
(it->type);
50
}
51
52
double
GMAD::GetLength
(
int
i)
53
{
54
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
55
std::advance(it, i);
56
return
it->l;
57
}
58
59
double
GMAD::GetAngle
(
int
i)
60
{
61
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
62
std::advance(it, i);
63
return
it->angle;
64
}
65
66
double
*
GMAD::GetKs
(
int
i)
67
{
68
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
69
std::advance(it, i);
70
double
* result =
new
double
[5];
71
result[0] = it->ks;
72
result[1] = it->k1;
73
result[2] = it->k2;
74
result[3] = it->k3;
75
result[4] = it->k4;
76
return
result;
77
}
78
79
double
GMAD::GetAper1
(
int
i)
80
{
81
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
82
std::advance(it, i);
83
return
it->aper1;
84
}
85
86
double
GMAD::GetAper2
(
int
i)
87
{
88
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
89
std::advance(it, i);
90
return
it->aper2;
91
}
92
93
double
GMAD::GetAper3
(
int
i)
94
{
95
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
96
std::advance(it, i);
97
return
it->aper3;
98
}
99
100
double
GMAD::GetAper4
(
int
i)
101
{
102
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
103
std::advance(it, i);
104
return
it->aper4;
105
}
106
107
const
char
*
GMAD::GetApertureType
(
int
i)
108
{
109
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
110
std::advance(it, i);
111
return
(it->apertureType).c_str();
112
}
113
114
double
GMAD::GetBeampipeThickness
(
int
i)
115
{
116
std::list<Element>::const_iterator it = Parser::Instance()->GetBeamline().begin();
117
std::advance(it, i);
118
return
it->beampipeThickness;
119
}
GMAD::GetBeampipeThickness
double GetBeampipeThickness(int)
Beam Pipe Thickness.
Definition
parserROOT.cc:114
GMAD::GetName
const char * GetName(int)
Name of element.
Definition
parserROOT.cc:38
GMAD::GetType
int GetType(int)
Type of element.
Definition
parserROOT.cc:45
GMAD::GetKs
double * GetKs(int)
All magnetic ks.
Definition
parserROOT.cc:66
GMAD::GetAper3
double GetAper3(int)
Aperture 3.
Definition
parserROOT.cc:93
GMAD::GetAper1
double GetAper1(int)
Aperture 1.
Definition
parserROOT.cc:79
GMAD::GetAper4
double GetAper4(int)
Aperture 4.
Definition
parserROOT.cc:100
GMAD::GmadParser_c
int GmadParser_c(char *name)
Definition
parserROOT.cc:27
GMAD::GetNElements
int GetNElements()
Length of list.
Definition
parserROOT.cc:33
GMAD::GetLength
double GetLength(int)
Length of element.
Definition
parserROOT.cc:52
GMAD::GetAngle
double GetAngle(int)
Angle of element.
Definition
parserROOT.cc:59
GMAD::GetApertureType
const char * GetApertureType(int)
Aperture Type.
Definition
parserROOT.cc:107
GMAD::GetAper2
double GetAper2(int)
Aperture 2.
Definition
parserROOT.cc:86
Generated on Sat Oct 18 2025 18:31:04 for BDSIM by
1.9.8