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 
130  vtkPVArrayInformation* GetArrayInformation(const char* arrayname, int fieldAssociation) const;
131 
143  vtkGetMacro(DataSetType, int);
144 
149  vtkGetMacro(CompositeDataSetType, int);
150 
154  bool IsCompositeDataSet() const { return (this->CompositeDataSetType != -1); }
155 
159  bool IsNull() const { return this->DataSetType == -1 && this->CompositeDataSetType == -1; }
160 
162 
169  const std::vector<int>& GetUniqueBlockTypes() const { return this->UniqueBlockTypes; }
170  unsigned int GetNumberOfUniqueBlockTypes() const
171  {
172  return static_cast<unsigned int>(this->UniqueBlockTypes.size());
173  }
174  int GetUniqueBlockType(unsigned int index) const;
176 
178 
184  static const char* GetDataSetTypeAsString(int type);
185  const char* GetDataSetTypeAsString() const
186  {
187  return vtkPVDataInformation::GetDataSetTypeAsString(this->DataSetType);
188  }
189  const char* GetDataClassName() const
190  {
191  return this->DataSetType != -1 ? this->GetDataSetTypeAsString() : nullptr;
192  }
193  const char* GetCompositeDataClassName() const
194  {
195  return this->CompositeDataSetType != -1
196  ? vtkPVDataInformation::GetDataSetTypeAsString(this->CompositeDataSetType)
197  : nullptr;
198  }
200 
202 
205  const char* GetPrettyDataTypeString() const;
206  static const char* GetPrettyDataTypeString(int dtype);
208 
210 
221  bool DataSetTypeIsA(const char* classname) const;
222  bool DataSetTypeIsA(int typeId) const;
224 
226 
232  bool HasDataSetType(const char* classname) const;
233  bool HasDataSetType(int typeId) const;
235 
243  vtkTypeInt64 GetNumberOfElements(int elementType) const;
244 
246 
249  vtkTypeInt64 GetNumberOfPoints() const { return this->GetNumberOfElements(vtkDataObject::POINT); }
250  vtkTypeInt64 GetNumberOfCells() const { return this->GetNumberOfElements(vtkDataObject::CELL); }
251  vtkTypeInt64 GetNumberOfVertices() const
252  {
253  return this->GetNumberOfElements(vtkDataObject::VERTEX);
254  }
255  vtkTypeInt64 GetNumberOfEdges() const { return this->GetNumberOfElements(vtkDataObject::EDGE); }
256  vtkTypeInt64 GetNumberOfRows() const { return this->GetNumberOfElements(vtkDataObject::ROW); }
258 
260 
264  vtkGetMacro(NumberOfTrees, vtkTypeInt64);
265  vtkGetMacro(NumberOfLeaves, vtkTypeInt64);
267 
272  vtkGetMacro(NumberOfAMRLevels, vtkTypeInt64);
273 
278  vtkTypeInt64 GetNumberOfAMRDataSets(vtkTypeInt64 level) const;
279 
292  vtkGetMacro(NumberOfDataSets, vtkTypeInt64);
293 
300  vtkGetMacro(MemorySize, vtkTypeInt64);
301 
307  vtkGetVector6Macro(Bounds, double);
308 
310 
315  vtkGetVector6Macro(Extent, int);
317 
319 
328  vtkPVDataSetAttributesInformation* GetAttributeInformation(int fieldAssociation) const;
330 
332 
337  {
338  return this->GetAttributeInformation(vtkDataObject::POINT);
339  }
341  {
342  return this->GetAttributeInformation(vtkDataObject::CELL);
343  }
345  {
346  return this->GetAttributeInformation(vtkDataObject::VERTEX);
347  }
349  {
350  return this->GetAttributeInformation(vtkDataObject::EDGE);
351  }
353  {
354  return this->GetAttributeInformation(vtkDataObject::ROW);
355  }
357  {
358  return this->GetAttributeInformation(vtkDataObject::FIELD);
359  }
361 
367  vtkGetObjectMacro(PointArrayInformation, vtkPVArrayInformation);
368 
370 
374  vtkGetMacro(HasTime, bool);
375  vtkGetMacro(Time, double);
377 
379 
384  vtkGetVector2Macro(TimeRange, double);
385  vtkGetMacro(TimeLabel, std::string);
386  const std::set<double>& GetTimeSteps() const { return this->TimeSteps; }
387  vtkTypeInt64 GetNumberOfTimeSteps() const
388  {
389  return static_cast<unsigned int>(this->TimeSteps.size());
390  }
392 
397  bool IsDataStructured() const;
398 
403  bool HasStructuredData() const;
404 
409  bool HasUnstructuredData() const;
410 
416  bool IsAttributeValid(int fieldAssociation) const;
417 
421  static int GetExtentType(int dataType);
422 
424 
431  vtkDataAssembly* GetHierarchy() const;
432  vtkDataAssembly* GetDataAssembly() const;
433  vtkDataAssembly* GetDataAssembly(const char* assemblyName) const;
435 
442  vtkGetMacro(FirstLeafCompositeIndex, vtkTypeUInt64);
443 
457  std::string GetBlockName(vtkTypeUInt64 cid) const;
458 
462  std::vector<std::string> GetBlockNames(
463  const std::vector<std::string>& selectors, const char* assemblyName) const;
464 
471  unsigned int ComputeCompositeIndexForAMR(unsigned int level, unsigned int index) const;
472 
478  const std::vector<unsigned char>& GetUniqueCellTypes() const { return this->UniqueCellTypes; }
479 
480 protected:
482  ~vtkPVDataInformation() override;
483 
488  void CopyFromPipelineInformation(vtkInformation* pipelineInfo);
489  void CopyFromDataObject(vtkDataObject* dobj);
490  friend class vtkPVDataInformationHelper;
491 
495  virtual vtkSmartPointer<vtkCompositeDataSet> SimplifyCompositeDataSet(vtkCompositeDataSet* cd);
496 
501  vtkSmartPointer<vtkDataObject> GetSubset(vtkDataObject* dobj) const;
502 
503 private:
505  void operator=(const vtkPVDataInformation&) = delete;
506 
507  int PortNumber = -1;
508  int Rank = -1;
509  char* SubsetSelector = nullptr;
510  char* SubsetAssemblyName = nullptr;
511 
512  int DataSetType = -1;
513  int CompositeDataSetType = -1;
514  vtkTypeUInt64 FirstLeafCompositeIndex = 0;
515  vtkTypeInt64 NumberOfTrees = 0;
516  vtkTypeInt64 NumberOfLeaves = 0;
517  vtkTypeInt64 NumberOfAMRLevels = 0;
518  vtkTypeInt64 NumberOfDataSets = 0;
519  vtkTypeInt64 MemorySize = 0;
520  double Bounds[6] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX,
521  VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
522  int Extent[6] = { VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX,
523  -VTK_INT_MAX };
524  bool HasTime = false;
525  double Time = 0.0;
526  double TimeRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
527  std::set<double> TimeSteps;
528  std::string TimeLabel;
529  std::vector<vtkTypeInt64> AMRNumberOfDataSets;
530 
531  std::vector<int> UniqueBlockTypes;
532  vtkTypeInt64 NumberOfElements[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES] = { 0, 0, 0, 0, 0, 0, 0 };
534  AttributeInformations[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES];
535  vtkNew<vtkPVArrayInformation> PointArrayInformation;
536 
537  vtkNew<vtkDataAssembly> Hierarchy;
538  vtkNew<vtkDataAssembly> DataAssembly;
539 
540  bool InspectCells = false;
541  std::vector<unsigned char> UniqueCellTypes;
542 
543  friend class vtkPVDataInformationAccumulator;
544 };
545 
546 #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 field type.
provides meta data about a vtkDataObject subclass.
level
vtkPVDataSetAttributesInformation * GetCellDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field 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 field type.
vtkTypeInt64 GetNumberOfEdges() const
Convenience methods that simply call GetNumberOfElements with appropriate element type...
vtkPVDataSetAttributesInformation * GetVertexDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field 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 field 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 field 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.