Changeset 233 for trunk/src/mesh


Ignore:
Timestamp:
Mar 1, 2006 9:46:19 AM (18 years ago)
Author:
cxsong
Message:

fixed allAll functions

Location:
trunk/src/mesh
Files:
2 edited

Legend:

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

    r229 r233  
    5050//                      0,0,1
    5151//              };
     52//
    5253//    2. numNodes: total number of nodes
    5354//
     
    5556//      error codes
    5657//
    57 RP_ERROR RpMesh3d::addAllNodes(int numNodes, int* nodes[])
     58RP_ERROR
     59//RpMesh3d::addAllNodes(int numNodes, int nodes[][3])
     60RpMesh3d::addAllNodes(int numNodes, int* nodes)
    5861{
    5962        if (numNodes != m_numNodes)
     
    6164
    6265        for (int i=0; i<numNodes; i++) {
    63                 m_nodeList[i].set(nodes[i]);
     66                m_nodeList[i].set(&(nodes[i*3]));
    6467                m_nodeList[i].id(i);
    6568        }
     
    7982//      error codes
    8083//
    81 RP_ERROR RpMesh3d::addNode(int* nodeVal)
     84RP_ERROR
     85RpMesh3d::addNode(int* nodeVal)
    8286{
    8387        if (m_nodeIndex < m_numNodes) {
     
    100104//      error codes
    101105//
    102 RP_ERROR RpMesh3d::addElement(int numNodes, const int* nodes)
     106RP_ERROR
     107RpMesh3d::addElement(int numNodes, const int* nodes)
    103108{
    104109        if (numNodes != (*m_elemList)[0].numNodes())
     
    116121}
    117122
     123//
     124// add all elements to mesh
     125//
     126// Input:
     127//   elemArray: a 2d array, e.g.:
     128//      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
     135//      };
     136//
     137//   numElements: number of elements in mesh
     138//   Note: number of nodes in an element must match the number when mesh object
     139//              was instantiated.
     140//
     141//
     142RP_ERROR
     143RpMesh3d::addAllElements(int numElements, int* elemArray)
     144{
     145        if (numElements != m_numElements)
     146                return RP_ERR_WRONG_NUM_NODES;
     147
     148        // number of nodes in an element
     149        int numNodes = (*m_elemList)[0].numNodes();
     150        for (int i=0; i < m_numElements; i++) {
     151                (*m_elemList)[i].addNodes(&(elemArray[i*numNodes]), numNodes);
     152        }
     153
     154        return RP_SUCCESS;
     155}
     156
    118157// retrieve nodes
    119158void
     
    122161        if (nodeSeqNum < m_numNodes)
    123162                m_nodeList[nodeSeqNum].get(x, y, z);
    124 
    125163}
    126164
     
    135173}
    136174
    137 RP_ERROR RpMesh3d::getNodesList(int* nodesList, int& num)
    138 {
    139 }
    140 
    141 RpElement RpMesh3d::getElement(int elemSeqNum)
    142 {
    143 }
    144 
    145 RP_ERROR RpMesh3d::getElement(int elemSeqNum, int* nodesBuf)
    146 {
     175RP_ERROR
     176RpMesh3d::getNodesList(int* nodesList, int& num)
     177{
     178        return RP_SUCCESS;
     179}
     180
     181RpElement
     182RpMesh3d::getElement(int elemSeqNum)
     183{
     184        return RP_SUCCESS;
     185}
     186
     187RP_ERROR
     188RpMesh3d::getElement(int elemSeqNum, int* nodesBuf)
     189{
     190        return RP_SUCCESS;
    147191}
    148192
    149193// serialization
    150 char* RpMesh3d::serialize()
    151 {
    152 
    153 }
    154 
    155 RP_ERROR RpMesh3d::serialize(char* buf, int buflen)
    156 {
    157 }
    158 
    159 RP_ERROR RpMesh3d::deserialize(const char* buf)
    160 {
     194char*
     195RpMesh3d::serialize()
     196{
     197        return NULL;
     198}
     199
     200RP_ERROR
     201RpMesh3d::serialize(char* buf, int buflen)
     202{
     203
     204        return RP_SUCCESS;
     205}
     206
     207RP_ERROR
     208RpMesh3d::deserialize(const char* buf)
     209{
     210        return RP_SUCCESS;
    161211}
    162212
     
    202252}
    203253
    204 
  • trunk/src/mesh/mesh.h

    r228 r233  
    2424
    2525        // add all nodes to mesh
    26         RP_ERROR addAllNodes(int numNodes, int* nodesList[]);
     26        RP_ERROR addAllNodes(int numNodes, int* nodesList);
    2727
    2828        // add one node to mesh
     
    3131        // add an element to mesh
    3232        RP_ERROR addElement(int numNodesInElem, const int* nodes);
     33
     34        // add all elements to mesh
     35        RP_ERROR addAllElements(int numElements, int* elementArray);
    3336
    3437        // retrieve nodes
Note: See TracChangeset for help on using the changeset viewer.