- Timestamp:
- Mar 10, 2006, 8:28:52 AM (19 years ago)
- Location:
- trunk/src/mesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mesh/grid1d.cc
r300 r315 29 29 RpGrid1d::RpGrid1d(const char * buf) 30 30 { 31 #ifdef DEBUG 32 printf("RpGrid1d(char*)\n"); 33 #endif 31 34 deserialize(buf); 32 35 } … … 251 254 RpGrid1d::objectName(const char* str) 252 255 { 253 m_name = str;256 m_name.assign(str); 254 257 } 255 258 … … 282 285 + m_data.size() * sizeof(DataValType); 283 286 284 #ifdef DEBUG285 printf("RpGrid1d::numBytes returns %d\n", nbytes);286 #endif287 287 return nbytes; 288 288 } -
trunk/src/mesh/test_grid.cc
r309 r315 45 45 { 46 46 int i, j, err, nbytes; 47 const char* name1 = "output.grid(g1d)"; 48 const char* name2 = "output.grid(g2d)"; 47 49 48 50 printf("Testing RpGrid1d\n"); 49 51 50 RpGrid1d* grid1 = new RpGrid1d( "output.grid(g1d)", 20);52 RpGrid1d* grid1 = new RpGrid1d(name1, 20); 51 53 grid1->addAllPoints(&(points[0]), 20); 52 54 53 char* buf = grid1->serialize(nbytes); 54 writeToFile(buf, nbytes, "out.grid1"); 55 56 delete [] buf; 57 buf = NULL; 58 59 printf("grid1 objectname: %s\n", grid1->objectName()); 55 RpGrid1d* grid2 = new RpGrid1d(name2, 20); 56 grid2->addAllPoints(&(points[0]), 20); 60 57 61 58 printf("Testing serializer\n"); … … 63 60 RpSerializer myvis; 64 61 myvis.addObject(grid1); 65 RpGrid1d* ptr = (RpGrid1d*) myvis.getObject(grid1->objectName()); 66 if (ptr == NULL) 67 printf("%s not found\n", grid1->objectName()); 62 myvis.addObject(grid2); 68 63 69 buf = myvis.serialize();64 char* buf = myvis.serialize(); 70 65 71 66 // write the byte stream to a file for verification 72 67 nbytes = myvis.numBytes(); 73 writeToFile(buf, nbytes, "out.g 1");68 writeToFile(buf, nbytes, "out.g2"); 74 69 75 70 //myvis.print(); … … 81 76 newvis.print(); 82 77 78 printf("Testing serializer::getObject\n"); 79 80 RpGrid1d* ptr1 = (RpGrid1d*) newvis.getObject(name1); 81 if (ptr1 != NULL) 82 ptr1->print(); 83 else 84 printf("%s not found\n", name1); 85 86 RpGrid1d* ptr2 = (RpGrid1d*) newvis.getObject(name2); 87 if (ptr2 != NULL) 88 ptr2->print(); 89 else 90 printf("%s not found\n", name2); 91 92 delete [] buf; 93 83 94 return 0; 84 95 }
Note: See TracChangeset
for help on using the changeset viewer.