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 vtkFieldData;
27 
29 {
30 public:
31  static vtkPVArrayInformation* New();
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
38  void Initialize();
39 
43  vtkGetMacro(DataType, int);
44 
48  const char* GetDataTypeAsString() const { return vtkImageScalarTypeNameMacro(this->DataType); }
49 
54  std::string GetRangesAsString(int lowExponent = -6, int highExponent = 20) const;
55 
59  const char* GetName() const { return this->Name.empty() ? nullptr : this->Name.c_str(); }
60 
64  int GetNumberOfComponents() const;
65 
70  const char* GetComponentName(int component) const;
71 
75  vtkGetMacro(NumberOfTuples, vtkTypeInt64);
76 
78 
84  const double* GetComponentRange(int comp) const VTK_SIZEHINT(2);
85  void GetComponentRange(int comp, double range[2]) const;
87 
89 
96  const double* GetComponentFiniteRange(int component) const VTK_SIZEHINT(2);
97  void GetComponentFiniteRange(int comp, double range[2]) const;
99 
106  void GetDataTypeRange(double range[2]) const;
107 
109 
114  vtkGetMacro(IsPartial, bool);
116 
118 
121  int GetNumberOfInformationKeys() const;
122  const char* GetInformationKeyLocation(int) const;
123  const char* GetInformationKeyName(int) const;
124  bool HasInformationKey(const char* location, const char* name) const;
126 
128 
131  int GetNumberOfStringValues();
132  const char* GetStringValue(int);
134 
135  void CopyFromArray(vtkAbstractArray* array, vtkFieldData* fd = nullptr);
136  void CopyFromGenericAttribute(vtkGenericAttribute* array);
137  void CopyToStream(vtkClientServerStream*) const;
138  bool CopyFromStream(const vtkClientServerStream*);
139 
140 protected:
142  ~vtkPVArrayInformation() override;
143 
145  friend class vtkPVDataInformation;
146 
148 
151  void DeepCopy(vtkPVArrayInformation* info);
152  void AddInformation(vtkPVArrayInformation*, int fieldAssociation);
153  vtkSetMacro(IsPartial, bool);
155 
156  vtkSetMacro(Name, std::string);
157 
158 private:
159  std::string Name;
160  int DataType = -1;
161  vtkTypeInt64 NumberOfTuples = 0;
162  bool IsPartial = false;
163 
164  struct ComponentInfo
165  {
168  std::string Name;
169  mutable std::string DefaultName;
170  };
171 
172  std::vector<ComponentInfo> Components;
173  std::vector<std::string> StringValues;
174 
175  // this array is used to store existing information keys (location/name pairs)
176  std::set<std::pair<std::string, std::string>> InformationKeys;
177 
179  void operator=(const vtkPVArrayInformation&) = delete;
180 };
181 
182 #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()