------------------------------------------------------------------------------
| 674 | |
| 675 | //------------------------------------------------------------------------------ |
| 676 | int vtkParticleReader::ProduceOutputFromBinaryFileFloat(vtkInformationVector* outputVector) |
| 677 | { |
| 678 | |
| 679 | unsigned long fileLength, start, next, length, ptIdx, cellPtIdx; |
| 680 | unsigned long cellLength; |
| 681 | int piece, numPieces; |
| 682 | float *data, *ptr; |
| 683 | |
| 684 | if (!this->FileName) |
| 685 | { |
| 686 | vtkErrorMacro(<< "FileName must be specified."); |
| 687 | return 0; |
| 688 | } |
| 689 | |
| 690 | this->OpenFile(); |
| 691 | |
| 692 | // Get the size of the header from the size of the image |
| 693 | this->File->seekg(0, ios::end); |
| 694 | if (this->File->fail()) |
| 695 | { |
| 696 | vtkErrorMacro("Could not seek to end of file."); |
| 697 | return 0; |
| 698 | } |
| 699 | |
| 700 | fileLength = (unsigned long)this->File->tellg(); |
| 701 | if (this->HasScalar) |
| 702 | { |
| 703 | this->NumberOfPoints = fileLength / (4 * sizeof(float)); |
| 704 | } |
| 705 | else |
| 706 | { |
| 707 | this->NumberOfPoints = fileLength / (3 * sizeof(float)); |
| 708 | } |
| 709 | |
| 710 | // get the info object |
| 711 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 712 | |
| 713 | piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()); |
| 714 | numPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES()); |
| 715 | |
| 716 | if ((unsigned long)numPieces > this->NumberOfPoints) |
| 717 | { |
| 718 | numPieces = (int)(this->NumberOfPoints); |
| 719 | } |
| 720 | if (numPieces <= 0 || piece < 0 || piece >= numPieces) |
| 721 | { |
| 722 | return 0; |
| 723 | } |
| 724 | |
| 725 | start = static_cast<unsigned long>(piece * this->NumberOfPoints / numPieces); |
| 726 | next = static_cast<unsigned long>((piece + 1) * this->NumberOfPoints / numPieces); |
| 727 | |
| 728 | length = next - start; |
| 729 | |
| 730 | if (this->HasScalar) |
| 731 | { |
| 732 | data = new float[length * 4]; |
| 733 | } |
nothing calls this directly
no test coverage detected