VTK  9.3.20240329
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 
75  explicit vtkArrayExtents(const vtkArrayRange& i);
76 
86 
97 
103 
109 
114 
120  SizeT GetSize() const;
121 
128  void SetDimensions(DimensionT dimensions);
129 
134 
139 
144 
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 
187 
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.
static vtkArrayExtents Uniform(DimensionT n, CoordinateT m)
Create n-dimensional extents with extent [0, m) along each dimension.
vtkTypeUInt64 SizeT
void SetExtent(DimensionT i, const vtkArrayRange &)
Set the extent of the i-th dimension.
vtkArrayCoordinates::CoordinateT CoordinateT
vtkArrayExtents(CoordinateT i)
Create zero-based one-dimensional extents.
vtkArrayExtents(const vtkArrayRange &i, const vtkArrayRange &j, const vtkArrayRange &k)
Create three-dimensional extents.
VTKCOMMONCORE_EXPORT friend ostream & operator<<(ostream &stream, const vtkArrayExtents &rhs)
vtkArrayRange GetExtent(DimensionT i) const
Get the extent of the i-th dimension.
vtkArrayExtents(CoordinateT i, CoordinateT j)
Create zero-based two-dimensional extents.
SizeT GetSize() const
Return the number of values that could be stored using the current extents.
void SetDimensions(DimensionT dimensions)
Set the current number of dimensions.
vtkArrayCoordinates::DimensionT DimensionT
const vtkArrayRange & operator[](DimensionT i) const
Accesses the extent of the i-th dimension.
vtkArrayExtents(const vtkArrayRange &i)
Create one-dimensional extents.
void Append(const vtkArrayRange &extent)
Grow the number of dimensions by one, specifying the extent of the new dimension.
vtkArrayExtents(const vtkArrayRange &i, const vtkArrayRange &j)
Create two-dimensional extents.
bool Contains(const vtkArrayCoordinates &coordinates) const
Returns true if the given array coordinates are completely contained by the current extents (i....
vtkArrayExtents()
Create zero-dimensional extents.
bool ZeroBased() const
Returns true iff every range in the current extents is zero-based.
vtkArrayExtents(CoordinateT i, CoordinateT j, CoordinateT k)
Create zero-based three-dimensional extents.
bool operator==(const vtkArrayExtents &rhs) const
Equality comparison.
vtkArrayRange & operator[](DimensionT i)
Accesses the extent of the i-th dimension.
bool operator!=(const vtkArrayExtents &rhs) const
Inequality comparison.
void GetRightToLeftCoordinatesN(SizeT n, vtkArrayCoordinates &coordinates) const
Returns coordinates that reference the n-th value in the extents, where n is in the range [0,...
bool Contains(const vtkArrayExtents &extents) const
Returns true if the given extents are a non-overlapping subset of the current extents.
DimensionT GetDimensions() const
Return the current number of dimensions.
void GetLeftToRightCoordinatesN(SizeT n, vtkArrayCoordinates &coordinates) const
Returns coordinates that reference the n-th value in the extents, where n is in the range [0,...
bool SameShape(const vtkArrayExtents &rhs) const
Returns true iff the given extents have the same number of dimensions and size along each dimension.
Stores a half-open range of array coordinates.
Definition: vtkArrayRange.h:33
@ extent
Definition: vtkX3D.h:345