vtk-m/vtkm/cont/CellSet.h

108 lines
2.8 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 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2015 UT-Battelle, LLC.
// Copyright 2015 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// 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-04-15 16:43:12 +00:00
#ifndef vtk_m_cont_CellSet_h
#define vtk_m_cont_CellSet_h
#include <vtkm/cont/vtkm_cont_export.h>
#include <vtkm/StaticAssert.h>
2015-04-15 16:43:12 +00:00
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
2017-05-18 14:51:24 +00:00
#include <vtkm/cont/Field.h>
#include <vtkm/cont/VariantArrayHandle.h>
2015-04-15 16:43:12 +00:00
2017-05-18 14:29:41 +00:00
namespace vtkm
{
namespace cont
{
2015-04-15 16:43:12 +00:00
class VTKM_CONT_EXPORT CellSet
2015-04-15 16:43:12 +00:00
{
public:
VTKM_CONT
2017-05-18 14:29:41 +00:00
CellSet(const std::string& name)
: Name(name)
{
}
VTKM_CONT
2017-05-18 14:29:41 +00:00
CellSet(const vtkm::cont::CellSet& src)
: Name(src.Name)
2017-05-18 14:29:41 +00:00
{
}
VTKM_CONT
2017-05-18 14:29:41 +00:00
CellSet& operator=(const vtkm::cont::CellSet& src)
{
this->Name = src.Name;
return *this;
}
virtual ~CellSet();
2017-05-18 14:29:41 +00:00
std::string GetName() const { return this->Name; }
virtual vtkm::Id GetNumberOfCells() const = 0;
virtual vtkm::Id GetNumberOfFaces() const = 0;
virtual vtkm::Id GetNumberOfEdges() const = 0;
virtual vtkm::Id GetNumberOfPoints() const = 0;
virtual vtkm::UInt8 GetCellShape(vtkm::Id id) const = 0;
virtual vtkm::IdComponent GetNumberOfPointsInCell(vtkm::Id id) const = 0;
virtual void GetCellPointIds(vtkm::Id id, vtkm::Id* ptids) const = 0;
virtual std::shared_ptr<CellSet> CreateNewInstance() const = 0;
virtual void DeepCopy(const CellSet* src) = 0;
virtual void PrintSummary(std::ostream&) const = 0;
2015-05-20 19:26:10 +00:00
virtual void ReleaseResourcesExecution() = 0;
2015-05-20 19:26:10 +00:00
protected:
2017-05-18 14:29:41 +00:00
std::string Name;
2015-04-15 16:43:12 +00:00
};
2017-05-18 14:29:41 +00:00
namespace internal
{
2016-08-29 15:13:00 +00:00
/// Checks to see if the given object is a cell set. It contains a
/// typedef named \c type that is either std::true_type or
/// std::false_type. Both of these have a typedef named value with the
/// respective boolean value.
///
2017-05-18 14:29:41 +00:00
template <typename T>
struct CellSetCheck
{
using U = typename std::remove_pointer<T>::type;
using type = typename std::is_base_of<vtkm::cont::CellSet, U>;
};
2017-05-18 14:29:41 +00:00
#define VTKM_IS_CELL_SET(T) VTKM_STATIC_ASSERT(::vtkm::cont::internal::CellSetCheck<T>::type::value)
} // namespace internal
2015-04-15 16:43:12 +00:00
}
} // namespace vtkm::cont
#endif //vtk_m_cont_CellSet_h