WARPXM v1.10.0
Loading...
Searching...
No Matches
timestep_status.h
Go to the documentation of this file.
1#pragma once
2
3// std includes
4#include <limits>
5
6// wxm includes
7#include "warpxm/warpxm_config.h" // real type
9
21{
22public:
26 TimestepStatus() : _num_trys(0) {};
27
35 {
36 _td_try = _td_next;
37 _td_taken = _td_next;
38 _num_trys = 0;
39 }
40
50 {
51 _td_try = new_td;
52 _td_taken = new_td;
53 }
54
61 {
62 _td_taken = new_td;
63 }
64
71 {
72 _td_taken = _td_next;
73 }
74
81 {
82 _td_next = new_td;
83 }
84
89 {
90 _num_trys++;
91 }
92
97 {
98 return _td_try.getDt();
99 }
100
104 std::string* getTryExplanation() const
105 {
106 return _td_try.getExplanation().get();
107 }
108
113 {
114 return _td_taken.getDt();
115 }
116
121 {
122 return _td_taken;
123 }
124
128 std::string* getTakenExplanation() const
129 {
130 return _td_taken.getExplanation().get();
131 }
132
137 {
138 return _td_next.getDt();
139 }
140
145 {
146 return _td_taken.getConstraint().get();
147 }
148
152 std::string* getNextExplanation() const
153 {
154 return _td_next.getExplanation().get();
155 }
156
161 {
162 return _num_trys;
163 }
164
165private:
167 TimestepDecision _td_try;
168
170 TimestepDecision _td_taken;
171
173 TimestepDecision _td_next;
174
176 int _num_trys;
177};
Information that constrain the time step.
Definition: timestep_constraint.h:17
Encapsulates information necessary to communicate and explain a decision about what timestep should b...
Definition: timestep_decision.h:16
real getDt() const
The timestep that was decided upon.
Definition: timestep_decision.h:56
std::shared_ptr< std::string > getExplanation() const
An explanation for why this timestep was chosen.
Definition: timestep_decision.h:72
std::shared_ptr< TimestepConstraint > getConstraint() const
The most restrictive TimestepConstraint that informed the decision.
Definition: timestep_decision.h:64
Manages information about dt tried first, dt actually taken, and dt suggested for the next timestep,...
Definition: timestep_status.h:21
TimestepConstraint * getConstraint() const
Get TimestepConstraint for dt taken.
Definition: timestep_status.h:144
void bumpTdTaken()
For time step with a retryable failure, set _td_taken to _td_next.
Definition: timestep_status.h:70
real getDtNext() const
Get dt suggested for next time step.
Definition: timestep_status.h:136
void setTdTaken(TimestepDecision new_td)
Set td taken to be new value.
Definition: timestep_status.h:60
std::string * getTakenExplanation() const
Get explanation of dt taken.
Definition: timestep_status.h:128
real getDtToTry() const
Get dt to try.
Definition: timestep_status.h:96
int getNumTrys()
Get number of attempts this timestep.
Definition: timestep_status.h:160
std::string * getTryExplanation() const
Get explanation of dt taken.
Definition: timestep_status.h:104
void incrementTrys()
Increment number of trys.
Definition: timestep_status.h:88
TimestepDecision getTdTaken() const
Get TimestepDecision of time step taken.
Definition: timestep_status.h:120
TimestepStatus()
Create a new dt status object.
Definition: timestep_status.h:26
void setTdNext(TimestepDecision new_td)
Set suggeted td for next time step.
Definition: timestep_status.h:80
std::string * getNextExplanation() const
Get explanation of dt suggested for next time step.
Definition: timestep_status.h:152
real getDtTaken() const
Get dt taken.
Definition: timestep_status.h:112
void setTdToTry(TimestepDecision new_td)
Set TimestepDecision to try this time step.
Definition: timestep_status.h:49
void updateForNextStep()
Prepare for next time step.
Definition: timestep_status.h:34
#define real
Definition: wmoclunstructuredreconstruction.h:11