11 #include "Tempus_TimeEventRange.hpp"
13 static double PI = M_PI;
15 namespace Tempus_Unit_Test {
19 using Teuchos::rcp_const_cast;
20 using Teuchos::rcp_dynamic_cast;
28 TEST_COMPARE(te->getName(), ==,
"TimeEventRange (0; 0; 0)");
29 te->setName(
"TestName");
38 te->getRelTol(), std::numeric_limits<double>::epsilon() * 100.0, 1.0e-14);
40 te->getAbsTol(), std::numeric_limits<double>::epsilon() * 100.0, 1.0e-14);
63 -
PI / 2.0,
PI / 2.0,
PI / 4.0,
"teRange2",
true, 1.0e-14));
93 te->setRelTol(1.0e-14);
94 te->setLandOnExactly(
false);
96 te->setLandOnExactly(
true);
99 te->setTimeStart(1.0);
106 te->setTimeStop(4.0);
113 te->setTimeStride(0.5);
125 te->setTimeStart(1.0);
126 te->setTimeStop(4.0);
127 te->setTimeStride(0.5);
130 te->setTimeStride(-0.5);
137 te->setTimeStride(5.0);
144 te->setTimeStride(1.0e-14);
158 te->setTimeRange(0.0,
PI, 1.0);
170 te->setTimeRange(0.0,
PI, 1.0);
171 te->setRelTol(1.0e-14);
225 te->setTimeRange(0.0,
PI, 1.0);
226 te->setRelTol(1.0e-14);
257 te->getDefaultTime(),
262 te->getDefaultTime(),
265 te->getDefaultTime(),
274 te->setTimeRange(0.0,
PI, 1.0);
275 te->setRelTol(1.0e-14);
306 te->getDefaultTime(),
311 te->getDefaultTime(),
314 te->getDefaultTime(),
323 te->setTimeRange(0.0,
PI, 1.0);
324 te->setRelTol(1.0e-14);
340 TEST_COMPARE(te->eventInRange(0.5, 1.0 + -10.0e-14), ==,
352 TEST_COMPARE(te->eventInRange(2.5, 3.0 + -10.0e-14), ==,
376 TEST_COMPARE(te->eventInRange(1.0 + -10.0e-14, 1.5), ==,
388 TEST_COMPARE(te->eventInRange(3.0 + -10.0e-14, 4.0), ==,
406 auto pl = ter->getValidParameters();
408 TEST_COMPARE(pl->get<std::string>(
"Type"), ==,
"Range");
409 TEST_COMPARE(pl->get<std::string>(
"Name"), ==,
"TimeEventRange (0; 0; 0)");
415 std::numeric_limits<double>::epsilon() * 100.0,
417 TEST_COMPARE(pl->get<
bool>(
"Land On Exactly"), ==,
true);
420 std::ostringstream unusedParameters;
421 pl->unused(unusedParameters);
432 Teuchos::parameterList(
"Time Event Range");
434 pl->
set(
"Name",
"Unit Test Time Event Range");
435 pl->
set(
"Type",
"Range");
436 pl->
set(
"Start Time", -0.1);
437 pl->
set(
"Stop Time", 1.1);
438 pl->
set(
"Stride Time", 0.1);
439 pl->
set(
"Relative Tolerance", 1.0e-10);
440 pl->
set(
"Land On Exactly",
false);
443 auto ter = Tempus::createTimeEventRange<double>(pl);
447 TEST_COMPARE(ter->getName(), ==,
"Unit Test Time Event Range");
462 "SingleEventAtZero",
true));
#define TEST_COMPARE(v1, comp, v2)
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
TimeEventRange specifies a start, stop and stride time.
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)