Commit 117ce0be authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Add const correctness to MultiBlock method arguments

Several MultiBlock methods take references as arguments. Generally that
is good as some of the arguments take larger data structures like
DataSet and std::vector that can be passed much faster as a reference.
However, the references were not declared const, which means that you
could not use rvalues. This is now fixed.
parent 6ad53c7b
......@@ -169,20 +169,20 @@ const std::vector<vtkm::cont::DataSet>& MultiBlock::GetBlocks() const
}
VTKM_CONT
void MultiBlock::AddBlock(vtkm::cont::DataSet& ds)
void MultiBlock::AddBlock(const vtkm::cont::DataSet& ds)
{
this->Blocks.insert(this->Blocks.end(), ds);
return;
}
void MultiBlock::AddBlocks(std::vector<vtkm::cont::DataSet>& mblocks)
void MultiBlock::AddBlocks(const std::vector<vtkm::cont::DataSet>& mblocks)
{
this->Blocks.insert(this->Blocks.end(), mblocks.begin(), mblocks.end());
return;
}
VTKM_CONT
void MultiBlock::InsertBlock(vtkm::Id index, vtkm::cont::DataSet& ds)
void MultiBlock::InsertBlock(vtkm::Id index, const vtkm::cont::DataSet& ds)
{
if (index <= static_cast<vtkm::Id>(this->Blocks.size()))
this->Blocks.insert(this->Blocks.begin() + index, ds);
......@@ -194,7 +194,7 @@ void MultiBlock::InsertBlock(vtkm::Id index, vtkm::cont::DataSet& ds)
}
VTKM_CONT
void MultiBlock::ReplaceBlock(vtkm::Id index, vtkm::cont::DataSet& ds)
void MultiBlock::ReplaceBlock(vtkm::Id index, const vtkm::cont::DataSet& ds)
{
if (index < static_cast<vtkm::Id>(this->Blocks.size()))
this->Blocks.at(static_cast<std::size_t>(index)) = ds;
......
......@@ -78,16 +78,16 @@ public:
const std::vector<vtkm::cont::DataSet>& GetBlocks() const;
/// add DataSet "ds" to the end of the contained DataSet vector
VTKM_CONT
void AddBlock(vtkm::cont::DataSet& ds);
void AddBlock(const vtkm::cont::DataSet& ds);
/// add DataSet "ds" to position "index" of the contained DataSet vector
VTKM_CONT
void InsertBlock(vtkm::Id index, vtkm::cont::DataSet& ds);
void InsertBlock(vtkm::Id index, const vtkm::cont::DataSet& ds);
/// replace the "index" positioned element of the contained DataSet vector with "ds"
VTKM_CONT
void ReplaceBlock(vtkm::Id index, vtkm::cont::DataSet& ds);
void ReplaceBlock(vtkm::Id index, const vtkm::cont::DataSet& ds);
/// append the DataSet vector "mblocks" to the end of the contained one
VTKM_CONT
void AddBlocks(std::vector<vtkm::cont::DataSet>& mblocks);
void AddBlocks(const std::vector<vtkm::cont::DataSet>& mblocks);
/// get the unified bounds of the same indexed coordinate system within all contained DataSet
VTKM_CONT
vtkm::Bounds GetBounds(vtkm::Id coordinate_system_index = 0) const;
......
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