vtkPVDataInformation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkPVDataInformation_h
15 #define vtkPVDataInformation_h
16 
17 #include "vtkDataObject.h" // for vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES
18 #include "vtkNew.h" // for vtkNew
19 #include "vtkPVInformation.h"
20 #include "vtkRemotingCoreModule.h" //needed for exports
21 #include "vtkSmartPointer.h" // for vtkSmartPointer
22 
23 #include <set> // for std::set
24 #include <vector> // for std::vector
25 
26 class vtkCellGrid;
27 class vtkCollection;
29 class vtkDataAssembly;
30 class vtkDataObject;
31 class vtkDataSet;
32 class vtkGenericDataSet;
33 class vtkGraph;
34 class vtkHyperTreeGrid;
35 class vtkInformation;
37 class vtkPVDataInformationHelper;
39 class vtkSelection;
40 class vtkTable;
41 
42 class VTKREMOTINGCORE_EXPORT vtkPVDataInformation : public vtkPVInformation
43 {
44 public:
45  static vtkPVDataInformation* New();
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
50 
56  vtkSetMacro(PortNumber, int);
57  vtkGetMacro(PortNumber, int);
59 
66  vtkSetMacro(InspectCells, bool);
67 
69 
73  vtkSetClampMacro(Rank, int, -1, VTK_INT_MAX);
74  vtkGetMacro(Rank, int);
76 
78 
83  vtkGetStringMacro(SubsetSelector);
84  vtkSetStringMacro(SubsetSelector);
86 
88 
93  vtkSetStringMacro(SubsetAssemblyName);
94  vtkGetStringMacro(SubsetAssemblyName);
95  void SetSubsetAssemblyNameToHierarchy();
97 
102  void CopyFromObject(vtkObject* object) override;
103 
105 
108  void AddInformation(vtkPVInformation* info) override;
109  void CopyToStream(vtkClientServerStream*) override;
110  void CopyFromStream(const vtkClientServerStream*) override;
114 
118  void Initialize();
119 
123  void DeepCopy(vtkPVDataInformation* info);
124 
131  vtkPVArrayInformation* GetArrayInformation(const char* arrayname, int attributeType) const;
132 
144  vtkGetMacro(DataSetType, int);
145 
150  vtkGetMacro(CompositeDataSetType, int);
151 
155  bool IsCompositeDataSet() const { return (this->CompositeDataSetType != -1); }
156 
160  bool IsNull() const { return this->DataSetType == -1 && this->CompositeDataSetType == -1; }
161 
163 
170  const std::vector<int>& GetUniqueBlockTypes() const { return this->UniqueBlockTypes; }
171  unsigned int GetNumberOfUniqueBlockTypes() const
172  {
173  return static_cast<unsigned int>(this->UniqueBlockTypes.size());
174  }
175  int GetUniqueBlockType(unsigned int index) const;
177 
179 
185  static const char* GetDataSetTypeAsString(int type);
186  const char* GetDataSetTypeAsString() const
187  {
188  return vtkPVDataInformation::GetDataSetTypeAsString(this->DataSetType);
189  }
190  const char* GetDataClassName() const
191  {
192  return this->DataSetType != -1 ? this->GetDataSetTypeAsString() : nullptr;
193  }
194  const char* GetCompositeDataClassName() const
195  {
196  return this->CompositeDataSetType != -1
197  ? vtkPVDataInformation::GetDataSetTypeAsString(this->CompositeDataSetType)
198  : nullptr;
199  }
201 
203 
206  const char* GetPrettyDataTypeString() const;
207  static const char* GetPrettyDataTypeString(int dtype);
209 
211 
222  bool DataSetTypeIsA(const char* classname) const;
223  bool DataSetTypeIsA(int typeId) const;
225 
227 
233  bool HasDataSetType(const char* classname) const;
234  bool HasDataSetType(int typeId) const;
236 
244  vtkTypeInt64 GetNumberOfElements(int elementType) const;
245 
247 
250  vtkTypeInt64 GetNumberOfPoints() const { return this->GetNumberOfElements(vtkDataObject::POINT); }
251  vtkTypeInt64 GetNumberOfCells() const { return this->GetNumberOfElements(vtkDataObject::CELL); }
252  vtkTypeInt64 GetNumberOfVertices() const
253  {
254  return this->GetNumberOfElements(vtkDataObject::VERTEX);
255  }
256  vtkTypeInt64 GetNumberOfEdges() const { return this->GetNumberOfElements(vtkDataObject::EDGE); }
257  vtkTypeInt64 GetNumberOfRows() const { return this->GetNumberOfElements(vtkDataObject::ROW); }
258  vtkTypeInt64 GetNumberOfSides() const { return this->GetNumberOfElements(vtkDataObject::SIDE); }
260 
262 
266  vtkGetMacro(NumberOfTrees, vtkTypeInt64);
267  vtkGetMacro(NumberOfLeaves, vtkTypeInt64);
269 
274  vtkGetMacro(NumberOfAMRLevels, vtkTypeInt64);
275 
280  vtkTypeInt64 GetNumberOfAMRDataSets(vtkTypeInt64 level) const;
281 
294  vtkGetMacro(NumberOfDataSets, vtkTypeInt64);
295 
302  vtkGetMacro(MemorySize, vtkTypeInt64);
303 
309  vtkGetVector6Macro(Bounds, double);
310 
312 
317  vtkGetVector6Macro(Extent, int);
319 
321 
331  int GetNumberOfAttributeTypes() const;
332  std::vector<int> GetAttributeTypes() const;
333  std::vector<std::string> GetAttributeNames() const;
334  std::string GetAttributeName(int attributeType) const;
335  vtkPVDataSetAttributesInformation* GetAttributeInformation(int attributeType) const;
337 
339 
344  {
345  return this->GetAttributeInformation(vtkDataObject::POINT);
346  }
348  {
349  return this->GetAttributeInformation(vtkDataObject::CELL);
350  }
352  {
353  return this->GetAttributeInformation(vtkDataObject::VERTEX);
354  }
356  {
357  return this->GetAttributeInformation(vtkDataObject::EDGE);
358  }
360  {
361  return this->GetAttributeInformation(vtkDataObject::ROW);
362  }
364  {
365  return this->GetAttributeInformation(vtkDataObject::SIDE);
366  }
368  {
369  return this->GetAttributeInformation(vtkDataObject::FIELD);
370  }
372 
378  vtkGetObjectMacro(PointArrayInformation, vtkPVArrayInformation);
379 
381 
385  vtkGetMacro(HasTime, bool);
386  vtkGetMacro(Time, double);
388 
390 
395  vtkGetVector2Macro(TimeRange, double);
396  vtkGetMacro(TimeLabel, std::string);
397  const std::set<double>& GetTimeSteps() const { return this->TimeSteps; }
398  vtkTypeInt64 GetNumberOfTimeSteps() const
399  {
400  return static_cast<unsigned int>(this->TimeSteps.size());
401  }
403 
408  bool IsDataStructured() const;
409 
414  bool HasStructuredData() const;
415 
420  bool HasUnstructuredData() const;
421 
427  bool IsAttributeValid(int attributeType) const;
428 
432  static int GetExtentType(int dataType);
433 
435 
442  vtkDataAssembly* GetHierarchy() const;
443  vtkDataAssembly* GetDataAssembly() const;
444  vtkDataAssembly* GetDataAssembly(const char* assemblyName) const;
446 
453  vtkGetMacro(FirstLeafCompositeIndex, vtkTypeUInt64);
454 
468  std::string GetBlockName(vtkTypeUInt64 cid) const;
469 
473  std::vector<std::string> GetBlockNames(
474  const std::vector<std::string>& selectors, const char* assemblyName) const;
475 
482  unsigned int ComputeCompositeIndexForAMR(unsigned int level, unsigned int index) const;
483 
489  const std::vector<unsigned char>& GetUniqueCellTypes() const { return this->UniqueCellTypes; }
490 
491 protected:
493  ~vtkPVDataInformation() override;
494 
499  void CopyFromPipelineInformation(vtkInformation* pipelineInfo);
500  void CopyFromDataObject(vtkDataObject* dobj);
501  friend class vtkPVDataInformationHelper;
502 
506  virtual vtkSmartPointer<vtkCompositeDataSet> SimplifyCompositeDataSet(vtkCompositeDataSet* cd);
507 
512  vtkSmartPointer<vtkDataObject> GetSubset(vtkDataObject* dobj) const;
513 
514 private:
516  void operator=(const vtkPVDataInformation&) = delete;
517 
518  int PortNumber = -1;
519  int Rank = -1;
520  char* SubsetSelector = nullptr;
521  char* SubsetAssemblyName = nullptr;
522 
523  int DataSetType = -1;
524  int CompositeDataSetType = -1;
525  vtkTypeUInt64 FirstLeafCompositeIndex = 0;
526  vtkTypeInt64 NumberOfTrees = 0;
527  vtkTypeInt64 NumberOfLeaves = 0;
528  vtkTypeInt64 NumberOfAMRLevels = 0;
529  vtkTypeInt64 NumberOfDataSets = 0;
530  vtkTypeInt64 MemorySize = 0;
531  double Bounds[6] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX,
532  VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
533  int Extent[6] = { VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX,
534  -VTK_INT_MAX };
535  bool HasTime = false;
536  double Time = 0.0;
537  double TimeRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
538  std::set<double> TimeSteps;
539  std::string TimeLabel;
540  std::vector<vtkTypeInt64> AMRNumberOfDataSets;
541 
542  std::vector<int> UniqueBlockTypes;
543  struct AttributeMetadata
544  {
545  std::string Name;
546  vtkTypeInt64 NumberOfElements;
548  };
549  std::map<int, AttributeMetadata> AttributeMetadata;
550  vtkNew<vtkPVArrayInformation> PointArrayInformation;
551 
552  vtkNew<vtkDataAssembly> Hierarchy;
553  vtkNew<vtkDataAssembly> DataAssembly;
554 
555  bool InspectCells = false;
556  std::vector<unsigned char> UniqueCellTypes;
557 
558  friend class vtkPVDataInformationAccumulator;
559 };
560 
561 #endif
virtual void CopyFromStream(const vtkClientServerStream *)
Manage a serialized version of the information.
const std::set< double > & GetTimeSteps() const
Strictly speaking, these are not data information since these cannot be obtained from the data but fr...
type
#define VTK_DOUBLE_MAX
vtkPVDataSetAttributesInformation * GetRowDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
provides meta data about a vtkDataObject subclass.
level
vtkPVDataSetAttributesInformation * GetCellDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
virtual void CopyParametersToStream(vtkMultiProcessStream &)
Serialize/Deserialize the parameters that control how/what information is gathered.
#define VTK_INT_MAX
void PrintSelf(ostream &os, vtkIndent indent) override
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
vtkTypeInt64 GetNumberOfCells() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
const std::vector< unsigned char > & GetUniqueCellTypes() const
Return a list of unique cell types (see vtkCellType.h).
bool IsNull() const
Returns true if the data information is empty or invalid.
Store messages for the interpreter.
const char * GetDataClassName() const
Returns a string for the given type.
vtkTypeInt64 GetNumberOfVertices() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
vtkPVDataSetAttributesInformation * GetEdgeDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
vtkTypeInt64 GetNumberOfEdges() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
vtkPVDataSetAttributesInformation * GetVertexDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
vtkPVDataSetAttributesInformation * GetSideDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
vtkTypeInt64 GetNumberOfRows() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
void operator=(const vtkPVInformation &)=delete
vtkPVDataSetAttributesInformation * GetFieldDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
vtkTypeInt64 GetNumberOfPoints() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
vtkPVDataSetAttributesInformation * GetPointDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific attribute type...
bool IsCompositeDataSet() const
Returns true if the data information corresponds to a composite dataset.
provides meta data about arrays.
const char * GetCompositeDataClassName() const
Returns a string for the given type.
virtual void CopyParametersFromStream(vtkMultiProcessStream &)
Serialize/Deserialize the parameters that control how/what information is gathered.
unsigned int GetNumberOfUniqueBlockTypes() const
For a composite dataset, returns a list of unique data set types for all non-null leaf nodes...
virtual void AddInformation(vtkPVInformation *)
Merge another information object.
virtual void CopyToStream(vtkClientServerStream *)=0
Manage a serialized version of the information.
const char * GetDataSetTypeAsString() const
Returns a string for the given type.
vtkTypeInt64 GetNumberOfTimeSteps() const
Strictly speaking, these are not data information since these cannot be obtained from the data but fr...
const std::vector< int > & GetUniqueBlockTypes() const
For a composite dataset, returns a list of unique data set types for all non-null leaf nodes...
virtual void CopyFromObject(vtkObject *)
Transfer information about a single object into this object.
static vtkObject * New()
index
vtkTypeInt64 GetNumberOfSides() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
Superclass for information objects.