vtk-m2/vtkm/cont/DataSet.h

81 lines
2.2 KiB
C
Raw Normal View History

//============================================================================
// 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.
//
// Copyright 2015 Sandia Corporation.
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 Los Alamos National Security.
//
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
2015-01-28 16:27:15 +00:00
#ifndef vtk_m_cont_DataSet_h
#define vtk_m_cont_DataSet_h
2015-01-27 21:22:21 +00:00
2015-02-09 22:04:09 +00:00
#include <vtkm/CellType.h>
2015-01-27 21:22:21 +00:00
#include <vtkm/cont/ArrayHandle.h>
2015-02-10 17:36:10 +00:00
#include <vtkm/cont/Field.h>
2015-01-27 21:22:21 +00:00
#include <vtkm/cont/DynamicArrayHandle.h>
2015-02-10 17:36:10 +00:00
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
2015-04-15 14:45:39 +00:00
#include <vtkm/cont/ExplicitConnectivity.h>
#include <vtkm/cont/RegularConnectivity.h>
2015-04-15 16:43:12 +00:00
#include <vtkm/cont/CellSet.h>
#include <vtkm/cont/CellSetExplicit.h>
#include <vtkm/cont/CellSetStructured.h>
2015-01-27 21:22:21 +00:00
namespace vtkm {
namespace cont {
2015-04-15 16:33:27 +00:00
class CellSet;
2015-01-28 16:27:15 +00:00
class DataSet
2015-01-27 21:22:21 +00:00
{
public:
DataSet() {}
2015-02-10 17:36:10 +00:00
template <typename T>
void AddFieldViaCopy(T *ptr, int nvals)
{
vtkm::cont::ArrayHandle<T> tmp = vtkm::cont::make_ArrayHandle(ptr, nvals);
vtkm::cont::ArrayHandle<vtkm::FloatDefault> array;
vtkm::cont::DeviceAdapterAlgorithm<VTKM_DEFAULT_DEVICE_ADAPTER_TAG>::
Copy(tmp, array);
Fields.resize(Fields.size()+1);
Fields[Fields.size()-1].SetData(array);
}
vtkm::cont::Field &GetField(int index)
{
return Fields[index];
}
vtkm::Id x_idx, y_idx, z_idx;
2015-01-27 21:22:21 +00:00
vtkm::cont::CellSet *GetCellSet(int index=0)
{
return CellSets[index];
}
2015-04-15 16:33:27 +00:00
void AddCellSet(vtkm::cont::CellSet *cs)
{
CellSets.push_back(cs);
}
2015-02-10 17:36:10 +00:00
private:
std::vector<vtkm::cont::Field> Fields;
2015-04-15 16:33:27 +00:00
std::vector<vtkm::cont::CellSet*> CellSets;
2015-01-27 21:22:21 +00:00
};
} // namespace cont
} // namespace vtkm
2015-01-27 21:22:21 +00:00
2015-01-28 16:27:15 +00:00
#endif //vtk_m_cont_DataSet_h