source: trunk/src/mesh/node2d.h @ 199

Last change on this file since 199 was 198, checked in by cxsong, 18 years ago

moved to src/mesh dir

File size: 892 bytes
Line 
1#ifndef __RP_NODE2D_H__
2#define __RP_NODE2D_H__
3
4#include <iostream>
5#include <vector>
6#include "util.h"
7
8//
9// define a 2-d node (x, y)
10//
11class RpNode2d {
12public:
13        // constructors
14        RpNode2d() { };
15
16        RpNode2d(int id): m_id(id)
17        { };
18
19        RpNode2d(int id, int x, int y):
20                m_id(id),
21                m_x(x),
22                m_y(y)
23        { };
24
25        // assign value to coordinate[index]
26        void set(int x, int y) { m_x = x; m_y = y; };
27        void set(int* val) { m_x = val[0]; m_y = val[1]; };
28
29        // get node coordinates
30        void get(int& xval, int& yval)
31        { xval = m_x; yval = m_y; };
32
33        void get(int * val) { val[0] = m_x; val[1] = m_y; );
34
35        int id() { return m_id; };
36        void id(int id) { m_id = id; };
37
38        char* serialize();
39        RP_ERROR serialize(char* buf, int buflen);
40        RP_ERROR deserialize(const char* buf);
41
42        void print();
43
44        virtual ~RpNode2d() { };
45
46private:
47        int m_id;
48        int m_x;
49        int m_y;
50};
51
52#endif
Note: See TracBrowser for help on using the repository browser.