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) BDSIM Collaboration, 2001 - 2026.
3
4This file is part of BDSIM.
5
6BDSIM is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published
8by the Free Software Foundation version 3 of the License.
9
10BDSIM is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#include "query.h"
19
20using namespace GMAD;
21
23{
24 clear();
26}
27
29{
30 name = "";
31 fieldObject = "";
32 nx = 1;
33 ny = 1;
34 nz = 1;
35 nt = 1;
36 xmin = 0;
37 xmax = 0;
38 ymin = 0;
39 ymax = 0;
40 zmin = 0;
41 zmax = 0;
42 tmin = 0;
43 tmax = 0;
44 outfileMagnetic = "";
45 outfileElectric = "";
46
47 queryMagneticField = false;
48 queryElectricField = false;
49
50 overwriteExistingFiles = true;
51 printTransform = true;
52
53 drawArrows = true;
54 drawZeroValuePoints = true;
55 drawBoxes = true;
56 boxAlpha = 0.2;
57
58 pointsFile = "";
59
62 s = 0;
63 x = 0;
64 y = 0;
65 z = 0;
66 phi = 0;
67 theta = 0;
68 psi = 0;
69 axisX = 0;
70 axisY = 0;
71 axisZ = 0;
72 angle = 0;
73 axisAngle = false;
74
75 checkParameters = true;
76}
77
79{
80 publish("name", &Query::name);
81 publish("fieldObject", &Query::fieldObject);
82 publish("nx", &Query::nx);
83 publish("ny", &Query::ny);
84 publish("nz", &Query::nz);
85 publish("nt", &Query::nt);
86 publish("xmin", &Query::xmin);
87 publish("ymin", &Query::ymin);
88 publish("zmin", &Query::zmin);
89 publish("tmin", &Query::tmin);
90 publish("xmax", &Query::xmax);
91 publish("ymax", &Query::ymax);
92 publish("zmax", &Query::zmax);
93 publish("tmax", &Query::tmax);
94 publish("outfileMagnetic", &Query::outfileMagnetic);
95 publish("outfileElectric", &Query::outfileElectric);
96
97 publish("queryMagneticField", &Query::queryMagneticField);
98 publish("queryElectricField", &Query::queryElectricField);
99
100 publish("overwriteExistingFiles", &Query::overwriteExistingFiles);
101 publish("printTransform", &Query::printTransform);
102
103 publish("drawArrows", &Query::drawArrows);
104 publish("drawZeroValuePoints", &Query::drawZeroValuePoints);
105 publish("drawBoxes", &Query::drawBoxes);
106 publish("boxAlpha", &Query::boxAlpha);
107
108 publish("pointsFile", &Query::pointsFile);
109
110 publish("referenceElement", &Query::referenceElement);
111 publish("referenceElementNumber", &Query::referenceElementNumber);
112 publish("s", &Query::s);
113 publish("x", &Query::x);
114 publish("y", &Query::y);
115 publish("z", &Query::z);
116 publish("phi", &Query::phi);
117 publish("theta", &Query::theta);
118 publish("psi", &Query::psi);
119 publish("axisX", &Query::axisX);
120 publish("axisY", &Query::axisY);
121 publish("axisZ", &Query::axisZ);
122 publish("angle", &Query::angle);
123 publish("axisAngle", &Query::axisAngle);
124
125 publish("checkParameters", &Query::checkParameters);
126}
127
128void Query::print()const
129{
130 std::cout << "query: "
131 << "name " << name << std::endl
132 << "nx " << nx << std::endl
133 << "ny " << ny << std::endl
134 << "nz " << nz << std::endl
135 << "nt " << ny << std::endl
136 << "x: (" << xmin << ", " << xmax << ")" << std::endl
137 << "y: (" << ymin << ", " << ymax << ")" << std::endl
138 << "z: (" << zmin << ", " << zmax << ")" << std::endl
139 << "t: (" << tmin << ", " << tmax << ")" << std::endl
140 << "outfileMagnetic: " << outfileMagnetic << std::endl
141 << "outfileElectric: " << outfileElectric << std::endl
142 << "fieldObject " << fieldObject << std::endl
143 << "queryMagneticField: " << queryMagneticField << std::endl
144 << "queryElectricField: " << queryElectricField << std::endl
145 << "overwriteExistingFiles " << overwriteExistingFiles << std::endl
146 << "printTransform " << printTransform << std::endl
147 << "drawArrows " << drawArrows << std::endl
148 << "drawZeroValuePoints " << drawZeroValuePoints << std::endl
149 << "drawBoxes " << drawBoxes << std::endl
150 << "boxAlpha " << boxAlpha << std::endl
151 << "pointsFile " << pointsFile << std::endl
152 << "referenceElement " << referenceElement << std::endl
153 << "referenceElementNumber " << referenceElementNumber << std::endl
154 << "s " << s << std::endl
155 << "x " << x << std::endl
156 << "y " << y << std::endl
157 << "z " << z << std::endl
158 << "phi " << phi << std::endl
159 << "theta " << theta << std::endl
160 << "psi " << psi << std::endl
161 << "axisX " << axisX << std::endl
162 << "axisY " << axisY << std::endl
163 << "axisZ " << axisZ << std::endl
164 << "angle " << angle << std::endl
165 << "axisAngle " << axisAngle << std::endl;
166}
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:93
bool axisAngle
Flag to use the axis angle construction of rotation.
Definition query.h:86
double tmax
T finish.
Definition query.h:50
double zmin
Z start.
Definition query.h:47
std::string referenceElement
Name of reference element w.r.t. to place to.
Definition query.h:69
double xmax
X finish.
Definition query.h:44
double s
Curvilinear s position to place w.r.t..
Definition query.h:71
void clear()
Reset.
Definition query.cc:28
double axisZ
Definition query.h:83
void PublishMembers()
publish members
Definition query.cc:78
Query()
Constructor.
Definition query.cc:22
double y
Offset in y.
Definition query.h:73
double angle
Definition query.h:84
double theta
Euler angle for rotation.
Definition query.h:77
double zmax
Z finish.
Definition query.h:48
double ymin
Y start.
Definition query.h:45
double axisX
Definition query.h:81
void print() const
Print some properties.
Definition query.cc:128
std::string pointsFile
File with 3D points to use.
Definition query.h:66
int nt
Number of samples in t.
Definition query.h:42
int nz
Number of samples in z.
Definition query.h:41
double xmin
X start.
Definition query.h:43
bool queryMagneticField
Whether to query the magnetic field.
Definition query.h:55
double psi
Euler angle for rotation.
Definition query.h:78
int ny
Number of samples in y.
Definition query.h:40
std::string name
Name of object.
Definition query.h:38
bool checkParameters
Definition query.h:90
int nx
Number of samples in x.
Definition query.h:39
double z
Definition query.h:74
double axisY
Definition query.h:82
double phi
Euler angle for rotation.
Definition query.h:76
std::string outfileMagnetic
Output file name.
Definition query.h:51
double ymax
Y finish.
Definition query.h:46
int referenceElementNumber
Index of repetition of element if there are multiple uses.
Definition query.h:70
double x
Offset in x.
Definition query.h:72
bool queryElectricField
Whether to query the electric field.
Definition query.h:56
std::string fieldObject
Name of field to query.
Definition query.h:53
double tmin
T start.
Definition query.h:49
Parser namespace for GMAD language. Combination of Geant4 and MAD.