VTK
vtkDataObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataObject.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm 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 =========================================================================*/
34 #ifndef vtkDataObject_h
35 #define vtkDataObject_h
36 
37 #include "vtkCommonDataModelModule.h" // For export macro
38 #include "vtkObject.h"
39 
40 class vtkAbstractArray;
42 class vtkFieldData;
43 class vtkInformation;
53 
54 #define VTK_PIECES_EXTENT 0
55 #define VTK_3D_EXTENT 1
56 #define VTK_TIME_EXTENT 2
57 
58 class VTKCOMMONDATAMODEL_EXPORT vtkDataObject : public vtkObject
59 {
60 public:
61  static vtkDataObject* New();
62 
63  vtkTypeMacro(vtkDataObject, vtkObject);
64  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
70  vtkGetObjectMacro(Information, vtkInformation);
71  virtual void SetInformation(vtkInformation*);
73 
78  vtkMTimeType GetMTime() override;
79 
83  virtual void Initialize();
84 
90  void ReleaseData();
91 
93 
96  vtkGetMacro(DataReleased, int);
98 
100 
104  static void SetGlobalReleaseDataFlag(int val);
105  void GlobalReleaseDataFlagOn() { this->SetGlobalReleaseDataFlag(1); }
106  void GlobalReleaseDataFlagOff() { this->SetGlobalReleaseDataFlag(0); }
107  static int GetGlobalReleaseDataFlag();
109 
111 
114  virtual void SetFieldData(vtkFieldData*);
115  vtkGetObjectMacro(FieldData, vtkFieldData);
117 
124  virtual int GetDataObjectType() { return VTK_DATA_OBJECT; }
125 
130  vtkMTimeType GetUpdateTime();
131 
139  virtual unsigned long GetActualMemorySize();
140 
145  virtual void CopyInformationFromPipeline(vtkInformation* vtkNotUsed(info)) {}
146 
152  virtual void CopyInformationToPipeline(vtkInformation* vtkNotUsed(info)) {}
153 
160  static vtkInformation* GetActiveFieldInformation(
161  vtkInformation* info, int fieldAssociation, int attributeType);
162 
168  static vtkInformation* GetNamedFieldInformation(
169  vtkInformation* info, int fieldAssociation, const char* name);
170 
174  static void RemoveNamedFieldInformation(
175  vtkInformation* info, int fieldAssociation, const char* name);
176 
183  static vtkInformation* SetActiveAttribute(
184  vtkInformation* info, int fieldAssociation, const char* attributeName, int attributeType);
185 
195  static void SetActiveAttributeInfo(vtkInformation* info, int fieldAssociation, int attributeType,
196  const char* name, int arrayType, int numComponents, int numTuples);
197 
202  static void SetPointDataActiveScalarInfo(vtkInformation* info, int arrayType, int numComponents);
203 
209  void DataHasBeenGenerated();
210 
216  virtual void PrepareForNewData() { this->Initialize(); }
217 
219 
223  virtual void ShallowCopy(vtkDataObject* src);
224  virtual void DeepCopy(vtkDataObject* src);
226 
235  virtual int GetExtentType() { return VTK_PIECES_EXTENT; }
236 
241  virtual void Crop(const int* updateExtent);
242 
247  {
255  NUMBER_OF_ASSOCIATIONS
256  };
257 
263  {
271  NUMBER_OF_ATTRIBUTE_TYPES
272  };
273 
289  virtual vtkDataSetAttributes* GetAttributes(int type);
290 
297  virtual vtkFieldData* GetAttributesAsFieldData(int type);
298 
304  virtual int GetAttributeTypeForArray(vtkAbstractArray* arr);
305 
309  virtual vtkIdType GetNumberOfElements(int type);
310 
315  {
319  FIELD_OPERATION_REMOVED
320  };
321 
326  static const char* GetAssociationTypeAsString(int associationType);
327 
332  static int GetAssociationTypeFromString(const char* associationType);
333 
334  // \ingroup InformationKeys
335  static vtkInformationStringKey* DATA_TYPE_NAME();
336  // \ingroup InformationKeys
337  static vtkInformationDataObjectKey* DATA_OBJECT();
338  // \ingroup InformationKeys
339  static vtkInformationIntegerKey* DATA_EXTENT_TYPE();
340  // \ingroup InformationKeys
341  static vtkInformationIntegerPointerKey* DATA_EXTENT();
342  // \ingroup InformationKeys
343  static vtkInformationIntegerVectorKey* ALL_PIECES_EXTENT();
344  // \ingroup InformationKeys
345  static vtkInformationIntegerKey* DATA_PIECE_NUMBER();
346  // \ingroup InformationKeys
347  static vtkInformationIntegerKey* DATA_NUMBER_OF_PIECES();
348  // \ingroup InformationKeys
349  static vtkInformationIntegerKey* DATA_NUMBER_OF_GHOST_LEVELS();
350  // \ingroup InformationKeys
351  static vtkInformationDoubleKey* DATA_TIME_STEP();
352  // \ingroup InformationKeys
353  static vtkInformationInformationVectorKey* POINT_DATA_VECTOR();
354  // \ingroup InformationKeys
355  static vtkInformationInformationVectorKey* CELL_DATA_VECTOR();
356  // \ingroup InformationKeys
357  static vtkInformationInformationVectorKey* VERTEX_DATA_VECTOR();
358  // \ingroup InformationKeys
359  static vtkInformationInformationVectorKey* EDGE_DATA_VECTOR();
360  // \ingroup InformationKeys
361  static vtkInformationIntegerKey* FIELD_ARRAY_TYPE();
362  // \ingroup InformationKeys
363  static vtkInformationIntegerKey* FIELD_ASSOCIATION();
364  // \ingroup InformationKeys
365  static vtkInformationIntegerKey* FIELD_ATTRIBUTE_TYPE();
366  // \ingroup InformationKeys
367  static vtkInformationIntegerKey* FIELD_ACTIVE_ATTRIBUTE();
368  // \ingroup InformationKeys
369  static vtkInformationIntegerKey* FIELD_NUMBER_OF_COMPONENTS();
370  // \ingroup InformationKeys
371  static vtkInformationIntegerKey* FIELD_NUMBER_OF_TUPLES();
372  // \ingroup InformationKeys
373  static vtkInformationIntegerKey* FIELD_OPERATION();
374  // \ingroup InformationKeys
375  static vtkInformationDoubleVectorKey* FIELD_RANGE();
376  // \ingroup InformationKeys
377  static vtkInformationIntegerVectorKey* PIECE_EXTENT();
378  // \ingroup InformationKeys
379  static vtkInformationStringKey* FIELD_NAME();
380  // \ingroup InformationKeys
381  static vtkInformationDoubleVectorKey* ORIGIN();
382  // \ingroup InformationKeys
383  static vtkInformationDoubleVectorKey* SPACING();
384  // \ingroup InformationKeys
385  static vtkInformationDoubleVectorKey* DIRECTION();
386  // \ingroup InformationKeys
387  static vtkInformationDoubleVectorKey* BOUNDING_BOX();
388 
389  // Key used to put SIL information in the output information by readers.
390  // \ingroup InformationKeys
391  static vtkInformationDataObjectKey* SIL();
392 
394 
397  static vtkDataObject* GetData(vtkInformation* info);
398  static vtkDataObject* GetData(vtkInformationVector* v, int i = 0);
400 
401 protected:
402  vtkDataObject();
403  ~vtkDataObject() override;
404 
405  // General field data associated with data object
407 
408  // Keep track of data release during network execution
410 
411  // When was this data last generated?
413 
414  // Arbitrary extra information associated with this data object.
416 
417 private:
418  // Helper method for the ShallowCopy and DeepCopy methods.
419  void InternalDataObjectCopy(vtkDataObject* src);
420 
421 private:
422  vtkDataObject(const vtkDataObject&) = delete;
423  void operator=(const vtkDataObject&) = delete;
424 };
425 
426 #endif
vtkDataObject::FIELD_ASSOCIATION_EDGES
Definition: vtkDataObject.h:253
vtkInformationStringKey
Key for string values in vtkInformation.
Definition: vtkInformationStringKey.h:33
vtkDataObject::POINT
Definition: vtkDataObject.h:264
vtkDataObject::CELL
Definition: vtkDataObject.h:265
VTK_DATA_OBJECT
#define VTK_DATA_OBJECT
Definition: vtkType.h:98
vtkDataObject::FieldData
vtkFieldData * FieldData
Definition: vtkDataObject.h:406
vtkX3D::type
Definition: vtkX3D.h:522
vtkIdType
int vtkIdType
Definition: vtkType.h:349
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:53
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkInformationDataObjectKey
Key for vtkDataObject values.
Definition: vtkInformationDataObjectKey.h:33
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkDataObject::CopyInformationFromPipeline
virtual void CopyInformationFromPipeline(vtkInformation *vtkNotUsed(info))
Copy from the pipeline information to the data object's own information.
Definition: vtkDataObject.h:145
vtkDataObject::Information
vtkInformation * Information
Definition: vtkDataObject.h:415
vtkDataObject::GetDataObjectType
virtual int GetDataObjectType()
Return class name of data type.
Definition: vtkDataObject.h:124
vtkDataObject::FIELD_ASSOCIATION_POINTS
Definition: vtkDataObject.h:248
vtkDataObject::GlobalReleaseDataFlagOn
void GlobalReleaseDataFlagOn()
Definition: vtkDataObject.h:105
vtkInformationIntegerPointerKey
Key for pointer to integer.
Definition: vtkInformationIntegerPointerKey.h:31
vtkInformationDoubleKey
Key for double values in vtkInformation.
Definition: vtkInformationDoubleKey.h:31
vtkDataObject::POINT_THEN_CELL
Definition: vtkDataObject.h:267
vtkDataObject::FIELD_ASSOCIATION_NONE
Definition: vtkDataObject.h:250
vtkDataObject::FIELD_ASSOCIATION_VERTICES
Definition: vtkDataObject.h:252
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:53
vtkDataObject::GlobalReleaseDataFlagOff
void GlobalReleaseDataFlagOff()
Definition: vtkDataObject.h:106
vtkDataObject::FieldOperations
FieldOperations
Possible values for the FIELD_OPERATION information entry.
Definition: vtkDataObject.h:314
vtkDataObject::FIELD_OPERATION_MODIFIED
Definition: vtkDataObject.h:318
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkDataObject::FIELD_ASSOCIATION_CELLS
Definition: vtkDataObject.h:249
vtkDataObject::VERTEX
Definition: vtkDataObject.h:268
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:31
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkDataObject::GetExtentType
virtual int GetExtentType()
The ExtentType will be left as VTK_PIECES_EXTENT for data objects such as vtkPolyData and vtkUnstruct...
Definition: vtkDataObject.h:235
vtkDataObject::PrepareForNewData
virtual void PrepareForNewData()
make the output data ready for new data to be inserted.
Definition: vtkDataObject.h:216
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataObject::UpdateTime
vtkTimeStamp UpdateTime
Definition: vtkDataObject.h:412
VTK_PIECES_EXTENT
#define VTK_PIECES_EXTENT
Definition: vtkDataObject.h:54
vtkDataObject::ROW
Definition: vtkDataObject.h:270
vtkX3D::name
Definition: vtkX3D.h:225
vtkObject.h
vtkDataObject::FIELD
Definition: vtkDataObject.h:266
vtkDataObject::CopyInformationToPipeline
virtual void CopyInformationToPipeline(vtkInformation *vtkNotUsed(info))
Copy information from this data object to the pipeline information.
Definition: vtkDataObject.h:152
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:64
vtkX3D::info
Definition: vtkX3D.h:382
vtkDataObject::EDGE
Definition: vtkDataObject.h:269
vtkDataObject::DataReleased
int DataReleased
Definition: vtkDataObject.h:409
vtkInformationDoubleVectorKey
Key for double vector values.
Definition: vtkInformationDoubleVectorKey.h:31
vtkInformationInformationVectorKey
Key for vtkInformation vectors.
Definition: vtkInformationInformationVectorKey.h:33
vtkDataObject::FIELD_OPERATION_REINTERPOLATED
Definition: vtkDataObject.h:317
vtkDataObject::FIELD_ASSOCIATION_POINTS_THEN_CELLS
Definition: vtkDataObject.h:251
vtkDataObject::FieldAssociations
FieldAssociations
Possible values for the FIELD_ASSOCIATION information entry.
Definition: vtkDataObject.h:246
vtkInformationIntegerVectorKey
Key for integer vector values.
Definition: vtkInformationIntegerVectorKey.h:31
vtkDataObject::FIELD_ASSOCIATION_ROWS
Definition: vtkDataObject.h:254
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkDataObject::AttributeTypes
AttributeTypes
Possible attribute types.
Definition: vtkDataObject.h:262
vtkDataObject::FIELD_OPERATION_PRESERVED
Definition: vtkDataObject.h:316
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:304