Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_InterpolatorLagrange_decl.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_InterpolatorLagrange_decl_hpp
10 #define Tempus_InterpolatorLagrange_decl_hpp
11 
12 #include "Tempus_Interpolator.hpp"
13 
14 namespace Tempus {
15 
16 /** \brief Concrete implemenation of <tt>Interpolator</tt> that does
17  * simple lagrange interpolation.
18  */
19 template<class Scalar>
20 class InterpolatorLagrange : virtual public Interpolator<Scalar>
21 {
22 public:
23 
24  /// Contructor
26 
27  /// Destructor
29 
30  /// \name Overridden from Tempus::Interpolator
31  //@{
32 
33  /// Store pointer to interpolation nodes
34  void setNodes(
35  const Teuchos::RCP<const std::vector<Teuchos::RCP<SolutionState<Scalar> > > > & nodes) { nodes_ = nodes; }
36 
37  /// Perform an interpolation
38  void interpolate(const Scalar& t, SolutionState<Scalar>* state_out) const;
39 
40  /// Return the order of the interpolation
41  int order() const { return order_; }
42 
43  //@}
44 
45  /// \name Overridden from Teuchos::Describable
46  //@{
47  std::string description() const { return "Tempus::InterpolatorLagrange"; }
48  void describe(Teuchos::FancyOStream &out,
49  const Teuchos::EVerbosityLevel /* verbLevel */) const
50  { out << description() << "::describe" << std::endl; }
51  //@}
52 
53  /// \name Overridden from Teuchos::ParameterListAcceptor
54  //@{
55  void setParameterList(const Teuchos::RCP<Teuchos::ParameterList>& paramList);
56  Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList();
57  Teuchos::RCP<Teuchos::ParameterList> unsetParameterList();
58  Teuchos::RCP<const Teuchos::ParameterList> getValidParameters() const;
59  //@}
60 
61 private:
62 
63  void lagrange(const int p, const Scalar& t,
64  SolutionState<Scalar>* state_out) const;
65 
66  Teuchos::RCP<const std::vector<Teuchos::RCP<SolutionState<Scalar> > > > nodes_;
67  Teuchos::RCP<Teuchos::ParameterList> pl_;
68  int order_;
69 
70 };
71 
72 // non-member constructor
73 template<class Scalar>
74 Teuchos::RCP<InterpolatorLagrange<Scalar> > lagrangeInterpolator()
75 {
76  return Teuchos::rcp(new InterpolatorLagrange<Scalar>);
77 }
78 
79 } // namespace Tempus
80 
81 #endif // Tempus_InterpolatorLagrange_decl_hpp
Teuchos::RCP< const std::vector< Teuchos::RCP< SolutionState< Scalar > > > > nodes_
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel) const
Teuchos::RCP< Teuchos::ParameterList > pl_
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Base strategy class for interpolation functionality.
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
void setNodes(const Teuchos::RCP< const std::vector< Teuchos::RCP< SolutionState< Scalar > > > > &nodes)
Store pointer to interpolation nodes.
Teuchos::RCP< InterpolatorLagrange< Scalar > > lagrangeInterpolator()
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void lagrange(const int p, const Scalar &t, SolutionState< Scalar > *state_out) const
void interpolate(const Scalar &t, SolutionState< Scalar > *state_out) const
Perform an interpolation.
Concrete implemenation of Interpolator that does simple lagrange interpolation.
Solution state for integrators and steppers. SolutionState contains the metadata for solutions and th...
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &paramList)
int order() const
Return the order of the interpolation.