OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
OpalBeamline.cpp
Go to the documentation of this file.
1//
2// Class OpalBeamline
3// :FIXME: add class description
4//
5// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
20#include "Physics/Units.h"
22#include "Utilities/Options.h"
23#include "Utilities/Util.h"
24
25#include <boost/filesystem.hpp>
26#include <boost/regex.hpp>
27#include <fstream>
28
31
33 : elements_m(), prepared_m(false), coordTransformationTo_m(origin, rotation) {
34}
35
39
40std::set<std::shared_ptr<Component>> OpalBeamline::getElements(const Vector_t<double, 3>& x) {
41 std::set<std::shared_ptr<Component>> elementSet;
42 FieldList::iterator it = elements_m.begin();
43 const FieldList::iterator end = elements_m.end();
44 for (; it != end; ++it) {
45 std::shared_ptr<Component> element = (*it).getElement();
46 Vector_t<double, 3> r = element->getCSTrafoGlobal2Local().transformTo(x);
47
48 if (element->isInside(r)) {
49 elementSet.insert(element);
50 }
51 }
52
53 return elementSet;
54}
55
57 const unsigned int& /*index*/, const Vector_t<double, 3>& /*pos*/, const long& /*sindex*/,
58 const double& /*t*/, Vector_t<double, 3>& /*E*/, Vector_t<double, 3>& /*B*/) {
59 unsigned long rtv = 0x00;
60
61 return rtv;
62}
63
65 const Vector_t<double, 3>& position, const Vector_t<double, 3>& momentum, const double& t,
67 unsigned long rtv = 0x00;
68
69 std::set<std::shared_ptr<Component>> elements = getElements(position);
70
71 std::set<std::shared_ptr<Component>>::const_iterator it = elements.begin();
72 const std::set<std::shared_ptr<Component>>::const_iterator end = elements.end();
73
74 for (; it != end; ++it) {
75 ElementType type = (*it)->getType();
76 if (type == ElementType::MARKER)
77 continue;
78
79 Vector_t<double, 3> localR = transformToLocalCS(*it, position);
80 Vector_t<double, 3> localP = rotateToLocalCS(*it, momentum);
81 Vector_t<double, 3> localE(0.0), localB(0.0);
82
83 (*it)->applyToReferenceParticle(localR, localP, t, localE, localB);
84
85 Ef += rotateFromLocalCS(*it, localE);
86 Bf += rotateFromLocalCS(*it, localB);
87 }
88
89 // if(section.hasWake()) {
90 // rtv |= BEAMLINE_WAKE;
91 // }
92 // if(section.hasParticleMatterInteraction()) {
93 // rtv |= BEAMLINE_PARTICLEMATTERINTERACTION;
94 // }
95
96 return rtv;
97}
98
100 const double& min, const double& max, const double& kineticEnergy, const bool& nomonitors) {
101 FieldList::iterator fprev;
102 for (FieldList::iterator flit = elements_m.begin(); flit != elements_m.end(); ++flit) {
103 // don't set online monitors if the centroid of the bunch is allready inside monitor
104 // or if explicitly not desired (eg during auto phasing)
105 if (!(*flit).isOn() && max > (*flit).getStart() && min < (*flit).getEnd()) {
106 (*flit).setOn(kineticEnergy);
107 }
108
109 fprev = flit;
110 }
111}
112
114 for (FieldList::iterator flit = elements_m.begin(); flit != elements_m.end(); ++flit)
115 (*flit).setOff();
116}
117
119 if (elements_m.empty()) {
120 prepared_m = true;
121 return;
122 }
124 prepared_m = true;
125}
126
127void OpalBeamline::print(Inform& /*msg*/) const {
128}
129
131 std::swap(elements_m, rhs.elements_m);
132 std::swap(prepared_m, rhs.prepared_m);
134}
135
137 elements_m.insert(elements_m.end(), rhs.elements_m.begin(), rhs.elements_m.end());
138 prepared_m = false;
139}
140
142 if (type == ElementType::ANY) {
143 return elements_m;
144 }
145
146 FieldList elements_of_requested_type;
147 for (FieldList::iterator fit = elements_m.begin(); fit != elements_m.end(); ++fit) {
148 if ((*fit).getElement()->getType() == type) {
149 elements_of_requested_type.push_back((*fit));
150 }
151 }
152 return elements_of_requested_type;
153}
154
155void OpalBeamline::positionElementRelative(std::shared_ptr<ElementBase> element) {
156 if (!element->isPositioned()) {
157 return;
158 }
159
160 element->releasePosition();
161 CoordinateSystemTrafo toElement = element->getCSTrafoGlobal2Local();
162 toElement *= coordTransformationTo_m;
163
164 element->setCSTrafoGlobal2Local(toElement);
165 element->fixPosition();
166}
167
169 static unsigned int order = 0;
170 const FieldList::iterator end = elements_m.end();
171
172 unsigned int minOrder = order;
173 {
174 double endPriorPathLength = 0.0;
176
177 FieldList::iterator it = elements_m.begin();
178 for (; it != end; ++it) {
179 std::shared_ptr<Component> element = (*it).getElement();
180 if (element->isPositioned()) {
181 continue;
182 }
183 (*it).order_m = minOrder;
184
185 if (element->getType() != ElementType::SBEND && element->getType() != ElementType::RBEND
186 && element->getType() != ElementType::RBEND3D) {
187 continue;
188 }
189
190 double beginThisPathLength = element->getElementPosition();
191 Vector_t<double, 3> beginThis3D(0, 0, beginThisPathLength - endPriorPathLength);
192 // BendBase * bendElement = static_cast<BendBase*>(element.get());
193 double thisLength = 0.; // bendElement->getChordLength();
194 double bendAngle = 0.0; // bendElement->getBendAngle();
195 double entranceAngle = 0.0; // bendElement->getEntranceAngle();
196 double arcLength =
197 0.0; // (thisLength * std::abs(bendAngle) / (2 * sin(std::abs(bendAngle) / 2)));
198
199 double rotationAngleAboutZ = 0.0; // bendElement->getRotationAboutZ();
200 Quaternion_t rotationAboutZ(
201 cos(0.5 * rotationAngleAboutZ),
202 sin(-0.5 * rotationAngleAboutZ) * Vector_t<double, 3>(0, 0, 1));
203
204 Vector_t<double, 3> effectiveRotationAxis =
205 rotationAboutZ.rotate(Vector_t<double, 3>(0, -1, 0));
206 effectiveRotationAxis = effectiveRotationAxis / euclidean_norm(effectiveRotationAxis);
207
208 Quaternion_t rotationAboutAxis(
209 cos(0.5 * bendAngle), sin(0.5 * bendAngle) * effectiveRotationAxis);
210 Quaternion_t halfRotationAboutAxis(
211 cos(0.25 * bendAngle), sin(0.25 * bendAngle) * effectiveRotationAxis);
212 Quaternion_t entryFaceRotation(
213 cos(0.5 * entranceAngle), sin(0.5 * entranceAngle) * effectiveRotationAxis);
214
215 if (!Options::idealized) {
216 /*
217 std::vector<Vector_t<double, 3>> truePath = bendElement->getDesignPath();
218 Quaternion_t directionExitHardEdge(cos(0.5 * (0.5 * bendAngle - entranceAngle)),
219 sin(0.5 * (0.5 * bendAngle - entranceAngle)) *
220 effectiveRotationAxis); Vector_t<double, 3> exitHardEdge = thisLength *
221 directionExitHardEdge.rotate(Vector_t<double, 3>(0, 0, 1)); double
222 distanceEntryHETruePath = euclidean_norm(truePath.front()); double
223 distanceExitHETruePath = euclidean_norm(rotationAboutZ.rotate(truePath.back()) -
224 exitHardEdge); double pathLengthTruePath = (*it).getEnd() - (*it).getStart();
225 arcLength = pathLengthTruePath - distanceEntryHETruePath - distanceExitHETruePath;
226 */
227 }
228
229 Vector_t<double, 3> chord =
230 thisLength * halfRotationAboutAxis.rotate(Vector_t<double, 3>(0, 0, 1));
231 Vector_t<double, 3> endThis3D = beginThis3D + chord;
232 double endThisPathLength = beginThisPathLength + arcLength;
233
234 CoordinateSystemTrafo fromEndLastToBeginThis(
235 beginThis3D, (entryFaceRotation * rotationAboutZ).conjugate());
236 CoordinateSystemTrafo fromEndLastToEndThis(endThis3D, rotationAboutAxis.conjugate());
237
238 element->setCSTrafoGlobal2Local(fromEndLastToBeginThis * currentCoordTrafo);
239
240 currentCoordTrafo = (fromEndLastToEndThis * currentCoordTrafo);
241
242 endPriorPathLength = endThisPathLength;
243 }
244 }
245
246 double endPriorPathLength = 0.0;
248
249 FieldList::iterator it = elements_m.begin();
250 for (; it != end; ++it) {
251 std::shared_ptr<Component> element = (*it).getElement();
252 if (element->isPositioned())
253 continue;
254
255 (*it).order_m = order++;
256
257 double beginThisPathLength = element->getElementPosition();
258 double thisLength = element->getElementLength();
259 Vector_t<double, 3> beginThis3D(0, 0, beginThisPathLength - endPriorPathLength);
260
261 if (element->getType() == ElementType::SOURCE) {
262 beginThis3D(2) -= thisLength;
263 }
264
265 Vector_t<double, 3> endThis3D;
266 if (element->getType() == ElementType::SBEND || element->getType() == ElementType::RBEND
267 || element->getType() == ElementType::RBEND3D) {
268 // BendBase * bendElement = static_cast<BendBase*>(element.get());
269 thisLength = 0.0; // bendElement->getChordLength();
270 double bendAngle = 0.0; // bendElement->getBendAngle();
271
272 double rotationAngleAboutZ = 0.0; // bendElement->getRotationAboutZ();
273 Quaternion_t rotationAboutZ(
274 cos(0.5 * rotationAngleAboutZ),
275 sin(-0.5 * rotationAngleAboutZ) * Vector_t<double, 3>(0, 0, 1));
276
277 Vector_t<double, 3> effectiveRotationAxis =
278 rotationAboutZ.rotate(Vector_t<double, 3>(0, -1, 0));
279 effectiveRotationAxis = effectiveRotationAxis / euclidean_norm(effectiveRotationAxis);
280
281 Quaternion_t rotationAboutAxis(
282 cos(0.5 * bendAngle), sin(0.5 * bendAngle) * effectiveRotationAxis);
283 Quaternion halfRotationAboutAxis(
284 cos(0.25 * bendAngle), sin(0.25 * bendAngle) * effectiveRotationAxis);
285
286 double arcLength = (thisLength * std::abs(bendAngle) / (2 * sin(bendAngle / 2)));
287 if (!Options::idealized) {
288 /*
289 std::vector<Vector_t<double, 3>> truePath = bendElement->getDesignPath();
290 double entranceAngle = bendElement->getEntranceAngle();
291 Quaternion_t directionExitHardEdge(cos(0.5 * (0.5 * bendAngle - entranceAngle)),
292 sin(0.5 * (0.5 * bendAngle - entranceAngle)) *
293 effectiveRotationAxis); Vector_t<double, 3> exitHardEdge = thisLength *
294 directionExitHardEdge.rotate(Vector_t<double, 3>(0, 0, 1)); double
295 distanceEntryHETruePath = euclidean_norm(truePath.front()); double
296 distanceExitHETruePath = euclidean_norm(rotationAboutZ.rotate(truePath.back()) -
297 exitHardEdge); double pathLengthTruePath = (*it).getEnd() - (*it).getStart();
298 arcLength = pathLengthTruePath - distanceEntryHETruePath - distanceExitHETruePath;
299 */
300 }
301
302 endThis3D =
303 (beginThis3D + halfRotationAboutAxis.rotate(Vector_t<double, 3>(0, 0, thisLength)));
304 CoordinateSystemTrafo fromEndLastToEndThis(endThis3D, rotationAboutAxis.conjugate());
305 currentCoordTrafo = fromEndLastToEndThis * currentCoordTrafo;
306
307 endPriorPathLength = beginThisPathLength + arcLength;
308 } else {
309 double rotationAngleAboutZ = (*it).getElement()->getRotationAboutZ();
310 Quaternion_t rotationAboutZ(
311 cos(0.5 * rotationAngleAboutZ),
312 sin(-0.5 * rotationAngleAboutZ) * Vector_t<double, 3>(0, 0, 1));
313
314 CoordinateSystemTrafo fromLastToThis(beginThis3D, rotationAboutZ);
315
316 element->setCSTrafoGlobal2Local(fromLastToThis * currentCoordTrafo);
317 }
318
319 element->fixPosition();
320 }
321}
322
324 if (ippl::Comm->rank() != 0 || OpalData::getInstance()->isOptimizerRun())
325 return;
326
327 elements_m.sort([](const ClassicField& a, const ClassicField& b) {
328 return a.order_m < b.order_m;
329 });
330
331 FieldList::iterator it = elements_m.begin();
332 FieldList::iterator end = elements_m.end();
333
334 std::ofstream pos;
335 std::string fileName = Util::combineFilePath(
337 OpalData::getInstance()->getInputBasename() + "_ElementPositions.txt"});
339 && boost::filesystem::exists(fileName)) {
340 pos.open(fileName, std::ios_base::app);
341 } else {
342 pos.open(fileName);
343 }
344
345 MeshGenerator mesh;
346 for (; it != end; ++it) {
347 std::shared_ptr<Component> element = (*it).getElement();
348 CoordinateSystemTrafo toBegin =
349 element->getEdgeToBegin() * element->getCSTrafoGlobal2Local();
350 CoordinateSystemTrafo toEnd = element->getEdgeToEnd() * element->getCSTrafoGlobal2Local();
351 Vector_t<double, 3> entry3D = toBegin.getOrigin();
352 Vector_t<double, 3> exit3D = toEnd.getOrigin();
353
354 mesh.add(*(element.get()));
355
356 if (element->getType() == ElementType::SBEND || element->getType() == ElementType::RBEND) {
357 // Bend2D * bendElement = static_cast<Bend2D*>(element.get());
358 std::vector<Vector_t<double, 3>> designPath; // bendElement->getDesignPath();
359 // toEnd = bendElement->getBeginToEnd_local() * element->getCSTrafoGlobal2Local();
360 // exit3D = toEnd.getOrigin();
361
362 unsigned int size = 0; // designPath.size();
363
364 unsigned int minNumSteps =
365 0; // std::max(20.0,
366 // std::abs(bendElement->getBendAngle() * Units::rad2deg));
367
368 unsigned int frequency = std::floor((double)size / minNumSteps);
369
370 pos << std::setw(30) << std::left
371 << std::string("\"ENTRY EDGE: ") + element->getName() + std::string("\"")
372 << std::setw(18) << std::setprecision(10) << entry3D(2) << std::setw(18)
373 << std::setprecision(10) << entry3D(0) << std::setw(18) << std::setprecision(10)
374 << entry3D(1) << "\n";
375
376 Vector_t<double, 3> position =
377 element->getCSTrafoGlobal2Local().transformFrom(designPath.front());
378 pos << std::setw(30) << std::left
379 << std::string("\"BEGIN: ") + element->getName() + std::string("\"")
380 << std::setw(18) << std::setprecision(10) << position(2) << std::setw(18)
381 << std::setprecision(10) << position(0) << std::setw(18) << std::setprecision(10)
382 << position(1) << std::endl;
383
384 for (unsigned int i = frequency; i + 1 < size; i += frequency) {
385 position = element->getCSTrafoGlobal2Local().transformFrom(designPath[i]);
386 pos << std::setw(30) << std::left
387 << std::string("\"MID: ") + element->getName() + std::string("\"")
388 << std::setw(18) << std::setprecision(10) << position(2) << std::setw(18)
389 << std::setprecision(10) << position(0) << std::setw(18)
390 << std::setprecision(10) << position(1) << std::endl;
391 }
392
393 position = element->getCSTrafoGlobal2Local().transformFrom(designPath.back());
394 pos << std::setw(30) << std::left
395 << std::string("\"END: ") + element->getName() + std::string("\"") << std::setw(18)
396 << std::setprecision(10) << position(2) << std::setw(18) << std::setprecision(10)
397 << position(0) << std::setw(18) << std::setprecision(10) << position(1)
398 << std::endl;
399
400 pos << std::setw(30) << std::left
401 << std::string("\"EXIT EDGE: ") + element->getName() + std::string("\"")
402 << std::setw(18) << std::setprecision(10) << exit3D(2) << std::setw(18)
403 << std::setprecision(10) << exit3D(0) << std::setw(18) << std::setprecision(10)
404 << exit3D(1) << std::endl;
405 } else {
406 pos << std::setw(30) << std::left
407 << std::string("\"BEGIN: ") + element->getName() + std::string("\"")
408 << std::setw(18) << std::setprecision(10) << entry3D(2) << std::setw(18)
409 << std::setprecision(10) << entry3D(0) << std::setw(18) << std::setprecision(10)
410 << entry3D(1) << "\n";
411
412 pos << std::setw(30) << std::left
413 << std::string("\"END: ") + element->getName() + std::string("\"") << std::setw(18)
414 << std::setprecision(10) << exit3D(2) << std::setw(18) << std::setprecision(10)
415 << exit3D(0) << std::setw(18) << std::setprecision(10) << exit3D(1) << std::endl;
416 }
417 }
419 mesh.write(OpalData::getInstance()->getInputBasename());
420}
421
422namespace {
423 std::string parseInput() {
424 std::ifstream in(OpalData::getInstance()->getInputFn());
425 std::string source("");
426 std::string str;
427 char testBit;
428 const std::string commentFormat("");
429 const boost::regex empty("^[ \t]*$");
430 const boost::regex lineEnd(";");
431 const std::string lineEndFormat(";\n");
432 const boost::regex cppCommentExpr("//.*");
433 const boost::regex cCommentExpr(
434 "/\\*.*?\\*/"); // "/\\*(?>[^*/]+|\\*[^/]|/[^*])*(?>(?R)(?>[^*/]+|\\*[^/]|/[^*])*)*\\*/"
435 bool priorEmpty = true;
436
437 in.get(testBit);
438 while (!in.eof()) {
439 in.putback(testBit);
440
441 std::getline(in, str);
442 str = boost::regex_replace(str, cppCommentExpr, commentFormat);
443 str = boost::regex_replace(str, empty, commentFormat);
444 if (!str.empty()) {
445 source += str; // + '\n';
446 priorEmpty = false;
447 } else if (!priorEmpty) {
448 source += "##EMPTY_LINE##";
449 priorEmpty = true;
450 }
451
452 in.get(testBit);
453 }
454
455 source = boost::regex_replace(source, cCommentExpr, commentFormat);
456 source = boost::regex_replace(
457 source, lineEnd, lineEndFormat, boost::match_default | boost::format_all);
458
459 // Since the positions of the elements are absolute in the laboratory coordinate system we
460 // have to make sure that the line command doesn't provide an origin and orientation.
461 // Everything after the sequence of elements can be deleted and only "LINE = (...);", the
462 // first sub-expression (denoted by '\1'), should be kept.
463 const boost::regex lineCommand(
464 "(LINE[ \t]*=[ \t]*\\([^\\)]*\\))[ \t]*,[^;]*;", boost::regex::icase);
465 const std::string firstSubExpression("\\1;");
466 source = boost::regex_replace(source, lineCommand, firstSubExpression);
467
468 return source;
469 }
470
471 unsigned int getMinimalSignificantDigits(double num, const unsigned int maxDigits) {
472 char buf[32];
473 snprintf(buf, 32, "%.*f", maxDigits + 1, num);
474 std::string numStr(buf);
475 unsigned int length = numStr.length();
476
477 unsigned int numDigits = maxDigits;
478 unsigned int i = 2;
479 while (i < maxDigits + 1 && numStr[length - i] == '0') {
480 --numDigits;
481 ++i;
482 }
483
484 return numDigits;
485 }
486
487 std::string round2string(double num, const unsigned int maxDigits) {
488 char buf[64];
489
490 snprintf(buf, 64, "%.*f", getMinimalSignificantDigits(num, maxDigits), num);
491
492 return std::string(buf);
493 }
494} // namespace
495
497 if (ippl::Comm->rank() != 0 || OpalData::getInstance()->isOptimizerRun())
498 return;
499
500 FieldList::iterator it = elements_m.begin();
501 FieldList::iterator end = elements_m.end();
502
503 std::string input = parseInput();
504 std::string fname = Util::combineFilePath(
506 OpalData::getInstance()->getInputBasename() + "_3D.opal"});
507 std::ofstream pos(fname);
508
509 for (; it != end; ++it) {
510 std::shared_ptr<Component> element = (*it).getElement();
511 std::string elementName = element->getName();
512 const boost::regex replacePSI(
513 "(" + elementName + "\\s*:[^\\n]*)PSI\\s*=[^,;]*,?", boost::regex::icase);
514 input = boost::regex_replace(input, replacePSI, "\\1\\2");
515
516 const boost::regex replaceELEMEDGE(
517 "(" + elementName + "\\s*:[^\\n]*)ELEMEDGE\\s*=[^,;]*(.)", boost::regex::icase);
518
519 CoordinateSystemTrafo cst = element->getCSTrafoGlobal2Local();
520 Vector_t<double, 3> origin = cst.getOrigin();
521 Vector_t<double, 3> orient =
522 Util::getTaitBryantAngles(cst.getRotation().conjugate(), elementName);
523 for (unsigned int d = 0; d < 3; ++d)
524 orient(d) *= Units::rad2deg;
525
526 std::string x =
527 (std::abs(origin(0)) > 1e-10 ? "X = " + round2string(origin(0), 10) + ", " : "");
528 std::string y =
529 (std::abs(origin(1)) > 1e-10 ? "Y = " + round2string(origin(1), 10) + ", " : "");
530 std::string z =
531 (std::abs(origin(2)) > 1e-10 ? "Z = " + round2string(origin(2), 10) + ", " : "");
532
533 std::string theta =
534 (orient(0) > 1e-10 ? "THETA = " + round2string(orient(0), 6) + " * PI / 180, " : "");
535 std::string phi =
536 (orient(1) > 1e-10 ? "PHI = " + round2string(orient(1), 6) + " * PI / 180, " : "");
537 std::string psi =
538 (orient(2) > 1e-10 ? "PSI = " + round2string(orient(2), 6) + " * PI / 180, " : "");
539 std::string coordTrafo = x + y + z + theta + phi + psi;
540 if (coordTrafo.length() > 2) {
541 coordTrafo = coordTrafo.substr(0, coordTrafo.length() - 2); // remove last ', '
542 }
543
544 std::string position = ("\\1" + coordTrafo + "\\2");
545
546 input = boost::regex_replace(input, replaceELEMEDGE, position);
547 }
548
549 const boost::regex empty("##EMPTY_LINE##");
550 const std::string emptyFormat("\n");
551 input = boost::regex_replace(input, empty, emptyFormat);
552
553 pos << input << std::endl;
554}
555
557 auto it = elements_m.begin();
558 const auto end = elements_m.end();
559 double designEnergy = 0.0;
560 for (; it != end; ++it) {
561 std::shared_ptr<Component> element = (*it).getElement();
562 (*it).setOn(designEnergy);
563 element->goOnline(designEnergy);
564 }
565}
ElementType
Definition ElementBase.h:88
Quaternion Quaternion_t
elements
Definition IndexMap.cpp:162
ippl::Vector< T, Dim > Vector_t
PartBunch< T, Dim >::ConstIterator end(PartBunch< T, Dim > const &bunch)
std::list< ClassicField > FieldList
KOKKOS_INLINE_FUNCTION double euclidean_norm(const Vector_t< T, D > &v)
Definition OPALTypes.h:35
constexpr double rad2deg
Definition Units.h:146
bool idealized
Definition Options.cpp:93
std::string combineFilePath(std::initializer_list< std::string > ilist)
Definition Util.cpp:197
Vector_t< double, 3 > getTaitBryantAngles(Quaternion rotation, const std::string &)
Definition Util.cpp:114
std::string getInputBasename()
get input file name without extension
Definition OpalData.cpp:685
static OpalData * getInstance()
Definition OpalData.cpp:195
std::string getAuxiliaryOutputDirectory() const
get the name of the the additional data directory
Definition OpalData.cpp:677
ippl::Vector< double, 3 > getOrigin() const
Quaternion getRotation() const
Quaternion conjugate() const
ippl::Vector< double, 3 > rotate(const ippl::Vector< double, 3 > &) const
FieldList getElementByType(ElementType)
Vector_t< double, 3 > rotateToLocalCS(const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
void positionElementRelative(std::shared_ptr< ElementBase >)
void merge(OpalBeamline &rhs)
unsigned long getFieldAt(const unsigned int &, const Vector_t< double, 3 > &, const long &, const double &, Vector_t< double, 3 > &, Vector_t< double, 3 > &)
CoordinateSystemTrafo coordTransformationTo_m
void prepareSections()
void print(Inform &) const
void compute3DLattice()
Vector_t< double, 3 > transformToLocalCS(const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
std::set< std::shared_ptr< Component > > getElements(const Vector_t< double, 3 > &x)
void switchElements(const double &, const double &, const double &kineticEnergy, const bool &nomonitors=false)
void switchElementsOff()
FieldList elements_m
Vector_t< double, 3 > rotateFromLocalCS(const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
void activateElements()
void swap(OpalBeamline &rhs)
void add(const ElementBase &element)
void write(const std::string &fname)
static bool SortAsc(const ClassicField &fle1, const ClassicField &fle2)
unsigned int order_m