OPAL (Object Oriented Parallel Accelerator Library)  2024.1
OPAL
StepSizeConfig.h
Go to the documentation of this file.
1 //
2 // Class StepSizeConfig
3 //
4 // This class stores tuples of time step sizes, path length range limits and limit of number of step sizes.
5 //
6 // Copyright (c) 2019 - 2021, Christof Metzger-Kraus
7 //
8 // All rights reserved
9 //
10 // This file is part of OPAL.
11 //
12 // OPAL is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with OPAL. If not, see <https://www.gnu.org/licenses/>.
19 //
20 #ifndef STEPSIZECONFIG_H
21 #define STEPSIZECONFIG_H
22 
23 #include "Structure/ValueRange.h"
24 #include "Utility/Inform.h"
25 
26 #include <list>
27 #include <tuple>
28 
30 public:
32 
33  StepSizeConfig(const StepSizeConfig &right);
34 
35  void operator=(const StepSizeConfig &) = delete;
36 
37  void push_back(double dt,
38  double zstop,
39  unsigned long numSteps);
40 
41  void sortAscendingZStop();
42 
43  void resetIterator();
44 
45  bool reachedStart() const;
46 
47  bool reachedEnd() const;
48 
49  void clear();
50 
51  void reverseDirection();
52 
53  StepSizeConfig& advanceToPos(double spos);
54 
56 
58 
59  void shiftZStopRight(double front);
60  void shiftZStopLeft(double back);
61 
62  double getdT() const;
63 
64  double getZStop() const;
65 
66  unsigned long getNumSteps() const;
67 
68  unsigned long long getMaxSteps() const;
69 
70  unsigned long long getNumStepsFinestResolution() const;
71 
72  double getMinTimeStep() const;
73 
74  double getFinalZStop() const;
75 
76  void print(Inform &out) const;
77 
79 
80 private:
81  typedef std::tuple<double, double, unsigned long> entry_t;
82  typedef std::list<entry_t> container_t;
83 
86 };
87 
88 inline
90  configurations_m(),
91  it_m(configurations_m.begin())
92 { }
93 
94 inline
96  configurations_m(right.configurations_m),
97  it_m(configurations_m.begin())
98 { }
99 
100 inline
102  double zstop,
103  unsigned long numSteps) {
104  configurations_m.push_back(std::make_tuple(dt, zstop, numSteps));
105 }
106 
107 inline
109  it_m = configurations_m.begin();
110 }
111 
112 inline
114  return (it_m == configurations_m.begin());
115 }
116 
117 inline
119  return (it_m == configurations_m.end());
120 }
121 
122 inline
124  configurations_m.clear();
125  it_m = configurations_m.begin();
126 }
127 
128 #endif
std::list< entry_t > container_t
double getZStop() const
double getFinalZStop() const
void sortAscendingZStop()
bool reachedEnd() const
ValueRange< double > getPathLengthRange() const
container_t configurations_m
container_t::iterator it_m
void print(Inform &out) const
StepSizeConfig & advanceToPos(double spos)
clearpage the user may choose between constant or variable radius This model includes fringe fields begin
Definition: multipole_t.tex:6
std::string::iterator iterator
Definition: MSLang.h:15
StepSizeConfig & operator++()
void push_back(double dt, double zstop, unsigned long numSteps)
StepSizeConfig & operator--()
Definition: Inform.h:42
unsigned long long getMaxSteps() const
unsigned long long getNumStepsFinestResolution() const
double getdT() const
double getMinTimeStep() const
void shiftZStopLeft(double back)
unsigned long getNumSteps() const
bool reachedStart() const
std::tuple< double, double, unsigned long > entry_t
void shiftZStopRight(double front)
void operator=(const StepSizeConfig &)=delete