9 #ifndef Tempus_StepperRKBase_hpp
10 #define Tempus_StepperRKBase_hpp
12 #include "Thyra_VectorBase.hpp"
14 #include "Tempus_config.hpp"
15 #include "Tempus_Stepper.hpp"
29 template<
class Scalar>
51 if (appAction == Teuchos::null) {
67 if (pl != Teuchos::null) {
79 "Error parsing general tableau. ParameterList is null.\n");
84 std::size_t numStages = 0;
85 int order = tableauPL->
get<
int>(
"order");
93 std::vector<std::string> A_row_tokens;
98 numStages = A_row_tokens.size();
101 A.shape(Teuchos::as<int>(numStages),Teuchos::as<int>(numStages));
104 for(std::size_t row=0;row<numStages;row++) {
106 std::vector<std::string> tokens;
109 std::vector<double> values;
113 "Error parsing A matrix, wrong number of stages in row "
116 for(std::size_t col=0;col<numStages;col++)
117 A(row,col) = values[col];
122 b.
size(Teuchos::as<int>(numStages));
123 c.
size(Teuchos::as<int>(numStages));
127 std::vector<std::string> tokens;
129 std::vector<double> values;
133 "Error parsing b vector, wrong number of stages.\n");
135 for(std::size_t i=0;i<numStages;i++)
141 std::vector<std::string> tokens;
143 std::vector<double> values;
147 "Error parsing c vector, wrong number of stages.\n");
149 for(std::size_t i=0;i<numStages;i++)
154 tableauPL->
get<std::string>(
"bstar") !=
"") {
155 bstar.
size(Teuchos::as<int>(numStages));
158 std::vector<std::string> tokens;
160 tokens, tableauPL->
get<std::string>(
"bstar"),
" ",
true);
161 std::vector<double> values;
165 "Error parsing bstar vector, wrong number of stages.\n"
166 " Number of RK stages = " << numStages <<
"\n"
167 " Number of bstar values = " << values.size() <<
"\n");
169 for(std::size_t i=0;i<numStages;i++)
170 bstar(i) = values[i];
173 "From ParameterList",A,b,c,order,order,order,bstar));
176 "From ParameterList",A,b,c,order,order,order));
201 #endif // Tempus_StepperRKBase_hpp
Teuchos::RCP< Thyra::VectorBase< Scalar > > sc
virtual void setAppAction(Teuchos::RCP< StepperRKAppAction< Scalar > > appAction)
virtual Teuchos::RCP< StepperRKAppAction< Scalar > > getAppAction() const
Teuchos::RCP< RKButcherTableau< Scalar > > tableau_
T & get(const std::string &name, T def_value)
virtual Scalar getOrderMin() const
virtual void setUseEmbedded(bool a)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void TokensToDoubles(std::vector< double > &values, const std::vector< std::string > &tokens)
Turn a vector of tokens into a vector of doubles.
virtual void setStageNumber(int s)
virtual Scalar getOrder() const
virtual void setStepperRKValues(Teuchos::RCP< Teuchos::ParameterList > pl)
Set StepperRK member data from the ParameterList.
bool isInitialized_
True if stepper's member data is initialized.
Teuchos::RCP< Thyra::VectorBase< Scalar > > ee_
Thyra Base interface for time steppers.
bool isParameter(const std::string &name) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Application Action for StepperRKBase.
virtual int getNumberOfStages() const
int stageNumber_
The current Runge-Kutta stage number, {0,...,s-1}. -1 indicates outside stage loop.
void validateParametersAndSetDefaults(ParameterList const &validParamList, int const depth=1000)
virtual int getStageNumber() const
virtual Teuchos::RCP< RKButcherTableau< Scalar > > createTableau(Teuchos::RCP< Teuchos::ParameterList > pl)
void setStepperValues(const Teuchos::RCP< Teuchos::ParameterList > pl)
Set Stepper member data from ParameterList.
Teuchos::RCP< Thyra::VectorBase< Scalar > > abs_u0
Teuchos::RCP< Thyra::VectorBase< Scalar > > abs_u
int size(OrdinalType length_in)
Default modifier for StepperRK.
virtual Scalar getOrderMax() const
void StringTokenizer(std::vector< std::string > &tokens, const std::string &str, const std::string delimiters, bool trim)
Tokenize a string, put tokens in a vector.
Teuchos::RCP< StepperRKAppAction< Scalar > > stepperRKAppAction_
virtual bool getUseEmbedded() const
virtual Teuchos::RCP< const RKButcherTableau< Scalar > > getTableau() const
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const