source: trunk/src/mesh/grid1d.h @ 176

Last change on this file since 176 was 176, checked in by cxsong, 19 years ago

moved into rappture src dir

File size: 875 bytes
Line 
1#ifndef __GRID1D_H__
2#define __GRID1D_H__
3
4//
5// class for 1D grid
6//
7
8#include <vector>
9#include "rp_defs.h"
10
11class RpGrid1d {
12public:
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        //int type() { return _type; }
20        //void type(int i) { _type = i; }
21
22        // return number of points in grid
23        int size() { return _points.size(); }
24
25        // change the size of the grid after grid is constructed
26        void resize(int size) { _points.resize(size); }
27
28        // serialize data
29        char * serialize();
30        int deserialize(const char* buf);
31
32        // destructor
33        virtual ~RpGrid1d() { };
34
35        // TODO
36        //virtual int xmlPut() { };
37        //virtual int xmlGet() { };
38
39private:
40        int _type;      // type of array elements: int, float, double, etc.
41        vector<double> _points; // array of doubles
42};
43
44#endif
Note: See TracBrowser for help on using the repository browser.