Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_UnitTest_Utils.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_UnitTest_Utils_hpp
10 #define Tempus_UnitTest_Utils_hpp
11 
12 #include "Tempus_config.hpp"
13 
16 
17 #include "Thyra_VectorStdOps.hpp"
18 #include "NOX_Thyra.H"
19 
21 #include "Tempus_StepperFactory.hpp"
22 #include "Tempus_SolutionHistory.hpp"
23 #include "Tempus_IntegratorBasic.hpp"
24 
25 #include "../TestModels/SinCosModel.hpp"
26 
27 namespace Tempus_Unit_Test {
28 
30 using Teuchos::RCP;
31 using Teuchos::rcp;
32 using Teuchos::rcp_const_cast;
33 using Teuchos::rcp_dynamic_cast;
34 
35 using Thyra::get_ele;
36 
38 
42  std::string stepperType,
43  const Teuchos::RCP<const Thyra::ModelEvaluator<double> >& model)
44 {
46 
47  // Test using stepperType
48  // Passing in model.
49  auto stepper = sf->createStepper(stepperType, model);
50  TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
51  // With setting model.
52  stepper = sf->createStepper(stepperType);
53  stepper->setModel(model);
54  stepper->initialize();
55  TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
56 
57  // Test using ParameterList.
58  // Passing in model.
59  auto stepperPL = rcp_const_cast<ParameterList>(stepper->getValidParameters());
60  stepper = sf->createStepper(stepperPL, model);
61  TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
62  // With setting model.
63  stepper = sf->createStepper(stepperPL);
64  stepper->setModel(model);
65  stepper->initialize();
66  TEUCHOS_TEST_FOR_EXCEPT(!stepper->isInitialized());
67 }
68 
69 } // namespace Tempus_Unit_Test
70 #endif // Tempus_UnitTest_Utils_hpp
void testFactoryConstruction(std::string stepperType, const Teuchos::RCP< const Thyra::ModelEvaluator< double > > &model)
Unit test utility for Stepper construction through StepperFactory.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)