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

Method ReadValues

IO/Parallel/vtkMultiBlockPLOT3DReader.cxx:2751–2813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2749}
2750
2751vtkIdType vtkMultiBlockPLOT3DReader::ReadValues(FILE* fp, int n, vtkDataArray* scalar)
2752{
2753 if (this->Internal->Settings.BinaryFile)
2754 {
2755 if (this->Internal->Settings.Precision == 4)
2756 {
2757 vtkPLOT3DArrayReader<float> arrayReader;
2758 arrayReader.ByteOrder = this->Internal->Settings.ByteOrder;
2759 vtkFloatArray* floatArray = static_cast<vtkFloatArray*>(scalar);
2760 return arrayReader.ReadScalar(fp, 0, n, 0, floatArray->WritePointer(0, n));
2761 }
2762 else
2763 {
2764 vtkPLOT3DArrayReader<double> arrayReader;
2765 arrayReader.ByteOrder = this->Internal->Settings.ByteOrder;
2766 vtkDoubleArray* doubleArray = static_cast<vtkDoubleArray*>(scalar);
2767 return arrayReader.ReadScalar(fp, 0, n, 0, doubleArray->WritePointer(0, n));
2768 }
2769 }
2770 else
2771 {
2772 if (this->Internal->Settings.Precision == 4)
2773 {
2774 vtkFloatArray* floatArray = static_cast<vtkFloatArray*>(scalar);
2775 float* values = floatArray->WritePointer(0, n);
2776
2777 int count = 0;
2778 for (int i = 0; i < n; i++)
2779 {
2780 if (auto result = vtk::scan_value<float>(fp))
2781 {
2782 values[i] = result->value();
2783 count++;
2784 }
2785 else
2786 {
2787 return 0;
2788 }
2789 }
2790 return count;
2791 }
2792 else
2793 {
2794 vtkDoubleArray* doubleArray = static_cast<vtkDoubleArray*>(scalar);
2795 double* values = doubleArray->WritePointer(0, n);
2796
2797 int count = 0;
2798 for (int i = 0; i < n; i++)
2799 {
2800 if (auto result = vtk::scan_value<double>(fp))
2801 {
2802 values[i] = result->value();
2803 count++;
2804 }
2805 else
2806 {
2807 return 0;
2808 }

Callers 3

GetTimeValueMethod · 0.95
ReadArraysMethod · 0.95
ReadVectorMethod · 0.95

Calls 3

ReadScalarMethod · 0.45
WritePointerMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected