OPAL (Object Oriented Parallel Accelerator Library) 2022.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
24#include "Utility/Inform.h"
25
26#include <list>
27#include <tuple>
28
30public:
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
80private:
81 typedef std::tuple<double, double, unsigned long> entry_t;
82 typedef std::list<entry_t> container_t;
83
86};
87
88inline
90 configurations_m(),
91 it_m(configurations_m.begin())
92{ }
93
94inline
96 configurations_m(right.configurations_m),
97 it_m(configurations_m.begin())
98{ }
99
100inline
102 double zstop,
103 unsigned long numSteps) {
104 configurations_m.push_back(std::make_tuple(dt, zstop, numSteps));
105}
106
107inline
109 it_m = configurations_m.begin();
110}
111
112inline
114 return (it_m == configurations_m.begin());
115}
116
117inline
119 return (it_m == configurations_m.end());
120}
121
122inline
124 configurations_m.clear();
125 it_m = configurations_m.begin();
126}
127
128#endif
PartBunchBase< T, Dim >::ConstIterator begin(PartBunchBase< T, Dim > const &bunch)
std::string::iterator iterator
Definition: MSLang.h:16
double getMinTimeStep() const
StepSizeConfig & advanceToPos(double spos)
bool reachedStart() const
void operator=(const StepSizeConfig &)=delete
StepSizeConfig & operator++()
double getdT() const
unsigned long long getNumStepsFinestResolution() const
void print(Inform &out) const
container_t::iterator it_m
void shiftZStopRight(double front)
void shiftZStopLeft(double back)
std::list< entry_t > container_t
double getZStop() const
void push_back(double dt, double zstop, unsigned long numSteps)
bool reachedEnd() const
unsigned long getNumSteps() const
unsigned long long getMaxSteps() const
container_t configurations_m
StepSizeConfig & operator--()
std::tuple< double, double, unsigned long > entry_t
void sortAscendingZStop()
ValueRange< double > getPathLengthRange() const
double getFinalZStop() const
Definition: Inform.h:42