OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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
5// sizes.
6//
7// Copyright (c) 2019 - 2021, Christof Metzger-Kraus
8//
9// All rights reserved
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
21#ifndef STEPSIZECONFIG_H
22#define STEPSIZECONFIG_H
23
25#include "Utility/Inform.h"
26
27#include <list>
28#include <tuple>
29
31public:
33
34 StepSizeConfig(const StepSizeConfig& right);
35
36 void operator=(const StepSizeConfig&) = delete;
37
38 void push_back(double dt, double zstop, unsigned long numSteps);
39
40 void sortAscendingZStop();
41
42 void resetIterator();
43
44 bool reachedStart() const;
45
46 bool reachedEnd() const;
47
48 void clear();
49
50 void reverseDirection();
51
52 StepSizeConfig& advanceToPos(double spos);
53
55
57
58 void shiftZStopRight(double front);
59
60 double getdT() const;
61
62 double getZStop() const;
63
64 unsigned long getNumSteps() const;
65
66 unsigned long long getMaxSteps() const;
67
68 unsigned long long getNumStepsFinestResolution() const;
69
70 double getMinTimeStep() const;
71
72 double getFinalZStop() const;
73
74 Inform& print(Inform& out) const;
75 void printDirect(Inform& out) const;
76
78
79private:
80 typedef std::tuple<double, double, unsigned long> entry_t;
81 typedef std::list<entry_t> container_t;
82
84 container_t::iterator it_m;
85};
86
87// Inform& operator<<(Inform& os, StepSizeConfig& s) {
88// return s.print(os);
89// }
90
91inline StepSizeConfig::StepSizeConfig() : configurations_m(), it_m(configurations_m.begin()) {}
92
94 : configurations_m(right.configurations_m), it_m(configurations_m.begin()) {}
95
96inline void StepSizeConfig::push_back(double dt, double zstop, unsigned long numSteps) {
97 configurations_m.push_back(std::make_tuple(dt, zstop, numSteps));
98}
99
101
102inline bool StepSizeConfig::reachedStart() const { return (it_m == configurations_m.begin()); }
103
104inline bool StepSizeConfig::reachedEnd() const { return (it_m == configurations_m.end()); }
105
107 configurations_m.clear();
108 it_m = configurations_m.begin();
109}
110
111#endif
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)
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