- Timestamp:
- Feb 17, 2006 8:30:27 AM (18 years ago)
- Location:
- trunk/src/mesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mesh/node.cc
r187 r188 4 4 // assign value to coordinate[index] 5 5 // 6 RP_ERROR RpNode::set(int val, int index) 6 RP_ERROR 7 RpNode::set(int val, int index) 7 8 { 8 9 RP_ERROR err = RP_SUCCESS; … … 10 11 if (index < m_dim) 11 12 m_node[index] = val; 13 else { 14 RpAppendErr("RpNode::set: index out of bound"); 15 RpPrintErr(); 16 err = RP_ERR_OUTOFBOUND_INDEX; 17 } 18 19 return err; 20 } 21 22 void 23 RpNode::setNode2d(int xval, int yval, const char* id) 24 { 25 m_node.resize(2); 26 27 m_dim = 2; 28 m_node[0] = xval; 29 m_node[1] = yval; 30 m_id = id; 31 } 32 33 void 34 RpNode::setNode3d(int xval, int yval, int zval, const char* id) 35 { 36 m_node.resize(3); 37 38 m_dim = 3; 39 m_node[0] = xval; 40 m_node[1] = yval; 41 m_node[2] = zval; 42 m_id = id; 43 } 44 45 RP_ERROR 46 RpNode::get(int& val, int index) 47 { 48 RP_ERROR err = RP_SUCCESS; 49 50 if (index < m_dim) 51 val = m_node[index]; 12 52 else { 13 53 RpAppendErr("RpNode::set: index out of bound"); -
trunk/src/mesh/node.h
r187 r188 10 10 public: 11 11 // constructors (default to 2d node) 12 RpNode(int dim=2): 13 m_dim(dim) 12 RpNode(int dim=2, const char* id=NULL): 13 m_dim(dim), 14 m_id(id) 14 15 { 15 16 m_node.resize(dim); … … 18 19 // assign value to coordinate[index] 19 20 RP_ERROR set(int val, int index); 21 RP_ERROR get(int& val, int index); 22 23 void setNode2d(int x, int y, const char* id); 24 void setNode3d(int x, int y, int z, const char* id); 25 26 const char* id() { return m_id.c_str(); }; 27 void id(const char* id) { m_id = id; }; 20 28 21 29 char* serialize(); … … 30 38 vector<int> m_node; 31 39 int m_dim; 40 std::string m_id; 32 41 }; 33 42
Note: See TracChangeset
for help on using the changeset viewer.