BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
field.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 "field.h"
20
21using namespace GMAD;
22
24{
25 clear();
27}
28
30{
31 name = "";
32 type = "";
33 eScaling = 1.0;
34 bScaling = 1.0;
35 integrator = "g4classicalrk4";
36 globalTransform = true;
37 magneticFile = "";
38 magneticInterpolator = "cubic";
39 electricFile = "";
40 electricInterpolator = "cubic";
41 fieldModulator = "";
42 x = 0;
43 y = 0;
44 z = 0;
45 t = 0;
46 phi = 0;
47 theta = 0;
48 psi = 0;
49 axisX = 0;
50 axisY = 0;
51 axisZ = 0;
52 angle = 0;
53 axisAngle = false;
54 autoScale = false;
56 magneticSubField = "";
57 electricSubField = "";
58 magneticReflection = "";
59 electricReflection = "";
60 fieldParameters = "";
61}
62
64{
65 publish("name", &Field::name);
66 publish("type", &Field::type);
67 publish("eScaling", &Field::eScaling);
68 publish("bScaling", &Field::bScaling);
69 publish("integrator", &Field::integrator);
70 publish("globalTransform", &Field::globalTransform);
71 publish("magneticFile", &Field::magneticFile);
72 publish("magneticInterpolator", &Field::magneticInterpolator);
73 publish("electricFile", &Field::electricFile);
74 publish("electricInterpolator", &Field::electricInterpolator);
75 publish("fieldModulator", &Field::fieldModulator);
76 publish("x", &Field::x);
77 publish("y", &Field::y);
78 publish("z", &Field::z);
79 publish("t", &Field::t);
80 publish("phi", &Field::phi);
81 publish("theta", &Field::theta);
82 publish("psi", &Field::psi);
83 publish("axisX", &Field::axisX);
84 publish("axisY", &Field::axisY);
85 publish("axisZ", &Field::axisZ);
86 publish("angle", &Field::angle);
87 publish("axisAngle", &Field::axisAngle);
88 publish("autoScale", &Field::autoScale);
89 publish("maximumStepLength", &Field::maximumStepLength);
90 publish("magneticSubField", &Field::magneticSubField);
91 publish("electricSubField", &Field::electricSubField);
92 publish("magneticReflection", &Field::magneticReflection);
93 publish("electricReflection", &Field::electricReflection);
94 publish("fieldParameters", &Field::fieldParameters);
95}
96
97void Field::print()const
98{
99 std::cout << "field: "
100 << "name " << name << std::endl
101 << "type " << type << std::endl
102 << "eScaling " << eScaling << std::endl
103 << "bScaling " << bScaling << std::endl
104 << "integrator " << integrator << std::endl
105 << "magneticFile " << magneticFile << std::endl
106 << "magneticInterpolator " << magneticInterpolator << std::endl
107 << "electricFile " << electricFile << std::endl
108 << "electricInterpolator " << electricInterpolator << std::endl
109 << "fieldModulator " << fieldModulator << std::endl
110 << "x, y, z,t " << x << " " << y << " " << z << " " << t << std::endl
111 << "phi, theta, psi " << phi << " " << theta << " " << psi << std::endl
112 << "axisX, Y, Z " << axisX << " " << axisY << " " << axisZ << std::endl
113 << "angle " << angle << std::endl
114 << "axisAngle " << axisAngle << std::endl
115 << "autoScale " << autoScale << std::endl
116 << "maximumStepLength " << maximumStepLength << std::endl
117 << "electricSubField " << electricSubField << std::endl
118 << "magneticSubField " << magneticSubField << std::endl
119 << "magneticReflection " << magneticReflection << std::endl
120 << "electricReflection " << electricReflection << std::endl
121 << "fieldParameters " << fieldParameters << std::endl;
122}
double theta
Euler angle for rotation.
Definition: field.h:57
bool autoScale
Scale the field to the magnet it's attached to.
Definition: field.h:68
void print() const
Print some properties.
Definition: field.cc:97
double z
Offset in z.
Definition: field.h:53
std::string type
Type.
Definition: field.h:40
std::string integrator
Which integrator to use.
Definition: field.h:43
Field()
Constructor.
Definition: field.cc:23
std::string magneticInterpolator
Interpolator for the magnetic field.
Definition: field.h:46
std::string electricFile
File for the electric field map.
Definition: field.h:47
double axisX
Definition: field.h:61
void PublishMembers()
publish members
Definition: field.cc:63
double phi
Euler angle for rotation.
Definition: field.h:56
double t
Definition: field.h:54
double bScaling
B Field Scaling factor.
Definition: field.h:42
std::string name
Name.
Definition: field.h:39
double maximumStepLength
Maximum permitted step length in the volumes the field is attached to.
Definition: field.h:71
double y
Offset in y.
Definition: field.h:52
double angle
Definition: field.h:64
std::string magneticFile
File for magnetic field map.
Definition: field.h:45
std::string electricInterpolator
Interpolator for the electric field.
Definition: field.h:48
double x
Offset in x.
Definition: field.h:51
void clear()
Reset.
Definition: field.cc:29
std::string fieldModulator
Name of field modulator object.
Definition: field.h:49
bool axisAngle
Flag to use the axis angle construction of rotation.
Definition: field.h:66
double axisY
Definition: field.h:62
bool globalTransform
Provide global to curvilinear coordinate transform.
Definition: field.h:44
double eScaling
E Field Scaling factor.
Definition: field.h:41
double axisZ
Definition: field.h:63
double psi
Euler angle for rotation.
Definition: field.h:58
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
Parser namespace for GMAD language. Combination of Geant4 and MAD.