vtkPVDataInformation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkPVDataInformation.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
26 #ifndef vtkPVDataInformation_h
27 #define vtkPVDataInformation_h
28 
29 #include "vtkDataObject.h" // for vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES
30 #include "vtkNew.h" // for vtkNew
31 #include "vtkPVInformation.h"
32 #include "vtkParaViewDeprecation.h" // for PARAVIEW_DEPRECATED_IN_5_10_0
33 #include "vtkRemotingCoreModule.h" //needed for exports
34 #include "vtkSmartPointer.h" // for vtkSmartPointer
35 
36 #include <vector> // for std::vector
37 
38 class vtkCollection;
40 class vtkDataAssembly;
41 class vtkDataObject;
42 class vtkDataSet;
43 class vtkGenericDataSet;
44 class vtkGraph;
45 class vtkHyperTreeGrid;
46 class vtkInformation;
48 class vtkPVDataInformationHelper;
50 class vtkSelection;
51 class vtkTable;
52 
54 {
55 public:
56  static vtkPVDataInformation* New();
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
61 
67  vtkSetMacro(PortNumber, int);
68  vtkGetMacro(PortNumber, int);
70 
72 
76  vtkSetClampMacro(Rank, int, -1, VTK_INT_MAX);
77  vtkGetMacro(Rank, int);
79 
81 
86  vtkGetStringMacro(SubsetSelector);
87  vtkSetStringMacro(SubsetSelector);
89 
91 
96  vtkSetStringMacro(SubsetAssemblyName);
97  vtkGetStringMacro(SubsetAssemblyName);
98  void SetSubsetAssemblyNameToHierarchy();
100 
105  void CopyFromObject(vtkObject* object) override;
106 
108 
111  void AddInformation(vtkPVInformation* info) override;
112  void CopyToStream(vtkClientServerStream*) override;
113  void CopyFromStream(const vtkClientServerStream*) override;
117 
121  void Initialize();
122 
126  void DeepCopy(vtkPVDataInformation* info);
127 
133  vtkPVArrayInformation* GetArrayInformation(const char* arrayname, int fieldAssociation) const;
134 
146  vtkGetMacro(DataSetType, int);
147 
152  vtkGetMacro(CompositeDataSetType, int);
153 
157  bool IsCompositeDataSet() const { return (this->CompositeDataSetType != -1); }
158 
162  bool IsNull() const { return this->DataSetType == -1 && this->CompositeDataSetType == -1; }
163 
165 
172  const std::vector<int>& GetUniqueBlockTypes() const { return this->UniqueBlockTypes; }
173  unsigned int GetNumberOfUniqueBlockTypes() const
174  {
175  return static_cast<unsigned int>(this->UniqueBlockTypes.size());
176  }
177  int GetUniqueBlockType(unsigned int index) const;
179 
181 
187  static const char* GetDataSetTypeAsString(int type);
188  const char* GetDataSetTypeAsString() const
189  {
190  return vtkPVDataInformation::GetDataSetTypeAsString(this->DataSetType);
191  }
192  const char* GetDataClassName() const
193  {
194  return this->DataSetType != -1 ? this->GetDataSetTypeAsString() : nullptr;
195  }
196  const char* GetCompositeDataClassName() const
197  {
198  return this->CompositeDataSetType != -1
199  ? vtkPVDataInformation::GetDataSetTypeAsString(this->CompositeDataSetType)
200  : nullptr;
201  }
203 
205 
208  const char* GetPrettyDataTypeString() const;
209  static const char* GetPrettyDataTypeString(int dtype);
211 
213 
224  bool DataSetTypeIsA(const char* classname) const;
225  bool DataSetTypeIsA(int typeId) const;
227 
229 
235  bool HasDataSetType(const char* classname) const;
236  bool HasDataSetType(int typeId) const;
238 
246  vtkTypeInt64 GetNumberOfElements(int elementType) const;
247 
249 
252  vtkTypeInt64 GetNumberOfPoints() const { return this->GetNumberOfElements(vtkDataObject::POINT); }
253  vtkTypeInt64 GetNumberOfCells() const { return this->GetNumberOfElements(vtkDataObject::CELL); }
254  vtkTypeInt64 GetNumberOfVertices() const
255  {
256  return this->GetNumberOfElements(vtkDataObject::VERTEX);
257  }
258  vtkTypeInt64 GetNumberOfEdges() const { return this->GetNumberOfElements(vtkDataObject::EDGE); }
259  vtkTypeInt64 GetNumberOfRows() const { return this->GetNumberOfElements(vtkDataObject::ROW); }
261 
263 
267  vtkGetMacro(NumberOfTrees, vtkTypeInt64);
268  vtkGetMacro(NumberOfLeaves, vtkTypeInt64);
270 
275  vtkGetMacro(NumberOfAMRLevels, vtkTypeInt64);
276 
281  vtkTypeInt64 GetNumberOfAMRDataSets(vtkTypeInt64 level) const;
282 
295  vtkGetMacro(NumberOfDataSets, vtkTypeInt64);
296 
303  vtkGetMacro(MemorySize, vtkTypeInt64);
304 
310  vtkGetVector6Macro(Bounds, double);
311 
313 
318  vtkGetVector6Macro(Extent, int);
320 
322 
331  vtkPVDataSetAttributesInformation* GetAttributeInformation(int fieldAssociation) const;
333 
335 
340  {
341  return this->GetAttributeInformation(vtkDataObject::POINT);
342  }
344  {
345  return this->GetAttributeInformation(vtkDataObject::CELL);
346  }
348  {
349  return this->GetAttributeInformation(vtkDataObject::VERTEX);
350  }
352  {
353  return this->GetAttributeInformation(vtkDataObject::EDGE);
354  }
356  {
357  return this->GetAttributeInformation(vtkDataObject::ROW);
358  }
360  {
361  return this->GetAttributeInformation(vtkDataObject::FIELD);
362  }
364 
370  vtkGetObjectMacro(PointArrayInformation, vtkPVArrayInformation);
371 
373 
377  vtkGetMacro(HasTime, bool);
378  vtkGetMacro(Time, double);
380 
382 
387  vtkGetVector2Macro(TimeRange, double);
388  vtkGetMacro(NumberOfTimeSteps, vtkTypeInt64);
389  vtkGetMacro(TimeLabel, std::string);
391 
396  bool IsDataStructured() const;
397 
402  bool HasStructuredData() const;
403 
408  bool HasUnstructuredData() const;
409 
415  bool IsAttributeValid(int fieldAssociation) const;
416 
420  static int GetExtentType(int dataType);
421 
423 
430  vtkDataAssembly* GetHierarchy() const;
431  vtkDataAssembly* GetDataAssembly() const;
432  vtkDataAssembly* GetDataAssembly(const char* assemblyName) const;
434 
441  vtkGetMacro(FirstLeafCompositeIndex, vtkTypeUInt64);
442 
456  std::string GetBlockName(vtkTypeUInt64 cid) const;
457 
461  std::vector<std::string> GetBlockNames(
462  const std::vector<std::string>& selectors, const char* assemblyName) const;
463 
470  unsigned int ComputeCompositeIndexForAMR(unsigned int level, unsigned int index) const;
471 
473 
476  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkPVDataInformation::GetNumberOfCells()` instead")
477  vtkTypeUInt64 GetPolygonCount();
479  void* GetCompositeDataInformation();
481  vtkPVDataInformation* GetDataInformationForCompositeIndex(int);
483  unsigned int GetNumberOfBlockLeafs(bool skipEmpty);
485  vtkPVDataInformation* GetDataInformationForCompositeIndex(int*);
486  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkPVDataInformation::GetTimeRange()` instead")
487  double* GetTimeSpan();
488  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkPVDataInformation::GetTimeRange()` instead")
489  void GetTimeSpan(double&, double&);
490  PARAVIEW_DEPRECATED_IN_5_10_0("Replaced by `vtkPVDataInformation::GetTimeRange()` instead")
491  void GetTimeSpan(double[2]);
493  static void RegisterHelper(const char*, const char*);
495 
496 protected:
498  ~vtkPVDataInformation() override;
499 
504  void CopyFromPipelineInformation(vtkInformation* pipelineInfo);
505  void CopyFromDataObject(vtkDataObject* dobj);
506  friend class vtkPVDataInformationHelper;
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::string TimeLabel;
539  vtkTypeInt64 NumberOfTimeSteps = 0;
540  std::vector<vtkTypeInt64> AMRNumberOfDataSets;
541 
542  std::vector<int> UniqueBlockTypes;
543  vtkTypeInt64 NumberOfElements[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES] = { 0, 0, 0, 0, 0, 0, 0 };
545  AttributeInformations[vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES];
546  vtkNew<vtkPVArrayInformation> PointArrayInformation;
547 
548  vtkNew<vtkDataAssembly> Hierarchy;
549  vtkNew<vtkDataAssembly> DataAssembly;
550 
551  friend class vtkPVDataInformationAccumulator;
552 };
553 
554 #endif
#define PARAVIEW_DEPRECATED_IN_5_10_0(reason)
virtual void CopyFromStream(const vtkClientServerStream *)
Manage a serialized version of the information.
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.
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.