VTK  9.3.1
vtkArrayExtents.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4 
46 #ifndef vtkArrayExtents_h
47 #define vtkArrayExtents_h
48 
49 #include "vtkArrayRange.h"
50 #include "vtkCommonCoreModule.h" // For export macro
51 #include "vtkSystemIncludes.h"
52 #include <vector> // STL Header
53 
54 VTK_ABI_NAMESPACE_BEGIN
55 class VTKCOMMONCORE_EXPORT vtkArrayExtents
56 {
57 public:
60  typedef vtkTypeUInt64 SizeT;
61 
66 
71  explicit vtkArrayExtents(CoordinateT i);
75  explicit vtkArrayExtents(const vtkArrayRange& i);
76 
81  vtkArrayExtents(CoordinateT i, CoordinateT j);
85  vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j);
86 
92  vtkArrayExtents(CoordinateT i, CoordinateT j, CoordinateT k);
96  vtkArrayExtents(const vtkArrayRange& i, const vtkArrayRange& j, const vtkArrayRange& k);
97 
102  static vtkArrayExtents Uniform(DimensionT n, CoordinateT m);
103 
108  void Append(const vtkArrayRange& extent);
109 
113  DimensionT GetDimensions() const;
114 
120  SizeT GetSize() const;
121 
128  void SetDimensions(DimensionT dimensions);
129 
133  vtkArrayRange& operator[](DimensionT i);
134 
138  const vtkArrayRange& operator[](DimensionT i) const;
139 
143  vtkArrayRange GetExtent(DimensionT i) const;
144 
148  void SetExtent(DimensionT i, const vtkArrayRange&);
149 
153  bool operator==(const vtkArrayExtents& rhs) const;
154 
158  bool operator!=(const vtkArrayExtents& rhs) const;
159 
168  bool ZeroBased() const;
169 
176  bool SameShape(const vtkArrayExtents& rhs) const;
177 
186  void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
187 
196  void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates& coordinates) const;
197 
204  bool Contains(const vtkArrayExtents& extents) const;
205 
213  bool Contains(const vtkArrayCoordinates& coordinates) const;
214 
215  VTKCOMMONCORE_EXPORT friend ostream& operator<<(ostream& stream, const vtkArrayExtents& rhs);
216 
217 private:
218  std::vector<vtkArrayRange> Storage;
219 };
220 
221 VTK_ABI_NAMESPACE_END
222 #endif
223 // VTK-HeaderTest-Exclude: vtkArrayExtents.h
Stores coordinate into an N-way array.
Stores the number of dimensions and valid coordinate ranges along each dimension for vtkArray...
Stores a half-open range of array coordinates.
Definition: vtkArrayRange.h:32
bool VTKCOMMONCORE_EXPORT operator==(const std::string &a, const vtkStringToken &b)
bool VTKCOMMONCORE_EXPORT operator!=(const std::string &a, const vtkStringToken &b)
vtkTypeUInt64 SizeT
vtkArrayCoordinates::CoordinateT CoordinateT
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
vtkArrayCoordinates::DimensionT DimensionT