Viskores  1.0
ConnectivityStructured.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 
19 #ifndef viskores_exec_ConnectivityStructured_h
20 #define viskores_exec_ConnectivityStructured_h
21 
22 #include <viskores/Deprecated.h>
24 #include <viskores/Types.h>
26 
27 namespace viskores
28 {
29 namespace exec
30 {
31 
37 template <typename VisitTopology, typename IncidentTopology, viskores::IdComponent Dimension>
39 {
40  VISKORES_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology);
41  VISKORES_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
42 
43  using InternalsType = viskores::internal::ConnectivityStructuredInternals<Dimension>;
44 
45  using Helper = viskores::internal::
46  ConnectivityStructuredIndexHelper<VisitTopology, IncidentTopology, Dimension>;
47 
48 public:
49  using SchedulingRangeType = typename InternalsType::SchedulingRangeType;
50 
51  ConnectivityStructured() = default;
52 
55  : Internals(src)
56  {
57  }
58 
59  ConnectivityStructured(const ConnectivityStructured& src) = default;
60 
64  : Internals(src.Internals)
65  {
66  }
67 
68 
71 
72 
79  viskores::Id GetNumberOfElements() const { return Helper::GetNumberOfElements(this->Internals); }
80 
86  using CellShapeTag = typename Helper::CellShapeTag;
87 
95 
98  template <typename IndexType>
100  {
101  return Helper::GetNumberOfIndices(this->Internals, index);
102  }
103 
105  using IndicesType = typename Helper::IndicesType;
106 
109  template <typename IndexType>
110  VISKORES_EXEC IndicesType GetIndices(const IndexType& index) const
111  {
112  return Helper::GetIndices(this->Internals, index);
113  }
114 
118  {
119  return Helper::FlatToLogicalVisitIndex(this->Internals, flatVisitIndex);
120  }
121 
125  FlatToLogicalIncidentIndex(viskores::Id flatIncidentIndex) const
126  {
127  return Helper::FlatToLogicalIncidentIndex(this->Internals, flatIncidentIndex);
128  }
129 
133  const SchedulingRangeType& logicalVisitIndex) const
134  {
135  return Helper::LogicalToFlatVisitIndex(this->Internals, logicalVisitIndex);
136  }
137 
141  const SchedulingRangeType& logicalIncidentIndex) const
142  {
143  return Helper::LogicalToFlatIncidentIndex(this->Internals, logicalIncidentIndex);
144  }
145 
147  VISKORES_DEPRECATED(2.1, "Use FlatToLogicalIncidentIndex.")
149  {
150  return this->FlatToLogicalIncidentIndex(flatFromIndex);
151  }
152 
154  VISKORES_DEPRECATED(2.1, "Use LogicalToFlatIncidentIndex.")
155  viskores::Id LogicalToFlatFromIndex(const SchedulingRangeType& logicalFromIndex) const
156  {
157  return this->LogicalToFlatIncidentIndex(logicalFromIndex);
158  }
159 
161  VISKORES_DEPRECATED(2.1, "Use FlatToLogicalVisitIndex.")
163  {
164  return this->FlatToLogicalVisitIndex(flatToIndex);
165  }
166 
168  VISKORES_DEPRECATED(2.1, "Use LogicalToFlatVisitIndex.")
169  viskores::Id LogicalToFlatToIndex(const SchedulingRangeType& logicalToIndex) const
170  {
171  return this->LogicalToFlatVisitIndex(logicalToIndex);
172  }
173 
177  {
178  return this->Internals.GetPointDimensions();
179  }
180 
184  {
185  return this->Internals.GetCellDimensions();
186  }
187 
190  {
191  return this->Internals.GetGlobalPointIndexStart();
192  }
193 
194  friend class ConnectivityStructured<IncidentTopology, VisitTopology, Dimension>;
195 
196 private:
198 };
199 }
200 } // namespace viskores::exec
201 
202 #endif //viskores_exec_ConnectivityStructured_h
viskores::exec::ConnectivityStructured::Internals
InternalsType Internals
Definition: ConnectivityStructured.h:197
viskores::exec::ConnectivityStructured::GetCellShape
CellShapeTag GetCellShape(viskores::Id) const
Returns a tag for the cell shape associated with the element at the given index.
Definition: ConnectivityStructured.h:94
viskores::exec::ConnectivityStructured::GetGlobalPointIndexStart
SchedulingRangeType GetGlobalPointIndexStart() const
Definition: ConnectivityStructured.h:189
ConnectivityStructuredInternals.h
Types.h
viskores::exec::ConnectivityStructured::GetCellDimensions
viskores::Vec< viskores::Id, Dimension > GetCellDimensions() const
Return the dimensions of the points in the cell set.
Definition: ConnectivityStructured.h:183
viskores::exec::ConnectivityStructured::Helper
viskores::internal::ConnectivityStructuredIndexHelper< VisitTopology, IncidentTopology, Dimension > Helper
Definition: ConnectivityStructured.h:46
viskores::exec::ConnectivityStructured::GetPointDimensions
viskores::Vec< viskores::Id, Dimension > GetPointDimensions() const
Return the dimensions of the points in the cell set.
Definition: ConnectivityStructured.h:176
viskores::exec::ConnectivityStructured::ConnectivityStructured
ConnectivityStructured(const InternalsType &src)
Definition: ConnectivityStructured.h:54
viskores::exec::ConnectivityStructured::operator=
ConnectivityStructured & operator=(const ConnectivityStructured &src)=default
viskores::exec::ConnectivityStructured::LogicalToFlatToIndex
viskores::Id LogicalToFlatToIndex(const SchedulingRangeType &logicalToIndex) const
Definition: ConnectivityStructured.h:169
VISKORES_IS_TOPOLOGY_ELEMENT_TAG
#define VISKORES_IS_TOPOLOGY_ELEMENT_TAG(type)
Definition: TopologyElementTag.h:100
viskores::IdComponent
viskores::Int32 IdComponent
Base type to use to index small lists.
Definition: Types.h:202
viskores::exec::ConnectivityStructured::ConnectivityStructured
ConnectivityStructured(const ConnectivityStructured< IncidentTopology, VisitTopology, Dimension > &src)
Definition: ConnectivityStructured.h:62
VISKORES_EXEC_CONT
#define VISKORES_EXEC_CONT
Definition: ExportMacros.h:60
viskores::exec::ConnectivityStructured::IndicesType
typename Helper::IndicesType IndicesType
Type of variable that lists of incident indices will be put into.
Definition: ConnectivityStructured.h:105
viskores::exec::ConnectivityStructured::CellShapeTag
typename Helper::CellShapeTag CellShapeTag
The tag representing the cell shape of the visited elements.
Definition: ConnectivityStructured.h:86
viskores::exec::ConnectivityStructured::LogicalToFlatIncidentIndex
viskores::Id LogicalToFlatIncidentIndex(const SchedulingRangeType &logicalIncidentIndex) const
Convenience method that converts logical indices in a viskores::Vec of an incident element to a flat,...
Definition: ConnectivityStructured.h:140
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::exec::ConnectivityStructured::LogicalToFlatVisitIndex
viskores::Id LogicalToFlatVisitIndex(const SchedulingRangeType &logicalVisitIndex) const
Convenience method that converts logical indices in a viskores::Vec of a visited element to a flat,...
Definition: ConnectivityStructured.h:132
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::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:110
viskores::exec::ConnectivityStructured::FlatToLogicalFromIndex
SchedulingRangeType FlatToLogicalFromIndex(viskores::Id flatFromIndex) const
Definition: ConnectivityStructured.h:148
VISKORES_DEPRECATED
#define VISKORES_DEPRECATED(...)
Definition: Deprecated.h:156
viskores::exec::ConnectivityStructured::SchedulingRangeType
typename InternalsType::SchedulingRangeType SchedulingRangeType
Definition: ConnectivityStructured.h:49
Deprecated.h
viskores::exec::ConnectivityStructured::GetNumberOfElements
viskores::Id GetNumberOfElements() const
Provides the number of elements in the topology.
Definition: ConnectivityStructured.h:79
viskores::exec::ConnectivityStructured::GetNumberOfIndices
viskores::IdComponent GetNumberOfIndices(const IndexType &index) const
Given the index of a visited element, returns the number of incident elements touching it.
Definition: ConnectivityStructured.h:99
viskores::exec::ConnectivityStructured::LogicalToFlatFromIndex
viskores::Id LogicalToFlatFromIndex(const SchedulingRangeType &logicalFromIndex) const
Definition: ConnectivityStructured.h:155
viskores::exec::ConnectivityStructured::InternalsType
viskores::internal::ConnectivityStructuredInternals< Dimension > InternalsType
Definition: ConnectivityStructured.h:43
viskores::exec::ConnectivityStructured::ConnectivityStructured
ConnectivityStructured()=default
viskores::exec::ConnectivityStructured::FlatToLogicalVisitIndex
SchedulingRangeType FlatToLogicalVisitIndex(viskores::Id flatVisitIndex) const
Convenience method that converts a flat, 1D index to the visited elements to a viskores::Vec containi...
Definition: ConnectivityStructured.h:117
viskores::Vec
A short fixed-length array.
Definition: Types.h:365
viskores::exec::ConnectivityStructured::FlatToLogicalToIndex
SchedulingRangeType FlatToLogicalToIndex(viskores::Id flatToIndex) const
Definition: ConnectivityStructured.h:162
viskores::exec::ConnectivityStructured
A class holding information about topology connections.
Definition: ConnectivityStructured.h:38
VISKORES_EXEC
#define VISKORES_EXEC
Definition: ExportMacros.h:59
TopologyElementTag.h
viskores::exec::ConnectivityStructured::FlatToLogicalIncidentIndex
SchedulingRangeType FlatToLogicalIncidentIndex(viskores::Id flatIncidentIndex) const
Convenience method that converts a flat, 1D index to the incident elements to a viskores::Vec contain...
Definition: ConnectivityStructured.h:125