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 vtkCollection;
28 class vtkDataAssembly;
29 class vtkDataObject;
30 class vtkDataSet;
31 class vtkGenericDataSet;
32 class vtkGraph;
33 class vtkHyperTreeGrid;
34 class vtkInformation;
36 class vtkPVDataInformationHelper;
38 class vtkSelection;
39 class vtkTable;
40 
42 {
43 public:
44  static vtkPVDataInformation* New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
55  vtkSetMacro(PortNumber, int);
56  vtkGetMacro(PortNumber, int);
58 
60 
64  vtkSetClampMacro(Rank, int, -1, VTK_INT_MAX);
65  vtkGetMacro(Rank, int);
67 
69 
74  vtkGetStringMacro(SubsetSelector);
75  vtkSetStringMacro(SubsetSelector);
77 
79 
84  vtkSetStringMacro(SubsetAssemblyName);
85  vtkGetStringMacro(SubsetAssemblyName);
86  void SetSubsetAssemblyNameToHierarchy();
88 
93  void CopyFromObject(vtkObject* object) override;
94 
96 
99  void AddInformation(vtkPVInformation* info) override;
100  void CopyToStream(vtkClientServerStream*) override;
101  void CopyFromStream(const vtkClientServerStream*) override;
105 
109  void Initialize();
110 
114  void DeepCopy(vtkPVDataInformation* info);
115 
121  vtkPVArrayInformation* GetArrayInformation(const char* arrayname, int fieldAssociation) const;
122 
134  vtkGetMacro(DataSetType, int);
135 
140  vtkGetMacro(CompositeDataSetType, int);
141 
145  bool IsCompositeDataSet() const { return (this->CompositeDataSetType != -1); }
146 
150  bool IsNull() const { return this->DataSetType == -1 && this->CompositeDataSetType == -1; }
151 
153 
160  const std::vector<int>& GetUniqueBlockTypes() const { return this->UniqueBlockTypes; }
161  unsigned int GetNumberOfUniqueBlockTypes() const
162  {
163  return static_cast<unsigned int>(this->UniqueBlockTypes.size());
164  }
165  int GetUniqueBlockType(unsigned int index) const;
167 
169 
175  static const char* GetDataSetTypeAsString(int type);
176  const char* GetDataSetTypeAsString() const
177  {
178  return vtkPVDataInformation::GetDataSetTypeAsString(this->DataSetType);
179  }
180  const char* GetDataClassName() const
181  {
182  return this->DataSetType != -1 ? this->GetDataSetTypeAsString() : nullptr;
183  }
184  const char* GetCompositeDataClassName() const
185  {
186  return this->CompositeDataSetType != -1
187  ? vtkPVDataInformation::GetDataSetTypeAsString(this->CompositeDataSetType)
188  : nullptr;
189  }
191 
193 
196  const char* GetPrettyDataTypeString() const;
197  static const char* GetPrettyDataTypeString(int dtype);
199 
201 
212  bool DataSetTypeIsA(const char* classname) const;
213  bool DataSetTypeIsA(int typeId) const;
215 
217 
223  bool HasDataSetType(const char* classname) const;
224  bool HasDataSetType(int typeId) const;
226 
234  vtkTypeInt64 GetNumberOfElements(int elementType) const;
235 
237 
240  vtkTypeInt64 GetNumberOfPoints() const { return this->GetNumberOfElements(vtkDataObject::POINT); }
241  vtkTypeInt64 GetNumberOfCells() const { return this->GetNumberOfElements(vtkDataObject::CELL); }
242  vtkTypeInt64 GetNumberOfVertices() const
243  {
244  return this->GetNumberOfElements(vtkDataObject::VERTEX);
245  }
246  vtkTypeInt64 GetNumberOfEdges() const { return this->GetNumberOfElements(vtkDataObject::EDGE); }
247  vtkTypeInt64 GetNumberOfRows() const { return this->GetNumberOfElements(vtkDataObject::ROW); }
249 
251 
255  vtkGetMacro(NumberOfTrees, vtkTypeInt64);
256  vtkGetMacro(NumberOfLeaves, vtkTypeInt64);
258 
263  vtkGetMacro(NumberOfAMRLevels, vtkTypeInt64);
264 
269  vtkTypeInt64 GetNumberOfAMRDataSets(vtkTypeInt64 level) const;
270 
283  vtkGetMacro(NumberOfDataSets, vtkTypeInt64);
284 
291  vtkGetMacro(MemorySize, vtkTypeInt64);
292 
298  vtkGetVector6Macro(Bounds, double);
299 
301 
306  vtkGetVector6Macro(Extent, int);
308 
310 
319  vtkPVDataSetAttributesInformation* GetAttributeInformation(int fieldAssociation) const;
321 
323 
328  {
329  return this->GetAttributeInformation(vtkDataObject::POINT);
330  }
332  {
333  return this->GetAttributeInformation(vtkDataObject::CELL);
334  }
336  {
337  return this->GetAttributeInformation(vtkDataObject::VERTEX);
338  }
340  {
341  return this->GetAttributeInformation(vtkDataObject::EDGE);
342  }
344  {
345  return this->GetAttributeInformation(vtkDataObject::ROW);
346  }
348  {
349  return this->GetAttributeInformation(vtkDataObject::FIELD);
350  }
352 
358  vtkGetObjectMacro(PointArrayInformation, vtkPVArrayInformation);
359 
361 
365  vtkGetMacro(HasTime, bool);
366  vtkGetMacro(Time, double);
368 
370 
375  vtkGetVector2Macro(TimeRange, double);
376  vtkGetMacro(TimeLabel, std::string);
377  const std::set<double>& GetTimeSteps() const { return this->TimeSteps; }
378  vtkTypeInt64 GetNumberOfTimeSteps() const
379  {
380  return static_cast<unsigned int>(this->TimeSteps.size());
381  }
383 
388  bool IsDataStructured() const;
389 
394  bool HasStructuredData() const;
395 
400  bool HasUnstructuredData() const;
401 
407  bool IsAttributeValid(int fieldAssociation) const;
408 
412  static int GetExtentType(int dataType);
413 
415 
422  vtkDataAssembly* GetHierarchy() const;
423  vtkDataAssembly* GetDataAssembly() const;
424  vtkDataAssembly* GetDataAssembly(const char* assemblyName) const;
426 
433  vtkGetMacro(FirstLeafCompositeIndex, vtkTypeUInt64);
434 
448  std::string GetBlockName(vtkTypeUInt64 cid) const;
449 
453  std::vector<std::string> GetBlockNames(
454  const std::vector<std::string>& selectors, const char* assemblyName) const;
455 
462  unsigned int ComputeCompositeIndexForAMR(unsigned int level, unsigned int index) const;
463 
464 protected:
466  ~vtkPVDataInformation() override;
467 
472  void CopyFromPipelineInformation(vtkInformation* pipelineInfo);
473  void CopyFromDataObject(vtkDataObject* dobj);
474  friend class vtkPVDataInformationHelper;
475 
480  vtkSmartPointer<vtkDataObject> GetSubset(vtkDataObject* dobj) const;
481 
482 private:
484  void operator=(const vtkPVDataInformation&) = delete;
485 
486  int PortNumber = -1;
487  int Rank = -1;
488  char* SubsetSelector = nullptr;
489  char* SubsetAssemblyName = nullptr;
490 
491  int DataSetType = -1;
492  int CompositeDataSetType = -1;
493  vtkTypeUInt64 FirstLeafCompositeIndex = 0;
494  vtkTypeInt64 NumberOfTrees = 0;
495  vtkTypeInt64 NumberOfLeaves = 0;
496  vtkTypeInt64 NumberOfAMRLevels = 0;
497  vtkTypeInt64 NumberOfDataSets = 0;
498  vtkTypeInt64 MemorySize = 0;
499  double Bounds[6] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX,
500  VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
501  int Extent[6] = { VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX, -VTK_INT_MAX, VTK_INT_MAX,
502  -VTK_INT_MAX };
503  bool HasTime = false;
504  double Time = 0.0;
505  double TimeRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
506  std::set<double> TimeSteps;
507  std::string TimeLabel;
508  std::vector<vtkTypeInt64> AMRNumberOfDataSets;
509 
510  std::vector<int> UniqueBlockTypes;
511  vtkTypeInt64 NumberOfElements[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES] = { 0, 0, 0, 0, 0, 0, 0 };
513  AttributeInformations[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES];
514  vtkNew<vtkPVArrayInformation> PointArrayInformation;
515 
516  vtkNew<vtkDataAssembly> Hierarchy;
517  vtkNew<vtkDataAssembly> DataAssembly;
518 
519  friend class vtkPVDataInformationAccumulator;
520 };
521 
522 #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...
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.