Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
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
13#include "Tempus_config.hpp"
14
15#include "Teuchos_UnitTestHarness.hpp"
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
28namespace Tempus_Unit_Test {
29
30using Teuchos::RCP;
31using Teuchos::rcp;
32using Teuchos::rcp_const_cast;
33using Teuchos::rcp_dynamic_cast;
34using Teuchos::ParameterList;
35
36using Thyra::get_ele;
37
39
42void testFactoryConstruction(std::string stepperType,
43 const Teuchos::RCP<const Thyra::ModelEvaluator<double> >& model)
44{
45 RCP<StepperFactory<double> > sf = Teuchos::rcp(new StepperFactory<double>());
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
70} // namespace Tempus_Test
71#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.