Changeset 188 for trunk/src/mesh/node.cc


Ignore:
Timestamp:
Feb 17, 2006 8:30:27 AM (18 years ago)
Author:
cxsong
Message:

added sets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mesh/node.cc

    r187 r188  
    44// assign value to coordinate[index]
    55//
    6 RP_ERROR RpNode::set(int val, int index)
     6RP_ERROR
     7RpNode::set(int val, int index)
    78{
    89        RP_ERROR err = RP_SUCCESS;
     
    1011        if (index < m_dim)
    1112                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
     22void
     23RpNode::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
     33void
     34RpNode::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
     45RP_ERROR
     46RpNode::get(int& val, int index)
     47{
     48        RP_ERROR err = RP_SUCCESS;
     49
     50        if (index < m_dim)
     51                val =  m_node[index];
    1252        else {
    1353                RpAppendErr("RpNode::set: index out of bound");
Note: See TracChangeset for help on using the changeset viewer.