VTK-m  2.2
ConnectivityStructured.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_exec_ConnectivityStructured_h
12 #define vtk_m_exec_ConnectivityStructured_h
13 
14 #include <vtkm/Deprecated.h>
16 #include <vtkm/Types.h>
18 
19 namespace vtkm
20 {
21 namespace exec
22 {
23 
29 template <typename VisitTopology, typename IncidentTopology, vtkm::IdComponent Dimension>
31 {
32  VTKM_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology);
33  VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
34 
35  using InternalsType = vtkm::internal::ConnectivityStructuredInternals<Dimension>;
36 
37  using Helper =
38  vtkm::internal::ConnectivityStructuredIndexHelper<VisitTopology, IncidentTopology, Dimension>;
39 
40 public:
41  using SchedulingRangeType = typename InternalsType::SchedulingRangeType;
42 
43  ConnectivityStructured() = default;
44 
47  : Internals(src)
48  {
49  }
50 
51  ConnectivityStructured(const ConnectivityStructured& src) = default;
52 
56  : Internals(src.Internals)
57  {
58  }
59 
60 
63 
64 
70  VTKM_EXEC
71  vtkm::Id GetNumberOfElements() const { return Helper::GetNumberOfElements(this->Internals); }
72 
78  using CellShapeTag = typename Helper::CellShapeTag;
79 
85  VTKM_EXEC
87 
90  template <typename IndexType>
91  VTKM_EXEC vtkm::IdComponent GetNumberOfIndices(const IndexType& index) const
92  {
93  return Helper::GetNumberOfIndices(this->Internals, index);
94  }
95 
97  using IndicesType = typename Helper::IndicesType;
98 
101  template <typename IndexType>
102  VTKM_EXEC IndicesType GetIndices(const IndexType& index) const
103  {
104  return Helper::GetIndices(this->Internals, index);
105  }
106 
110  {
111  return Helper::FlatToLogicalVisitIndex(this->Internals, flatVisitIndex);
112  }
113 
117  {
118  return Helper::FlatToLogicalIncidentIndex(this->Internals, flatIncidentIndex);
119  }
120 
124  const SchedulingRangeType& logicalVisitIndex) const
125  {
126  return Helper::LogicalToFlatVisitIndex(this->Internals, logicalVisitIndex);
127  }
128 
132  const SchedulingRangeType& logicalIncidentIndex) const
133  {
134  return Helper::LogicalToFlatIncidentIndex(this->Internals, logicalIncidentIndex);
135  }
136 
138  VTKM_DEPRECATED(2.1, "Use FlatToLogicalIncidentIndex.")
140  {
141  return this->FlatToLogicalIncidentIndex(flatFromIndex);
142  }
143 
145  VTKM_DEPRECATED(2.1, "Use LogicalToFlatIncidentIndex.")
146  vtkm::Id LogicalToFlatFromIndex(const SchedulingRangeType& logicalFromIndex) const
147  {
148  return this->LogicalToFlatIncidentIndex(logicalFromIndex);
149  }
150 
152  VTKM_DEPRECATED(2.1, "Use FlatToLogicalVisitIndex.")
154  {
155  return this->FlatToLogicalVisitIndex(flatToIndex);
156  }
157 
159  VTKM_DEPRECATED(2.1, "Use LogicalToFlatVisitIndex.")
160  vtkm::Id LogicalToFlatToIndex(const SchedulingRangeType& logicalToIndex) const
161  {
162  return this->LogicalToFlatVisitIndex(logicalToIndex);
163  }
164 
168  {
169  return this->Internals.GetPointDimensions();
170  }
171 
175  {
176  return this->Internals.GetCellDimensions();
177  }
178 
181  {
182  return this->Internals.GetGlobalPointIndexStart();
183  }
184 
185  friend class ConnectivityStructured<IncidentTopology, VisitTopology, Dimension>;
186 
187 private:
189 };
190 }
191 } // namespace vtkm::exec
192 
193 #endif //vtk_m_exec_ConnectivityStructured_h
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ConnectivityStructuredInternals.h
Types.h
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::IdComponent
vtkm::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:194
vtkm::exec::ConnectivityStructured::ConnectivityStructured
ConnectivityStructured()=default
vtkm::exec::ConnectivityStructured::FlatToLogicalToIndex
SchedulingRangeType FlatToLogicalToIndex(vtkm::Id flatToIndex) const
Definition: ConnectivityStructured.h:153
vtkm::exec::ConnectivityStructured::LogicalToFlatToIndex
vtkm::Id LogicalToFlatToIndex(const SchedulingRangeType &logicalToIndex) const
Definition: ConnectivityStructured.h:160
VTKM_IS_TOPOLOGY_ELEMENT_TAG
#define VTKM_IS_TOPOLOGY_ELEMENT_TAG(type)
Definition: TopologyElementTag.h:92
vtkm::exec::ConnectivityStructured::ConnectivityStructured
ConnectivityStructured(const ConnectivityStructured< IncidentTopology, VisitTopology, Dimension > &src)
Definition: ConnectivityStructured.h:54
vtkm::exec::ConnectivityStructured::ConnectivityStructured
ConnectivityStructured(const InternalsType &src)
Definition: ConnectivityStructured.h:46
vtkm::exec::ConnectivityStructured::Helper
vtkm::internal::ConnectivityStructuredIndexHelper< VisitTopology, IncidentTopology, Dimension > Helper
Definition: ConnectivityStructured.h:38
vtkm::exec::ConnectivityStructured::Internals
InternalsType Internals
Definition: ConnectivityStructured.h:188
vtkm::exec::ConnectivityStructured::LogicalToFlatIncidentIndex
vtkm::Id LogicalToFlatIncidentIndex(const SchedulingRangeType &logicalIncidentIndex) const
Convenience method that converts logical indices in a vtkm::Vec of an incident element to a flat,...
Definition: ConnectivityStructured.h:131
vtkm::exec::ConnectivityStructured::FlatToLogicalFromIndex
SchedulingRangeType FlatToLogicalFromIndex(vtkm::Id flatFromIndex) const
Definition: ConnectivityStructured.h:139
vtkm::exec::ConnectivityStructured::SchedulingRangeType
typename InternalsType::SchedulingRangeType SchedulingRangeType
Definition: ConnectivityStructured.h:41
vtkm::exec::ConnectivityStructured::CellShapeTag
typename Helper::CellShapeTag CellShapeTag
The tag representing the cell shape of the visited elements.
Definition: ConnectivityStructured.h:78
vtkm::exec::ConnectivityStructured::GetCellShape
CellShapeTag GetCellShape(vtkm::Id) const
Returns a tag for the cell shape associated with the element at the given index.
Definition: ConnectivityStructured.h:86
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
vtkm::exec::ConnectivityStructured::LogicalToFlatVisitIndex
vtkm::Id LogicalToFlatVisitIndex(const SchedulingRangeType &logicalVisitIndex) const
Convenience method that converts logical indices in a vtkm::Vec of a visited element to a flat,...
Definition: ConnectivityStructured.h:123
vtkm::exec::ConnectivityStructured
A class holding information about topology connections.
Definition: ConnectivityStructured.h:30
vtkm::Vec
A short fixed-length array.
Definition: Types.h:357
vtkm::exec::ConnectivityStructured::GetGlobalPointIndexStart
SchedulingRangeType GetGlobalPointIndexStart() const
Definition: ConnectivityStructured.h:180
vtkm::exec::ConnectivityStructured::GetNumberOfIndices
vtkm::IdComponent GetNumberOfIndices(const IndexType &index) const
Given the index of a visited element, returns the number of incident elements touching it.
Definition: ConnectivityStructured.h:91
vtkm::exec::ConnectivityStructured::operator=
ConnectivityStructured & operator=(const ConnectivityStructured &src)=default
Deprecated.h
vtkm::exec::ConnectivityStructured::IndicesType
typename Helper::IndicesType IndicesType
Type of variable that lists of incident indices will be put into.
Definition: ConnectivityStructured.h:97
vtkm::exec::ConnectivityStructured::FlatToLogicalIncidentIndex
SchedulingRangeType FlatToLogicalIncidentIndex(vtkm::Id flatIncidentIndex) const
Convenience method that converts a flat, 1D index to the incident elements to a vtkm::Vec containing ...
Definition: ConnectivityStructured.h:116
vtkm::exec::ConnectivityStructured::GetPointDimensions
vtkm::Vec< vtkm::Id, Dimension > GetPointDimensions() const
Return the dimensions of the points in the cell set.
Definition: ConnectivityStructured.h:167
vtkm::exec::ConnectivityStructured::GetNumberOfElements
vtkm::Id GetNumberOfElements() const
Provides the number of elements in the topology.
Definition: ConnectivityStructured.h:71
vtkm::exec::ConnectivityStructured::FlatToLogicalVisitIndex
SchedulingRangeType FlatToLogicalVisitIndex(vtkm::Id flatVisitIndex) const
Convenience method that converts a flat, 1D index to the visited elements to a vtkm::Vec containing t...
Definition: ConnectivityStructured.h:109
vtkm::exec::ConnectivityStructured::GetCellDimensions
vtkm::Vec< vtkm::Id, Dimension > GetCellDimensions() const
Return the dimensions of the points in the cell set.
Definition: ConnectivityStructured.h:174
vtkm::exec::ConnectivityStructured::InternalsType
vtkm::internal::ConnectivityStructuredInternals< Dimension > InternalsType
Definition: ConnectivityStructured.h:35
VTKM_DEPRECATED
#define VTKM_DEPRECATED(...)
Definition: Deprecated.h:145
vtkm::exec::ConnectivityStructured::GetIndices
IndicesType GetIndices(const IndexType &index) const
Provides the indices of all elements incident to the visit element of the provided index.
Definition: ConnectivityStructured.h:102
vtkm::exec::ConnectivityStructured::LogicalToFlatFromIndex
vtkm::Id LogicalToFlatFromIndex(const SchedulingRangeType &logicalFromIndex) const
Definition: ConnectivityStructured.h:146
TopologyElementTag.h