BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
query.cc
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#include "query.h"
20
21using namespace GMAD;
22
24{
25 clear();
27}
28
30{
31 name = "";
32 fieldObject = "";
33 nx = 1;
34 ny = 1;
35 nz = 1;
36 nt = 1;
37 xmin = 0;
38 xmax = 0;
39 ymin = 0;
40 ymax = 0;
41 zmin = 0;
42 zmax = 0;
43 tmin = 0;
44 tmax = 0;
45 outfileMagnetic = "";
46 outfileElectric = "";
47
48 queryMagneticField = true;
49 queryElectricField = false;
50
51 overwriteExistingFiles = true;
52 printTransform = true;
53
54 drawArrows = true;
55 drawZeroValuePoints = true;
56 drawBoxes = true;
57 boxAlpha = 0.2;
58
59 pointsFile = "";
60
63 s = 0;
64 x = 0;
65 y = 0;
66 z = 0;
67 phi = 0;
68 theta = 0;
69 psi = 0;
70 axisX = 0;
71 axisY = 0;
72 axisZ = 0;
73 angle = 0;
74 axisAngle = false;
75
76 checkParameters = true;
77}
78
80{
81 publish("name", &Query::name);
82 publish("fieldObject", &Query::fieldObject);
83 publish("nx", &Query::nx);
84 publish("ny", &Query::ny);
85 publish("nz", &Query::nz);
86 publish("nt", &Query::nt);
87 publish("xmin", &Query::xmin);
88 publish("ymin", &Query::ymin);
89 publish("zmin", &Query::zmin);
90 publish("tmin", &Query::tmin);
91 publish("xmax", &Query::xmax);
92 publish("ymax", &Query::ymax);
93 publish("zmax", &Query::zmax);
94 publish("tmax", &Query::tmax);
95 publish("outfileMagnetic", &Query::outfileMagnetic);
96 publish("outfileElectric", &Query::outfileElectric);
97
98 publish("queryMagneticField", &Query::queryMagneticField);
99 publish("queryElectricField", &Query::queryElectricField);
100
101 publish("overwriteExistingFiles", &Query::overwriteExistingFiles);
102 publish("printTransform", &Query::printTransform);
103
104 publish("drawArrows", &Query::drawArrows);
105 publish("drawZeroValuePoints", &Query::drawZeroValuePoints);
106 publish("drawBoxes", &Query::drawBoxes);
107 publish("boxAlpha", &Query::boxAlpha);
108
109 publish("pointsFile", &Query::pointsFile);
110
111 publish("referenceElement", &Query::referenceElement);
112 publish("referenceElementNumber", &Query::referenceElementNumber);
113 publish("s", &Query::s);
114 publish("x", &Query::x);
115 publish("y", &Query::y);
116 publish("z", &Query::z);
117 publish("phi", &Query::phi);
118 publish("theta", &Query::theta);
119 publish("psi", &Query::psi);
120 publish("axisX", &Query::axisX);
121 publish("axisY", &Query::axisY);
122 publish("axisZ", &Query::axisZ);
123 publish("angle", &Query::angle);
124 publish("axisAngle", &Query::axisAngle);
125
126 publish("checkParameters", &Query::checkParameters);
127}
128
129void Query::print()const
130{
131 std::cout << "query: "
132 << "name " << name << std::endl
133 << "nx " << nx << std::endl
134 << "ny " << ny << std::endl
135 << "nz " << nz << std::endl
136 << "nt " << ny << std::endl
137 << "x: (" << xmin << ", " << xmax << ")" << std::endl
138 << "y: (" << ymin << ", " << ymax << ")" << std::endl
139 << "z: (" << zmin << ", " << zmax << ")" << std::endl
140 << "t: (" << tmin << ", " << tmax << ")" << std::endl
141 << "outfileMagnetic: " << outfileMagnetic << std::endl
142 << "outfileElectric: " << outfileElectric << std::endl
143 << "fieldObject " << fieldObject << std::endl
144 << "queryMagneticField: " << queryMagneticField << std::endl
145 << "queryElectricField: " << queryElectricField << std::endl
146 << "overwriteExistingFiles " << overwriteExistingFiles << std::endl
147 << "printTransform " << printTransform << std::endl
148 << "drawArrows " << drawArrows << std::endl
149 << "drawZeroValuePoints " << drawZeroValuePoints << std::endl
150 << "drawBoxes " << drawBoxes << std::endl
151 << "boxAlpha " << boxAlpha << std::endl
152 << "pointsFile " << pointsFile << std::endl
153 << "referenceElement " << referenceElement << std::endl
154 << "referenceElementNumber " << referenceElementNumber << std::endl
155 << "s " << s << std::endl
156 << "x " << x << std::endl
157 << "y " << y << std::endl
158 << "z " << z << std::endl
159 << "phi " << phi << std::endl
160 << "theta " << theta << std::endl
161 << "psi " << psi << std::endl
162 << "axisX " << axisX << std::endl
163 << "axisY " << axisY << std::endl
164 << "axisZ " << axisZ << std::endl
165 << "angle " << angle << std::endl
166 << "axisAngle " << axisAngle << std::endl;
167}
void publish(const std::string &name, T C::*mp)
Make pointer to member from class C and type T with accessible with a name.
Definition: published.h:92
bool axisAngle
Flag to use the axis angle construction of rotation.
Definition: query.h:87
double tmax
T finish.
Definition: query.h:51
double zmin
Z start.
Definition: query.h:48
std::string referenceElement
Name of reference element w.r.t. to place to.
Definition: query.h:70
double xmax
X finish.
Definition: query.h:45
double s
Curvilinear s position to place w.r.t..
Definition: query.h:72
void clear()
Reset.
Definition: query.cc:29
double axisZ
Definition: query.h:84
void PublishMembers()
publish members
Definition: query.cc:79
Query()
Constructor.
Definition: query.cc:23
double y
Offset in y.
Definition: query.h:74
double angle
Definition: query.h:85
double theta
Euler angle for rotation.
Definition: query.h:78
double zmax
Z finish.
Definition: query.h:49
double ymin
Y start.
Definition: query.h:46
double axisX
Definition: query.h:82
void print() const
Print some properties.
Definition: query.cc:129
std::string pointsFile
File with 3D points to use.
Definition: query.h:67
int nt
Number of samples in t.
Definition: query.h:43
int nz
Number of samples in z.
Definition: query.h:42
double xmin
X start.
Definition: query.h:44
bool queryMagneticField
Whether to query the magnetic field.
Definition: query.h:56
double psi
Euler angle for rotation.
Definition: query.h:79
int ny
Number of samples in y.
Definition: query.h:41
std::string name
Name of object.
Definition: query.h:39
bool checkParameters
Definition: query.h:91
int nx
Number of samples in x.
Definition: query.h:40
double z
Definition: query.h:75
double axisY
Definition: query.h:83
double phi
Euler angle for rotation.
Definition: query.h:77
std::string outfileMagnetic
Output file name.
Definition: query.h:52
double ymax
Y finish.
Definition: query.h:47
int referenceElementNumber
Index of repetition of element if there are multiple uses.
Definition: query.h:71
double x
Offset in x.
Definition: query.h:73
bool queryElectricField
Whether to query the electric field.
Definition: query.h:57
std::string fieldObject
Name of field to query.
Definition: query.h:54
double tmin
T start.
Definition: query.h:50
Parser namespace for GMAD language. Combination of Geant4 and MAD.