31 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
34 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStrategyType() !=
"Constant");
35 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStepType() !=
"Constant");
36 TEUCHOS_TEST_FOR_EXCEPT(tscs->getName() !=
"Constant");
37 TEST_FLOATING_EQUALITY (tscs->getConstantTimeStep(), 0.0, 1.0e-14);
40 tscs->setConstantTimeStep(0.989); tscs->initialize(); TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
42 TEST_FLOATING_EQUALITY (tscs->getConstantTimeStep(), 0.989, 1.0e-14);
52 0.123,
"Full_Construction_Test"));
53 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
55 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStrategyType() !=
"Constant");
56 TEUCHOS_TEST_FOR_EXCEPT(tscs->getStepType() !=
"Constant");
57 TEUCHOS_TEST_FOR_EXCEPT(tscs->getName() !=
"Full_Construction_Test");
58 TEST_FLOATING_EQUALITY (tscs->getConstantTimeStep(), 0.123, 1.0e-14);
66 auto pl = Tempus::getTimeStepControlStrategyConstantPL<double>();
69 pl->set<
double>(
"Time Step", 0.02);
71 auto tscsc = Tempus::createTimeStepControlStrategyConstant<double>(pl);
72 TEUCHOS_TEST_FOR_EXCEPT(!tscsc->isInitialized());
74 TEST_FLOATING_EQUALITY (tscsc->getConstantTimeStep(), 0.02, 1.0e-14);
83 TEUCHOS_TEST_FOR_EXCEPT(!tscs->isInitialized());
85 double initTime = 1.0;
89 auto model = rcp(
new Tempus_Test::SinCosModel<double>());
90 auto inArgsIC = model->getNominalValues();
91 auto icSolution = rcp_const_cast<Thyra::VectorBase<double> >(inArgsIC.get_x());
92 auto icState = Tempus::createSolutionStateX<double>(icSolution);
94 solutionHistory->addState(icState);
95 solutionHistory->getCurrentState()->setTimeStep(0.9);
96 solutionHistory->getCurrentState()->setTime(initTime);
97 solutionHistory->getCurrentState()->setIndex(initIndex);
101 tsc->setTimeStepControlStrategy(tscs);
102 tsc->setInitTime(initTime);
103 tsc->setFinalTime(100.0);
104 tsc->setMinTimeStep(0.01);
105 tsc->setInitTimeStep(0.02);
106 tsc->setMaxTimeStep(0.05);
107 tsc->setInitIndex(initIndex);
108 tsc->setFinalIndex(100);
110 TEUCHOS_TEST_FOR_EXCEPT(!tsc->isInitialized());
114 solutionHistory->initWorkingState();
116 tsc->setNextTimeStep(solutionHistory, status);
119 auto workingState = solutionHistory->getWorkingState();
120 TEST_FLOATING_EQUALITY( workingState->getTimeStep(), 0.02, 1.0e-14);
121 TEST_FLOATING_EQUALITY( workingState->getTime(), 1.02, 1.0e-14);
131 auto pl = tscsc->getValidParameters();
133 TEST_COMPARE ( pl->get<std::string>(
"Strategy Type"), ==,
"Constant");
134 TEST_FLOATING_EQUALITY( pl->get<
double>(
"Time Step"), 0.0, 1.0e-14);
137 std::ostringstream unusedParameters;
138 pl->unused(unusedParameters);
139 TEST_COMPARE ( unusedParameters.str(), ==,
"");
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...