vtkPVArrayInformation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkPVArrayInformation_h
13 #define vtkPVArrayInformation_h
14 
15 #include "vtkObject.h"
16 #include "vtkRemotingCoreModule.h" // needed for exports
17 #include "vtkTuple.h" // for vtkTuple
18 
19 #include <array> // for std::array
20 #include <set> // for std::set
21 #include <string> // for std::string
22 #include <vector> // for std::vector
23 
24 class vtkAbstractArray;
25 class vtkCellAttribute;
26 class vtkCellGrid;
28 class vtkFieldData;
30 
32 {
33 public:
34  static vtkPVArrayInformation* New();
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
41  void Initialize();
42 
46  vtkGetMacro(DataType, int);
47 
51  const char* GetDataTypeAsString() const { return vtkImageScalarTypeNameMacro(this->DataType); }
52 
57  std::string GetRangesAsString(int lowExponent = -6, int highExponent = 20) const;
58 
62  const char* GetName() const { return this->Name.empty() ? nullptr : this->Name.c_str(); }
63 
67  int GetNumberOfComponents() const;
68 
73  const char* GetComponentName(int component) const;
74 
78  vtkGetMacro(NumberOfTuples, vtkTypeInt64);
79 
81 
87  const double* GetComponentRange(int comp) const VTK_SIZEHINT(2);
88  void GetComponentRange(int comp, double range[2]) const;
90 
92 
99  const double* GetComponentFiniteRange(int component) const VTK_SIZEHINT(2);
100  void GetComponentFiniteRange(int comp, double range[2]) const;
102 
109  void GetDataTypeRange(double range[2]) const;
110 
112 
117  vtkGetMacro(IsPartial, bool);
119 
121 
126  vtkGetMacro(IsGlobal, bool);
128 
133  vtkGetMacro(IsCellGrid, bool);
134 
138  vtkGetVector2Macro(PolynomialOrderRange, int);
139 
141  vtkGetMacro(DegreesOfFreedom, vtkTypeInt64);
142 
144 
147  int GetNumberOfInformationKeys() const;
148  const char* GetInformationKeyLocation(int) const;
149  const char* GetInformationKeyName(int) const;
150  bool HasInformationKey(const char* location, const char* name) const;
152 
154 
157  int GetNumberOfStringValues();
158  const char* GetStringValue(int);
160 
162 
165  void CopyFromArray(vtkAbstractArray* array);
166  void CopyFromArray(vtkFieldData* fieldData, int fdArrayIdx);
168 
169  void CopyFromCellAttribute(vtkCellGrid* grid, vtkCellAttribute* attribute);
170  void CopyFromGenericAttribute(vtkGenericAttribute* array);
171  void CopyToStream(vtkClientServerStream*) const;
172  bool CopyFromStream(const vtkClientServerStream*);
173 
174 protected:
176  ~vtkPVArrayInformation() override;
177 
179  friend class vtkPVDataInformation;
180 
182 
185  void DeepCopy(vtkPVArrayInformation* info);
186  void AddInformation(vtkPVArrayInformation*, int fieldAssociation);
187  vtkSetMacro(IsPartial, bool);
188  vtkSetMacro(IsGlobal, bool);
190 
191  vtkSetMacro(Name, std::string);
192 
193 private:
194  std::string Name;
195  int DataType = -1;
196  vtkTypeInt64 NumberOfTuples = 0;
197  bool IsPartial = false;
198  bool IsGlobal = false;
199  bool IsCellGrid = false;
200  int PolynomialOrderRange[2] = { VTK_INT_MAX, -VTK_INT_MAX };
201  vtkTypeInt64 DegreesOfFreedom = 0;
202 
203  struct ComponentInfo
204  {
207  std::string Name;
208  mutable std::string DefaultName;
209  };
210 
211  std::vector<ComponentInfo> Components;
212  std::vector<std::string> StringValues;
213 
214  // this array is used to store existing information keys (location/name pairs)
215  std::set<std::pair<std::string, std::string>> InformationKeys;
216 
217  struct GetRangeFunctor;
222  void CopyFromArrayInternal(vtkAbstractArray* array, GetRangeFunctor& getRangeFn);
223 
225  void operator=(const vtkPVArrayInformation&) = delete;
226 };
227 
228 #endif
location
component
#define VTK_DOUBLE_MAX
provides meta data about a vtkDataObject subclass.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
void DeepCopy(vtkPVDataInformation *info)
Simply copies from another vtkPVDataInformation.
#define VTK_INT_MAX
Store messages for the interpreter.
name
const char * GetDataTypeAsString() const
Returns a printable string for the array value type.
const char * GetName() const
Get array&#39;s name.
#define VTKREMOTINGCORE_EXPORT
void AddInformation(vtkPVInformation *info) override
vtkPVInformation API implementation.
range
provides meta data about arrays.
static vtkObject * New()