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

Last change on this file since 232 was 211, checked in by cxsong, 18 years ago

various changes made 2/22

File size: 977 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 id, int x, int y) { m_id = id; m_x = x; m_y = y; };
27        void set(int id, int* val) { m_id = id; m_x = val[0]; m_y = val[1]; };
28        void set(int x, int y) { m_x = x; m_y = y; };
29
30        // get node coordinates
31        void get(int& xval, int& yval)
32        { xval = m_x; yval = m_y; };
33
34        void get(int * val) { val[0] = m_x; val[1] = m_y; };
35
36        int id() { return m_id; };
37        void id(int id) { m_id = id; };
38
39        char* serialize();
40        RP_ERROR serialize(char* buf, int buflen);
41        RP_ERROR deserialize(const char* buf);
42
43        void print();
44
45        virtual ~RpNode2d() { };
46
47private:
48        int m_id;
49        int m_x;
50        int m_y;
51};
52
53#endif
Note: See TracBrowser for help on using the repository browser.