187 Teuchos::RCP<Teuchos::ParameterList>
const& pList,
188 std::string name =
"Composite")
190 using Teuchos::ParameterList;
193 std::vector<std::string> tscsList;
195 TEUCHOS_TEST_FOR_EXCEPTION(
196 pList->get<std::string>(
"Strategy Type") !=
"Composite", std::logic_error,
197 "Error - Strategy Type != 'Composite'. (='" +
198 pList->get<std::string>(
"Strategy Type") +
"')\n");
202 std::string str = pList->get<std::string>(
"Strategy List");
203 std::string delimiters(
",");
204 const char* WhiteSpace =
" \t\v\r\n";
206 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
208 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
209 while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
211 std::string token = str.substr(lastPos, pos - lastPos);
213 std::size_t start = token.find_first_not_of(WhiteSpace);
214 std::size_t end = token.find_last_not_of(WhiteSpace);
216 (start == end ? std::string() : token.substr(start, end - start + 1));
218 tscsList.push_back(token);
219 if (pos == std::string::npos)
break;
221 lastPos = str.find_first_not_of(delimiters, pos);
222 pos = str.find_first_of(delimiters, lastPos);
228 for (
auto tscsName : tscsList) {
229 RCP<ParameterList> pl =
230 Teuchos::rcp(
new ParameterList(pList->sublist(tscsName,
true)));
232 auto strategyType = pl->get<std::string>(
"Strategy Type",
"Unknown");
233 if (strategyType ==
"Constant") {
235 createTimeStepControlStrategyConstant<Scalar>(pl, tscsName));
237 else if (strategyType ==
"Basic VS") {
239 createTimeStepControlStrategyBasicVS<Scalar>(pl, tscsName));
241 else if (strategyType ==
"Integral Controller") {
243 createTimeStepControlStrategyIntegralController<Scalar>(pl,
246 else if (strategyType ==
"Composite") {
248 createTimeStepControlStrategyComposite<Scalar>(pl, tscsName));
251 RCP<Teuchos::FancyOStream> out =
252 Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
253 out->setOutputToRootOnly(0);
254 Teuchos::OSTab ostab(out, 1,
"createTimeStepControlStrategyComposite()");
255 *out <<
"Warning -- Unknown strategy type!\n"
256 <<
"'Strategy Type' = '" << strategyType <<
"'\n"
257 <<
"Should call addStrategy() with this\n"
258 <<
"(app-specific?) strategy, and initialize().\n"
263 tscsc->setName(name);
265 if (tscsc->size() == 0) {
266 RCP<Teuchos::FancyOStream> out =
267 Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
268 out->setOutputToRootOnly(0);
269 Teuchos::OSTab ostab(out, 1,
"createTimeStepControlStrategyComposite()");
270 *out <<
"Warning -- Did not find a Tempus strategy to create!\n"
271 <<
"Should call addStrategy() with (app-specific?) strategy(ies),\n"
272 <<
"and initialize().\n"
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...