MUQ  0.4.3
RootfindingIVP.h
Go to the documentation of this file.
1 #ifndef ROOTFINDINGIVP_H_
2 #define ROOTFINDINGIVP_H_
3 
4 #include "MUQ/Modeling/ODEBase.h"
5 
6 namespace muq {
7  namespace Modeling {
9  class RootfindingIVP : public ODEBase {
10  public:
11 
48  RootfindingIVP(std::shared_ptr<WorkPiece> rhs, std::shared_ptr<WorkPiece> root, boost::property_tree::ptree const& pt, std::shared_ptr<muq::Utilities::AnyAlgebra> algebra = std::make_shared<muq::Utilities::AnyAlgebra>());
49 
50  virtual ~RootfindingIVP();
51 
52  private:
53 
55 
58  virtual void EvaluateImpl(ref_vector<boost::any> const& inputs) override;
59 
61 
66  virtual void JacobianImpl(unsigned int const wrtIn, unsigned int const wrtOut, ref_vector<boost::any> const& inputs) override;
67 
69 
76  Eigen::VectorXi FindRoot(ref_vector<boost::any> const& inputs, int const wrtIn = -1, int const wrtOut = -1, DerivativeMode const& mode = DerivativeMode::Jac);
77 
79 
83 
85 
91  static int EvaluateRoot(realtype t, N_Vector state, realtype *root, void *user_data);
92 
94  std::shared_ptr<WorkPiece> root;
95 
97  const unsigned int maxSteps;
98 
100  const double maxTime;
101 
103  const unsigned int maxErrorTests;
104 
105  };
106  } // namespace Modeling
107 } // namespace muq
108 
109 #endif
A rootfinding initial value problem — find the root of a function along an orbit of an ODE.
Definition: RootfindingIVP.h:9
const unsigned int maxSteps
The maximum number of steps the timesteper can take.
std::shared_ptr< WorkPiece > root
The root function.
virtual void JacobianImpl(unsigned int const wrtIn, unsigned int const wrtOut, ref_vector< boost::any > const &inputs) override
Compute the Jacobian of the state at the root.
const unsigned int maxErrorTests
The maximum number of error test failures.
RootfindingIVP(std::shared_ptr< WorkPiece > rhs, std::shared_ptr< WorkPiece > root, boost::property_tree::ptree const &pt, std::shared_ptr< muq::Utilities::AnyAlgebra > algebra=std::make_shared< muq::Utilities::AnyAlgebra >())
Eigen::VectorXi FindRoot(ref_vector< boost::any > const &inputs, int const wrtIn=-1, int const wrtOut=-1, DerivativeMode const &mode=DerivativeMode::Jac)
Run the CVODES integrator.
const double maxTime
The maximum amount of time to integrate.
virtual void EvaluateImpl(ref_vector< boost::any > const &inputs) override
Integrate the ODE until we find a root.
static int EvaluateRoot(realtype t, N_Vector state, realtype *root, void *user_data)
Evaluate the root function.
void UpdateInputOutputTypes()
Update the input and output types based on the rhs and root muq::Modeling::WorkPiece's.
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...
Definition: WorkPiece.h:37