12 #include "Tempus_TimeEventRangeIndex.hpp"
14 namespace Tempus_Unit_Test {
18 using Teuchos::rcp_const_cast;
19 using Teuchos::rcp_dynamic_cast;
27 TEST_COMPARE(te->getName(), ==,
"TimeEventRangeIndex (0; 0; 1)");
38 TEST_COMPARE(te->timeToNextEvent(1.0), ==, te->getDefaultTime());
39 TEST_COMPARE(te->timeOfNextEvent(1.0), ==, te->getDefaultTime());
64 te->setName(
"TestName");
82 te->setIndexStride(2);
89 te->setIndexRange(-5, 5, 3);
101 te->setIndexStart(1);
107 te->setIndexStride(-1);
112 te->setIndexStride(5);
122 te->setIndexRange(-5, 5, 3);
143 te->setIndexRange(-5, 5, 3);
155 TEST_COMPARE(te->indexToNextEvent(4), ==, te->getDefaultIndex() - 4);
156 TEST_COMPARE(te->indexToNextEvent(8), ==, te->getDefaultIndex() - 8);
164 te->setIndexRange(-5, 5, 3);
176 TEST_COMPARE(te->indexOfNextEvent(4), ==, te->getDefaultIndex());
177 TEST_COMPARE(te->indexOfNextEvent(8), ==, te->getDefaultIndex());
185 te->setIndexRange(-5, 5, 3);
205 TEST_COMPARE(te->eventInRangeIndex(-5.0, -3), ==,
false);
206 TEST_COMPARE(te->eventInRangeIndex(-4.0, -3), ==,
false);
223 auto pl = teri->getValidParameters();
225 TEST_COMPARE(pl->get<std::string>(
"Type"), ==,
"Range Index");
227 "TimeEventRangeIndex (0; 0; 1)");
233 std::ostringstream unusedParameters;
234 pl->unused(unusedParameters);
245 Teuchos::parameterList(
"Time Event Range Index");
247 pl->
set(
"Name",
"Unit Test Time Event Range Index");
248 pl->
set(
"Type",
"Range Index");
249 pl->
set(
"Start Index", -1);
250 pl->
set(
"Stop Index", 11);
251 pl->
set(
"Stride Index", 2);
254 auto teri = Tempus::createTimeEventRangeIndex<double>(pl);
258 TEST_COMPARE(teri->getName(), ==,
"Unit Test Time Event Range Index");
TimeEventRangeIndex specifies a start, stop and stride index.
#define TEST_COMPARE(v1, comp, v2)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< TimeEventRange< Scalar > > createTimeEventRange(Teuchos::RCP< Teuchos::ParameterList > pList)
Nonmember Constructor via ParameterList.
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)