OPAL (Object Oriented Parallel Accelerator Library)  2024.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 //
22 #include "BeamlineCore/VacuumRep.h"
24 
25 namespace {
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 
55 VacuumRep::VacuumRep(const std::string& name):
56  Vacuum(name),
57  geometry()
58 {}
59 
60 
62 {}
63 
64 
66  return new VacuumRep(*this);
67 }
68 
69 
70 Channel* 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 }
A geometry representing a straight line.
virtual ~VacuumRep()
Definition: VacuumRep.cpp:61
Definition: Vacuum.h:61
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated then offering equivalent access to copy the source code from the same place counts as distribution of the source even though third parties are not compelled to copy the source along with the object code You may not or distribute the Program except as expressly provided under this License Any attempt otherwise to sublicense or distribute the Program is void
Definition: LICENSE:162
void setPressure(double pressure)
Definition: Vacuum.cpp:124
StraightGeometry geometry
Definition: VacuumRep.h:76
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Definition: VacuumRep.cpp:70
set(_SRCS Action.cpp Attribute.cpp AttributeBase.cpp AttributeHandler.cpp BeamSequence.cpp Definition.cpp Directory.cpp Element.cpp Invalidator.cpp OpalData.cpp Object.cpp ObjectFunction.cpp PlaceRep.cpp RangeRep.cpp Table.cpp TableRowRep.cpp ValueDefinition.cpp) include_directories($
Definition: CMakeLists.txt:1
Abstract interface for read/write access to variable.
Definition: Channel.h:32
Access to a [b]double[/b] data member.
const std::string name
virtual NullField & getField()
Get field.
Definition: VacuumRep.cpp:80
virtual ElementBase * clone() const
Return clone.
Definition: VacuumRep.cpp:65
virtual StraightGeometry & getGeometry()
Get geometry.
Definition: VacuumRep.cpp:88
A zero electromagnetic field.
Definition: NullField.h:30
NullField field
Definition: VacuumRep.h:73
double getPressure() const
Definition: Vacuum.cpp:128