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 "vtkParaViewDeprecation.h"
17 #include "vtkRemotingCoreModule.h" //needed for exports
18 #include "vtkTuple.h" // for vtkTuple
19 
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 
124  int GetNumberOfInformationKeys() const;
125  const char* GetInformationKeyLocation(int) const;
126  const char* GetInformationKeyName(int) const;
127  bool HasInformationKey(const char* location, const char* name) const;
129 
131 
134  int GetNumberOfStringValues();
135  const char* GetStringValue(int);
137 
139 
142  void CopyFromArray(vtkAbstractArray* array);
143  void CopyFromArray(vtkFieldData* fieldData, int fdArrayIdx);
144 
145  PARAVIEW_DEPRECATED_IN_5_14_0("Please use the CopyFromArray(vtkAbstractArray*) or "
146  "CopyFromArray(vtkFieldData*, int) overloads")
147  void CopyFromArray(vtkAbstractArray* array, vtkFieldData* fieldData);
149 
150  void CopyFromCellAttribute(vtkCellGrid* grid, vtkCellAttribute* attribute);
151  void CopyFromGenericAttribute(vtkGenericAttribute* array);
152  void CopyToStream(vtkClientServerStream*) const;
153  bool CopyFromStream(const vtkClientServerStream*);
154 
155 protected:
157  ~vtkPVArrayInformation() override;
158 
160  friend class vtkPVDataInformation;
161 
163 
166  void DeepCopy(vtkPVArrayInformation* info);
167  void AddInformation(vtkPVArrayInformation*, int fieldAssociation);
168  vtkSetMacro(IsPartial, bool);
170 
171  vtkSetMacro(Name, std::string);
172 
173 private:
174  std::string Name;
175  int DataType = -1;
176  vtkTypeInt64 NumberOfTuples = 0;
177  bool IsPartial = false;
178 
179  struct ComponentInfo
180  {
183  std::string Name;
184  mutable std::string DefaultName;
185  };
186 
187  std::vector<ComponentInfo> Components;
188  std::vector<std::string> StringValues;
189 
190  // this array is used to store existing information keys (location/name pairs)
191  std::set<std::pair<std::string, std::string>> InformationKeys;
192 
193  struct GetRangeFunctor;
198  void CopyFromArrayInternal(vtkAbstractArray* array, GetRangeFunctor& getRangeFn);
199 
201  void operator=(const vtkPVArrayInformation&) = delete;
202 };
203 
204 #endif
location
component
#define VTK_DOUBLE_MAX
provides meta data about a vtkDataObject subclass.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define PARAVIEW_DEPRECATED_IN_5_14_0(reason)
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
range
provides meta data about arrays.
#define const
Definition: zconf.h:238
static vtkObject * New()
void operator=(const vtkObjectBase &)