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 
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); }
259 
261 
265  vtkGetMacro(NumberOfTrees, vtkTypeInt64);
266  vtkGetMacro(NumberOfLeaves, vtkTypeInt64);
268 
273  vtkGetMacro(NumberOfAMRLevels, vtkTypeInt64);
274 
279  vtkTypeInt64 GetNumberOfAMRDataSets(vtkTypeInt64 level) const;
280 
293  vtkGetMacro(NumberOfDataSets, vtkTypeInt64);
294 
301  vtkGetMacro(MemorySize, vtkTypeInt64);
302 
308  vtkGetVector6Macro(Bounds, double);
309 
311 
316  vtkGetVector6Macro(Extent, int);
318 
320 
330  int GetNumberOfAttributeTypes() const;
331  std::vector<int> GetAttributeTypes() const;
332  std::vector<std::string> GetAttributeNames() const;
333  std::string GetAttributeName(int attributeType) const;
334  vtkPVDataSetAttributesInformation* GetAttributeInformation(int attributeType) const;
336 
338 
343  {
344  return this->GetAttributeInformation(vtkDataObject::POINT);
345  }
347  {
348  return this->GetAttributeInformation(vtkDataObject::CELL);
349  }
351  {
352  return this->GetAttributeInformation(vtkDataObject::VERTEX);
353  }
355  {
356  return this->GetAttributeInformation(vtkDataObject::EDGE);
357  }
359  {
360  return this->GetAttributeInformation(vtkDataObject::ROW);
361  }
363  {
364  return this->GetAttributeInformation(vtkDataObject::FIELD);
365  }
367 
373  vtkGetObjectMacro(PointArrayInformation, vtkPVArrayInformation);
374 
376 
380  vtkGetMacro(HasTime, bool);
381  vtkGetMacro(Time, double);
383 
385 
390  vtkGetVector2Macro(TimeRange, double);
391  vtkGetMacro(TimeLabel, std::string);
392  const std::set<double>& GetTimeSteps() const { return this->TimeSteps; }
393  vtkTypeInt64 GetNumberOfTimeSteps() const
394  {
395  return static_cast<unsigned int>(this->TimeSteps.size());
396  }
398 
403  bool IsDataStructured() const;
404 
409  bool HasStructuredData() const;
410 
415  bool HasUnstructuredData() const;
416 
422  bool IsAttributeValid(int attributeType) const;
423 
427  static int GetExtentType(int dataType);
428 
430 
437  vtkDataAssembly* GetHierarchy() const;
438  vtkDataAssembly* GetDataAssembly() const;
439  vtkDataAssembly* GetDataAssembly(const char* assemblyName) const;
441 
448  vtkGetMacro(FirstLeafCompositeIndex, vtkTypeUInt64);
449 
463  std::string GetBlockName(vtkTypeUInt64 cid) const;
464 
468  std::vector<std::string> GetBlockNames(
469  const std::vector<std::string>& selectors, const char* assemblyName) const;
470 
477  unsigned int ComputeCompositeIndexForAMR(unsigned int level, unsigned int index) const;
478 
484  const std::vector<unsigned char>& GetUniqueCellTypes() const { return this->UniqueCellTypes; }
485 
486 protected:
488  ~vtkPVDataInformation() override;
489 
494  void CopyFromPipelineInformation(vtkInformation* pipelineInfo);
495  void CopyFromDataObject(vtkDataObject* dobj);
496  friend class vtkPVDataInformationHelper;
497 
501  virtual vtkSmartPointer<vtkCompositeDataSet> SimplifyCompositeDataSet(vtkCompositeDataSet* cd);
502 
507  vtkSmartPointer<vtkDataObject> GetSubset(vtkDataObject* dobj) const;
508 
509 private:
511  void operator=(const vtkPVDataInformation&) = delete;
512 
513  int PortNumber = -1;
514  int Rank = -1;
515  char* SubsetSelector = nullptr;
516  char* SubsetAssemblyName = nullptr;
517 
518  int DataSetType = -1;
519  int CompositeDataSetType = -1;
520  vtkTypeUInt64 FirstLeafCompositeIndex = 0;
521  vtkTypeInt64 NumberOfTrees = 0;
522  vtkTypeInt64 NumberOfLeaves = 0;
523  vtkTypeInt64 NumberOfAMRLevels = 0;
524  vtkTypeInt64 NumberOfDataSets = 0;
525  vtkTypeInt64 MemorySize = 0;
526  double Bounds[6] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX,
527  VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
528  int Extent[6] = { VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX,
529  -VTK_INT_MAX };
530  bool HasTime = false;
531  double Time = 0.0;
532  double TimeRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
533  std::set<double> TimeSteps;
534  std::string TimeLabel;
535  std::vector<vtkTypeInt64> AMRNumberOfDataSets;
536 
537  std::vector<int> UniqueBlockTypes;
538  struct AttributeMetadata
539  {
540  std::string Name;
541  vtkTypeInt64 NumberOfElements;
543  };
544  std::map<int, AttributeMetadata> AttributeMetadata;
545  vtkNew<vtkPVArrayInformation> PointArrayInformation;
546 
547  vtkNew<vtkDataAssembly> Hierarchy;
548  vtkNew<vtkDataAssembly> DataAssembly;
549 
550  bool InspectCells = false;
551  std::vector<unsigned char> UniqueCellTypes;
552 
553  friend class vtkPVDataInformationAccumulator;
554 };
555 
556 #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...
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...
#define VTKREMOTINGCORE_EXPORT
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
Superclass for information objects.