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 
30 class VTKREMOTINGCORE_EXPORT vtkPVArrayInformation : public vtkObject
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 
137  void CopyFromArray(vtkAbstractArray* array, vtkFieldData* fd = nullptr);
138  void CopyFromCellAttribute(vtkCellGrid* grid, vtkCellAttribute* attribute);
139  void CopyFromGenericAttribute(vtkGenericAttribute* array);
140  void CopyToStream(vtkClientServerStream*) const;
141  bool CopyFromStream(const vtkClientServerStream*);
142 
143 protected:
145  ~vtkPVArrayInformation() override;
146 
148  friend class vtkPVDataInformation;
149 
151 
154  void DeepCopy(vtkPVArrayInformation* info);
155  void AddInformation(vtkPVArrayInformation*, int fieldAssociation);
156  vtkSetMacro(IsPartial, bool);
158 
159  vtkSetMacro(Name, std::string);
160 
161 private:
162  std::string Name;
163  int DataType = -1;
164  vtkTypeInt64 NumberOfTuples = 0;
165  bool IsPartial = false;
166 
167  struct ComponentInfo
168  {
171  std::string Name;
172  mutable std::string DefaultName;
173  };
174 
175  std::vector<ComponentInfo> Components;
176  std::vector<std::string> StringValues;
177 
178  // this array is used to store existing information keys (location/name pairs)
179  std::set<std::pair<std::string, std::string>> InformationKeys;
180 
182  void operator=(const vtkPVArrayInformation&) = delete;
183 };
184 
185 #endif
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkObject::New
static vtkObject * New()
vtkClientServerStream
Store messages for the interpreter.
Definition: vtkClientServerStream.h:23
vtkObject
vtkFieldData
vtkPVArrayInformation::GetDataTypeAsString
const char * GetDataTypeAsString() const
Returns a printable string for the array value type.
Definition: vtkPVArrayInformation.h:50
vtkPVDataSetAttributesInformation
List of array info.
Definition: vtkPVDataSetAttributesInformation.h:24
vtkIndent
vtkPVArrayInformation::GetName
const char * GetName() const
Get array's name.
Definition: vtkPVArrayInformation.h:61
vtkObject.h
vtkAbstractArray
vtkPVDataInformation
provides meta data about a vtkDataObject subclass.
Definition: vtkPVDataInformation.h:42
vtkPVArrayInformation
provides meta data about arrays.
Definition: vtkPVArrayInformation.h:30
vtkPVDataInformation::AddInformation
void AddInformation(vtkPVInformation *info) override
vtkPVInformation API implementation.
vtkTuple.h
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkGenericAttribute
vtkPVDataInformation::DeepCopy
void DeepCopy(vtkPVDataInformation *info)
Simply copies from another vtkPVDataInformation.
vtkTuple< double, 2 >
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX