VTK  9.1.0
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 =========================================================================*/
143 #ifndef vtkDataObject_h
144 #define vtkDataObject_h
145 
146 #include "vtkCommonDataModelModule.h" // For export macro
147 #include "vtkObject.h"
148 
149 class vtkAbstractArray;
150 class vtkDataArray;
152 class vtkFieldData;
153 class vtkInformation;
163 
164 #define VTK_PIECES_EXTENT 0
165 #define VTK_3D_EXTENT 1
166 #define VTK_TIME_EXTENT 2
167 
168 class VTKCOMMONDATAMODEL_EXPORT vtkDataObject : public vtkObject
169 {
170 public:
171  static vtkDataObject* New();
172 
173  vtkTypeMacro(vtkDataObject, vtkObject);
174  void PrintSelf(ostream& os, vtkIndent indent) override;
175 
177 
180  vtkGetObjectMacro(Information, vtkInformation);
183 
188  vtkMTimeType GetMTime() override;
189 
193  virtual void Initialize();
194 
200  void ReleaseData();
201 
203 
206  vtkGetMacro(DataReleased, int);
208 
210 
214  static void SetGlobalReleaseDataFlag(int val);
215  void GlobalReleaseDataFlagOn() { this->SetGlobalReleaseDataFlag(1); }
216  void GlobalReleaseDataFlagOff() { this->SetGlobalReleaseDataFlag(0); }
219 
221 
224  virtual void SetFieldData(vtkFieldData*);
225  vtkGetObjectMacro(FieldData, vtkFieldData);
227 
234  virtual int GetDataObjectType() { return VTK_DATA_OBJECT; }
235 
241 
249  virtual unsigned long GetActualMemorySize();
250 
255  virtual void CopyInformationFromPipeline(vtkInformation* vtkNotUsed(info)) {}
256 
262  virtual void CopyInformationToPipeline(vtkInformation* vtkNotUsed(info)) {}
263 
271  vtkInformation* info, int fieldAssociation, int attributeType);
272 
279  vtkInformation* info, int fieldAssociation, const char* name);
280 
285  vtkInformation* info, int fieldAssociation, const char* name);
286 
294  vtkInformation* info, int fieldAssociation, const char* attributeName, int attributeType);
295 
305  static void SetActiveAttributeInfo(vtkInformation* info, int fieldAssociation, int attributeType,
306  const char* name, int arrayType, int numComponents, int numTuples);
307 
312  static void SetPointDataActiveScalarInfo(vtkInformation* info, int arrayType, int numComponents);
313 
320 
326  virtual void PrepareForNewData() { this->Initialize(); }
327 
329 
333  virtual void ShallowCopy(vtkDataObject* src);
334  virtual void DeepCopy(vtkDataObject* src);
336 
345  virtual int GetExtentType() { return VTK_PIECES_EXTENT; }
346 
351  virtual void Crop(const int* updateExtent);
352 
357  {
365  NUMBER_OF_ASSOCIATIONS
366  };
367 
373  {
381  NUMBER_OF_ATTRIBUTE_TYPES
382  };
383 
404 
417 
425 
432 
437 
442  {
446  FIELD_OPERATION_REMOVED
447  };
448 
453  static const char* GetAssociationTypeAsString(int associationType);
454 
459  static int GetAssociationTypeFromString(const char* associationName);
460 
461  // \ingroup InformationKeys
463  // \ingroup InformationKeys
465  // \ingroup InformationKeys
467  // \ingroup InformationKeys
469  // \ingroup InformationKeys
471  // \ingroup InformationKeys
473  // \ingroup InformationKeys
475  // \ingroup InformationKeys
477  // \ingroup InformationKeys
479  // \ingroup InformationKeys
481  // \ingroup InformationKeys
483  // \ingroup InformationKeys
485  // \ingroup InformationKeys
487  // \ingroup InformationKeys
489  // \ingroup InformationKeys
491  // \ingroup InformationKeys
493  // \ingroup InformationKeys
495  // \ingroup InformationKeys
497  // \ingroup InformationKeys
499  // \ingroup InformationKeys
501  // \ingroup InformationKeys
503  // \ingroup InformationKeys
505  // \ingroup InformationKeys
507  // \ingroup InformationKeys
509  // \ingroup InformationKeys
511  // \ingroup InformationKeys
513  // \ingroup InformationKeys
515 
516  // Key used to put SIL information in the output information by readers.
517  // \ingroup InformationKeys
519 
521 
527 
528 protected:
530  ~vtkDataObject() override;
531 
532  // General field data associated with data object
534 
535  // Keep track of data release during network execution
537 
538  // When was this data last generated?
540 
541  // Arbitrary extra information associated with this data object.
543 
544 private:
545  // Helper method for the ShallowCopy and DeepCopy methods.
546  void InternalDataObjectCopy(vtkDataObject* src);
547 
548 private:
549  vtkDataObject(const vtkDataObject&) = delete;
550  void operator=(const vtkDataObject&) = delete;
551 };
552 
553 #endif
Abstract superclass for all arrays.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
general representation of visualization data
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)
Shallow and Deep copy.
static int GetAssociationTypeFromString(const char *associationName)
Given a string association name, this static method returns an integer association type for the attri...
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)
Retrieve an instance of this class from an information object.
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()
Turn on/off flag to control whether every object releases its data after being used by a filter.
virtual void SetInformation(vtkInformation *)
Set/Get the information object associated with this data object.
virtual void PrepareForNewData()
make the output data ready for new data to be inserted.
void GlobalReleaseDataFlagOff()
Turn on/off flag to control whether every object releases its data after being used by a filter.
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()
Turn on/off flag to control whether every object releases its data after being used by a filter.
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 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:164
a simple class to control print indentation
Definition: vtkIndent.h:113
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:73
record modification and/or execution time
Definition: vtkTimeStamp.h:52
@ info
Definition: vtkX3D.h:382
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
#define VTK_PIECES_EXTENT
int vtkIdType
Definition: vtkType.h:332
#define VTK_DATA_OBJECT
Definition: vtkType.h:84
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287