roadrunner  2.6.0
Fast simulator for SBML models
rrRoadRunnerData.h
1 #ifndef rrRoadRunnerDataH
2 #define rrRoadRunnerDataH
3 
4 #ifdef _MSC_VER
5 #pragma warning(disable: 26812)
6 #pragma warning(disable: 26451)
7 #endif
8 #include "rr-libstruct/lsMatrix.h"
9 #ifdef _MSC_VER
10 #pragma warning(disable: 26812)
11 #pragma warning(disable: 26451)
12 #endif
13 
14 #include "rrExporter.h"
15 
16 #include <string>
17 #include <vector>
18 #include <fstream>
19 #include <sstream>
20 
21 namespace rr
22 {
23 
24  using namespace ls;
25  using std::ofstream;
26  using std::stringstream;
27 
28  class RoadRunner;
29 
34  class RR_DECLSPEC RoadRunnerData
35  {
36 
37  public:
38  RoadRunnerData(const int& rSize = 0, const int& cSize = 0);
39 
40  RoadRunnerData(const std::vector<std::string>& colNames,
41  const DoubleMatrix& data);
42 
43  RoadRunnerData(const RoadRunner* rr);
44 
45  ~RoadRunnerData();
46 
47  void allocate(const size_t& cSize, const size_t& rSize);
48 
49  void allocateWeights();
50 
51  bool hasWeights() const;
52 
53  const std::vector<std::string>& getColumnNames() const;
54  std::string getColumnName(const int col) const;
55  std::string getColumnNamesAsString() const;
56  void setColumnNames(const std::vector<std::string>& colNames);
57  std::ptrdiff_t getColumnIndex(const std::string& colName) const;
58  void setTimeDataPrecision(const int& prec);
59  void setDataPrecision(const int& prec);
60  void reSize(int rows, int cols);
61 
62  void clear();
63 
64  int rSize() const;
65 
66  int cSize() const;
67 
68  void setData(const DoubleMatrix& theData);
69 
70  bool loadSimpleFormat(const std::string& fileName);
71 
72  bool writeTo(const std::string& fileName) const;
73 
74  bool readFrom(const std::string& fileName);
75 
76  static void writeOnlyData(std::ostream& ss, const RoadRunnerData& data);
77 
78  static void writeWeights(std::ostream& ss, const RoadRunnerData& data);
79 
80  bool check() const;
81 
82  bool structuredResult;
83 
84  RR_DECLSPEC
85  friend std::ostream& operator <<(std::ostream& ss, const RoadRunnerData& data);
86 
87  RR_DECLSPEC
88  friend std::istream& operator >>(std::istream& ss, RoadRunnerData& data);
89 
90  double& operator()(const unsigned& row, const unsigned& col);
91 
92  double operator()(const unsigned& row, const unsigned& col) const;
93 
94  double getDataElement(int row, int col);
95 
96  void setDataElement(int row, int col, double value);
97 
98  RoadRunnerData& operator=(const RoadRunnerData& rhs);
99 
100  double getWeight(int row, int col) const;
101 
102  void setWeight(int row, int col, double val);
103 
104  void setName(const std::string& name);
105 
106  std::string getName() const;
107 
108  std::pair<int, int> dimension() const;
109 
110  bool append(const RoadRunnerData& data);
111 
112  double getTimeStart() const;
113 
114  double getTimeEnd() const;
115 
116  const DoubleMatrix& getData() const;
117 
118  const DoubleMatrix& getWeights() const;
119 
120 
121  protected:
122 
126  std::vector<std::string> mColumnNames;
127 
131  DoubleMatrix mTheData;
132 
136  DoubleMatrix mWeights;
137 
142 
146  int mDataPrecision; //The precision when saved to file
147 
152  std::string mName; //For debugging purposes mainly..
153  };
154 
155 }
156 
157 #endif
The RoadRunnerData class is used for simulation output, and provides a wrapper around 2D matrix data.
Definition: rrRoadRunnerData.h:35
int mDataPrecision
Integer setting the precision of 'data' double numbers when writing to file.
Definition: rrRoadRunnerData.h:146
DoubleMatrix mWeights
Container holding the data weights.
Definition: rrRoadRunnerData.h:136
std::string mName
String holding the 'name' of the object.
Definition: rrRoadRunnerData.h:152
int mTimePrecision
Integer setting the precision of 'time' double numbers when writing to file.
Definition: rrRoadRunnerData.h:141
DoubleMatrix mTheData
Container holding the actual data.
Definition: rrRoadRunnerData.h:131
std::vector< std::string > mColumnNames
Container holding column names.
Definition: rrRoadRunnerData.h:126
The main RoadRunner class.
Definition: rrRoadRunner.h:59
C_DECL_SPEC bool rrcCallConv getTimeStart(RRHandle handle, double *timeStart)
Get the value of the current time start.
C_DECL_SPEC bool rrcCallConv getTimeEnd(RRHandle handle, double *timeEnd)
Get the value of the current time end.