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

Function WriteSparseArrayBinary

IO/Core/vtkArrayWriter.cxx:74–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72
73template <typename ValueT>
74bool WriteSparseArrayBinary(const std::string& type_name, vtkArray* array, ostream& stream)
75{
76 vtkSparseArray<ValueT>* const concrete_array = vtkSparseArray<ValueT>::SafeDownCast(array);
77 if (!concrete_array)
78 return false;
79
80 // Write the array header ...
81 WriteHeader("vtk-sparse-array", type_name, array, stream, true);
82 WriteEndianOrderMark(stream);
83
84 // Serialize the array nullptr value ...
85 stream.write(reinterpret_cast<const char*>(&concrete_array->GetNullValue()), sizeof(ValueT));
86
87 // Serialize the array coordinates ...
88 for (vtkIdType i = 0; i != array->GetDimensions(); ++i)
89 {
90 stream.write(reinterpret_cast<char*>(concrete_array->GetCoordinateStorage(i)),
91 concrete_array->GetNonNullSize() * sizeof(vtkIdType));
92 }
93
94 // Serialize the array values ...
95 stream.write(reinterpret_cast<char*>(concrete_array->GetValueStorage()),
96 concrete_array->GetNonNullSize() * sizeof(ValueT));
97
98 return true;
99}
100
101template <>
102bool WriteSparseArrayBinary<vtkStdString>(

Callers

nothing calls this directly

Calls 4

WriteEndianOrderMarkFunction · 0.85
WriteHeaderFunction · 0.70
writeMethod · 0.45
GetDimensionsMethod · 0.45

Tested by

no test coverage detected