12 #include "Teuchos_DefaultComm.hpp"
14 #include "Tempus_TimeEventList.hpp"
16 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
19 static double PI = M_PI;
21 namespace Tempus_Unit_Test {
25 using Teuchos::rcp_const_cast;
26 using Teuchos::rcp_dynamic_cast;
43 TEST_COMPARE(te->indexToNextEvent(1), ==, te->getDefaultIndex());
44 TEST_COMPARE(te->indexOfNextEvent(1), ==, te->getDefaultIndex());
53 std::vector<double> testVector;
54 testVector.push_back(-1.0);
55 testVector.push_back( 0.0);
56 testVector.push_back( 5.0);
57 testVector.push_back( 2.0);
58 testVector.push_back(
PI);
61 "TestName", testVector, 1.0e-14,
true));
67 auto testList = te->getTimeList();
70 TEST_FLOATING_EQUALITY(testList[1], 0.0, 1.0e-14);
71 TEST_FLOATING_EQUALITY(testList[2], 2.0, 1.0e-14);
72 TEST_FLOATING_EQUALITY(testList[3],
PI, 1.0e-14);
73 TEST_FLOATING_EQUALITY(testList[4], 5.0, 1.0e-14);
83 te->setName(
"TestName");
87 te->setRelTol(1.0e-14);
88 te->setLandOnExactly(
false);
102 auto testList = te->getTimeList();
105 TEST_FLOATING_EQUALITY(testList[1], 0.0, 1.0e-14);
106 TEST_FLOATING_EQUALITY(testList[2], 2.0, 1.0e-14);
107 TEST_FLOATING_EQUALITY(testList[3],
PI, 1.0e-14);
108 TEST_FLOATING_EQUALITY(testList[4], 5.0, 1.0e-14);
111 te->addTime( 2.0 + 1.0e-14);
113 te->addTime( 2.0 + 1.0e-13);
157 std::vector<double> testList;
158 testList.push_back( 0.0);
159 testList.push_back(
PI);
160 testList.push_back(-1.0);
161 testList.push_back( 2.0);
162 testList.push_back( 5.0);
165 "testList", testList, 1.0e-14,
true));
195 std::vector<double> testList;
196 testList.push_back( 0.0);
197 testList.push_back(
PI);
198 testList.push_back(-1.0);
199 testList.push_back( 2.0);
200 testList.push_back( 5.0);
203 "testList", testList, 1.0e-14,
true));
233 std::vector<double> testList;
234 testList.push_back( 0.0);
235 testList.push_back(
PI);
236 testList.push_back(-1.0);
237 testList.push_back( 2.0);
238 testList.push_back( 5.0);
241 "testList", testList, 1.0e-14,
true));
245 TEST_COMPARE(te->eventInRange(-2.0, -1.0 + -10.0e-14), ==,
false);
246 TEST_COMPARE(te->eventInRange(-2.0, -1.0 + -1.0e-14), ==, true );
247 TEST_COMPARE(te->eventInRange(-2.0, -1.0 + 0.0 ), ==, true );
248 TEST_COMPARE(te->eventInRange(-2.0, -1.0 + 1.0e-14), ==, true );
249 TEST_COMPARE(te->eventInRange(-2.0, -1.0 + 10.0e-14), ==, true );
257 TEST_COMPARE(te->eventInRange(4.5, 5.0 + -10.0e-14), ==,
false);
258 TEST_COMPARE(te->eventInRange(4.5, 5.0 + -1.0e-14), ==, true );
259 TEST_COMPARE(te->eventInRange(4.5, 5.0 + 0.0 ), ==, true );
260 TEST_COMPARE(te->eventInRange(4.5, 5.0 + 1.0e-14), ==, true );
261 TEST_COMPARE(te->eventInRange(4.5, 5.0 + 10.0e-14), ==, true );
264 TEST_COMPARE(te->eventInRange(-1.0 + -10.0e-14, -0.5), ==, true );
265 TEST_COMPARE(te->eventInRange(-1.0 + -1.0e-14, -0.5), ==, true );
266 TEST_COMPARE(te->eventInRange(-1.0 + 0.0 , -0.5), ==, true );
267 TEST_COMPARE(te->eventInRange(-1.0 + 1.0e-14, -0.5), ==, true );
268 TEST_COMPARE(te->eventInRange(-1.0 + 10.0e-14, -0.5), ==, false );
276 TEST_COMPARE(te->eventInRange(5.0 + -10.0e-14, 6.0), ==, true );
277 TEST_COMPARE(te->eventInRange(5.0 + -1.0e-14, 6.0), ==, true );
278 TEST_COMPARE(te->eventInRange(5.0 + 0.0 , 6.0), ==, true );
279 TEST_COMPARE(te->eventInRange(5.0 + 1.0e-14, 6.0), ==, true );
280 TEST_COMPARE(te->eventInRange(5.0 + 10.0e-14, 6.0), ==,
false);
#define TEST_COMPARE(v1, comp, v2)
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
TimeEventList specifies a list of time events.