VTK  9.0.2
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;
41 class vtkDataArray;
43 class vtkFieldData;
44 class vtkInformation;
54 
55 #define VTK_PIECES_EXTENT 0
56 #define VTK_3D_EXTENT 1
57 #define VTK_TIME_EXTENT 2
58 
59 class VTKCOMMONDATAMODEL_EXPORT vtkDataObject : public vtkObject
60 {
61 public:
62  static vtkDataObject* New();
63 
64  vtkTypeMacro(vtkDataObject, vtkObject);
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
68 
71  vtkGetObjectMacro(Information, vtkInformation);
74 
79  vtkMTimeType GetMTime() override;
80 
84  virtual void Initialize();
85 
91  void ReleaseData();
92 
94 
97  vtkGetMacro(DataReleased, int);
99 
101 
105  static void SetGlobalReleaseDataFlag(int val);
106  void GlobalReleaseDataFlagOn() { this->SetGlobalReleaseDataFlag(1); }
107  void GlobalReleaseDataFlagOff() { this->SetGlobalReleaseDataFlag(0); }
110 
112 
115  virtual void SetFieldData(vtkFieldData*);
116  vtkGetObjectMacro(FieldData, vtkFieldData);
118 
125  virtual int GetDataObjectType() { return VTK_DATA_OBJECT; }
126 
132 
140  virtual unsigned long GetActualMemorySize();
141 
146  virtual void CopyInformationFromPipeline(vtkInformation* vtkNotUsed(info)) {}
147 
153  virtual void CopyInformationToPipeline(vtkInformation* vtkNotUsed(info)) {}
154 
162  vtkInformation* info, int fieldAssociation, int attributeType);
163 
170  vtkInformation* info, int fieldAssociation, const char* name);
171 
176  vtkInformation* info, int fieldAssociation, const char* name);
177 
185  vtkInformation* info, int fieldAssociation, const char* attributeName, int attributeType);
186 
196  static void SetActiveAttributeInfo(vtkInformation* info, int fieldAssociation, int attributeType,
197  const char* name, int arrayType, int numComponents, int numTuples);
198 
203  static void SetPointDataActiveScalarInfo(vtkInformation* info, int arrayType, int numComponents);
204 
211 
217  virtual void PrepareForNewData() { this->Initialize(); }
218 
220 
224  virtual void ShallowCopy(vtkDataObject* src);
225  virtual void DeepCopy(vtkDataObject* src);
227 
236  virtual int GetExtentType() { return VTK_PIECES_EXTENT; }
237 
242  virtual void Crop(const int* updateExtent);
243 
248  {
256  NUMBER_OF_ASSOCIATIONS
257  };
258 
264  {
272  NUMBER_OF_ATTRIBUTE_TYPES
273  };
274 
295 
308 
316 
323 
328 
333  {
337  FIELD_OPERATION_REMOVED
338  };
339 
344  static const char* GetAssociationTypeAsString(int associationType);
345 
350  static int GetAssociationTypeFromString(const char* associationType);
351 
352  // \ingroup InformationKeys
354  // \ingroup InformationKeys
356  // \ingroup InformationKeys
358  // \ingroup InformationKeys
360  // \ingroup InformationKeys
362  // \ingroup InformationKeys
364  // \ingroup InformationKeys
366  // \ingroup InformationKeys
368  // \ingroup InformationKeys
370  // \ingroup InformationKeys
372  // \ingroup InformationKeys
374  // \ingroup InformationKeys
376  // \ingroup InformationKeys
378  // \ingroup InformationKeys
380  // \ingroup InformationKeys
382  // \ingroup InformationKeys
384  // \ingroup InformationKeys
386  // \ingroup InformationKeys
388  // \ingroup InformationKeys
390  // \ingroup InformationKeys
392  // \ingroup InformationKeys
394  // \ingroup InformationKeys
396  // \ingroup InformationKeys
398  // \ingroup InformationKeys
400  // \ingroup InformationKeys
402  // \ingroup InformationKeys
404  // \ingroup InformationKeys
406 
407  // Key used to put SIL information in the output information by readers.
408  // \ingroup InformationKeys
410 
412 
418 
419 protected:
421  ~vtkDataObject() override;
422 
423  // General field data associated with data object
425 
426  // Keep track of data release during network execution
428 
429  // When was this data last generated?
431 
432  // Arbitrary extra information associated with this data object.
434 
435 private:
436  // Helper method for the ShallowCopy and DeepCopy methods.
437  void InternalDataObjectCopy(vtkDataObject* src);
438 
439 private:
440  vtkDataObject(const vtkDataObject&) = delete;
441  void operator=(const vtkDataObject&) = delete;
442 };
443 
444 #endif
Abstract superclass for all arrays.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
general representation of visualization data
Definition: vtkDataObject.h:60
virtual vtkFieldData * GetAttributesAsFieldData(int type)
Returns the attributes of the data object as a vtkFieldData.
virtual void ShallowCopy(vtkDataObject *src)
Shallow and Deep copy.
vtkMTimeType GetUpdateTime()
Used by Threaded ports to determine if they should initiate an asynchronous update (still in developm...
virtual void Initialize()
Restore data object to initial state,.
static vtkDataObject * New()
virtual int GetAttributeTypeForArray(vtkAbstractArray *arr)
Retrieves the attribute type that an array came from.
static vtkInformationIntegerKey * DATA_NUMBER_OF_PIECES()
static vtkInformationDoubleVectorKey * BOUNDING_BOX()
static vtkInformationDoubleVectorKey * FIELD_RANGE()
virtual unsigned long GetActualMemorySize()
Return the actual size of the data in kibibytes (1024 bytes).
static void SetActiveAttributeInfo(vtkInformation *info, int fieldAssociation, int attributeType, const char *name, int arrayType, int numComponents, int numTuples)
Set the name, array type, number of components, and number of tuples within the passed information ob...
virtual void Crop(const int *updateExtent)
This method crops the data object (if necessary) so that the extent matches the update extent.
static vtkInformationIntegerKey * FIELD_OPERATION()
static vtkInformationDoubleVectorKey * SPACING()
static const char * GetAssociationTypeAsString(int associationType)
Given an integer association type, this static method returns a string type for the attribute (i....
FieldOperations
Possible values for the FIELD_OPERATION information entry.
@ FIELD_OPERATION_REINTERPOLATED
static vtkInformationIntegerKey * FIELD_ASSOCIATION()
~vtkDataObject() override
vtkTimeStamp UpdateTime
static vtkInformationIntegerKey * FIELD_ACTIVE_ATTRIBUTE()
virtual void DeepCopy(vtkDataObject *src)
vtkFieldData * FieldData
void ReleaseData()
Release data back to system to conserve memory resource.
FieldAssociations
Possible values for the FIELD_ASSOCIATION information entry.
@ FIELD_ASSOCIATION_POINTS_THEN_CELLS
@ FIELD_ASSOCIATION_VERTICES
virtual vtkDataSetAttributes * GetAttributes(int type)
Returns the attributes of the data object of the specified attribute type.
static vtkInformationDoubleVectorKey * DIRECTION()
static vtkDataObject * GetData(vtkInformationVector *v, int i=0)
virtual vtkDataArray * GetGhostArray(int type)
Returns the ghost arrays of the data object of the specified atribute type.
static vtkInformationIntegerKey * FIELD_ARRAY_TYPE()
static int GetGlobalReleaseDataFlag()
virtual void SetInformation(vtkInformation *)
virtual void PrepareForNewData()
make the output data ready for new data to be inserted.
void GlobalReleaseDataFlagOff()
static vtkInformationIntegerKey * FIELD_ATTRIBUTE_TYPE()
static vtkInformationIntegerKey * DATA_PIECE_NUMBER()
AttributeTypes
Possible attribute types.
static void RemoveNamedFieldInformation(vtkInformation *info, int fieldAssociation, const char *name)
Remove the info associated with an array.
static vtkInformationIntegerKey * DATA_EXTENT_TYPE()
virtual void CopyInformationFromPipeline(vtkInformation *vtkNotUsed(info))
Copy from the pipeline information to the data object's own information.
static vtkInformationInformationVectorKey * POINT_DATA_VECTOR()
static vtkInformationIntegerKey * DATA_NUMBER_OF_GHOST_LEVELS()
void DataHasBeenGenerated()
This method is called by the source when it executes to generate data.
static vtkInformationInformationVectorKey * CELL_DATA_VECTOR()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int GetDataObjectType()
Return class name of data type.
vtkMTimeType GetMTime() override
Data objects are composite objects and need to check each part for MTime.
static vtkInformationInformationVectorKey * VERTEX_DATA_VECTOR()
static vtkInformationIntegerKey * FIELD_NUMBER_OF_TUPLES()
static vtkInformationStringKey * FIELD_NAME()
static vtkInformationDataObjectKey * DATA_OBJECT()
static void SetGlobalReleaseDataFlag(int val)
Turn on/off flag to control whether every object releases its data after being used by a filter.
static vtkInformationIntegerVectorKey * ALL_PIECES_EXTENT()
static vtkInformationStringKey * DATA_TYPE_NAME()
static vtkInformationDataObjectKey * SIL()
void GlobalReleaseDataFlagOn()
static void SetPointDataActiveScalarInfo(vtkInformation *info, int arrayType, int numComponents)
Convenience version of previous method for use (primarily) by the Imaging filters.
static vtkInformation * GetNamedFieldInformation(vtkInformation *info, int fieldAssociation, const char *name)
Return the information object within the input information object's field data corresponding to the s...
static vtkInformationInformationVectorKey * EDGE_DATA_VECTOR()
static int GetAssociationTypeFromString(const char *associationType)
Given an integer association type, this static method returns a string type for the attribute (i....
static vtkDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
static vtkInformationIntegerVectorKey * PIECE_EXTENT()
static vtkInformationDoubleVectorKey * ORIGIN()
virtual void CopyInformationToPipeline(vtkInformation *vtkNotUsed(info))
Copy information from this data object to the pipeline information.
virtual void SetFieldData(vtkFieldData *)
Assign or retrieve a general field data to this data object.
static vtkInformation * SetActiveAttribute(vtkInformation *info, int fieldAssociation, const char *attributeName, int attributeType)
Set the named array to be the active field for the specified type (SCALARS, VECTORS,...
virtual int GetExtentType()
The ExtentType will be left as VTK_PIECES_EXTENT for data objects such as vtkPolyData and vtkUnstruct...
static vtkInformationIntegerKey * FIELD_NUMBER_OF_COMPONENTS()
static vtkInformation * GetActiveFieldInformation(vtkInformation *info, int fieldAssociation, int attributeType)
Return the information object within the input information object's field data corresponding to the s...
virtual vtkIdType GetNumberOfElements(int type)
Get the number of elements for a specific attribute type (POINT, CELL, etc.).
vtkInformation * Information
static vtkInformationDoubleKey * DATA_TIME_STEP()
static vtkInformationIntegerPointerKey * DATA_EXTENT()
represent and manipulate attribute data in a dataset
represent and manipulate fields of data
Definition: vtkFieldData.h:54
a simple class to control print indentation
Definition: vtkIndent.h:34
Key for vtkDataObject values.
Key for double values in vtkInformation.
Key for integer values in vtkInformation.
Key for string values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:63
record modification and/or execution time
Definition: vtkTimeStamp.h:33
@ info
Definition: vtkX3D.h:382
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
#define VTK_PIECES_EXTENT
Definition: vtkDataObject.h:55
int vtkIdType
Definition: vtkType.h:338
#define VTK_DATA_OBJECT
Definition: vtkType.h:92
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293