Line | |
---|
1 | #ifndef __GRID1D_H__ |
---|
2 | #define __GRID1D_H__ |
---|
3 | |
---|
4 | // |
---|
5 | // class for 1D grid |
---|
6 | // |
---|
7 | |
---|
8 | #include <vector> |
---|
9 | #include "util.h" |
---|
10 | |
---|
11 | class RpGrid1d { |
---|
12 | public: |
---|
13 | // constructors |
---|
14 | RpGrid1d(); |
---|
15 | RpGrid1d(int size); |
---|
16 | RpGrid1d(double* data, int size); // makes a copy of data |
---|
17 | RpGrid1d(const char* buf); // instantiate with byte stream |
---|
18 | |
---|
19 | void addPoint(double val); |
---|
20 | |
---|
21 | // return number of points in grid |
---|
22 | int size() { return m_data.size(); } |
---|
23 | |
---|
24 | // change the size of the grid after grid is constructed |
---|
25 | void resize(int size) { m_data.resize(size); } |
---|
26 | |
---|
27 | // serialize data |
---|
28 | char * serialize(RP_ENCODE_ALG eflag=RP_NO_ENCODING, |
---|
29 | RP_COMPRESSION cflag=RP_NO_COMPRESSION); |
---|
30 | int deserialize(const char* buf); |
---|
31 | |
---|
32 | // destructor |
---|
33 | virtual ~RpGrid1d() { }; |
---|
34 | |
---|
35 | // TODO |
---|
36 | //virtual int xmlPut() { }; |
---|
37 | //virtual int xmlGet() { }; |
---|
38 | |
---|
39 | private: |
---|
40 | vector<double> m_data; // array of doubles |
---|
41 | }; |
---|
42 | |
---|
43 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.