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 <set> // for std::set
20 #include <string> // for std::string
21 #include <vector> // for std::vector
22 
23 class vtkAbstractArray;
24 class vtkCellAttribute;
25 class vtkCellGrid;
27 class vtkFieldData;
29 
31 {
32 public:
33  static vtkPVArrayInformation* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
40  void Initialize();
41 
45  vtkGetMacro(DataType, int);
46 
50  const char* GetDataTypeAsString() const { return vtkImageScalarTypeNameMacro(this->DataType); }
51 
56  std::string GetRangesAsString(int lowExponent = -6, int highExponent = 20) const;
57 
61  const char* GetName() const { return this->Name.empty() ? nullptr : this->Name.c_str(); }
62 
66  int GetNumberOfComponents() const;
67 
72  const char* GetComponentName(int component) const;
73 
77  vtkGetMacro(NumberOfTuples, vtkTypeInt64);
78 
80 
86  const double* GetComponentRange(int comp) const VTK_SIZEHINT(2);
87  void GetComponentRange(int comp, double range[2]) const;
89 
91 
98  const double* GetComponentFiniteRange(int component) const VTK_SIZEHINT(2);
99  void GetComponentFiniteRange(int comp, double range[2]) const;
101 
108  void GetDataTypeRange(double range[2]) const;
109 
111 
116  vtkGetMacro(IsPartial, bool);
118 
120 
123  int GetNumberOfInformationKeys() const;
124  const char* GetInformationKeyLocation(int) const;
125  const char* GetInformationKeyName(int) const;
126  bool HasInformationKey(const char* location, const char* name) const;
128 
130 
133  int GetNumberOfStringValues();
134  const char* GetStringValue(int);
136 
138 
141  void CopyFromArray(vtkAbstractArray* array);
142  void CopyFromArray(vtkFieldData* fieldData, int fdArrayIdx);
144 
145  void CopyFromCellAttribute(vtkCellGrid* grid, vtkCellAttribute* attribute);
146  void CopyFromGenericAttribute(vtkGenericAttribute* array);
147  void CopyToStream(vtkClientServerStream*) const;
148  bool CopyFromStream(const vtkClientServerStream*);
149 
150 protected:
152  ~vtkPVArrayInformation() override;
153 
155  friend class vtkPVDataInformation;
156 
158 
161  void DeepCopy(vtkPVArrayInformation* info);
162  void AddInformation(vtkPVArrayInformation*, int fieldAssociation);
163  vtkSetMacro(IsPartial, bool);
165 
166  vtkSetMacro(Name, std::string);
167 
168 private:
169  std::string Name;
170  int DataType = -1;
171  vtkTypeInt64 NumberOfTuples = 0;
172  bool IsPartial = false;
173 
174  struct ComponentInfo
175  {
178  std::string Name;
179  mutable std::string DefaultName;
180  };
181 
182  std::vector<ComponentInfo> Components;
183  std::vector<std::string> StringValues;
184 
185  // this array is used to store existing information keys (location/name pairs)
186  std::set<std::pair<std::string, std::string>> InformationKeys;
187 
188  struct GetRangeFunctor;
193  void CopyFromArrayInternal(vtkAbstractArray* array, GetRangeFunctor& getRangeFn);
194 
196  void operator=(const vtkPVArrayInformation&) = delete;
197 };
198 
199 #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.
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()