| 308 | //--------------------------------------------------------------------------- |
| 309 | |
| 310 | static void write_points(LASzipper* zipper, PointData& data) |
| 311 | { |
| 312 | if (zipper==NULL) |
| 313 | return; |
| 314 | |
| 315 | double start_time, end_time; |
| 316 | unsigned char c; |
| 317 | unsigned int i,j; |
| 318 | |
| 319 | // the two branches of this IF are the same, except for the use of a random number; |
| 320 | // we keep the random case separate, so that we can get fastest timing tests w/o random data |
| 321 | if (settings->use_random) |
| 322 | { |
| 323 | srand(settings->seed); |
| 324 | start_time = taketime(); |
| 325 | c = rand() % 256; |
| 326 | for (i = 0; i < settings->num_points; i++) |
| 327 | { |
| 328 | for (j = 0; j < data.point_size; j++) |
| 329 | { |
| 330 | data.point_data[j] = c; |
| 331 | c = rand() % 256; |
| 332 | } |
| 333 | zipper->write(data.point); |
| 334 | } |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | start_time = taketime(); |
| 339 | c = 0; |
| 340 | for (i = 0; i < settings->num_points; i++) |
| 341 | { |
| 342 | for (j = 0; j < data.point_size; j++) |
| 343 | { |
| 344 | data.point_data[j] = c; |
| 345 | c++; |
| 346 | } |
| 347 | zipper->write(data.point); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | if (!zipper->close()) |
| 352 | { |
| 353 | log("ERROR on zipper->close(): %s\n", zipper->get_error()); |
| 354 | } |
| 355 | end_time = taketime(); |
| 356 | |
| 357 | log("laszipper wrote %u points in %g seconds\n", settings->num_points, end_time-start_time); |
| 358 | |
| 359 | return; |
| 360 | } |
| 361 | |
| 362 | |
| 363 | //--------------------------------------------------------------------------- |