Changeset 241 for trunk/src


Ignore:
Timestamp:
Mar 1, 2006 10:41:00 AM (18 years ago)
Author:
cxsong
Message:

modified getNodesList, getNode, etc.

Location:
trunk/src/mesh
Files:
2 edited

Legend:

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

    r233 r241  
    5757//
    5858RP_ERROR
    59 //RpMesh3d::addAllNodes(int numNodes, int nodes[][3])
    6059RpMesh3d::addAllNodes(int numNodes, int* nodes)
    6160{
     
    127126//   elemArray: a 2d array, e.g.:
    128127//      static int elem[6][4] = {
    129 //              0,1,5,6,
    130 //              1,2,6,7,
    131 //              2,3,7,1,
    132 //              3,4,1,2,
    133 //              5,6,2,3,
    134 //              6,7,3,4
     128//              {0,1,5,6},
     129//              {1,2,6,7},
     130//              {2,3,7,1},
     131//              {3,4,1,2},
     132//              {5,6,2,3},
     133//              {6,7,3,4}
    135134//      };
    136135//
     
    157156// retrieve nodes
    158157void
    159 RpMesh3d::getNode(int nodeSeqNum, int& x, int& y, int& z)
     158RpMesh3d::getNode(int nodeSeqNum, int* x, int* y, int* z)
    160159{
    161160        if (nodeSeqNum < m_numNodes)
     
    173172}
    174173
    175 RP_ERROR
    176 RpMesh3d::getNodesList(int* nodesList, int& num)
    177 {
     174//
     175// Returns nodes in a list of int (nodesList)
     176// Input:
     177//      nodesList: length should be 3*numNodes
     178//      numNodes: number of nodes
     179// Returns:
     180//      numnodes = number of nodes returned
     181//      nodesList = all the nodes in mesh
     182//
     183RP_ERROR
     184RpMesh3d::getNodesList(int* nodesList, int& numNodes)
     185{
     186        if (nodesList == NULL)
     187                return RP_ERR_NULL_PTR;
     188        if (numNodes > m_numNodes)
     189                numNodes = m_numNodes;
     190
     191        int j;
     192        for (int i=0; i<numNodes; i++) {
     193                j = i * 3;
     194                getNode(i, &(nodesList[j]), &(nodesList[j+1]), &(nodesList[j+2]));
     195        }
     196
    178197        return RP_SUCCESS;
    179198}
  • trunk/src/mesh/mesh.h

    r233 r241  
    3636
    3737        // retrieve nodes
    38         void getNode(int nodeSeqNum, int& x, int& y, int& z);
     38        void getNode(int nodeSeqNum, int* x, int* y, int* z);
    3939        RP_ERROR getNode(int nodeSeqNum, RpNode3d& node);
    4040        RP_ERROR getNodesList(int* nodesList, int& num);
Note: See TracChangeset for help on using the changeset viewer.