VTK-m  1.8
PartitionedDataSet.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_PartitionedDataSet_h
11 #define vtk_m_cont_PartitionedDataSet_h
12 #include <limits>
13 #include <vtkm/StaticAssert.h>
14 
15 #include <vtkm/cont/ArrayHandle.h>
16 #include <vtkm/cont/DataSet.h>
17 #include <vtkm/cont/Field.h>
18 
19 namespace vtkm
20 {
21 namespace cont
22 {
23 
24 class VTKM_CONT_EXPORT PartitionedDataSet
25 {
26  using StorageVec = std::vector<vtkm::cont::DataSet>;
27 
28 public:
29  using iterator = typename StorageVec::iterator;
30  using const_iterator = typename StorageVec::const_iterator;
31  using value_type = typename StorageVec::value_type;
32  using reference = typename StorageVec::reference;
33  using const_reference = typename StorageVec::const_reference;
34 
36  VTKM_CONT
39  VTKM_CONT
42  VTKM_CONT
43  explicit PartitionedDataSet(const std::vector<vtkm::cont::DataSet>& partitions);
45  VTKM_CONT
46  explicit PartitionedDataSet(vtkm::Id size);
47 
48  VTKM_CONT
50 
51  VTKM_CONT
53 
54  VTKM_CONT
57  VTKM_CONT
58  vtkm::cont::Field GetField(const std::string& field_name, int partition_index) const;
59 
60  VTKM_CONT
61  vtkm::Id GetNumberOfPartitions() const;
62 
63  VTKM_CONT
64  const vtkm::cont::DataSet& GetPartition(vtkm::Id partId) const;
65 
66  VTKM_CONT
67  const std::vector<vtkm::cont::DataSet>& GetPartitions() const;
68 
70  VTKM_CONT
71  void AppendPartition(const vtkm::cont::DataSet& ds);
72 
74  VTKM_CONT
75  void InsertPartition(vtkm::Id index, const vtkm::cont::DataSet& ds);
76 
79  VTKM_CONT
80  void ReplacePartition(vtkm::Id index, const vtkm::cont::DataSet& ds);
81 
83  VTKM_CONT
84  void AppendPartitions(const std::vector<vtkm::cont::DataSet>& partitions);
85 
86  VTKM_CONT
87  void PrintSummary(std::ostream& stream) const;
88 
90  VTKM_CONT
92  iterator begin() noexcept { return this->Partitions.begin(); }
93  VTKM_CONT
94  iterator end() noexcept { return this->Partitions.end(); }
95  VTKM_CONT
96  const_iterator begin() const noexcept { return this->Partitions.begin(); }
97  VTKM_CONT
98  const_iterator end() const noexcept { return this->Partitions.end(); }
99  VTKM_CONT
100  const_iterator cbegin() const noexcept { return this->Partitions.cbegin(); }
101  VTKM_CONT
102  const_iterator cend() const noexcept { return this->Partitions.cend(); }
104 private:
105  std::vector<vtkm::cont::DataSet> Partitions;
106 };
107 }
108 } // namespace vtkm::cont
109 
110 #endif
ArrayHandle.h
vtkm
VTKM_NO_DEPRECATED_VIRTUAL.
Definition: Algorithms.h:18
vtkm::cont::DataSet
Definition: DataSet.h:27
vtkm::cont::PartitionedDataSet::end
VTKM_CONT iterator end() noexcept
Definition: PartitionedDataSet.h:94
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::cont::PartitionedDataSet::cbegin
VTKM_CONT const_iterator cbegin() const noexcept
Definition: PartitionedDataSet.h:100
vtkm::cont::PartitionedDataSet::begin
VTKM_CONT iterator begin() noexcept
API to support range-based for loops on partitions.
Definition: PartitionedDataSet.h:92
vtkm::cont::PartitionedDataSet::end
VTKM_CONT const_iterator end() const noexcept
Definition: PartitionedDataSet.h:98
vtkm::cont::Field
A Field encapsulates an array on some piece of the mesh, such as the points, a cell set,...
Definition: cont/Field.h:31
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::PartitionedDataSet::Partitions
std::vector< vtkm::cont::DataSet > Partitions
Definition: PartitionedDataSet.h:105
StaticAssert.h
Field.h
vtkm::cont::PartitionedDataSet::begin
VTKM_CONT const_iterator begin() const noexcept
Definition: PartitionedDataSet.h:96
vtkm::cont::PartitionedDataSet::iterator
typename StorageVec::iterator iterator
Definition: PartitionedDataSet.h:29
vtkm::cont::PartitionedDataSet::cend
VTKM_CONT const_iterator cend() const noexcept
Definition: PartitionedDataSet.h:102
vtkm::cont::PartitionedDataSet::value_type
typename StorageVec::value_type value_type
Definition: PartitionedDataSet.h:31
vtkm::cont::PartitionedDataSet::const_reference
typename StorageVec::const_reference const_reference
Definition: PartitionedDataSet.h:33
vtkm::cont::PartitionedDataSet::const_iterator
typename StorageVec::const_iterator const_iterator
Definition: PartitionedDataSet.h:30
DataSet.h
vtkm::cont::PartitionedDataSet::StorageVec
std::vector< vtkm::cont::DataSet > StorageVec
Definition: PartitionedDataSet.h:26
vtkm::cont::PartitionedDataSet
Definition: PartitionedDataSet.h:24
vtkm::cont::PartitionedDataSet::reference
typename StorageVec::reference reference
Definition: PartitionedDataSet.h:32