VTK  9.3.20240418
vtkDataObject.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
137 #ifndef vtkDataObject_h
138 #define vtkDataObject_h
139 
140 #include "vtkCommonDataModelModule.h" // For export macro
141 #include "vtkObject.h"
142 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
143 
144 VTK_ABI_NAMESPACE_BEGIN
145 class vtkAbstractArray;
147 class vtkFieldData;
148 class vtkInformation;
159 
160 #define VTK_PIECES_EXTENT 0
161 #define VTK_3D_EXTENT 1
162 #define VTK_TIME_EXTENT 2
163 
164 class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkDataObject : public vtkObject
165 {
166 public:
167  static vtkDataObject* New();
168 
169  vtkTypeMacro(vtkDataObject, vtkObject);
170  void PrintSelf(ostream& os, vtkIndent indent) override;
171 
173 
177  vtkGetObjectMacro(Information, vtkInformation);
179  virtual void SetInformation(vtkInformation*);
181 
186  vtkMTimeType GetMTime() override;
187 
191  virtual void Initialize();
192 
198  void ReleaseData();
199 
201 
204  vtkGetMacro(DataReleased, vtkTypeBool);
206 
208 
212  static void SetGlobalReleaseDataFlag(vtkTypeBool val);
213  void GlobalReleaseDataFlagOn() { vtkDataObject::SetGlobalReleaseDataFlag(1); }
217 
219 
222  virtual void SetFieldData(vtkFieldData*);
223  vtkGetObjectMacro(FieldData, vtkFieldData);
225 
232  virtual int GetDataObjectType() { return VTK_DATA_OBJECT; }
233 
239 
247  virtual unsigned long GetActualMemorySize();
248 
253  virtual void CopyInformationFromPipeline(vtkInformation* vtkNotUsed(info)) {}
254 
260  virtual void CopyInformationToPipeline(vtkInformation* vtkNotUsed(info)) {}
261 
269  vtkInformation* info, int fieldAssociation, int attributeType);
270 
277  vtkInformation* info, int fieldAssociation, const char* name);
278 
283  vtkInformation* info, int fieldAssociation, const char* name);
284 
292  vtkInformation* info, int fieldAssociation, const char* attributeName, int attributeType);
293 
303  static void SetActiveAttributeInfo(vtkInformation* info, int fieldAssociation, int attributeType,
304  const char* name, int arrayType, int numComponents, int numTuples);
305 
310  static void SetPointDataActiveScalarInfo(vtkInformation* info, int arrayType, int numComponents);
311 
318 
324  virtual void PrepareForNewData() { this->Initialize(); }
325 
333  virtual void ShallowCopy(vtkDataObject* src);
334 
342  virtual void DeepCopy(vtkDataObject* src);
343 
352  virtual int GetExtentType() { return VTK_PIECES_EXTENT; }
353 
358  virtual void Crop(const int* updateExtent);
359 
364  {
372  NUMBER_OF_ASSOCIATIONS
373  };
374 
380  {
388  NUMBER_OF_ATTRIBUTE_TYPES
389  };
390 
411 
424 
437  virtual bool SupportsGhostArray(int type);
438 
446 
453 
458 
463  {
467  FIELD_OPERATION_REMOVED
468  };
469 
474  static const char* GetAssociationTypeAsString(int associationType);
475 
480  static int GetAssociationTypeFromString(const char* associationName);
481 
482  // \ingroup InformationKeys
484  // \ingroup InformationKeys
486  // \ingroup InformationKeys
488  // \ingroup InformationKeys
490  // \ingroup InformationKeys
492  // \ingroup InformationKeys
494  // \ingroup InformationKeys
496  // \ingroup InformationKeys
498  // \ingroup InformationKeys
500  // \ingroup InformationKeys
502  // \ingroup InformationKeys
504  // \ingroup InformationKeys
506  // \ingroup InformationKeys
508  // \ingroup InformationKeys
510  // \ingroup InformationKeys
512  // \ingroup InformationKeys
514  // \ingroup InformationKeys
516  // \ingroup InformationKeys
518  // \ingroup InformationKeys
520  // \ingroup InformationKeys
522  // \ingroup InformationKeys
524  // \ingroup InformationKeys
526  // \ingroup InformationKeys
528  // \ingroup InformationKeys
530  // \ingroup InformationKeys
532  // \ingroup InformationKeys
534  // \ingroup InformationKeys
536 
537  // Key used to put SIL information in the output information by readers.
538  // \ingroup InformationKeys
540 
542 
548 
549 protected:
551  ~vtkDataObject() override;
552 
553  // General field data associated with data object
555 
556  // Keep track of data release during network execution
558 
559  // When was this data last generated?
561 
562  // Arbitrary extra information associated with this data object.
564 
565 private:
566  // Helper method for the ShallowCopy and DeepCopy methods.
567  void InternalDataObjectCopy(vtkDataObject* src);
568 
569  vtkDataObject(const vtkDataObject&) = delete;
570  void operator=(const vtkDataObject&) = delete;
571 };
572 
573 VTK_ABI_NAMESPACE_END
574 #endif
Abstract superclass for all arrays.
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)
The goal of the method is to copy the data up to the array pointers only.
vtkMTimeType GetUpdateTime()
Used by Threaded ports to determine if they should initiate an asynchronous update (still in developm...
static vtkDataObject * New()
static vtkTypeBool GetGlobalReleaseDataFlag()
Turn on/off flag to control whether every object releases its data after being used by a filter.
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)
The goal of the method is to copy the complete data from src into this object.
static int GetAssociationTypeFromString(const char *associationName)
Given a string association name, this static method returns an integer association type for the attri...
vtkFieldData * FieldData
virtual bool SupportsGhostArray(int type)
Returns if this type of data object support ghost array for specified type.
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.
virtual vtkUnsignedCharArray * GetGhostArray(int type)
Returns the ghost arrays 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.
static vtkInformationIntegerKey * FIELD_ARRAY_TYPE()
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()
vtkTypeBool DataReleased
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.
static vtkInformationInformationVectorKey * VERTEX_DATA_VECTOR()
static vtkInformationIntegerKey * FIELD_NUMBER_OF_TUPLES()
static vtkInformationStringKey * FIELD_NAME()
static vtkInformationDataObjectKey * DATA_OBJECT()
static vtkInformationIntegerVectorKey * ALL_PIECES_EXTENT()
static vtkInformationStringKey * DATA_TYPE_NAME()
static vtkInformationDataObjectKey * SIL()
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 void SetGlobalReleaseDataFlag(vtkTypeBool val)
Turn on/off flag to control whether every object releases its data after being used by a filter.
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:162
a simple class to control print indentation
Definition: vtkIndent.h:108
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:162
record modification and/or execution time
Definition: vtkTimeStamp.h:44
dynamic, self-adjusting array of unsigned char
@ info
Definition: vtkX3D.h:376
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_PIECES_EXTENT
int vtkIdType
Definition: vtkType.h:315
#define VTK_DATA_OBJECT
Definition: vtkType.h:72
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)