C API Documentation
SteadyStateSolver.h
Go to the documentation of this file.
1 // == PREAMBLE ================================================
2 
3 // * Licensed under the Apache License, Version 2.0; see README
4 
5 // == FILEDOC =================================================
6 
14 # ifndef RR_STEADY_STATE_SOLVER_H_
15 # define RR_STEADY_STATE_SOLVER_H_
16 
17 // == INCLUDES ================================================
18 
19 # include "rrLogger.h"
20 # include "rrOSSpecifics.h"
21 # include "Dictionary.h"
22 # include "rrException.h"
23 # include "Solver.h"
24 
25 # include "tr1proxy/rr_memory.h"
26 # include "tr1proxy/rr_unordered_map.h"
27 # include <stdexcept>
28 
29 // == CODE ====================================================
30 
31 namespace rr
32 {
33  class ExecutableModel;
34 
35 
36  /*-------------------------------------------------------------------------------------------
37  SteadyStateSolver is an abstract base class that provides an interface to specific steady-state solver
38  class implementations.
39  ---------------------------------------------------------------------------------------------*/
40  class RR_DECLSPEC SteadyStateSolver : public Solver
41  {
42  public:
43 
44  virtual ~SteadyStateSolver() {};
45 
51  virtual void syncWithModel(ExecutableModel* m) = 0;
52 
53  virtual double solve() = 0;
54 
55  virtual void loadConfigSettings();
56 
61  std::string getSettingsRepr() const;
62 
67  std::string settingsPyDictRepr() const;
68 
73  virtual std::string toString() const;
74 
79  virtual std::string toRepr() const;
80  };
81 
87  class RR_DECLSPEC SteadyStateSolverRegistrar
88  {
89  protected:
90  typedef SteadyStateSolver* (*SteadyStateSolverCtor)(ExecutableModel *model);
91  public:
92  virtual ~SteadyStateSolverRegistrar();
93 
98  virtual std::string getName() const = 0;
99 
104  virtual std::string getDescription() const = 0;
105 
110  virtual std::string getHint() const = 0;
111 
116  virtual SteadyStateSolver* construct(ExecutableModel *model) const = 0;
117  };
118 
126  class RR_DECLSPEC SteadyStateSolverFactory
127  {
128  public:
129  virtual ~SteadyStateSolverFactory();
130 
136  SteadyStateSolver* New(std::string name, ExecutableModel *m) const;
137 
145 
151 
152  // ** Indexing *********************************************************
153 
154  std::size_t getNumSteadyStateSolvers() const;
155 
156  std::vector<std::string> getListSteadyStateSolverNames();
157 
158  std::string getSteadyStateSolverName(std::size_t n) const;
159 
160  std::string getSteadyStateSolverHint(std::size_t n) const;
161 
162  std::string getSteadyStateSolverDescription(std::size_t n) const;
163 
164  private:
170  typedef std::vector<SteadyStateSolverRegistrar*> SteadyStateSolverRegistrars;
171  SteadyStateSolverRegistrars mRegisteredSteadyStateSolvers;
172  };
173 
174 }
175 
176 # endif /* RR_STEADY_STATE_SOLVER_H_ */
Contains the base class for RoadRunner solvers.
Base class for all code generation systems; allows compiling and evaluating the model.
Definition: rrExecutableModel.h:118
Base class for all integrators and steady state solvers.
Definition: Solver.h:37
Constructs new integrators.
Definition: SteadyStateSolver.h:127
SteadyStateSolver * New(std::string name, ExecutableModel *m) const
Constructs a new solver given the name (e.g. cvode, gillespie)
void registerSteadyStateSolver(SteadyStateSolverRegistrar *i)
Registers a new solver with the factory so that it can be constructed.
static SteadyStateSolverFactory & getInstance()
Returns the singleton instance of the solver factory.
Definition: SteadyStateSolver.h:41
virtual std::string toString() const
Return a string representation of the solver.
std::string settingsPyDictRepr() const
Python dictionary-style string representation of settings.
std::string getSettingsRepr() const
Get the solver settings as a string.
virtual void syncWithModel(ExecutableModel *m)=0
Called whenever a new model is loaded to allow integrator to reset internal state.
virtual std::string toRepr() const
Return string representation a la Python repr method.
Handles constructing a solver and contains meta information about it.
Definition: SteadyStateSolver.h:88
virtual std::string getHint() const =0
Gets the hint associated with this integrator type.
virtual std::string getDescription() const =0
Gets the description associated with this integrator type.
virtual SteadyStateSolver * construct(ExecutableModel *model) const =0
Constructs a new integrator of a given type.
virtual std::string getName() const =0
Gets the name associated with this integrator type.