2022-01-05 21:39:18 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
|
|
|
//
|
|
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
|
|
//============================================================================
|
2022-12-01 20:07:56 +00:00
|
|
|
#include <vtkm/filter/FilterField.h>
|
2022-01-05 21:39:18 +00:00
|
|
|
|
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace filter
|
|
|
|
{
|
|
|
|
|
2022-12-01 20:07:56 +00:00
|
|
|
vtkm::cont::DataSet FilterField::CreateResultField(const vtkm::cont::DataSet& inDataSet,
|
|
|
|
const vtkm::cont::Field& resultField) const
|
2022-01-27 00:11:11 +00:00
|
|
|
{
|
|
|
|
vtkm::cont::DataSet outDataSet = this->CreateResult(inDataSet);
|
|
|
|
outDataSet.AddField(resultField);
|
|
|
|
VTKM_ASSERT(!resultField.GetName().empty());
|
|
|
|
VTKM_ASSERT(outDataSet.HasField(resultField.GetName(), resultField.GetAssociation()));
|
|
|
|
return outDataSet;
|
|
|
|
}
|
|
|
|
|
2022-12-01 20:07:56 +00:00
|
|
|
void FilterField::ResizeIfNeeded(size_t index_st)
|
2022-01-05 21:39:18 +00:00
|
|
|
{
|
|
|
|
if (this->ActiveFieldNames.size() <= index_st)
|
|
|
|
{
|
|
|
|
auto oldSize = this->ActiveFieldNames.size();
|
|
|
|
this->ActiveFieldNames.resize(index_st + 1);
|
|
|
|
this->ActiveFieldAssociation.resize(index_st + 1);
|
|
|
|
this->UseCoordinateSystemAsField.resize(index_st + 1);
|
|
|
|
this->ActiveCoordinateSystemIndices.resize(index_st + 1);
|
|
|
|
for (std::size_t i = oldSize; i <= index_st; ++i)
|
|
|
|
{
|
2022-03-17 17:02:37 +00:00
|
|
|
this->ActiveFieldAssociation[i] = cont::Field::Association::Any;
|
2022-01-05 21:39:18 +00:00
|
|
|
this->UseCoordinateSystemAsField[i] = false;
|
|
|
|
this->ActiveCoordinateSystemIndices[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace filter
|
2022-01-05 21:40:10 +00:00
|
|
|
} // namespace vtkm
|