Scine::Kinetx  3.0.0
Kinetic models for reaction networks.
 All Classes Files Functions Variables Enumerations Pages
NetworkBuilder.h
Go to the documentation of this file.
1 
7 #ifndef KINETX_NETWORKBUILDER_H_
8 #define KINETX_NETWORKBUILDER_H_
9 
10 #include <Eigen/Dense>
11 #include <Eigen/Sparse>
12 
13 namespace Scine {
14 namespace Kinetx {
15 
16 class Network;
17 
22  public:
24  NetworkBuilder() = default;
29  Network generate();
37  void reserve(unsigned int nCompounds, unsigned int nReactions, unsigned int nChannelsPerReaction);
47  void addReaction(std::vector<double> rfs, std::vector<double> rbs, std::vector<std::pair<unsigned int, int>> lhs,
48  std::vector<std::pair<unsigned int, int>> rhs);
58  void addReactionChannel(unsigned int reaction, double rf, double rb);
67  void addCompound(double mass, std::string label = "");
68 
69  private:
70  unsigned int _nCompounds = 0;
71  unsigned int _nReactions = 0;
72  unsigned int _nChannels = 0;
73  Eigen::VectorXi _channelCounts;
74  Eigen::VectorXd _masses;
75  std::vector<std::string> _labels;
76  Eigen::SparseMatrix<double> _ratesForward;
77  Eigen::SparseMatrix<double> _ratesBackward;
78  Eigen::SparseMatrix<int> _stoichiometryForward;
79  Eigen::SparseMatrix<int> _stoichiometryBackward;
80 };
81 
82 } /* namespace Kinetx */
83 } /* namespace Scine */
84 
85 #endif // KINETX_NETWORKBUILDER_H_
A class allowing for easier building of reaction networks.
Definition: NetworkBuilder.h:21
void addReactionChannel(unsigned int reaction, double rf, double rb)
Adds a single reaction channel to an existing reaction.
Definition: NetworkBuilder.cpp:98
Definition: Network.h:17
void addCompound(double mass, std::string label="")
Adds a single new compound to the network.
Definition: NetworkBuilder.cpp:111
void reserve(unsigned int nCompounds, unsigned int nReactions, unsigned int nChannelsPerReaction)
Reserves space in the underlying data objects, allowing for faster inserts.
Definition: NetworkBuilder.cpp:34
void addReaction(std::vector< double > rfs, std::vector< double > rbs, std::vector< std::pair< unsigned int, int >> lhs, std::vector< std::pair< unsigned int, int >> rhs)
Adds a new reaction to the network, auto expands fields if required.
Definition: NetworkBuilder.cpp:54
NetworkBuilder()=default
Default constructor.
Network generate()
Generates the final network.
Definition: NetworkBuilder.cpp:14