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