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);
59 virtual void initialize(Teuchos::RCP<Teuchos::ParameterList> pList =
65 Status & integratorStatus);
88 void describe(Teuchos::FancyOStream &out,
89 const Teuchos::EVerbosityLevel verbLevel)
const;
95 {
return tscPL_->get<
double>(
"Initial Time"); }
97 {
return tscPL_->get<
double>(
"Final Time"); }
99 {
return tscPL_->get<
double>(
"Minimum Time Step"); }
101 {
return tscPL_->get<
double>(
"Initial Time Step"); }
103 {
return tscPL_->get<
double>(
"Maximum Time Step"); }
105 {
return tscPL_->get<
int> (
"Initial Time Index"); }
107 {
return tscPL_->get<
int> (
"Final Time Index"); }
109 {
return tscPL_->get<
double>(
"Maximum Absolute Error"); }
111 {
return tscPL_->get<
double>(
"Maximum Relative Error"); }
113 {
return tscPL_->get<
int> (
"Minimum Order"); }
115 {
return tscPL_->get<
int> (
"Initial Order"); }
117 {
return tscPL_->get<
int> (
"Maximum Order"); }
119 {
return tscPL_->get<std::string>(
"Integrator Step Type"); }
121 {
return tscPL_->get<
bool>(
"Output Exactly On Output Times"); }
127 {
return tscPL_->get<
int>(
"Maximum Number of Stepper Failures"); }
130 get<int>(
"Maximum Number of Consecutive Stepper Failures"); }
132 {
return tscPL_->get<
int>(
"Number of Time Steps"); }
133 virtual Teuchos::RCP<TimeStepControlStrategyComposite<Scalar>>
140 {
tscPL_->set<
double>(
"Initial Time" , InitTime ); }
142 {
tscPL_->set<
double>(
"Final Time" , FinalTime ); }
144 {
tscPL_->set<
double>(
"Minimum Time Step" , MinTimeStep ); }
146 {
tscPL_->set<
double>(
"Initial Time Step" , InitTimeStep); }
148 {
tscPL_->set<
double>(
"Maximum Time Step" , MaxTimeStep ); }
150 {
tscPL_->set<
int> (
"Initial Time Index" , InitIndex ); }
152 {
tscPL_->set<
int> (
"Final Time Index" , FinalIndex ); }
154 {
tscPL_->set<
double>(
"Maximum Absolute Error" , MaxAbsError ); }
156 {
tscPL_->set<
double>(
"Maximum Relative Error" , MaxRelError ); }
158 {
tscPL_->set<
int> (
"Minimum Order" , MinOrder ); }
160 {
tscPL_->set<
int> (
"Initial Order" , InitOrder ); }
162 {
tscPL_->set<
int> (
"Maximum Order" , MaxOrder ); }
164 {
tscPL_->set<std::string>(
"Integrator Step Type", StepType ); }
166 {
tscPL_->get<
bool>(
"Output Exactly On Output Times", OutputExactly); }
169 std::ostringstream ss;
170 std::copy(OutputIndices.begin(), OutputIndices.end()-1,
171 std::ostream_iterator<int>(ss,
","));
172 ss << OutputIndices.back();
173 tscPL_->set<std::string>(
"Output Index List", ss.str());
177 std::ostringstream ss;
178 std::copy(OutputTimes.begin(), OutputTimes.end()-1,
179 std::ostream_iterator<Scalar>(ss,
","));
180 ss << OutputTimes.back();
181 tscPL_->set<std::string>(
"Output Time List", ss.str());
184 {
tscPL_->set<
int>(
"Maximum Number of Stepper Failures", MaxFailures); }
187 (
"Maximum Number of Consecutive Stepper Failures", MaxConsecFailures); }
193 Teuchos::RCP<Teuchos::ParameterList>
tscPL_;
206 #endif // Tempus_TimeStepControl_decl_hpp
virtual Teuchos::RCP< TimeStepControlStrategyComposite< Scalar > > getTimeStepControlStrategy() const
virtual void setOutputTimes(std::vector< Scalar > OutputTimes)
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 void setMaxFailures(int MaxFailures)
virtual void setMinTimeStep(Scalar MinTimeStep)
virtual int getMaxConsecFailures() const
virtual Scalar getInitTimeStep() 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_
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual Scalar getMaxTimeStep() const
virtual Scalar getMinTimeStep() const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
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