Commit 4aa479b0 authored by Robert Maynard's avatar Robert Maynard Committed by Kitware Robot
Browse files

Merge topic 'io_writer_copies_by_value_less_frequently'

8e38e383

 VTKDataSetWriter now uses const ref wherever possible to reduce copies.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Allison Vacanti's avatarAllison Vacanti <allison.vacanti@kitware.com>
Merge-request: !1246
parents e50350d0 8e38e383
...@@ -157,7 +157,7 @@ private: ...@@ -157,7 +157,7 @@ private:
struct VTKDataSetWriter struct VTKDataSetWriter
{ {
private: private:
static void WritePoints(std::ostream& out, vtkm::cont::DataSet dataSet) static void WritePoints(std::ostream& out, const vtkm::cont::DataSet& dataSet)
{ {
///\todo: support other coordinate systems ///\todo: support other coordinate systems
int cindex = 0; int cindex = 0;
...@@ -171,7 +171,7 @@ private: ...@@ -171,7 +171,7 @@ private:
} }
template <class CellSetType> template <class CellSetType>
static void WriteExplicitCells(std::ostream& out, CellSetType cellSet) static void WriteExplicitCells(std::ostream& out, const CellSetType& cellSet)
{ {
vtkm::Id nCells = cellSet.GetNumberOfCells(); vtkm::Id nCells = cellSet.GetNumberOfCells();
...@@ -203,7 +203,7 @@ private: ...@@ -203,7 +203,7 @@ private:
} }
} }
static void WriteVertexCells(std::ostream& out, vtkm::cont::DataSet dataSet) static void WriteVertexCells(std::ostream& out, const vtkm::cont::DataSet& dataSet)
{ {
vtkm::Id nCells = dataSet.GetCoordinateSystem(0).GetData().GetNumberOfValues(); vtkm::Id nCells = dataSet.GetCoordinateSystem(0).GetData().GetNumberOfValues();
...@@ -219,7 +219,7 @@ private: ...@@ -219,7 +219,7 @@ private:
} }
} }
static void WritePointFields(std::ostream& out, vtkm::cont::DataSet dataSet) static void WritePointFields(std::ostream& out, const vtkm::cont::DataSet& dataSet)
{ {
bool wrote_header = false; bool wrote_header = false;
for (vtkm::Id f = 0; f < dataSet.GetNumberOfFields(); f++) for (vtkm::Id f = 0; f < dataSet.GetNumberOfFields(); f++)
...@@ -255,8 +255,8 @@ private: ...@@ -255,8 +255,8 @@ private:
} }
static void WriteCellFields(std::ostream& out, static void WriteCellFields(std::ostream& out,
vtkm::cont::DataSet dataSet, const vtkm::cont::DataSet& dataSet,
vtkm::cont::DynamicCellSet cellSet) const vtkm::cont::DynamicCellSet& cellSet)
{ {
bool wrote_header = false; bool wrote_header = false;
for (vtkm::Id f = 0; f < dataSet.GetNumberOfFields(); f++) for (vtkm::Id f = 0; f < dataSet.GetNumberOfFields(); f++)
...@@ -293,7 +293,7 @@ private: ...@@ -293,7 +293,7 @@ private:
} }
} }
static void WriteDataSetAsPoints(std::ostream& out, vtkm::cont::DataSet dataSet) static void WriteDataSetAsPoints(std::ostream& out, const vtkm::cont::DataSet& dataSet)
{ {
out << "DATASET UNSTRUCTURED_GRID" << std::endl; out << "DATASET UNSTRUCTURED_GRID" << std::endl;
WritePoints(out, dataSet); WritePoints(out, dataSet);
...@@ -302,8 +302,8 @@ private: ...@@ -302,8 +302,8 @@ private:
template <class CellSetType> template <class CellSetType>
static void WriteDataSetAsUnstructured(std::ostream& out, static void WriteDataSetAsUnstructured(std::ostream& out,
vtkm::cont::DataSet dataSet, const vtkm::cont::DataSet& dataSet,
CellSetType cellSet) const CellSetType& cellSet)
{ {
out << "DATASET UNSTRUCTURED_GRID" << std::endl; out << "DATASET UNSTRUCTURED_GRID" << std::endl;
WritePoints(out, dataSet); WritePoints(out, dataSet);
...@@ -312,8 +312,8 @@ private: ...@@ -312,8 +312,8 @@ private:
template <vtkm::IdComponent DIM> template <vtkm::IdComponent DIM>
static void WriteDataSetAsStructured(std::ostream& out, static void WriteDataSetAsStructured(std::ostream& out,
vtkm::cont::DataSet dataSet, const vtkm::cont::DataSet& dataSet,
vtkm::cont::CellSetStructured<DIM> cellSet) const vtkm::cont::CellSetStructured<DIM>& cellSet)
{ {
///\todo: support uniform/rectilinear ///\todo: support uniform/rectilinear
out << "DATASET STRUCTURED_GRID" << std::endl; out << "DATASET STRUCTURED_GRID" << std::endl;
...@@ -326,7 +326,7 @@ private: ...@@ -326,7 +326,7 @@ private:
WritePoints(out, dataSet); WritePoints(out, dataSet);
} }
static void Write(std::ostream& out, vtkm::cont::DataSet dataSet, vtkm::Id csindex = 0) static void Write(std::ostream& out, const vtkm::cont::DataSet& dataSet, vtkm::Id csindex = 0)
{ {
VTKM_ASSERT(csindex < dataSet.GetNumberOfCellSets()); VTKM_ASSERT(csindex < dataSet.GetNumberOfCellSets());
...@@ -377,7 +377,7 @@ public: ...@@ -377,7 +377,7 @@ public:
} }
VTKM_CONT VTKM_CONT
void WriteDataSet(vtkm::cont::DataSet dataSet, vtkm::Id cellSetIndex = 0) const void WriteDataSet(const vtkm::cont::DataSet& dataSet, vtkm::Id cellSetIndex = 0) const
{ {
if (cellSetIndex >= dataSet.GetNumberOfCellSets()) if (cellSetIndex >= dataSet.GetNumberOfCellSets())
{ {
...@@ -412,7 +412,7 @@ public: ...@@ -412,7 +412,7 @@ public:
} }
VTKM_CONT VTKM_CONT
void WriteDataSet(vtkm::cont::DataSet dataSet, const std::string& cellSetName) const void WriteDataSet(const vtkm::cont::DataSet& dataSet, const std::string& cellSetName)
{ {
this->WriteDataSet(dataSet, dataSet.GetCellSetIndex(cellSetName)); this->WriteDataSet(dataSet, dataSet.GetCellSetIndex(cellSetName));
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment