2015-11-03 03:24:57 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2015-11-03 03:24:57 +00:00
|
|
|
// 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.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_cont_DataSetFieldAdd_h
|
|
|
|
#define vtk_m_cont_DataSetFieldAdd_h
|
|
|
|
|
2020-05-27 19:27:47 +00:00
|
|
|
#include <vtkm/Deprecated.h>
|
2015-12-22 17:41:30 +00:00
|
|
|
#include <vtkm/cont/DataSet.h>
|
|
|
|
#include <vtkm/cont/Field.h>
|
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
2015-11-03 03:24:57 +00:00
|
|
|
|
2020-05-27 19:27:47 +00:00
|
|
|
class VTKM_DEPRECATED(1.6,
|
|
|
|
"The AddPointField and AddCellField methods should now be called "
|
|
|
|
"directly on the vtkm::cont::DataSet object") DataSetFieldAdd
|
2015-11-03 03:24:57 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-05-18 14:29:41 +00:00
|
|
|
VTKM_CONT
|
|
|
|
DataSetFieldAdd() {}
|
|
|
|
|
|
|
|
//Point centered fields.
|
|
|
|
VTKM_CONT
|
2017-05-26 17:53:28 +00:00
|
|
|
static void AddPointField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
2021-04-02 17:37:49 +00:00
|
|
|
const vtkm::cont::UnknownArrayHandle& field)
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
2019-08-13 14:10:52 +00:00
|
|
|
dataSet.AddField(make_FieldPoint(fieldName, field));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename Storage>
|
2017-05-26 17:53:28 +00:00
|
|
|
VTKM_CONT static void AddPointField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
2017-05-18 14:29:41 +00:00
|
|
|
const vtkm::cont::ArrayHandle<T, Storage>& field)
|
|
|
|
{
|
2019-08-13 14:10:52 +00:00
|
|
|
dataSet.AddField(make_FieldPoint(fieldName, field));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
2017-05-26 17:53:28 +00:00
|
|
|
VTKM_CONT static void AddPointField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
2017-05-18 14:29:41 +00:00
|
|
|
const std::vector<T>& field)
|
|
|
|
{
|
2017-12-20 22:07:44 +00:00
|
|
|
dataSet.AddField(
|
2018-05-18 20:10:15 +00:00
|
|
|
make_Field(fieldName, vtkm::cont::Field::Association::POINTS, field, vtkm::CopyFlag::On));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
2017-05-26 17:53:28 +00:00
|
|
|
VTKM_CONT static void AddPointField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
|
|
|
const T* field,
|
|
|
|
const vtkm::Id& n)
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
2017-12-20 22:07:44 +00:00
|
|
|
dataSet.AddField(
|
2018-05-18 20:10:15 +00:00
|
|
|
make_Field(fieldName, vtkm::cont::Field::Association::POINTS, field, n, vtkm::CopyFlag::On));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Cell centered field
|
|
|
|
VTKM_CONT
|
2017-05-26 17:53:28 +00:00
|
|
|
static void AddCellField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
2021-04-02 17:37:49 +00:00
|
|
|
const vtkm::cont::UnknownArrayHandle& field)
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
2019-08-13 17:08:54 +00:00
|
|
|
dataSet.AddField(make_FieldCell(fieldName, field));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T, typename Storage>
|
2017-05-26 17:53:28 +00:00
|
|
|
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
2019-08-13 17:08:54 +00:00
|
|
|
const vtkm::cont::ArrayHandle<T, Storage>& field)
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
2019-08-13 17:08:54 +00:00
|
|
|
dataSet.AddField(make_FieldCell(fieldName, field));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
2017-05-26 17:53:28 +00:00
|
|
|
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
2019-08-13 17:08:54 +00:00
|
|
|
const std::vector<T>& field)
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
2019-08-13 17:08:54 +00:00
|
|
|
dataSet.AddField(
|
|
|
|
make_Field(fieldName, vtkm::cont::Field::Association::CELL_SET, field, vtkm::CopyFlag::On));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
2017-05-26 17:53:28 +00:00
|
|
|
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
|
|
|
|
const std::string& fieldName,
|
|
|
|
const T* field,
|
2019-08-13 17:08:54 +00:00
|
|
|
const vtkm::Id& n)
|
2017-05-18 14:29:41 +00:00
|
|
|
{
|
2019-08-13 17:08:54 +00:00
|
|
|
dataSet.AddField(make_Field(
|
|
|
|
fieldName, vtkm::cont::Field::Association::CELL_SET, field, n, vtkm::CopyFlag::On));
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
2015-11-03 03:24:57 +00:00
|
|
|
};
|
|
|
|
}
|
2017-05-18 14:29:41 +00:00
|
|
|
} //namespace vtkm::cont
|
2015-11-03 03:24:57 +00:00
|
|
|
|
|
|
|
#endif //vtk_m_cont_DataSetFieldAdd_h
|