13 #include "Tempus_TimeEventRange.hpp"
14 #include "Tempus_TimeEventRangeIndex.hpp"
15 #include "Tempus_TimeEventList.hpp"
16 #include "Tempus_TimeEventListIndex.hpp"
18 static double PI = M_PI;
20 namespace Tempus_Unit_Test {
24 using Teuchos::rcp_const_cast;
25 using Teuchos::rcp_dynamic_cast;
32 0.0,
PI, 1.0,
"teRange1",
true, 1.0e-14));
39 -
PI / 2.0,
PI / 2.0,
PI / 4.0,
"teRange2",
true, 1.0e-14));
46 4.0, 10.0, 4.0,
"teRange3",
true, 1.0e-14));
54 std::vector<double> testList1;
55 testList1.push_back(-1.0);
56 testList1.push_back(0.0);
57 testList1.push_back(5.0);
58 testList1.push_back(2.0);
59 testList1.push_back(
PI);
68 std::vector<double> testList2;
69 testList2.push_back(-0.5);
70 testList2.push_back(1.25);
71 testList2.push_back(4.95);
72 testList2.push_back(12.34);
81 std::vector<double> testList3;
82 testList3.push_back(-5.0);
83 testList3.push_back(-
PI);
103 return teRangeIndex2;
110 return teRangeIndex3;
117 std::vector<int> testListIndex1;
118 testListIndex1.push_back(-2);
119 testListIndex1.push_back(0);
120 testListIndex1.push_back(7);
121 testListIndex1.push_back(3);
122 testListIndex1.push_back(-5);
124 auto teListIndex1 =
rcp(
131 std::vector<int> testListIndex2;
132 testListIndex2.push_back(2);
134 auto teListIndex2 =
rcp(
141 std::vector<int> testListIndex3;
142 testListIndex3.push_back(14);
143 testListIndex3.push_back(9);
145 auto teListIndex3 =
rcp(
167 TEST_COMPARE(tec->indexToNextEvent(0), ==, tec->getDefaultIndex());
168 TEST_COMPARE(tec->indexOfNextEvent(0), ==, tec->getDefaultIndex());
171 auto timeEvents = tec->getTimeEvents();
179 std::vector<Teuchos::RCP<Tempus::TimeEventBase<double> > > timeEvents;
186 timeEvents,
"Test TimeEventComposite"));
190 TEST_COMPARE(tec->getName(), ==,
"Test TimeEventComposite");
206 TEST_COMPARE(tec->indexToNextEvent(9), ==, tec->getDefaultIndex() - 9);
217 TEST_COMPARE(tec->indexOfNextEvent(9), ==, tec->getDefaultIndex());
225 TEST_COMPARE(tec->eventInRangeIndex(-8, -6), ==,
false);
229 TEST_COMPARE(tec->eventInRangeIndex(12, 14), ==,
false);
231 timeEvents = tec->getTimeEvents();
239 std::vector<Teuchos::RCP<Tempus::TimeEventBase<double> > > timeEvents;
247 tec->setTimeEvents(timeEvents);
249 auto timeEventsSet = tec->getTimeEvents();
268 auto timeEvents = tec->getTimeEvents();
289 auto timeEvents = tec->getTimeEvents();
319 auto timeEvents = tec->getTimeEvents();
338 auto timeEvents = tec->getTimeEvents();
359 auto timeEvents = tec->getTimeEvents();
388 auto timeEvents = tec->getTimeEvents();
399 tec->add(teRangeIndex1);
407 auto timeEvents = tec->getTimeEvents();
419 tec->add(teRangeIndex1);
420 tec->add(teRangeIndex2);
428 auto timeEvents = tec->getTimeEvents();
440 tec->add(teRangeIndex3);
441 tec->add(teRangeIndex2);
448 TEST_COMPARE(tec->indexOfNextEvent(16), ==, tec->getDefaultIndex());
449 TEST_COMPARE(tec->eventInRangeIndex(-3, -2), ==,
false);
454 TEST_COMPARE(tec->eventInRangeIndex(10, 13), ==,
false);
457 auto timeEvents = tec->getTimeEvents();
468 tec->add(teListIndex1);
476 auto timeEvents = tec->getTimeEvents();
488 tec->add(teListIndex1);
489 tec->add(teListIndex2);
497 auto timeEvents = tec->getTimeEvents();
509 tec->add(teListIndex3);
510 tec->add(teListIndex2);
516 TEST_COMPARE(tec->indexOfNextEvent(19), ==, tec->getDefaultIndex());
519 TEST_COMPARE(tec->eventInRangeIndex(15, 20), ==,
false);
521 auto timeEvents = tec->getTimeEvents();
537 tec->add(teRangeIndex1);
538 tec->add(teListIndex1);
555 TEST_COMPARE(tec->indexToNextEvent(9), ==, tec->getDefaultIndex() - 9);
566 TEST_COMPARE(tec->indexOfNextEvent(9), ==, tec->getDefaultIndex());
574 TEST_COMPARE(tec->eventInRangeIndex(-8, -6), ==,
false);
578 TEST_COMPARE(tec->eventInRangeIndex(12, 14), ==,
false);
580 auto timeEvents = tec->getTimeEvents();
596 tec->add(teRangeIndex1);
597 tec->add(teListIndex1);
601 std::vector<Teuchos::RCP<Tempus::TimeEventBase<double> > > teCons;
607 TEST_COMPARE(tec->isTime(-1.0, teCons), ==,
true);
608 TEST_COMPARE(teCons.size(), ==, 1);
609 TEST_COMPARE(teCons[0]->getName(), ==,
"teList1");
611 TEST_COMPARE(tec->isIndex(2, teCons), ==,
true);
612 TEST_COMPARE(teCons.size(), ==, 1);
613 TEST_COMPARE(teCons[0]->getName(), ==,
"teRangeIndex1");
615 TEST_COMPARE(tec->isIndex(-2, teCons), ==,
true);
616 TEST_COMPARE(teCons.size(), ==, 1);
617 TEST_COMPARE(teCons[0]->getName(), ==,
"teListIndex1");
620 TEST_COMPARE(teCons.size(), ==, 1);
621 TEST_COMPARE(teCons[0]->getName(), ==,
"teList1");
624 TEST_COMPARE(teCons.size(), ==, 1);
625 TEST_COMPARE(teCons[0]->getName(), ==,
"teRange1");
628 TEST_COMPARE(teCons.size(), ==, 1);
629 TEST_COMPARE(teCons[0]->getName(), ==,
"teList1");
632 tec->getDefaultTime(), 1.0e-14);
633 TEST_COMPARE(teCons.size(), ==, 0);
635 TEST_COMPARE(tec->indexToNextEvent(-6, teCons), ==, 1);
636 TEST_COMPARE(teCons.size(), ==, 1);
637 TEST_COMPARE(teCons[0]->getName(), ==,
"teListIndex1");
639 TEST_COMPARE(tec->indexToNextEvent(1, teCons), ==, 1);
640 TEST_COMPARE(teCons.size(), ==, 1);
641 TEST_COMPARE(teCons[0]->getName(), ==,
"teRangeIndex1");
643 TEST_COMPARE(tec->indexToNextEvent(7, teCons), ==, 1);
644 TEST_COMPARE(teCons.size(), ==, 1);
645 TEST_COMPARE(teCons[0]->getName(), ==,
"teRangeIndex1");
647 TEST_COMPARE(tec->indexToNextEvent(9, teCons), ==,
648 tec->getDefaultIndex() - 9);
649 TEST_COMPARE(teCons.size(), ==, 0);
652 TEST_COMPARE(teCons.size(), ==, 1);
653 TEST_COMPARE(teCons[0]->getName(), ==,
"teList1");
656 TEST_COMPARE(teCons.size(), ==, 2);
657 TEST_COMPARE(teCons[0]->getName(), ==,
"teRange1");
658 TEST_COMPARE(teCons[1]->getName(), ==,
"teList1");
661 TEST_COMPARE(teCons.size(), ==, 1);
662 TEST_COMPARE(teCons[0]->getName(), ==,
"teRange1");
665 tec->getDefaultTime(), 1.0e-14);
666 TEST_COMPARE(teCons.size(), ==, 0);
668 TEST_COMPARE(tec->indexOfNextEvent(-6, teCons), ==, -5);
669 TEST_COMPARE(teCons.size(), ==, 1);
670 TEST_COMPARE(teCons[0]->getName(), ==,
"teListIndex1");
672 TEST_COMPARE(tec->indexOfNextEvent(1, teCons), ==, 2);
673 TEST_COMPARE(teCons.size(), ==, 1);
674 TEST_COMPARE(teCons[0]->getName(), ==,
"teRangeIndex1");
676 TEST_COMPARE(tec->indexOfNextEvent(7, teCons), ==, 8);
677 TEST_COMPARE(teCons.size(), ==, 1);
678 TEST_COMPARE(teCons[0]->getName(), ==,
"teRangeIndex1");
680 TEST_COMPARE(tec->indexOfNextEvent(9, teCons), ==, tec->getDefaultIndex());
681 TEST_COMPARE(teCons.size(), ==, 0);
683 TEST_COMPARE(tec->eventInRange(-5.0, -2.0, teCons), ==,
false);
684 TEST_COMPARE(teCons.size(), ==, 0);
685 TEST_COMPARE(tec->eventInRange(-2.0, -0.5, teCons), ==,
true);
686 TEST_COMPARE(teCons.size(), ==, 1);
687 TEST_COMPARE(tec->eventInRange(1.2, 1.8, teCons), ==,
false);
688 TEST_COMPARE(teCons.size(), ==, 0);
689 TEST_COMPARE(tec->eventInRange(3.1, 4.0, teCons), ==,
true);
690 TEST_COMPARE(teCons.size(), ==, 1);
691 TEST_COMPARE(tec->eventInRange(4.5, 6.0, teCons), ==,
true);
692 TEST_COMPARE(teCons.size(), ==, 1);
694 TEST_COMPARE(tec->eventInRangeIndex(-8, -6, teCons), ==,
false);
695 TEST_COMPARE(teCons.size(), ==, 0);
696 TEST_COMPARE(tec->eventInRangeIndex(1, 1, teCons), ==,
false);
697 TEST_COMPARE(teCons.size(), ==, 0);
698 TEST_COMPARE(tec->eventInRangeIndex(5, 7, teCons), ==,
true);
699 TEST_COMPARE(teCons.size(), ==, 1);
700 TEST_COMPARE(tec->eventInRangeIndex(8, 10, teCons), ==,
false);
701 TEST_COMPARE(teCons.size(), ==, 0);
702 TEST_COMPARE(tec->eventInRangeIndex(12, 14, teCons), ==,
false);
703 TEST_COMPARE(teCons.size(), ==, 0);
705 auto timeEvents = tec->getTimeEvents();
706 TEST_COMPARE(timeEvents.size(), ==, 4);
719 std::vector<double> testList1;
720 testList1.push_back(0.0);
721 testList1.push_back(4.0);
722 testList1.push_back(5.0);
723 testList1.push_back(9.0);
724 testList1.push_back(20.0);
728 std::vector<double> testList2;
729 testList2.push_back(0.0);
730 testList2.push_back(3.0);
731 testList2.push_back(5.0);
732 testList2.push_back(13.0);
733 testList2.push_back(20.0);
742 std::vector<int> testListIndex1;
743 testListIndex1.push_back(0);
744 testListIndex1.push_back(40);
745 testListIndex1.push_back(50);
746 testListIndex1.push_back(90);
747 testListIndex1.push_back(200);
751 std::vector<int> testListIndex2;
752 testListIndex2.push_back(0);
753 testListIndex2.push_back(30);
754 testListIndex2.push_back(50);
755 testListIndex2.push_back(130);
756 testListIndex2.push_back(200);
773 std::vector<Teuchos::RCP<Tempus::TimeEventBase<double> > > teCons;
778 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
779 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
780 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
782 TEST_COMPARE(tec->isTime(5.0, teCons), ==,
true);
783 TEST_COMPARE(teCons.size(), ==, 3);
784 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
785 TEST_COMPARE(teCons[1]->getName(), ==,
"tel1");
786 TEST_COMPARE(teCons[2]->getName(), ==,
"tel2");
788 TEST_COMPARE(tec->isTime(10.0, teCons), ==,
true);
789 TEST_COMPARE(teCons.size(), ==, 2);
790 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
791 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
793 TEST_COMPARE(tec->isTime(20.0, teCons), ==,
true);
794 TEST_COMPARE(teCons.size(), ==, 4);
795 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
796 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
797 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
798 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
800 TEST_COMPARE(tec->isIndex(0, teCons), ==,
true);
801 TEST_COMPARE(teCons.size(), ==, 4);
802 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
803 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
804 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
805 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
807 TEST_COMPARE(tec->isIndex(50, teCons), ==,
true);
808 TEST_COMPARE(teCons.size(), ==, 3);
809 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
810 TEST_COMPARE(teCons[1]->getName(), ==,
"teli1");
811 TEST_COMPARE(teCons[2]->getName(), ==,
"teli2");
813 TEST_COMPARE(tec->isIndex(100, teCons), ==,
true);
814 TEST_COMPARE(teCons.size(), ==, 2);
815 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
816 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
818 TEST_COMPARE(tec->isIndex(200, teCons), ==,
true);
819 TEST_COMPARE(teCons.size(), ==, 4);
820 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
821 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
822 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
823 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
826 TEST_COMPARE(teCons.size(), ==, 4);
827 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
828 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
829 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
830 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
833 TEST_COMPARE(teCons.size(), ==, 3);
834 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
835 TEST_COMPARE(teCons[1]->getName(), ==,
"tel1");
836 TEST_COMPARE(teCons[2]->getName(), ==,
"tel2");
839 TEST_COMPARE(teCons.size(), ==, 2);
840 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
841 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
844 TEST_COMPARE(teCons.size(), ==, 4);
845 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
846 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
847 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
848 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
850 TEST_COMPARE(tec->indexOfNextEvent(-1, teCons), ==, 0);
851 TEST_COMPARE(teCons.size(), ==, 4);
852 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
853 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
854 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
855 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
857 TEST_COMPARE(tec->indexOfNextEvent(40, teCons), ==, 50);
858 TEST_COMPARE(teCons.size(), ==, 3);
859 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
860 TEST_COMPARE(teCons[1]->getName(), ==,
"teli1");
861 TEST_COMPARE(teCons[2]->getName(), ==,
"teli2");
863 TEST_COMPARE(tec->indexOfNextEvent(90, teCons), ==, 100);
864 TEST_COMPARE(teCons.size(), ==, 2);
865 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
866 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
868 TEST_COMPARE(tec->indexOfNextEvent(190, teCons), ==, 200);
869 TEST_COMPARE(teCons.size(), ==, 4);
870 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
871 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
872 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
873 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
876 TEST_COMPARE(tec->eventInRange(-1.0, 21.0, teCons), ==,
true);
877 TEST_COMPARE(teCons.size(), ==, 4);
878 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
879 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
880 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
881 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
884 TEST_COMPARE(tec->eventInRange(0.0, 21.0, teCons), ==,
true);
885 TEST_COMPARE(teCons.size(), ==, 4);
886 TEST_COMPARE(teCons[0]->getName(), ==,
"ter2");
888 TEST_COMPARE(teCons[1]->getName(), ==,
"tel2");
890 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
892 TEST_COMPARE(teCons[3]->getName(), ==,
"ter1");
895 TEST_COMPARE(tec->eventInRange(7.0, 21.0, teCons), ==,
true);
896 TEST_COMPARE(teCons.size(), ==, 4);
897 TEST_COMPARE(teCons[0]->getName(), ==,
"ter2");
899 TEST_COMPARE(teCons[1]->getName(), ==,
"tel1");
901 TEST_COMPARE(teCons[2]->getName(), ==,
"ter1");
903 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
906 TEST_COMPARE(tec->eventInRange(19.0, 21.0, teCons), ==,
true);
907 TEST_COMPARE(teCons.size(), ==, 4);
908 TEST_COMPARE(teCons[0]->getName(), ==,
"ter1");
910 TEST_COMPARE(teCons[1]->getName(), ==,
"ter2");
912 TEST_COMPARE(teCons[2]->getName(), ==,
"tel1");
914 TEST_COMPARE(teCons[3]->getName(), ==,
"tel2");
918 TEST_COMPARE(tec->eventInRangeIndex(-10, 210, teCons), ==,
true);
919 TEST_COMPARE(teCons.size(), ==, 4);
920 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
921 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
922 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
923 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
926 TEST_COMPARE(tec->eventInRangeIndex(0, 210, teCons), ==,
true);
927 TEST_COMPARE(teCons.size(), ==, 4);
928 TEST_COMPARE(teCons[0]->getName(), ==,
"teri2");
929 TEST_COMPARE(teCons[0]->indexOfNextEvent(0), ==, 20);
930 TEST_COMPARE(teCons[1]->getName(), ==,
"teli2");
931 TEST_COMPARE(teCons[1]->indexOfNextEvent(0), ==, 30);
932 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
933 TEST_COMPARE(teCons[2]->indexOfNextEvent(0), ==, 40);
934 TEST_COMPARE(teCons[3]->getName(), ==,
"teri1");
935 TEST_COMPARE(teCons[3]->indexOfNextEvent(0), ==, 50);
937 TEST_COMPARE(tec->eventInRangeIndex(70, 210, teCons), ==,
true);
938 TEST_COMPARE(teCons.size(), ==, 4);
939 TEST_COMPARE(teCons[0]->getName(), ==,
"teri2");
940 TEST_COMPARE(teCons[0]->indexOfNextEvent(70), ==, 80);
941 TEST_COMPARE(teCons[1]->getName(), ==,
"teli1");
942 TEST_COMPARE(teCons[1]->indexOfNextEvent(70), ==, 90);
943 TEST_COMPARE(teCons[2]->getName(), ==,
"teri1");
944 TEST_COMPARE(teCons[2]->indexOfNextEvent(70), ==, 100);
945 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
946 TEST_COMPARE(teCons[3]->indexOfNextEvent(70), ==, 130);
948 TEST_COMPARE(tec->eventInRangeIndex(190, 210, teCons), ==,
true);
949 TEST_COMPARE(teCons.size(), ==, 4);
950 TEST_COMPARE(teCons[0]->getName(), ==,
"teri1");
951 TEST_COMPARE(teCons[0]->indexOfNextEvent(190), ==, 200);
952 TEST_COMPARE(teCons[1]->getName(), ==,
"teri2");
953 TEST_COMPARE(teCons[1]->indexOfNextEvent(190), ==, 200);
954 TEST_COMPARE(teCons[2]->getName(), ==,
"teli1");
955 TEST_COMPARE(teCons[2]->indexOfNextEvent(190), ==, 200);
956 TEST_COMPARE(teCons[3]->getName(), ==,
"teli2");
957 TEST_COMPARE(teCons[3]->indexOfNextEvent(190), ==, 200);
971 ter->setName(
"Test Range");
972 teri->setName(
"Test Range Index");
973 tel->setName(
"Test List");
974 teli->setName(
"Test List Index");
982 tec->remove(
"Blah Blah");
985 tec->remove(
"Test Range Index");
987 auto names = tec->getTimeEventNames();
988 TEST_COMPARE(names, ==,
"Test Range, Test List, Test List Index");
990 tec->remove(
"Test List Index");
992 names = tec->getTimeEventNames();
995 tec->remove(
"Test Range");
997 names = tec->getTimeEventNames();
1000 tec->remove(
"Test List");
1002 names = tec->getTimeEventNames();
1017 ter->setName(
"Test Range");
1018 teri->setName(
"Test Range Index");
1019 tel->setName(
"Test List");
1020 teli->setName(
"Test List Index");
1028 auto teTest = tec->find(
"Test Range");
1031 teTest = tec->find(
"Test Range Index");
1032 TEST_COMPARE(teTest->getName(), ==,
"Test Range Index");
1034 teTest = tec->find(
"Test List");
1037 teTest = tec->find(
"Test List Index");
1038 TEST_COMPARE(teTest->getName(), ==,
"Test List Index");
1040 teTest = tec->find(
"Blah Blah");
1077 ter->setName(
"Test Range");
1078 teri->setName(
"Test Range Index");
1079 tel->setName(
"Test List");
1080 teli->setName(
"Test List Index");
1088 auto timeEvents = tec->getTimeEvents();
1091 auto pl = tec->getValidParameters();
1093 TEST_COMPARE(pl->get<std::string>(
"Name"), ==,
"TimeEventComposite");
1094 TEST_COMPARE(pl->get<std::string>(
"Type"), ==,
"Composite");
1096 "Test Range, Test Range Index, Test List, Test List Index");
1098 TEST_COMPARE(pl->isSublist(
"Test Range Index"), ==,
true);
1100 TEST_COMPARE(pl->isSublist(
"Test List Index"), ==,
true);
1103 std::ostringstream unusedParameters;
1104 pl->unused(unusedParameters);
1106 unusedParameters.str(), ==,
1107 "WARNING: Parameter \"Test Range\" [unused] is unused\n"
1108 "WARNING: Parameter \"Test Range Index\" [unused] is unused\n"
1109 "WARNING: Parameter \"Test List\" [unused] is unused\n"
1110 "WARNING: Parameter \"Test List Index\" [unused] is unused\n");
1113 auto terPL = pl->sublist(
"Test Range");
1114 TEST_COMPARE(terPL.get<std::string>(
"Type"), ==,
"Range");
1115 TEST_COMPARE(terPL.get<std::string>(
"Name"), ==,
"Test Range");
1119 TEST_COMPARE(terPL.get<
int>(
"Number of Events"), ==, 1);
1121 std::numeric_limits<double>::epsilon() * 100.0,
1124 TEST_COMPARE(terPL.get<
bool>(
"Land On Exactly"), ==,
true);
1127 std::ostringstream unusedParameters;
1128 terPL.unused(unusedParameters);
1132 auto teriPL = pl->sublist(
"Test Range Index");
1133 TEST_COMPARE(teriPL.get<std::string>(
"Type"), ==,
"Range Index");
1134 TEST_COMPARE(teriPL.get<std::string>(
"Name"), ==,
"Test Range Index");
1140 std::ostringstream unusedParameters;
1141 teriPL.unused(unusedParameters);
1145 auto telPL = pl->sublist(
"Test List");
1146 TEST_COMPARE(telPL.get<std::string>(
"Type"), ==,
"List");
1147 TEST_COMPARE(telPL.get<std::string>(
"Name"), ==,
"Test List");
1149 std::numeric_limits<double>::epsilon() * 100.0,
1151 TEST_COMPARE(telPL.get<
bool>(
"Land On Exactly"), ==,
true);
1152 TEST_COMPARE(telPL.get<std::string>(
"Time List"), ==,
"");
1155 std::ostringstream unusedParameters;
1156 telPL.unused(unusedParameters);
1160 auto teliPL = pl->sublist(
"Test List Index");
1161 TEST_COMPARE(teliPL.get<std::string>(
"Type"), ==,
"List Index");
1162 TEST_COMPARE(teliPL.get<std::string>(
"Name"), ==,
"Test List Index");
1163 TEST_COMPARE(teliPL.get<std::string>(
"Index List"), ==,
"");
1166 std::ostringstream unusedParameters;
1167 teliPL.unused(unusedParameters);
1177 using Teuchos::rcp_const_cast;
1181 auto pl = rcp_const_cast<
ParameterList>(tecTmp->getValidParameters());
1183 auto tec = Tempus::createTimeEventComposite<double>(pl);
1186 TEST_COMPARE(tec->getName(), ==,
"TimeEventComposite");
1199 ter->setName(
"Test Range");
1200 teri->setName(
"Test Range Index");
1201 tel->setName(
"Test List");
1202 teli->setName(
"Test List Index");
1209 auto pl = rcp_const_cast<
ParameterList>(tecTmp->getValidParameters());
1211 auto tec = Tempus::createTimeEventComposite<double>(pl);
1214 TEST_COMPARE(tec->getName(), ==,
"TimeEventComposite");
1218 "Test Range, Test Range Index, Test List, Test List Index");
1223 auto pl = rcp_const_cast<
ParameterList>(tecTmp->getValidParameters());
1225 auto nonTempusTE = Teuchos::parameterList(
"Application Time Event");
1226 nonTempusTE->set<std::string>(
"Name",
"Application Time Event");
1227 nonTempusTE->set<std::string>(
"Type",
"Application Time Event Type");
1228 nonTempusTE->set<
double>(
"Secret Sauce", 1.2345);
1229 pl->set(
"Application Time Event", *nonTempusTE);
1230 pl->set(
"Time Events",
"Application Time Event");
1232 auto tec = Tempus::createTimeEventComposite<double>(pl);
1235 TEST_COMPARE(tec->getName(), ==,
"TimeEventComposite");
Teuchos::RCP< Tempus::TimeEventRange< double > > getTestRange3()
TimeEventRangeIndex specifies a start, stop and stride index.
Teuchos::RCP< Tempus::TimeEventRange< double > > getTestRange2()
Teuchos::RCP< Tempus::TimeEventListIndex< double > > getTestListIndex2()
TimeEventListIndex specifies a list of index events.
#define TEST_COMPARE(v1, comp, v2)
Teuchos::RCP< Tempus::TimeEventRangeIndex< double > > getTestRangeIndex3()
#define TEST_FLOATING_EQUALITY(v1, v2, tol)
Teuchos::RCP< Tempus::TimeEventList< double > > getTestList3()
Teuchos::RCP< Tempus::TimeEventRange< double > > getTestRange1()
TimeEventRange specifies a start, stop and stride time.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< Tempus::TimeEventList< double > > getTestList1()
This composite TimeEvent loops over added TimeEvents.
TEUCHOS_UNIT_TEST(BackwardEuler, Default_Construction)
Teuchos::RCP< Tempus::TimeEventListIndex< double > > getTestListIndex3()
Teuchos::RCP< Tempus::TimeEventListIndex< double > > getTestListIndex1()
Teuchos::RCP< Tempus::TimeEventRangeIndex< double > > getTestRangeIndex1()
Teuchos::RCP< Tempus::TimeEventList< double > > getTestList2()
Teuchos::RCP< Tempus::TimeEventRangeIndex< double > > getTestRangeIndex2()
TimeEventList specifies a list of time events.
Teuchos::RCP< TimeEventComposite< Scalar > > createTimeEventComposite(Teuchos::RCP< Teuchos::ParameterList > const &pList)
TimeEventComposite nonmember constructor via ParameterList.