- Timestamp:
- Mar 8, 2006, 11:26:58 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mesh/test_grid1d.cc
r256 r296 27 27 }; 28 28 29 static double points2[20][2] = {30 0.309504615287, 0.844069129715,31 0.269863116215, 0.589394224151,32 0.948725301748, 0.226146486693,33 0.844001851438, 0.139117111982,34 0.141301087635, 0.847379885543,35 0.913736318664, 0.166307778641,36 0.134835615817, 0.182195034894,37 0.151951467689, 0.848317450773,38 0.671395143807, 0.138181958412,39 0.424175028887, 0.10971049923,40 0.904360553671, 0.587825545849,41 0.58394908746, 0.432312932998,42 0.88346489886, 0.394555137211,43 0.288191101648, 0.627845397977,44 0.197603800892, 0.127081587039,45 0.86023335618, 0.942017313532,46 0.484988525736, 0.202152039484,47 0.56932761081, 0.689154883236,48 0.62612255133, 0.241720210408,49 0.591576322723, 0.62325600517150 };51 52 29 int main() 53 30 { … … 57 34 58 35 printf("Testing constructor\n"); 59 RpGrid1d grid1( 20);36 RpGrid1d grid1("output.grid(g1d)", 20); 60 37 61 printf("vector size: %d\n", grid1. numPoints());38 printf("vector size: %d\n", grid1.size()); 62 39 printf("capacity: %d\n", grid1.capacity()); 63 40 … … 65 42 grid1.addAllPoints(&(points[0]), 20); 66 43 67 printf("vector size: %d\n", grid1. numPoints());44 printf("vector size: %d\n", grid1.size()); 68 45 69 46 printf("Testing print\n"); … … 80 57 fclose(fp); 81 58 82 printf("Testing deserialize\n"); 83 grid1.deserialize(buf); 59 printf("Testing print\n"); 84 60 grid1.print(); 85 61 86 printf("Testing instantiation from byte stream\n"); 87 RpGrid1d * grid2; 62 printf("Testing deserialize\n"); 88 63 89 grid2 = new RpGrid1d(buf); 64 RpGrid1d * grid2 = new RpGrid1d("test.path"); 65 grid2->deserialize(buf); 90 66 91 grid2->print(); 92 93 printf("Testing grid2.data()\n"); 94 95 double* ptr = grid2->data(); 96 for (i=0; i<grid2->numPoints(); i++) { 97 printf("%.12f \n", ptr[i]); 67 printf("Testing getData\n"); 68 69 double* ptr = grid2->getDataCopy(); 70 for (i=0; i<grid2->size(); i++) { 71 printf("%.12f\n", ptr[i]); 98 72 } 99 73 100 /*101 printf("Testing addPoint\n");102 74 103 RpGrid1d grid3(20);104 grid3.addPoint(points[0]);105 grid3.addPoint(points[1]);106 grid3.addPoint(points[2]);107 108 printf("size=%d\n", grid3.numPoints());109 110 grid3.print();111 112 printf("Testing data()\n");113 printf("size=%d\n", grid3.numPoints());114 double* ptr = grid3.data();115 for (i=0; i<grid3.numPoints(); i++) {116 printf("%.12f \n", ptr[i]);117 }*/118 75 119 76 return 0;
Note: See TracChangeset
for help on using the changeset viewer.