9 #ifndef Tempus_TimeStepControl_decl_hpp
10 #define Tempus_TimeStepControl_decl_hpp
13 #include "Teuchos_VerboseObject.hpp"
14 #include "Teuchos_Describable.hpp"
15 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
17 #include "Tempus_config.hpp"
18 #include "Tempus_SolutionHistory.hpp"
42 template<
class Scalar>
44 :
virtual public Teuchos::Describable,
45 virtual public Teuchos::ParameterListAcceptor,
46 virtual public Teuchos::VerboseObject<Tempus::TimeStepControl<Scalar> >
51 TimeStepControl(Teuchos::RCP<Teuchos::ParameterList> pList = Teuchos::null);
56 virtual void initialize(Teuchos::RCP<Teuchos::ParameterList> pList =
62 Status & integratorStatus);
85 void describe(Teuchos::FancyOStream &out,
86 const Teuchos::EVerbosityLevel verbLevel)
const;
92 {
return tscPL_->get<
double>(
"Initial Time"); }
94 {
return tscPL_->get<
double>(
"Final Time"); }
96 {
return tscPL_->get<
double>(
"Minimum Time Step"); }
98 {
return tscPL_->get<
double>(
"Initial Time Step"); }
100 {
return tscPL_->get<
double>(
"Maximum Time Step"); }
102 {
return tscPL_->get<
int> (
"Initial Time Index"); }
104 {
return tscPL_->get<
int> (
"Final Time Index"); }
106 {
return tscPL_->get<
double>(
"Maximum Absolute Error"); }
108 {
return tscPL_->get<
double>(
"Maximum Relative Error"); }
110 {
return tscPL_->get<
int> (
"Minimum Order"); }
112 {
return tscPL_->get<
int> (
"Initial Order"); }
114 {
return tscPL_->get<
int> (
"Maximum Order"); }
116 {
return tscPL_->get<std::string>(
"Integrator Step Type"); }
118 {
return tscPL_->get<
bool>(
"Output Exactly On Output Times"); }
124 {
return tscPL_->get<
int>(
"Maximum Number of Stepper Failures"); }
127 get<int>(
"Maximum Number of Consecutive Stepper Failures"); }
129 {
return tscPL_->get<
int>(
"Number of Time Steps"); }
130 virtual Teuchos::RCP<TimeStepControlStrategyComposite<Scalar>>
141 {
tscPL_->set<
double>(
"Initial Time" , InitTime ); }
143 {
tscPL_->set<
double>(
"Final Time" , FinalTime ); }
145 {
tscPL_->set<
double>(
"Minimum Time Step" , MinTimeStep ); }
147 {
tscPL_->set<
double>(
"Initial Time Step" , InitTimeStep); }
149 {
tscPL_->set<
double>(
"Maximum Time Step" , MaxTimeStep ); }
151 {
tscPL_->set<
int> (
"Initial Time Index" , InitIndex ); }
153 {
tscPL_->set<
int> (
"Final Time Index" , FinalIndex ); }
155 {
tscPL_->set<
double>(
"Maximum Absolute Error" , MaxAbsError ); }
157 {
tscPL_->set<
double>(
"Maximum Relative Error" , MaxRelError ); }
159 {
tscPL_->set<
int> (
"Minimum Order" , MinOrder ); }
161 {
tscPL_->set<
int> (
"Initial Order" , InitOrder ); }
163 {
tscPL_->set<
int> (
"Maximum Order" , MaxOrder ); }
165 {
tscPL_->set<std::string>(
"Integrator Step Type", StepType ); }
167 {
tscPL_->get<
bool>(
"Output Exactly On Output Times", OutputExactly); }
170 std::ostringstream ss;
171 std::copy(OutputIndices.begin(), OutputIndices.end()-1,
172 std::ostream_iterator<int>(ss,
","));
173 ss << OutputIndices.back();
174 tscPL_->set<std::string>(
"Output Index List", ss.str());
179 std::ostringstream ss;
180 ss << std::setprecision(16);
186 tscPL_->set<std::string>(
"Output Time List", ss.str());
189 {
tscPL_->set<
int>(
"Maximum Number of Stepper Failures", MaxFailures); }
192 (
"Maximum Number of Consecutive Stepper Failures", MaxConsecFailures); }
195 {
tscPL_->set<
int>(
"Output Index Interval",OutputIndexInterval);
198 {
tscPL_->set<
double>(
"Output Time Interval",OutputTimeInterval);
207 Teuchos::RCP<Teuchos::ParameterList>
tscPL_;
224 #endif // Tempus_TimeStepControl_decl_hpp
virtual Teuchos::RCP< TimeStepControlStrategyComposite< Scalar > > getTimeStepControlStrategy() const
virtual void setOutputTimes(std::vector< Scalar > OutputTimes)
virtual void setPrintDtChanges(bool printDtChanges)
virtual double getOutputTimeInterval()
virtual void setInitTimeStep(Scalar InitTimeStep)
virtual int getInitIndex() const
virtual void setFinalTime(Scalar FinalTime)
virtual void setOutputExactly(bool OutputExactly)
virtual void setNumTimeSteps(int numTimeSteps)
virtual Scalar getMaxRelError() const
Teuchos::RCP< TimeStepControlStrategyComposite< Scalar > > stepControlStrategy_
virtual ~TimeStepControl()
Destructor.
virtual void getNextTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory, Status &integratorStatus)
Determine the time step size.
virtual void setFinalIndex(int FinalIndex)
virtual Scalar getFinalTime() const
virtual void setInitIndex(int InitIndex)
std::string description() const
virtual int getOutputIndexInterval()
virtual void setMaxFailures(int MaxFailures)
virtual void setMinTimeStep(Scalar MinTimeStep)
virtual int getMaxConsecFailures() const
virtual Scalar getInitTimeStep() const
virtual void setOutputTimeInterval(double OutputTimeInterval)
virtual bool getPrintDtChanges() const
virtual int getMinOrder() const
virtual void setMaxOrder(int MaxOrder)
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
virtual void setStepType(std::string StepType)
virtual std::vector< Scalar > getOutputTimes() const
virtual bool getOutputExactly() const
virtual void initialize(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
virtual void setMaxTimeStep(Scalar MaxTimeStep)
virtual void setTimeStepControlStrategy(Teuchos::RCP< TimeStepControlStrategy< Scalar > > tscs=Teuchos::null)
Set the TimeStepControlStrategy.
Status
Status for the Integrator, the Stepper and the SolutionState.
virtual bool indexInRange(const int iStep) const
Check if time step index is within minimum and maximum index.
virtual Scalar getMaxAbsError() const
virtual int getFinalIndex() const
virtual void setMaxConsecFailures(int MaxConsecFailures)
Teuchos::RCP< Teuchos::ParameterList > tscPL_
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
double outputTimeInterval_
virtual Scalar getMaxTimeStep() const
virtual Scalar getMinTimeStep() const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
virtual void setOutputIndexInterval(int OutputIndexInterval)
virtual int getNumTimeSteps() const
virtual int getInitOrder() const
Scalar dtAfterOutput_
dt to reinstate after output step.
virtual void setMinOrder(int MinOrder)
virtual int getMaxOrder() const
virtual bool timeInRange(const Scalar time) const
Check if time is within minimum and maximum time.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
std::vector< Scalar > outputTimes_
Vector of output times.
virtual void setMaxAbsError(Scalar MaxAbsError)
virtual std::vector< int > getOutputIndices() const
virtual void setOutputIndices(std::vector< int > OutputIndices)
virtual void setMaxRelError(Scalar MaxRelError)
virtual void setInitTime(Scalar InitTime)
std::vector< int > outputIndices_
Vector of output indices.
StepControlStrategy class for TimeStepControl.
virtual Scalar getInitTime() const
virtual int getMaxFailures() const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
bool outputAdjustedDt_
Flag indicating that dt was adjusted for output.
virtual void setInitOrder(int InitOrder)
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
TimeStepControl(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Constructor.
virtual std::string getStepType() const