MCPcopy Create free account
hub / github.com/LASzip/LASzip / write_points_explicit_chunk

Function write_points_explicit_chunk

example/laszippertest.cpp:586–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584//---------------------------------------------------------------------------
585
586static void write_points_explicit_chunk(LASzipper* zipper, PointData& data)
587{
588 if (zipper==NULL)
589 return;
590
591 double start_time, end_time;
592 unsigned char c;
593 unsigned int i,j;
594 unsigned int next_chunk = settings->num_points/10;
595
596 // the two branches of this IF are the same, except for the use of a random number;
597 // we keep the random case separate, so that we can get fastest timing tests w/o random data
598 if (settings->use_random)
599 {
600 srand(settings->seed);
601 start_time = taketime();
602 c = rand() % 256;
603 for (i = 0; i < settings->num_points; i++)
604 {
605 for (j = 0; j < data.point_size; j++)
606 {
607 data.point_data[j] = c;
608 c = rand() % 256;
609 }
610 zipper->write(data.point);
611 if (i == next_chunk)
612 {
613 zipper->chunk();
614 next_chunk += settings->num_points/10;
615 next_chunk -= c;
616 }
617 }
618 }
619 else
620 {
621 start_time = taketime();
622 c = 0;
623 for (i = 0; i < settings->num_points; i++)
624 {
625 for (j = 0; j < data.point_size; j++)
626 {
627 data.point_data[j] = c;
628 c++;
629 }
630 zipper->write(data.point);
631 if (i == next_chunk)
632 {
633 zipper->chunk();
634 next_chunk += settings->num_points/10;
635 next_chunk -= (rand() % 256);
636 }
637 }
638 }
639
640 if (!zipper->close())
641 {
642 log("ERROR on zipper->close(): %s\n", zipper->get_error());
643 }

Callers 1

run_testFunction · 0.85

Calls 6

logFunction · 0.85
taketimeFunction · 0.70
writeMethod · 0.45
chunkMethod · 0.45
closeMethod · 0.45
get_errorMethod · 0.45

Tested by

no test coverage detected