Viskores  1.0
ConnectivityExplicitInternals.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 #ifndef viskores_cont_internal_ConnectivityExplicitInternals_h
19 #define viskores_cont_internal_ConnectivityExplicitInternals_h
20 
21 #include <viskores/CellShape.h>
26 
27 namespace viskores
28 {
29 namespace cont
30 {
31 namespace internal
32 {
33 
34 template <typename ShapesStorageTag = VISKORES_DEFAULT_STORAGE_TAG,
35  typename ConnectivityStorageTag = VISKORES_DEFAULT_STORAGE_TAG,
36  typename OffsetsStorageTag = VISKORES_DEFAULT_STORAGE_TAG>
37 struct ConnectivityExplicitInternals
38 {
42 
43  ShapesArrayType Shapes;
44  ConnectivityArrayType Connectivity;
45  OffsetsArrayType Offsets;
46 
47  bool ElementsValid;
48 
50  ConnectivityExplicitInternals()
51  : ElementsValid(false)
52  {
53  }
54 
56  viskores::Id GetNumberOfElements() const
57  {
58  VISKORES_ASSERT(this->ElementsValid);
59 
60  return this->Shapes.GetNumberOfValues();
61  }
62 
64  void ReleaseResourcesExecution()
65  {
66  this->Shapes.ReleaseResourcesExecution();
67  this->Connectivity.ReleaseResourcesExecution();
68  this->Offsets.ReleaseResourcesExecution();
69  }
70 
72  void PrintSummary(std::ostream& out) const
73  {
74  if (this->ElementsValid)
75  {
76  out << " Shapes: ";
78  out << " Connectivity: ";
79  viskores::cont::printSummary_ArrayHandle(this->Connectivity, out);
80  out << " Offsets: ";
81  viskores::cont::printSummary_ArrayHandle(this->Offsets, out);
82  }
83  else
84  {
85  out << " Not Allocated" << std::endl;
86  }
87  }
88 };
89 }
90 }
91 } // namespace viskores::cont::internal
92 
93 #endif //viskores_cont_internal_ConnectivityExplicitInternals_h
ArrayHandle.h
ArrayHandleCast.h
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
ArrayHandleConstant.h
CellShape.h
viskores::cont::printSummary_ArrayHandle
void printSummary_ArrayHandle(const viskores::cont::ArrayHandle< T, StorageT > &array, std::ostream &out, bool full=false)
Definition: ArrayHandle.h:837
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
VISKORES_ASSERT
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
ArrayHandleCounting.h