source: trunk/src/mesh/test_element.cc @ 222

Last change on this file since 222 was 214, checked in by cxsong, 18 years ago

moved to src/mesh dir

File size: 938 bytes
Line 
1#include "node3d.h"
2#include "element.h"
3
4#define Num_nodes 8
5#define Num_elements 6
6
7static int nodes[8][3] = {
8        0,0,0,
9        1,0,0,
10        1,1,0,
11        0,1,0,
12        0,1,1,
13        1,1,1,
14        0,1,1,
15        0,0,1
16};
17
18static int elem[6][4] = {
19        0,1,5,6,
20        1,2,6,7,
21        2,3,7,1,
22        3,4,1,2,
23        5,6,2,3,
24        6,7,3,4
25};
26
27int main()
28{
29        // create a list of elements
30        // each element represents connectivity of 4 nodes
31        //
32        vector<RpElement> elemList(Num_elements, RpElement(4));
33
34        // an array of nodes
35        RpNode3d nodeList[Num_nodes];
36
37        int i;
38
39        // add nodes to nodeList
40        for (i=0; i<Num_nodes; i++) {
41                nodeList[i].set(nodes[i]);
42                nodeList[i].id(i);
43                nodeList[i].print();
44        }
45
46        string str;
47        //elemList = new RpElement[Num_elements];
48
49        for (i=0; i<Num_elements; i++) {
50                // each element has 4 nodes
51                (elemList[i]).id(i);
52                elemList[i].addNodes(elem[i], 4);
53                elemList[i].xmlString(str);
54                printf("%s\n", str.c_str());
55                printf("element size: %d\n", elemList[i].numNodes());
56        }
57       
58        return 0;
59}
Note: See TracBrowser for help on using the repository browser.