10 #ifndef Tempus_StepperRKBase_hpp
11 #define Tempus_StepperRKBase_hpp
13 #include "Thyra_VectorBase.hpp"
15 #include "Tempus_config.hpp"
16 #include "Tempus_Stepper.hpp"
20 #include "Tempus_Stepper_ErrorNorm.hpp"
30 template <
class Scalar>
56 &errCalculator = Teuchos::null)
58 if (errCalculator != Teuchos::null) {
69 if (appAction == Teuchos::null) {
88 if (pl != Teuchos::null) {
100 pl == Teuchos::null, std::runtime_error,
101 "Error parsing general tableau. ParameterList is null.\n");
106 sublist(pl,
"Tableau",
true);
107 std::size_t numStages = 0;
108 int order = tableauPL->
get<
int>(
"order");
116 std::vector<std::string> A_row_tokens;
121 numStages = A_row_tokens.size();
124 A.shape(Teuchos::as<int>(numStages), Teuchos::as<int>(numStages));
127 for (std::size_t row = 0; row < numStages; row++) {
129 std::vector<std::string> tokens;
132 std::vector<double> values;
136 values.size() != numStages, std::runtime_error,
137 "Error parsing A matrix, wrong number of stages in row "
140 for (std::size_t col = 0; col < numStages; col++)
141 A(row, col) = values[col];
146 b.
size(Teuchos::as<int>(numStages));
147 c.
size(Teuchos::as<int>(numStages));
151 std::vector<std::string> tokens;
154 std::vector<double> values;
158 values.size() != numStages, std::runtime_error,
159 "Error parsing b vector, wrong number of stages.\n");
161 for (std::size_t i = 0; i < numStages; i++) b(i) = values[i];
166 std::vector<std::string> tokens;
169 std::vector<double> values;
173 values.size() != numStages, std::runtime_error,
174 "Error parsing c vector, wrong number of stages.\n");
176 for (std::size_t i = 0; i < numStages; i++) c(i) = values[i];
180 tableauPL->
get<std::string>(
"bstar") !=
"") {
181 bstar.
size(Teuchos::as<int>(numStages));
184 std::vector<std::string> tokens;
187 std::vector<double> values;
191 values.size() != numStages, std::runtime_error,
192 "Error parsing bstar vector, wrong number of stages.\n"
193 <<
" Number of RK stages = " << numStages
194 <<
"\n Number of bstar values = "
195 << values.size() <<
"\n");
197 for (std::size_t i = 0; i < numStages; i++) bstar(i) = values[i];
200 order, order, order, bstar));
204 order, order, order));
231 #endif // Tempus_StepperRKBase_hpp
Teuchos::RCP< Thyra::VectorBase< Scalar > > sc
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
virtual void setAppAction(Teuchos::RCP< StepperRKAppAction< Scalar >> appAction)
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
Stepper_ErrorNorm provides error norm calcualtions for variable time stepping.
int size(OrdinalType length_in)
Default modifier for StepperRK.
virtual void setErrorNorm(const Teuchos::RCP< Stepper_ErrorNorm< Scalar >> &errCalculator=Teuchos::null)
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_
Teuchos::RCP< Stepper_ErrorNorm< Scalar > > stepperErrorNormCalculator_
virtual bool getUseEmbedded() const
virtual Teuchos::RCP< const RKButcherTableau< Scalar > > getTableau() const
virtual void setEmbeddedMemory()
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const