VTK-m  2.2
ConnectivityExplicitInternals.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 #ifndef vtk_m_cont_internal_ConnectivityExplicitInternals_h
11 #define vtk_m_cont_internal_ConnectivityExplicitInternals_h
12 
13 #include <vtkm/CellShape.h>
14 #include <vtkm/cont/ArrayHandle.h>
18 
19 namespace vtkm
20 {
21 namespace cont
22 {
23 namespace internal
24 {
25 
26 template <typename ShapesStorageTag = VTKM_DEFAULT_STORAGE_TAG,
27  typename ConnectivityStorageTag = VTKM_DEFAULT_STORAGE_TAG,
28  typename OffsetsStorageTag = VTKM_DEFAULT_STORAGE_TAG>
29 struct ConnectivityExplicitInternals
30 {
34 
35  ShapesArrayType Shapes;
36  ConnectivityArrayType Connectivity;
37  OffsetsArrayType Offsets;
38 
39  bool ElementsValid;
40 
41  VTKM_CONT
42  ConnectivityExplicitInternals()
43  : ElementsValid(false)
44  {
45  }
46 
47  VTKM_CONT
48  vtkm::Id GetNumberOfElements() const
49  {
50  VTKM_ASSERT(this->ElementsValid);
51 
52  return this->Shapes.GetNumberOfValues();
53  }
54 
55  VTKM_CONT
56  void ReleaseResourcesExecution()
57  {
58  this->Shapes.ReleaseResourcesExecution();
59  this->Connectivity.ReleaseResourcesExecution();
60  this->Offsets.ReleaseResourcesExecution();
61  }
62 
63  VTKM_CONT
64  void PrintSummary(std::ostream& out) const
65  {
66  if (this->ElementsValid)
67  {
68  out << " Shapes: ";
69  vtkm::cont::printSummary_ArrayHandle(this->Shapes, out);
70  out << " Connectivity: ";
71  vtkm::cont::printSummary_ArrayHandle(this->Connectivity, out);
72  out << " Offsets: ";
73  vtkm::cont::printSummary_ArrayHandle(this->Offsets, out);
74  }
75  else
76  {
77  out << " Not Allocated" << std::endl;
78  }
79  }
80 };
81 }
82 }
83 } // namespace vtkm::cont::internal
84 
85 #endif //vtk_m_cont_internal_ConnectivityExplicitInternals_h
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
ArrayHandle.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ArrayHandleCast.h
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
vtkm::cont::printSummary_ArrayHandle
void printSummary_ArrayHandle(const vtkm::cont::ArrayHandle< T, StorageT > &array, std::ostream &out, bool full=false)
Definition: ArrayHandle.h:814
ArrayHandleConstant.h
CellShape.h
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::Id
vtkm::Int64 Id
Base type to use to index arrays.
Definition: Types.h:227
ArrayHandleCounting.h