Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_WrapperModelEvaluatorPairIMEX_Basic_decl.hpp
Go to the documentation of this file.
1 //@HEADER
2 // *****************************************************************************
3 // Tempus: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Tempus_ModelEvaluatorPairIMEX_Basic_decl_hpp
11 #define Tempus_ModelEvaluatorPairIMEX_Basic_decl_hpp
12 
13 #include "Tempus_config.hpp"
15 #include "Thyra_StateFuncModelEvaluatorBase.hpp"
16 
17 namespace Tempus {
18 
38 template <typename Scalar>
40  : public Tempus::WrapperModelEvaluatorPairIMEX<Scalar> {
41  public:
44  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& explicitModel,
45  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& implicitModel)
46  : timeDer_(Teuchos::null)
47  {
48  setExplicitModel(explicitModel);
49  setImplicitModel(implicitModel);
50  initialize();
51  }
52 
55 
57  virtual void initialize();
58 
60 
61  virtual void setAppModel(
64  const;
65 
69  const Teuchos::RCP<Thyra::VectorBase<Scalar> >& xDot, const Scalar time,
71  const Teuchos::RCP<Thyra::VectorBase<Scalar> >& y = Teuchos::null,
72  const int index = -1 /* index and y are for IMEX_RK_Partition */)
73  {
74  x_ = x;
75  xDot_ = xDot;
76  time_ = time;
77  p_ = p;
78  y_ = y;
79  index_ = index;
80  timeDer_ = p->timeDer_;
81  }
82 
84 
86 
89  const;
90 
93  int i) const;
94 
97  int i) const;
99 
101  virtual void setExplicitModel(
102  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model)
103  {
104  explicitModel_ = model;
105  }
106  virtual void setImplicitModel(
107  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model)
108  {
109  implicitModel_ = model;
110  }
112  const
113  {
114  return explicitModel_;
115  }
117  const
118  {
119  return implicitModel_;
120  }
122 
124 
126  {
127  return implicitModel_->create_W_op();
128  }
129 
132  {
133  return implicitModel_->get_W_factory();
134  }
135 
137  const
138  {
139  return explicitModel_->get_f_space();
140  }
141 
145 
146  virtual void evalModelImpl(
150 
151  protected:
154 
156  void setup(
157  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& explicitModel,
158  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& implicitModel)
159  {
160  setExplicitModel(explicitModel);
161  setImplicitModel(implicitModel);
162  initialize();
163  }
164 
165  protected:
168 
171  Scalar time_;
174  int index_;
176 };
177 
178 } // namespace Tempus
179 
180 #endif // Tempus_ModelEvaluatorPairIMEX_Basic_decl_hpp
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > implicitModel_
WrapperModelEvaluatorPairIMEX_Basic(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &explicitModel, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &implicitModel)
Constructor.
virtual Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getAppModel() const
Get the underlying application ModelEvaluator.
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int i) const
Get the g space.
virtual void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &in, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &out) const
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getExplicitModel() const
ModelEvaluator pair for implicit and explicit (IMEX) evaulations.
ModelEvaluator pair for implicit and explicit (IMEX) evaluations.
void setup(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &explicitModel, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &implicitModel)
Setup ME when using default constructor – for derived classes.
virtual void setImplicitModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
virtual void initialize()
Initialize after setting member data.
void setForSolve(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &xDot, const Scalar time, const Teuchos::RCP< ImplicitODEParameters< Scalar > > &p, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &y=Teuchos::null, const int index=-1)
Set parameters for application implicit ModelEvaluator solve.
virtual void setExplicitModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model)
virtual void setAppModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &me)
Set the underlying application ModelEvaluator.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int i) const
Get the p space.
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
WrapperModelEvaluatorPairIMEX_Basic()
Default constructor – only allowed for derived classes.
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getImplicitModel() const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > explicitModel_
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Get the x-solution space.
virtual Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const