BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSLine.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
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#ifndef BDSLINE_H
20#define BDSLINE_H
21
22#include "BDSAcceleratorComponent.hh"
23
24#include <iterator>
25#include <set>
26#include <vector>
27
38{
39private:
42 typedef std::vector<BDSAcceleratorComponent*> BDSLineVector;
43
46
47public:
48 explicit BDSLine(G4String name);
49 virtual ~BDSLine(){;}
50
51 BDSLine() = delete;
52
54 BDSLine& operator=(const BDSLine&) = delete;
55 BDSLine(BDSLine&) = delete;
57
60
62 virtual G4double GetArcLength() const;
63 virtual G4double GetChordLength() const;
65
67 virtual std::set<G4LogicalVolume*> GetAcceleratorVacuumLogicalVolumes() const;
68 virtual std::set<G4LogicalVolume*> GetAcceleratorMaterialLogicalVolumes() const;
70
72 typedef BDSLineVector::iterator iterator;
73 typedef BDSLineVector::const_iterator const_iterator;
74 iterator begin() {return line.begin();}
75 iterator end() {return line.end();}
76 const_iterator begin() const {return line.begin();}
77 const_iterator end() const {return line.end();}
78 G4bool empty() const {return line.empty();}
79 const BDSAcceleratorComponent* back() const {return line.back();}
81
83 size_t size() const {return line.size();}
84
86 BDSAcceleratorComponent* const& operator[](G4int index) const {return line.at(index);}
87
90 virtual void Initialise();
91
93 virtual void SetBiasVacuumList(const std::list<std::string>& biasVacuumList);
94 virtual void SetBiasMaterialList(const std::list<std::string>& biasMaterialList);
96
98 virtual void SetRegion(const G4String& region);
99
100private:
103};
104
105#endif
Abstract class that represents a component of an accelerator.
std::list< std::string > biasVacuumList
Copy of bias list from parser for this particular component.
const G4String name
Const protected member variable that may not be changed by derived classes.
G4String region
Protected member variable that can be modified by derived classes.
std::list< std::string > biasMaterialList
Copy of bias list from parser for this particular component.
A class that hold multiple accelerator components.
Definition: BDSLine.hh:38
virtual void SetBiasVacuumList(const std::list< std::string > &biasVacuumList)
Copy the bias list to each component.
Definition: BDSLine.cc:80
virtual void BuildContainerLogicalVolume()
define pure virtual method
Definition: BDSLine.hh:102
BDSLineVector::const_iterator const_iterator
Iterator mechanics.
Definition: BDSLine.hh:73
virtual std::set< G4LogicalVolume * > GetAcceleratorVacuumLogicalVolumes() const
Re-implement from BDSAcceleratorComponent.
Definition: BDSLine.cc:47
iterator begin()
Iterator mechanics.
Definition: BDSLine.hh:74
BDSLine & operator=(const BDSLine &)=delete
Assignment and copy constructor not implemented nor used.
virtual void SetBiasMaterialList(const std::list< std::string > &biasMaterialList)
Copy the bias list to each component.
Definition: BDSLine.cc:87
virtual void Initialise()
Definition: BDSLine.cc:69
virtual void SetRegion(const G4String &region)
Set the region name for each component.
Definition: BDSLine.cc:94
virtual std::set< G4LogicalVolume * > GetAcceleratorMaterialLogicalVolumes() const
Re-implement from BDSAcceleratorComponent.
Definition: BDSLine.cc:58
iterator end()
Iterator mechanics.
Definition: BDSLine.hh:75
const BDSAcceleratorComponent * back() const
Iterator mechanics.
Definition: BDSLine.hh:79
BDSLineVector line
Member vector to store components.
Definition: BDSLine.hh:45
std::vector< BDSAcceleratorComponent * > BDSLineVector
Definition: BDSLine.hh:42
BDSAcceleratorComponent *const & operator[](G4int index) const
Accessor for part - exposes functionality of the vector for iteration by index.
Definition: BDSLine.hh:86
const_iterator begin() const
Iterator mechanics.
Definition: BDSLine.hh:76
void AddComponent(BDSAcceleratorComponent *component)
Add a component to the line.
Definition: BDSLine.cc:28
G4bool empty() const
Iterator mechanics.
Definition: BDSLine.hh:78
virtual G4double GetArcLength() const
Override base class method as BDSAcceleratorComponent::chordLength etc variables are const and we app...
Definition: BDSLine.cc:31
BDSLine(BDSLine &)=delete
Assignment and copy constructor not implemented nor used.
const_iterator end() const
Iterator mechanics.
Definition: BDSLine.hh:77
virtual G4double GetChordLength() const
Override base class method as BDSAcceleratorComponent::chordLength etc variables are const and we app...
Definition: BDSLine.cc:39
size_t size() const
Size of line.
Definition: BDSLine.hh:83
BDSLineVector::iterator iterator
Iterator mechanics.
Definition: BDSLine.hh:72