VTK  9.3.1
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
28 #ifndef vtkDataObject_h
29 #define vtkDataObject_h
30 
31 #include "vtkCommonDataModelModule.h" // For export macro
32 #include "vtkObject.h"
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkAbstractArray;
37 class vtkFieldData;
38 class vtkInformation;
49 
50 #define VTK_PIECES_EXTENT 0
51 #define VTK_3D_EXTENT 1
52 #define VTK_TIME_EXTENT 2
53 
54 class VTKCOMMONDATAMODEL_EXPORT vtkDataObject : public vtkObject
55 {
56 public:
57  static vtkDataObject* New();
58 
59  vtkTypeMacro(vtkDataObject, vtkObject);
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
63 
66  vtkGetObjectMacro(Information, vtkInformation);
67  virtual void SetInformation(vtkInformation*);
69 
74  vtkMTimeType GetMTime() override;
75 
79  virtual void Initialize();
80 
86  void ReleaseData();
87 
89 
92  vtkGetMacro(DataReleased, vtkTypeBool);
94 
96 
100  static void SetGlobalReleaseDataFlag(vtkTypeBool val);
103  static vtkTypeBool GetGlobalReleaseDataFlag();
105 
107 
110  virtual void SetFieldData(vtkFieldData*);
111  vtkGetObjectMacro(FieldData, vtkFieldData);
113 
120  virtual int GetDataObjectType() { return VTK_DATA_OBJECT; }
121 
126  vtkMTimeType GetUpdateTime();
127 
135  virtual unsigned long GetActualMemorySize();
136 
141  virtual void CopyInformationFromPipeline(vtkInformation* vtkNotUsed(info)) {}
142 
148  virtual void CopyInformationToPipeline(vtkInformation* vtkNotUsed(info)) {}
149 
156  static vtkInformation* GetActiveFieldInformation(
157  vtkInformation* info, int fieldAssociation, int attributeType);
158 
164  static vtkInformation* GetNamedFieldInformation(
165  vtkInformation* info, int fieldAssociation, const char* name);
166 
170  static void RemoveNamedFieldInformation(
171  vtkInformation* info, int fieldAssociation, const char* name);
172 
179  static vtkInformation* SetActiveAttribute(
180  vtkInformation* info, int fieldAssociation, const char* attributeName, int attributeType);
181 
191  static void SetActiveAttributeInfo(vtkInformation* info, int fieldAssociation, int attributeType,
192  const char* name, int arrayType, int numComponents, int numTuples);
193 
198  static void SetPointDataActiveScalarInfo(vtkInformation* info, int arrayType, int numComponents);
199 
205  void DataHasBeenGenerated();
206 
212  virtual void PrepareForNewData() { this->Initialize(); }
213 
221  virtual void ShallowCopy(vtkDataObject* src);
222 
230  virtual void DeepCopy(vtkDataObject* src);
231 
240  virtual int GetExtentType() { return VTK_PIECES_EXTENT; }
241 
246  virtual void Crop(const int* updateExtent);
247 
252  {
260  NUMBER_OF_ASSOCIATIONS
261  };
262 
268  {
276  NUMBER_OF_ATTRIBUTE_TYPES
277  };
278 
298  virtual vtkDataSetAttributes* GetAttributes(int type);
299 
311  virtual vtkUnsignedCharArray* GetGhostArray(int type);
312 
319  virtual vtkFieldData* GetAttributesAsFieldData(int type);
320 
326  virtual int GetAttributeTypeForArray(vtkAbstractArray* arr);
327 
331  virtual vtkIdType GetNumberOfElements(int type);
332 
337  {
341  FIELD_OPERATION_REMOVED
342  };
343 
348  static const char* GetAssociationTypeAsString(int associationType);
349 
354  static int GetAssociationTypeFromString(const char* associationName);
355 
356  // \ingroup InformationKeys
357  static vtkInformationStringKey* DATA_TYPE_NAME();
358  // \ingroup InformationKeys
359  static vtkInformationDataObjectKey* DATA_OBJECT();
360  // \ingroup InformationKeys
361  static vtkInformationIntegerKey* DATA_EXTENT_TYPE();
362  // \ingroup InformationKeys
363  static vtkInformationIntegerPointerKey* DATA_EXTENT();
364  // \ingroup InformationKeys
365  static vtkInformationIntegerVectorKey* ALL_PIECES_EXTENT();
366  // \ingroup InformationKeys
367  static vtkInformationIntegerKey* DATA_PIECE_NUMBER();
368  // \ingroup InformationKeys
369  static vtkInformationIntegerKey* DATA_NUMBER_OF_PIECES();
370  // \ingroup InformationKeys
371  static vtkInformationIntegerKey* DATA_NUMBER_OF_GHOST_LEVELS();
372  // \ingroup InformationKeys
373  static vtkInformationDoubleKey* DATA_TIME_STEP();
374  // \ingroup InformationKeys
375  static vtkInformationInformationVectorKey* POINT_DATA_VECTOR();
376  // \ingroup InformationKeys
377  static vtkInformationInformationVectorKey* CELL_DATA_VECTOR();
378  // \ingroup InformationKeys
379  static vtkInformationInformationVectorKey* VERTEX_DATA_VECTOR();
380  // \ingroup InformationKeys
381  static vtkInformationInformationVectorKey* EDGE_DATA_VECTOR();
382  // \ingroup InformationKeys
383  static vtkInformationIntegerKey* FIELD_ARRAY_TYPE();
384  // \ingroup InformationKeys
385  static vtkInformationIntegerKey* FIELD_ASSOCIATION();
386  // \ingroup InformationKeys
387  static vtkInformationIntegerKey* FIELD_ATTRIBUTE_TYPE();
388  // \ingroup InformationKeys
389  static vtkInformationIntegerKey* FIELD_ACTIVE_ATTRIBUTE();
390  // \ingroup InformationKeys
391  static vtkInformationIntegerKey* FIELD_NUMBER_OF_COMPONENTS();
392  // \ingroup InformationKeys
393  static vtkInformationIntegerKey* FIELD_NUMBER_OF_TUPLES();
394  // \ingroup InformationKeys
395  static vtkInformationIntegerKey* FIELD_OPERATION();
396  // \ingroup InformationKeys
397  static vtkInformationDoubleVectorKey* FIELD_RANGE();
398  // \ingroup InformationKeys
399  static vtkInformationIntegerVectorKey* PIECE_EXTENT();
400  // \ingroup InformationKeys
401  static vtkInformationStringKey* FIELD_NAME();
402  // \ingroup InformationKeys
403  static vtkInformationDoubleVectorKey* ORIGIN();
404  // \ingroup InformationKeys
405  static vtkInformationDoubleVectorKey* SPACING();
406  // \ingroup InformationKeys
407  static vtkInformationDoubleVectorKey* DIRECTION();
408  // \ingroup InformationKeys
409  static vtkInformationDoubleVectorKey* BOUNDING_BOX();
410 
411  // Key used to put SIL information in the output information by readers.
412  // \ingroup InformationKeys
413  static vtkInformationDataObjectKey* SIL();
414 
416 
420  static vtkDataObject* GetData(vtkInformationVector* v, int i = 0);
422 
423 protected:
424  vtkDataObject();
425  ~vtkDataObject() override;
426 
427  // General field data associated with data object
429 
430  // Keep track of data release during network execution
432 
433  // When was this data last generated?
435 
436  // Arbitrary extra information associated with this data object.
438 
439 private:
440  // Helper method for the ShallowCopy and DeepCopy methods.
441  void InternalDataObjectCopy(vtkDataObject* src);
442 
443  vtkDataObject(const vtkDataObject&) = delete;
444  void operator=(const vtkDataObject&) = delete;
445 };
446 
447 VTK_ABI_NAMESPACE_END
448 #endif
vtkFieldData * FieldData
void GlobalReleaseDataFlagOn()
Turn on/off flag to control whether every object releases its data after being used by a filter...
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
Key for vtkDataObject values.
Abstract superclass for all arrays.
record modification and/or execution time
Definition: vtkTimeStamp.h:24
virtual void PrepareForNewData()
make the output data ready for new data to be inserted.
FieldAssociations
Possible values for the FIELD_ASSOCIATION information entry.
void GlobalReleaseDataFlagOff()
Turn on/off flag to control whether every object releases its data after being used by a filter...
int vtkIdType
Definition: vtkType.h:315
virtual int GetExtentType()
The ExtentType will be left as VTK_PIECES_EXTENT for data objects such as vtkPolyData and vtkUnstruct...
Key for string values in vtkInformation.
int vtkTypeBool
Definition: vtkABI.h:64
Key for double vector values.
FieldOperations
Possible values for the FIELD_OPERATION information entry.
a simple class to control print indentation
Definition: vtkIndent.h:28
Key for integer values in vtkInformation.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
virtual void CopyInformationFromPipeline(vtkInformation *vtkNotUsed(info))
Copy from the pipeline information to the data object's own information.
#define VTK_PIECES_EXTENT
Definition: vtkDataObject.h:50
represent and manipulate attribute data in a dataset
vtkSmartPointer< vtkDataArray > GetData(const Ioss::GroupingEntity *entity, const std::string &fieldname, Ioss::Transform *transform=nullptr, Cache *cache=nullptr, const std::string &cachekey=std::string())
Returns a VTK array for a given field (fieldname) on the chosen block (or set) entity.
dynamic, self-adjusting array of unsigned char
Key for double values in vtkInformation.
Store zero or more vtkInformation instances.
vtkTimeStamp UpdateTime
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual int GetDataObjectType()
Return class name of data type.
vtkTypeBool DataReleased
general representation of visualization data
Definition: vtkDataObject.h:54
AttributeTypes
Possible attribute types.
virtual void CopyInformationToPipeline(vtkInformation *vtkNotUsed(info))
Copy information from this data object to the pipeline information.
static void SetGlobalReleaseDataFlag(vtkTypeBool val)
Turn on/off flag to control whether every object releases its data after being used by a filter...
vtkInformation * Information
represent and manipulate fields of data
Definition: vtkFieldData.h:51
#define VTK_DATA_OBJECT
Definition: vtkType.h:72