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

Method ReadIntBlock

IO/Parallel/vtkMultiBlockPLOT3DReader.cxx:2705–2737  ·  view source on GitHub ↗

Read a block of ints (ascii or binary) and return number read.

Source from the content-addressed store, hash-verified

2703
2704// Read a block of ints (ascii or binary) and return number read.
2705int vtkMultiBlockPLOT3DReader::ReadIntBlock(FILE* fp, int n, int* block)
2706{
2707 if (this->Internal->Settings.BinaryFile)
2708 {
2709 vtkIdType retVal = static_cast<vtkIdType>(fread(block, sizeof(int), n, fp));
2710 if (this->Internal->Settings.ByteOrder == FILE_LITTLE_ENDIAN)
2711 {
2712 vtkByteSwap::Swap4LERange(block, n);
2713 }
2714 else
2715 {
2716 vtkByteSwap::Swap4BERange(block, n);
2717 }
2718 return retVal == n;
2719 }
2720 else
2721 {
2722 vtkIdType count = 0;
2723 for (int i = 0; i < n; i++)
2724 {
2725 if (auto result = vtk::scan_value<int>(fp))
2726 {
2727 block[i] = result->value();
2728 count++;
2729 }
2730 else
2731 {
2732 return 0;
2733 }
2734 }
2735 return count == n;
2736 }
2737}
2738
2739vtkDataArray* vtkMultiBlockPLOT3DReader::NewFloatArray()
2740{

Callers 6

ReadArraysMethod · 0.95
ReadIntScalarMethod · 0.95
ReadGeometryHeaderMethod · 0.95
ReadQHeaderMethod · 0.95
ReadFunctionHeaderMethod · 0.95

Calls 1

valueMethod · 0.45

Tested by

no test coverage detected