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 
61 
65  vtkSetClampMacro(Rank, int, -1, VTK_INT_MAX);
66  vtkGetMacro(Rank, int);
68 
70 
75  vtkGetStringMacro(SubsetSelector);
76  vtkSetStringMacro(SubsetSelector);
78 
80 
85  vtkSetStringMacro(SubsetAssemblyName);
86  vtkGetStringMacro(SubsetAssemblyName);
87  void SetSubsetAssemblyNameToHierarchy();
89 
94  void CopyFromObject(vtkObject* object) override;
95 
97 
100  void AddInformation(vtkPVInformation* info) override;
101  void CopyToStream(vtkClientServerStream*) override;
102  void CopyFromStream(const vtkClientServerStream*) override;
106 
110  void Initialize();
111 
115  void DeepCopy(vtkPVDataInformation* info);
116 
122  vtkPVArrayInformation* GetArrayInformation(const char* arrayname, int fieldAssociation) const;
123 
135  vtkGetMacro(DataSetType, int);
136 
141  vtkGetMacro(CompositeDataSetType, int);
142 
146  bool IsCompositeDataSet() const { return (this->CompositeDataSetType != -1); }
147 
151  bool IsNull() const { return this->DataSetType == -1 && this->CompositeDataSetType == -1; }
152 
154 
161  const std::vector<int>& GetUniqueBlockTypes() const { return this->UniqueBlockTypes; }
162  unsigned int GetNumberOfUniqueBlockTypes() const
163  {
164  return static_cast<unsigned int>(this->UniqueBlockTypes.size());
165  }
166  int GetUniqueBlockType(unsigned int index) const;
168 
170 
176  static const char* GetDataSetTypeAsString(int type);
177  const char* GetDataSetTypeAsString() const
178  {
179  return vtkPVDataInformation::GetDataSetTypeAsString(this->DataSetType);
180  }
181  const char* GetDataClassName() const
182  {
183  return this->DataSetType != -1 ? this->GetDataSetTypeAsString() : nullptr;
184  }
185  const char* GetCompositeDataClassName() const
186  {
187  return this->CompositeDataSetType != -1
188  ? vtkPVDataInformation::GetDataSetTypeAsString(this->CompositeDataSetType)
189  : nullptr;
190  }
192 
194 
197  const char* GetPrettyDataTypeString() const;
198  static const char* GetPrettyDataTypeString(int dtype);
200 
202 
213  bool DataSetTypeIsA(const char* classname) const;
214  bool DataSetTypeIsA(int typeId) const;
216 
218 
224  bool HasDataSetType(const char* classname) const;
225  bool HasDataSetType(int typeId) const;
227 
235  vtkTypeInt64 GetNumberOfElements(int elementType) const;
236 
238 
241  vtkTypeInt64 GetNumberOfPoints() const { return this->GetNumberOfElements(vtkDataObject::POINT); }
242  vtkTypeInt64 GetNumberOfCells() const { return this->GetNumberOfElements(vtkDataObject::CELL); }
243  vtkTypeInt64 GetNumberOfVertices() const
244  {
245  return this->GetNumberOfElements(vtkDataObject::VERTEX);
246  }
247  vtkTypeInt64 GetNumberOfEdges() const { return this->GetNumberOfElements(vtkDataObject::EDGE); }
248  vtkTypeInt64 GetNumberOfRows() const { return this->GetNumberOfElements(vtkDataObject::ROW); }
250 
252 
256  vtkGetMacro(NumberOfTrees, vtkTypeInt64);
257  vtkGetMacro(NumberOfLeaves, vtkTypeInt64);
259 
264  vtkGetMacro(NumberOfAMRLevels, vtkTypeInt64);
265 
270  vtkTypeInt64 GetNumberOfAMRDataSets(vtkTypeInt64 level) const;
271 
284  vtkGetMacro(NumberOfDataSets, vtkTypeInt64);
285 
292  vtkGetMacro(MemorySize, vtkTypeInt64);
293 
299  vtkGetVector6Macro(Bounds, double);
300 
302 
307  vtkGetVector6Macro(Extent, int);
309 
311 
320  vtkPVDataSetAttributesInformation* GetAttributeInformation(int fieldAssociation) const;
322 
324 
329  {
330  return this->GetAttributeInformation(vtkDataObject::POINT);
331  }
333  {
334  return this->GetAttributeInformation(vtkDataObject::CELL);
335  }
337  {
338  return this->GetAttributeInformation(vtkDataObject::VERTEX);
339  }
341  {
342  return this->GetAttributeInformation(vtkDataObject::EDGE);
343  }
345  {
346  return this->GetAttributeInformation(vtkDataObject::ROW);
347  }
349  {
350  return this->GetAttributeInformation(vtkDataObject::FIELD);
351  }
353 
359  vtkGetObjectMacro(PointArrayInformation, vtkPVArrayInformation);
360 
362 
366  vtkGetMacro(HasTime, bool);
367  vtkGetMacro(Time, double);
369 
371 
376  vtkGetVector2Macro(TimeRange, double);
377  vtkGetMacro(TimeLabel, std::string);
378  const std::set<double>& GetTimeSteps() const { return this->TimeSteps; }
379  vtkTypeInt64 GetNumberOfTimeSteps() const
380  {
381  return static_cast<unsigned int>(this->TimeSteps.size());
382  }
384 
389  bool IsDataStructured() const;
390 
395  bool HasStructuredData() const;
396 
401  bool HasUnstructuredData() const;
402 
408  bool IsAttributeValid(int fieldAssociation) const;
409 
413  static int GetExtentType(int dataType);
414 
416 
423  vtkDataAssembly* GetHierarchy() const;
424  vtkDataAssembly* GetDataAssembly() const;
425  vtkDataAssembly* GetDataAssembly(const char* assemblyName) const;
427 
434  vtkGetMacro(FirstLeafCompositeIndex, vtkTypeUInt64);
435 
449  std::string GetBlockName(vtkTypeUInt64 cid) const;
450 
454  std::vector<std::string> GetBlockNames(
455  const std::vector<std::string>& selectors, const char* assemblyName) const;
456 
463  unsigned int ComputeCompositeIndexForAMR(unsigned int level, unsigned int index) const;
464 
465 protected:
467  ~vtkPVDataInformation() override;
468 
473  void CopyFromPipelineInformation(vtkInformation* pipelineInfo);
474  void CopyFromDataObject(vtkDataObject* dobj);
475  friend class vtkPVDataInformationHelper;
476 
481  vtkSmartPointer<vtkDataObject> GetSubset(vtkDataObject* dobj) const;
482 
483 private:
485  void operator=(const vtkPVDataInformation&) = delete;
486 
487  int PortNumber = -1;
488  int Rank = -1;
489  char* SubsetSelector = nullptr;
490  char* SubsetAssemblyName = nullptr;
491 
492  int DataSetType = -1;
493  int CompositeDataSetType = -1;
494  vtkTypeUInt64 FirstLeafCompositeIndex = 0;
495  vtkTypeInt64 NumberOfTrees = 0;
496  vtkTypeInt64 NumberOfLeaves = 0;
497  vtkTypeInt64 NumberOfAMRLevels = 0;
498  vtkTypeInt64 NumberOfDataSets = 0;
499  vtkTypeInt64 MemorySize = 0;
503  -VTK_INT_MAX };
504  bool HasTime = false;
505  double Time = 0.0;
506  double TimeRange[2] = { VTK_DOUBLE_MAX, -VTK_DOUBLE_MAX };
507  std::set<double> TimeSteps;
508  std::string TimeLabel;
509  std::vector<vtkTypeInt64> AMRNumberOfDataSets;
510 
511  std::vector<int> UniqueBlockTypes;
512  vtkTypeInt64 NumberOfElements[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES] = { 0, 0, 0, 0, 0, 0, 0 };
514  AttributeInformations[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES];
515  vtkNew<vtkPVArrayInformation> PointArrayInformation;
516 
517  vtkNew<vtkDataAssembly> Hierarchy;
518  vtkNew<vtkDataAssembly> DataAssembly;
519 
520  friend class vtkPVDataInformationAccumulator;
521 };
522 
523 #endif
DeepCopy
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
VTK_INT_MAX
#define VTK_INT_MAX
vtkDataObject::POINT
POINT
vtkPVInformation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
vtkDataObject::CELL
CELL
vtkPVDataInformation::GetNumberOfPoints
vtkTypeInt64 GetNumberOfPoints() const
Convenience methods that simply call GetNumberOfElements with appropriate element type.
Definition: vtkPVDataInformation.h:241
vtkPVDataInformation::GetTimeSteps
const std::set< double > & GetTimeSteps() const
Strictly speaking, these are not data information since these cannot be obtained from the data but fr...
Definition: vtkPVDataInformation.h:378
vtkPVDataInformation::GetDataSetTypeAsString
const char * GetDataSetTypeAsString() const
Returns a string for the given type.
Definition: vtkPVDataInformation.h:177
vtkPVDataInformation::GetNumberOfTimeSteps
vtkTypeInt64 GetNumberOfTimeSteps() const
Strictly speaking, these are not data information since these cannot be obtained from the data but fr...
Definition: vtkPVDataInformation.h:379
vtkPVDataInformation::GetNumberOfEdges
vtkTypeInt64 GetNumberOfEdges() const
Convenience methods that simply call GetNumberOfElements with appropriate element type.
Definition: vtkPVDataInformation.h:247
vtkTable
vtkObject::New
static vtkObject * New()
vtkMultiProcessStream
vtkPVDataInformation::GetDataClassName
const char * GetDataClassName() const
Returns a string for the given type.
Definition: vtkPVDataInformation.h:181
vtkClientServerStream
Store messages for the interpreter.
Definition: vtkClientServerStream.h:23
vtkPVInformation.h
vtkSmartPointer< vtkDataObject >
vtkObject
vtkPVDataInformation::GetNumberOfRows
vtkTypeInt64 GetNumberOfRows() const
Convenience methods that simply call GetNumberOfElements with appropriate element type.
Definition: vtkPVDataInformation.h:248
vtkPVDataInformation::GetNumberOfCells
vtkTypeInt64 GetNumberOfCells() const
Convenience methods that simply call GetNumberOfElements with appropriate element type.
Definition: vtkPVDataInformation.h:242
vtkSelection
vtkPVDataInformation::GetNumberOfVertices
vtkTypeInt64 GetNumberOfVertices() const
Convenience methods that simply call GetNumberOfElements with appropriate element type.
Definition: vtkPVDataInformation.h:243
vtkCompositeDataSet
vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES
NUMBER_OF_ATTRIBUTE_TYPES
vtkPVInformation::CopyParametersToStream
virtual void CopyParametersToStream(vtkMultiProcessStream &)
Serialize/Deserialize the parameters that control how/what information is gathered.
Definition: vtkPVInformation.h:50
vtkGenericDataSet
vtkPVInformation::operator=
void operator=(const vtkPVInformation &)=delete
vtkPVDataSetAttributesInformation
List of array info.
Definition: vtkPVDataSetAttributesInformation.h:24
vtkCollection
vtkPVInformation::AddInformation
virtual void AddInformation(vtkPVInformation *)
Merge another information object.
vtkDataObject::VERTEX
VERTEX
vtkIndent
vtkSmartPointer.h
vtkPVInformation::CopyFromObject
virtual void CopyFromObject(vtkObject *)
Transfer information about a single object into this object.
vtkPVDataInformation::GetPointDataInformation
vtkPVDataSetAttributesInformation * GetPointDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field type.
Definition: vtkPVDataInformation.h:328
vtkNew< vtkPVDataSetAttributesInformation >
vtkPVDataInformation::IsCompositeDataSet
bool IsCompositeDataSet() const
Returns true if the data information corresponds to a composite dataset.
Definition: vtkPVDataInformation.h:146
vtkPVDataInformation::GetCellDataInformation
vtkPVDataSetAttributesInformation * GetCellDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field type.
Definition: vtkPVDataInformation.h:332
vtkDataObject::ROW
ROW
vtkDataObject::FIELD
FIELD
vtkPVDataInformation::GetFieldDataInformation
vtkPVDataSetAttributesInformation * GetFieldDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field type.
Definition: vtkPVDataInformation.h:348
vtkDataSet
vtkInformation
vtkPVDataInformation
provides meta data about a vtkDataObject subclass.
Definition: vtkPVDataInformation.h:42
vtkPVArrayInformation
provides meta data about arrays.
Definition: vtkPVArrayInformation.h:30
vtkPVInformation
Superclass for information objects.
Definition: vtkPVInformation.h:19
vtkPVDataInformation::IsNull
bool IsNull() const
Returns true if the data information is empty or invalid.
Definition: vtkPVDataInformation.h:151
vtkDataObject::EDGE
EDGE
vtkNew.h
vtkPVDataInformation::GetEdgeDataInformation
vtkPVDataSetAttributesInformation * GetEdgeDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field type.
Definition: vtkPVDataInformation.h:340
vtkDataObject.h
vtkPVDataInformation::GetCompositeDataClassName
const char * GetCompositeDataClassName() const
Returns a string for the given type.
Definition: vtkPVDataInformation.h:185
vtkPVInformation::CopyToStream
virtual void CopyToStream(vtkClientServerStream *)=0
Manage a serialized version of the information.
vtkGraph
vtkDataObject
vtkPVDataInformation::GetUniqueBlockTypes
const std::vector< int > & GetUniqueBlockTypes() const
For a composite dataset, returns a list of unique data set types for all non-null leaf nodes.
Definition: vtkPVDataInformation.h:161
vtkPVDataInformation::GetVertexDataInformation
vtkPVDataSetAttributesInformation * GetVertexDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field type.
Definition: vtkPVDataInformation.h:336
vtkPVInformation::CopyFromStream
virtual void CopyFromStream(const vtkClientServerStream *)
Manage a serialized version of the information.
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
vtkPVDataInformation::GetNumberOfUniqueBlockTypes
unsigned int GetNumberOfUniqueBlockTypes() const
For a composite dataset, returns a list of unique data set types for all non-null leaf nodes.
Definition: vtkPVDataInformation.h:162
vtkPVInformation::CopyParametersFromStream
virtual void CopyParametersFromStream(vtkMultiProcessStream &)
Serialize/Deserialize the parameters that control how/what information is gathered.
Definition: vtkPVInformation.h:51
vtkPVDataInformation::GetRowDataInformation
vtkPVDataSetAttributesInformation * GetRowDataInformation() const
Convenience methods to get vtkPVDataSetAttributesInformation for specific field type.
Definition: vtkPVDataInformation.h:344
vtkHyperTreeGrid