12 #include "Teuchos_DefaultComm.hpp"
14 #include "Tempus_TimeEventListIndex.hpp"
16 #include "../TestUtils/Tempus_ConvergenceTestUtils.hpp"
19 namespace Tempus_Unit_Test {
23 using Teuchos::rcp_const_cast;
24 using Teuchos::rcp_dynamic_cast;
38 TEST_COMPARE(te->isIndex(te->getDefaultIndex()), ==,
true );
39 TEST_COMPARE(te->isIndex( 1), ==,
false);
41 TEST_COMPARE(te->indexToNextEvent(0), ==, te->getDefaultIndex());
42 TEST_COMPARE(te->indexOfNextEvent(0), ==, te->getDefaultIndex());
43 TEST_COMPARE(te->eventInRangeIndex(2, -1), ==,
false);
46 TEST_COMPARE(te->isTime(1.0), ==,
false);
47 TEST_COMPARE(te->timeToNextEvent(1.0), ==, te->getDefaultTime());
48 TEST_COMPARE(te->timeOfNextEvent(1.0), ==, te->getDefaultTime());
49 TEST_COMPARE(te->eventInRange(1.0, 4.0), ==,
false);
57 std::vector<int> testVector;
58 testVector.push_back(-2);
59 testVector.push_back( 0);
60 testVector.push_back( 7);
61 testVector.push_back( 3);
62 testVector.push_back(-5);
65 "TestName", testVector));
69 auto testList = te->getIndexList();
72 TEST_COMPARE(testList[1], ==, -2);
73 TEST_COMPARE(testList[2], ==, 0);
74 TEST_COMPARE(testList[3], ==, 3);
75 TEST_COMPARE(testList[4], ==, 7);
79 TEST_COMPARE(te->getIndexList().size(), ==, 5);
81 TEST_COMPARE(te->getIndexList().size(), ==, 6);
91 te->setName(
"TestName");
110 auto testList = te->getIndexList();
113 TEST_COMPARE(testList[1], ==, -5);
114 TEST_COMPARE(testList[2], ==, -2);
115 TEST_COMPARE(testList[3], ==, 1);
116 TEST_COMPARE(testList[4], ==, 4);
124 std::vector<int> testListIndex;
125 testListIndex.push_back(-5);
126 testListIndex.push_back( 1);
127 testListIndex.push_back(-2);
128 testListIndex.push_back( 4);
129 testListIndex.push_back(-9);
132 "teListIndex", testListIndex));
156 std::vector<int> testListIndex;
157 testListIndex.push_back(-5);
158 testListIndex.push_back( 1);
159 testListIndex.push_back(-2);
160 testListIndex.push_back( 4);
161 testListIndex.push_back(-9);
164 "teListIndex", testListIndex));
188 std::vector<int> testListIndex;
189 testListIndex.push_back(-5);
190 testListIndex.push_back( 1);
191 testListIndex.push_back(-2);
192 testListIndex.push_back( 4);
193 testListIndex.push_back(-9);
196 "teListIndex", testListIndex));
200 TEST_COMPARE(te->eventInRangeIndex(-12.0, -10), ==,
false);
201 TEST_COMPARE(te->eventInRangeIndex(-12.0, -9), ==, true );
202 TEST_COMPARE(te->eventInRangeIndex(-12.0, -8), ==, true );
213 TEST_COMPARE(te->eventInRangeIndex(-12, -7), ==, true );
214 TEST_COMPARE(te->eventInRangeIndex( -9, -7), ==, true );
215 TEST_COMPARE(te->eventInRangeIndex( -8, -7), ==,
false);
TimeEventListIndex specifies a list of index events.
#define TEST_COMPARE(v1, comp, v2)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)