MCPcopy Create free account
hub / github.com/Kitware/VTK / ProduceOutputFromBinaryFileDouble

Method ProduceOutputFromBinaryFileDouble

IO/Geometry/vtkParticleReader.cxx:502–673  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

500
501//------------------------------------------------------------------------------
502int vtkParticleReader::ProduceOutputFromBinaryFileDouble(vtkInformationVector* outputVector)
503{
504
505 unsigned long fileLength, start, next, length, ptIdx, cellPtIdx;
506 unsigned long cellLength;
507 int piece, numPieces;
508 double *data, *ptr;
509
510 if (!this->FileName)
511 {
512 vtkErrorMacro(<< "FileName must be specified.");
513 return 0;
514 }
515
516 this->OpenFile();
517
518 // Get the size of the header from the size of the image
519 this->File->seekg(0, ios::end);
520 if (this->File->fail())
521 {
522 vtkErrorMacro("Could not seek to end of file.");
523 return 0;
524 }
525
526 fileLength = (unsigned long)this->File->tellg();
527 if (this->HasScalar)
528 {
529 this->NumberOfPoints = fileLength / (4 * sizeof(double));
530 }
531 else
532 {
533 this->NumberOfPoints = fileLength / (3 * sizeof(double));
534 }
535
536 // get the info object
537 vtkInformation* outInfo = outputVector->GetInformationObject(0);
538
539 piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
540 numPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());
541
542 if ((unsigned long)numPieces > this->NumberOfPoints)
543 {
544 numPieces = (int)(this->NumberOfPoints);
545 }
546 if (numPieces <= 0 || piece < 0 || piece >= numPieces)
547 {
548 return 0;
549 }
550
551 start = static_cast<unsigned long>(piece * this->NumberOfPoints / numPieces);
552 next = static_cast<unsigned long>((piece + 1) * this->NumberOfPoints / numPieces);
553
554 length = next - start;
555
556 if (this->HasScalar)
557 {
558 data = new double[length * 4];
559 }

Callers

nothing calls this directly

Calls 15

OpenFileMethod · 0.95
GetInformationObjectMethod · 0.80
AllocateEstimateMethod · 0.80
InsertCellPointMethod · 0.80
SetVertsMethod · 0.80
SetScalarsMethod · 0.80
NewFunction · 0.50
minFunction · 0.50
GetMethod · 0.45
readMethod · 0.45
UpdateProgressMethod · 0.45
SetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected