OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
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 Inform& print(Inform &out) const;
77 void printDirect(Inform &out) const;
78
80
81private:
82 typedef std::tuple<double, double, unsigned long> entry_t;
83 typedef std::list<entry_t> container_t;
84
86 container_t::iterator it_m;
87};
88
89//Inform& operator<<(Inform& os, StepSizeConfig& s) {
90// return s.print(os);
91//}
92
93
94inline
99
100inline
105
106inline
108 double zstop,
109 unsigned long numSteps) {
110 configurations_m.push_back(std::make_tuple(dt, zstop, numSteps));
111}
112
113inline
117
118inline
120 return (it_m == configurations_m.begin());
121}
122
123inline
125 return (it_m == configurations_m.end());
126}
127
128inline
130 configurations_m.clear();
131 it_m = configurations_m.begin();
132}
133
134#endif
PartBunch< T, Dim >::ConstIterator begin(PartBunch< T, Dim > const &bunch)
double getMinTimeStep() const
StepSizeConfig & advanceToPos(double spos)
bool reachedStart() const
void operator=(const StepSizeConfig &)=delete
StepSizeConfig & operator++()
Inform & print(Inform &out) const
double getdT() const
unsigned long long getNumStepsFinestResolution() const
void printDirect(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
ValueRange< double > getPathLengthRange() const
double getFinalZStop() const