TopologyElementTag.h 3.38 KB
Newer Older
1 2 3 4 5 6 7 8
//============================================================================
//  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.
//
9
//  Copyright 2015 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
10 11 12
//  Copyright 2015 UT-Battelle, LLC.
//  Copyright 2015 Los Alamos National Security.
//
13
//  Under the terms of Contract DE-NA0003525 with NTESS,
14 15 16 17 18 19 20 21 22 23 24
//  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.
//============================================================================
#ifndef vtk_m_TopologyElementTag_h
#define vtk_m_TopologyElementTag_h

#include <vtkm/Types.h>

25 26
namespace vtkm
{
27 28 29 30 31 32 33

/// \brief A tag used to identify the cell elements in a topology.
///
/// A topology element refers to some type of substructure of a topology. For
/// example, a 3D mesh has points, edges, faces, and cells. Each of these is an
/// example of a topology element and has its own tag.
///
34 35 36
struct TopologyElementTagCell
{
};
37 38 39 40 41 42 43

/// \brief A tag used to identify the point elements in a topology.
///
/// A topology element refers to some type of substructure of a topology. For
/// example, a 3D mesh has points, edges, faces, and cells. Each of these is an
/// example of a topology element and has its own tag.
///
44 45 46
struct TopologyElementTagPoint
{
};
47 48 49 50 51 52 53

/// \brief A tag used to identify the edge elements in a topology.
///
/// A topology element refers to some type of substructure of a topology. For
/// example, a 3D mesh has points, edges, faces, and cells. Each of these is an
/// example of a topology element and has its own tag.
///
54 55 56
struct TopologyElementTagEdge
{
};
57 58 59 60 61 62 63

/// \brief A tag used to identify the face elements in a topology.
///
/// A topology element refers to some type of substructure of a topology. For
/// example, a 3D mesh has points, edges, faces, and cells. Each of these is an
/// example of a topology element and has its own tag.
///
64 65 66
struct TopologyElementTagFace
{
};
67

68 69
namespace internal
{
70

71 72 73 74
/// Checks to see if the given object is a topology element tag.This check is
/// compatible with C++11 type_traits.
/// 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
75 76
/// respective boolean value.
///
77
template <typename T>
78
struct TopologyElementTagCheck : std::false_type
79 80 81
{
};

82
template <>
83
struct TopologyElementTagCheck<vtkm::TopologyElementTagCell> : std::true_type
84 85 86
{
};

87
template <>
88
struct TopologyElementTagCheck<vtkm::TopologyElementTagPoint> : std::true_type
89 90 91
{
};

92
template <>
93
struct TopologyElementTagCheck<vtkm::TopologyElementTagEdge> : std::true_type
94 95 96
{
};

97
template <>
98
struct TopologyElementTagCheck<vtkm::TopologyElementTagFace> : std::true_type
99 100 101
{
};

102 103 104
#define VTKM_IS_TOPOLOGY_ELEMENT_TAG(type)                                                         \
  static_assert(::vtkm::internal::TopologyElementTagCheck<type>::value,                            \
                "Invalid Topology Element Tag being used")
105 106 107 108 109 110

} // namespace internal

} // namespace vtkm

#endif //vtk_m_TopologyElementTag_h