Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_WrapCombinedFSAModelEvaluator.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_WrapCombinedFSAModelEvaluator_hpp
10 #define Tempus_WrapCombinedFSAModelEvaluator_hpp
11 
13 #include "Tempus_WrapperModelEvaluatorPairPartIMEX_CombinedFSA.hpp"
14 
15 namespace Tempus {
16 
17 /*! Helper function for creating a CombinedForwardSensitivityModelEvaluator
18  * from a given application model evaluator. It handles the complexity
19  * introducted by IMEX steppers where the sensitivity model evaluator needs
20  * to be put inside the IMEX pair model evaluators.
21  */
22 template <typename Scalar>
23 Teuchos::RCP< SensitivityModelEvaluatorBase<Scalar> >
25  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model,
26  const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null)
27 {
28  using Teuchos::RCP;
29  using Teuchos::rcp_dynamic_cast;
30 
31  RCP<SensitivityModelEvaluatorBase<Scalar> > wrapped_model;
32 
33  // Test if model is an IMEX pair
34  RCP<const WrapperModelEvaluatorPairIMEX_Basic<Scalar> > modelPairIMEX =
35  rcp_dynamic_cast<const WrapperModelEvaluatorPairIMEX_Basic<Scalar> >(model);
36  RCP<const WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> > modelPairPartIMEX =
37  rcp_dynamic_cast<const WrapperModelEvaluatorPairPartIMEX_Basic<Scalar> >(model);
38  if (modelPairIMEX != Teuchos::null) {
39  wrapped_model =
41  modelPairIMEX, pList));
42  }
43  else if (modelPairPartIMEX != Teuchos::null) {
44  wrapped_model =
46  modelPairPartIMEX, pList));
47  }
48  else {
49  wrapped_model =
51  }
52 
53  return wrapped_model;
54 }
55 
56 template <typename Scalar>
57 Teuchos::RCP< SensitivityModelEvaluatorBase<Scalar> >
59  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> > & model,
60  const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null)
61 {
62  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > cmodel = model;
63  return wrapCombinedFSAModelEvaluator(cmodel, pList);
64 }
65 
66 } // namespace Tempus
67 
68 #endif
Transform a ModelEvaluator&#39;s sensitivity equations to its residual.
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
Specialization of IMEX ME for &quot;combined&quot; FSA method.
Specialization of IMEX-Part ME for &quot;combined&quot; FSA method.
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
Teuchos::RCP< SensitivityModelEvaluatorBase< Scalar > > wrapCombinedFSAModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< const Teuchos::ParameterList > &pList=Teuchos::null)