OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
VacuumRep.cpp
Go to the documentation of this file.
1//
2// Class VacuumRep
3// Representation for the vacuum conditions.
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//
24
25namespace {
26 struct Entry {
27 const char* name;
28 double(VacuumRep::*get)() const;
29 void (VacuumRep::*set)(double);
30 };
31
32 const Entry entries[] = {
33 {
34 "p",
37 },
38 { 0, 0, 0 }
39 };
40}
41
42
44 Vacuum(),
45 geometry(0.0)
46{}
47
48
50 Vacuum(right),
51 geometry(right.geometry)
52{}
53
54
55VacuumRep::VacuumRep(const std::string& name):
56 Vacuum(name),
57 geometry()
58{}
59
60
62{}
63
64
66 return new VacuumRep(*this);
67}
68
69
70Channel* VacuumRep::getChannel(const std::string& aKey, bool create) {
71 for (const Entry *entry = entries; entry->name != 0; ++entry) {
72 if (aKey == entry->name) {
73 return new IndirectChannel<VacuumRep>(*this, entry->get, entry->set);
74 }
75 }
76
77 return ElementBase::getChannel(aKey, create);
78}
79
81 return field;
82}
83
85 return field;
86}
87
89 return geometry;
90}
91
93 return geometry;
94}
const std::string name
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
Definition: Vacuum.h:61
double getPressure() const
Definition: Vacuum.cpp:128
void setPressure(double pressure)
Definition: Vacuum.cpp:124
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Definition: VacuumRep.cpp:70
virtual ~VacuumRep()
Definition: VacuumRep.cpp:61
virtual StraightGeometry & getGeometry()
Get geometry.
Definition: VacuumRep.cpp:88
StraightGeometry geometry
Definition: VacuumRep.h:76
NullField field
Definition: VacuumRep.h:73
virtual ElementBase * clone() const
Return clone.
Definition: VacuumRep.cpp:65
virtual NullField & getField()
Get field.
Definition: VacuumRep.cpp:80
A geometry representing a straight line.
Abstract interface for read/write access to variable.
Definition: Channel.h:32
Access to a [b]double[/b] data member.
A zero electromagnetic field.
Definition: NullField.h:30