OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
OpalVacuum.cpp
Go to the documentation of this file.
1//
2// Class OpalVacuum
3// Defines the VACUUM element and its attributes.
4//
5// Copyright (c) 2018 - 2021, Pedro Calvo, CIEMAT, Spain
6// All rights reserved
7//
8// Implemented as part of the PhD thesis
9// "Optimizing the radioisotope production of the novel AMIT
10// superconducting weak focusing cyclotron"
11//
12// This file is part of OPAL.
13//
14// OPAL is free software: you can redistribute it and/or modify
15// it under the terms of the GNU General Public License as published by
16// the Free Software Foundation, either version 3 of the License, or
17// (at your option) any later version.
18//
19// You should have received a copy of the GNU General Public License
20// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
21//
22#include "Elements/OpalVacuum.h"
24#include "BeamlineCore/VacuumRep.h"
25#include "Structure/ParticleMatterInteraction.h"
26
27
29 OpalElement(SIZE, "VACUUM",
30 "The \"VACUUM\" element defines the vacuum conditions "
31 "for beam stripping interactions."),
32 parmatint_m(nullptr) {
34 ("GAS", "The composition of residual gas", {"AIR", "H2"});
35
37 ("PRESSURE", " Pressure in the accelerator, [mbar]");
38
40 ("PMAPFN", "Filename for the Pressure fieldmap");
41
43 ("PSCALE", "Scale factor for the P-field", 1.0);
44
46 ("TEMPERATURE", " Temperature of the accelerator, [K]");
47
49 ("STOP", "Option whether stop tracking after beam stripping. Default: true", true);
50
52
53 setElement(new VacuumRep("VACUUM"));
54}
55
56
57OpalVacuum::OpalVacuum(const std::string& name, OpalVacuum* parent):
58 OpalElement(name, parent),
59 parmatint_m(nullptr) {
60 setElement(new VacuumRep(name));
61}
62
63
67
68
69OpalVacuum* OpalVacuum::clone(const std::string& name) {
70 return new OpalVacuum(name, this);
71}
72
73
76
77 VacuumRep* vac = dynamic_cast<VacuumRep*>(getElement());
78
79 double length = Attributes::getReal(itsAttr[LENGTH]);
80 std::string gas = Attributes::getString(itsAttr[GAS]);
81 double pressure = Attributes::getReal(itsAttr[PRESSURE]);
82 std::string pmap = Attributes::getString(itsAttr[PMAPFN]);
83 double pscale = Attributes::getReal(itsAttr[PSCALE]);
84 double temperature = Attributes::getReal(itsAttr[TEMPERATURE]);
85 bool stop = Attributes::getBool(itsAttr[STOP]);
86
87 vac->setElementLength(length);
88 vac->setResidualGas(gas);
89 vac->setPressure(pressure);
90 vac->setPressureMapFN(pmap);
91 vac->setPScale(pscale);
92 vac->setTemperature(temperature);
93 vac->setStop(stop);
94
95 // Transmit "unknown" attributes.
97}
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double getReal(const Attribute &attr)
Return real value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
bool getBool(const Attribute &attr)
Return logical value.
std::string getString(const Attribute &attr)
Get string value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition Element.h:121
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition Element.h:126
std::vector< Attribute > itsAttr
The object attributes.
Definition Object.h:216
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown'' (not known to OPAL) attributes to CLASSIC.
virtual void update()
Update the embedded CLASSIC element.
OpalElement(int size, const char *name, const char *help)
Exemplar constructor.
void registerOwnership() const
OpalVacuum()
Exemplar constructor.
ParticleMatterInteraction * parmatint_m
Definition OpalVacuum.h:64
virtual ~OpalVacuum()
virtual OpalVacuum * clone(const std::string &name)
Make clone.
virtual void update()
Update the embedded CLASSIC vacuum.