VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDataObject.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00040 #ifndef __vtkDataObject_h 00041 #define __vtkDataObject_h 00042 00043 #include "vtkObject.h" 00044 00045 class vtkAbstractArray; 00046 class vtkAlgorithmOutput; 00047 class vtkDataSetAttributes; 00048 class vtkExecutive; 00049 class vtkFieldData; 00050 class vtkInformation; 00051 class vtkProcessObject; 00052 class vtkSource; 00053 class vtkStreamingDemandDrivenPipelineToDataObjectFriendship; 00054 class vtkExtentTranslator; 00055 class vtkInformationDataObjectKey; 00056 class vtkInformationDoubleKey; 00057 class vtkInformationDoubleVectorKey; 00058 class vtkInformationIntegerKey; 00059 class vtkInformationIntegerPointerKey; 00060 class vtkInformationIntegerVectorKey; 00061 class vtkInformationStringKey; 00062 class vtkInformationVector; 00063 class vtkStreamingDemandDrivenPipeline; 00064 class vtkInformationInformationVectorKey; 00065 00066 #define VTK_PIECES_EXTENT 0 00067 #define VTK_3D_EXTENT 1 00068 #define VTK_TIME_EXTENT 2 00069 00070 class VTK_FILTERING_EXPORT vtkDataObject : public vtkObject 00071 { 00072 public: 00073 static vtkDataObject *New(); 00074 00075 vtkTypeMacro(vtkDataObject,vtkObject); 00076 void PrintSelf(ostream& os, vtkIndent indent); 00077 00079 00080 vtkGetObjectMacro(Source,vtkSource); 00081 void SetSource(vtkSource *s); 00083 00085 00086 vtkGetObjectMacro(Information, vtkInformation); 00087 virtual void SetInformation(vtkInformation*); 00089 00091 00092 vtkGetObjectMacro(PipelineInformation, vtkInformation); 00093 virtual void SetPipelineInformation(vtkInformation*); 00095 00097 virtual vtkAlgorithmOutput* GetProducerPort(); 00098 00101 unsigned long int GetMTime(); 00102 00104 virtual void Initialize(); 00105 00110 void ReleaseData(); 00111 00114 int ShouldIReleaseData(); 00115 00117 00118 vtkGetMacro(DataReleased,int); 00120 00122 00124 void SetReleaseDataFlag(int); 00125 int GetReleaseDataFlag(); 00126 vtkBooleanMacro(ReleaseDataFlag,int); 00128 00130 00132 static void SetGlobalReleaseDataFlag(int val); 00133 void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);}; 00134 void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);}; 00135 static int GetGlobalReleaseDataFlag(); 00137 00139 00140 virtual void SetFieldData(vtkFieldData*); 00141 vtkGetObjectMacro(FieldData,vtkFieldData); 00143 00144 // Handle the source/data loop. 00145 virtual void Register(vtkObjectBase* o); 00146 virtual void UnRegister(vtkObjectBase* o); 00147 00153 virtual void Update(); 00154 00160 virtual void UpdateInformation(); 00161 00166 virtual void PropagateUpdateExtent(); 00167 00173 virtual void TriggerAsynchronousUpdate(); 00174 00181 virtual void UpdateData(); 00182 00188 virtual unsigned long GetEstimatedMemorySize(); 00189 00191 00194 virtual void SetUpdateExtent(int piece,int numPieces, int ghostLevel); 00195 void SetUpdateExtent(int piece, int numPieces) 00196 {this->SetUpdateExtent(piece, numPieces, 0);} 00198 00200 00207 virtual void SetUpdateExtent(int x0, int x1, int y0, int y1, int z0, int z1); 00208 virtual void SetUpdateExtent(int extent[6]); 00209 virtual int* GetUpdateExtent(); 00210 virtual void GetUpdateExtent(int& x0, int& x1, int& y0, int& y1, 00211 int& z0, int& z1); 00212 virtual void GetUpdateExtent(int extent[6]); 00214 00219 virtual int GetDataObjectType() {return VTK_DATA_OBJECT;} 00220 00223 unsigned long GetUpdateTime(); 00224 00229 void SetUpdateExtentToWholeExtent(); 00230 00233 unsigned long GetPipelineMTime(); 00234 00240 virtual unsigned long GetActualMemorySize(); 00241 00243 void CopyInformation( vtkDataObject *data ); 00244 00246 00247 virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 00248 {this->CopyInformation( data );}; 00250 00252 00254 void SetUpdatePiece(int piece); 00255 void SetUpdateNumberOfPieces(int num); 00256 virtual int GetUpdatePiece(); 00257 virtual int GetUpdateNumberOfPieces(); 00259 00261 00263 void SetUpdateGhostLevel(int level); 00264 virtual int GetUpdateGhostLevel(); 00266 00268 00273 virtual void SetRequestExactExtent(int flag); 00274 virtual int GetRequestExactExtent(); 00275 vtkBooleanMacro(RequestExactExtent, int); 00277 00279 00282 virtual void SetWholeExtent(int x0, int x1, int y0, int y1, int z0, int z1); 00283 virtual void SetWholeExtent(int extent[6]); 00284 virtual int* GetWholeExtent(); 00285 virtual void GetWholeExtent(int& x0, int& x1, int& y0, int& y1, 00286 int& z0, int& z1); 00287 virtual void GetWholeExtent(int extent[6]); 00289 00291 00294 virtual void SetWholeBoundingBox(double x0, double x1, double y0, 00295 double y1, double z0, double z1); 00296 virtual void SetWholeBoundingBox(double bb[6]); 00297 virtual double* GetWholeBoundingBox(); 00298 virtual void GetWholeBoundingBox(double& x0, double& x1, double& y0, 00299 double& y1, double& z0, double& z1); 00300 virtual void GetWholeBoundingBox(double extent[6]); 00302 00304 00308 virtual void SetMaximumNumberOfPieces(int); 00309 virtual int GetMaximumNumberOfPieces(); 00311 00313 00318 virtual void CopyInformationToPipeline(vtkInformation* request, 00319 vtkInformation* input, 00320 vtkInformation* output, 00321 int forceCopy); 00323 00325 00328 void CopyInformationToPipeline(vtkInformation* request, 00329 vtkInformation* input) 00330 { 00331 this->CopyInformationToPipeline(request, input, this->PipelineInformation, 0); 00332 } 00334 00337 virtual void CopyInformationFromPipeline(vtkInformation* request); 00338 00340 00344 static vtkInformation *GetActiveFieldInformation(vtkInformation *info, 00345 int fieldAssociation, int attributeType); 00347 00349 00352 static vtkInformation *GetNamedFieldInformation(vtkInformation *info, 00353 int fieldAssociation, const char *name); 00355 00357 00358 static void RemoveNamedFieldInformation(vtkInformation *info, 00359 int fieldAssociation, 00360 const char *name); 00362 00364 00369 static vtkInformation *SetActiveAttribute(vtkInformation *info, 00370 int fieldAssociation, const char *attributeName, int attributeType); 00372 00374 00381 static void SetActiveAttributeInfo(vtkInformation *info, 00382 int fieldAssociation, int attributeType, const char *name, int arrayType, 00383 int numComponents, int numTuples); 00385 00387 00390 static void SetPointDataActiveScalarInfo(vtkInformation *info, 00391 int arrayType, int numComponents); 00393 00397 void DataHasBeenGenerated(); 00398 00402 virtual void PrepareForNewData() {this->Initialize();}; 00403 00405 00407 virtual void ShallowCopy(vtkDataObject *src); 00408 virtual void DeepCopy(vtkDataObject *src); 00410 00412 00413 void SetExtentTranslator(vtkExtentTranslator* translator); 00414 vtkExtentTranslator* GetExtentTranslator(); 00416 00423 virtual int GetExtentType() { return VTK_PIECES_EXTENT; }; 00424 00427 virtual void Crop(); 00428 00429 //BTX 00431 00432 enum FieldAssociations 00433 { 00434 FIELD_ASSOCIATION_POINTS, 00435 FIELD_ASSOCIATION_CELLS, 00436 FIELD_ASSOCIATION_NONE, 00437 FIELD_ASSOCIATION_POINTS_THEN_CELLS, 00438 FIELD_ASSOCIATION_VERTICES, 00439 FIELD_ASSOCIATION_EDGES, 00440 FIELD_ASSOCIATION_ROWS, 00441 NUMBER_OF_ASSOCIATIONS 00442 }; 00443 //ETX 00445 00446 //BTX 00448 00450 enum AttributeTypes 00451 { 00452 POINT, 00453 CELL, 00454 FIELD, 00455 POINT_THEN_CELL, 00456 VERTEX, 00457 EDGE, 00458 ROW, 00459 NUMBER_OF_ATTRIBUTE_TYPES 00460 }; 00461 //ETX 00463 00472 virtual vtkDataSetAttributes* GetAttributes(int type); 00473 00478 virtual vtkFieldData* GetAttributesAsFieldData(int type); 00479 00483 virtual int GetAttributeTypeForArray(vtkAbstractArray* arr); 00484 00487 virtual vtkIdType GetNumberOfElements(int type); 00488 00489 //BTX 00491 00492 enum FieldOperations 00493 { 00494 FIELD_OPERATION_PRESERVED, 00495 FIELD_OPERATION_REINTERPOLATED, 00496 FIELD_OPERATION_MODIFIED, 00497 FIELD_OPERATION_REMOVED 00498 }; 00499 //ETX 00501 00504 static const char* GetAssociationTypeAsString(int associationType); 00505 00506 static vtkInformationStringKey* DATA_TYPE_NAME(); 00507 static vtkInformationDataObjectKey* DATA_OBJECT(); 00508 static vtkInformationIntegerKey* DATA_EXTENT_TYPE(); 00509 static vtkInformationIntegerPointerKey* DATA_EXTENT(); 00510 static vtkInformationIntegerKey* DATA_PIECE_NUMBER(); 00511 static vtkInformationIntegerKey* DATA_NUMBER_OF_PIECES(); 00512 static vtkInformationIntegerKey* DATA_NUMBER_OF_GHOST_LEVELS(); 00513 static vtkInformationDoubleKey* DATA_RESOLUTION(); 00514 static vtkInformationDoubleVectorKey* DATA_TIME_STEPS(); 00515 static vtkInformationInformationVectorKey* POINT_DATA_VECTOR(); 00516 static vtkInformationInformationVectorKey* CELL_DATA_VECTOR(); 00517 static vtkInformationInformationVectorKey* VERTEX_DATA_VECTOR(); 00518 static vtkInformationInformationVectorKey* EDGE_DATA_VECTOR(); 00519 static vtkInformationIntegerKey* FIELD_ARRAY_TYPE(); 00520 static vtkInformationIntegerKey* FIELD_ASSOCIATION(); 00521 static vtkInformationIntegerKey* FIELD_ATTRIBUTE_TYPE(); 00522 static vtkInformationIntegerKey* FIELD_ACTIVE_ATTRIBUTE(); 00523 static vtkInformationIntegerKey* FIELD_NUMBER_OF_COMPONENTS(); 00524 static vtkInformationIntegerKey* FIELD_NUMBER_OF_TUPLES(); 00525 static vtkInformationIntegerKey* FIELD_OPERATION(); 00526 static vtkInformationDoubleVectorKey* FIELD_RANGE(); 00527 static vtkInformationDoubleVectorKey* PIECE_FIELD_RANGE(); 00528 static vtkInformationStringKey* FIELD_ARRAY_NAME(); 00529 static vtkInformationIntegerVectorKey* PIECE_EXTENT(); 00530 static vtkInformationStringKey* FIELD_NAME(); 00531 static vtkInformationDoubleVectorKey* ORIGIN(); 00532 static vtkInformationDoubleVectorKey* SPACING(); 00533 static vtkInformationIntegerKey* DATA_GEOMETRY_UNMODIFIED(); 00534 00535 // Key used to put SIL information in the output information by readers. 00536 static vtkInformationDataObjectKey* SIL(); 00537 00538 //BTX 00540 00541 static vtkDataObject* GetData(vtkInformation* info); 00542 static vtkDataObject* GetData(vtkInformationVector* v, int i=0); 00543 //ETX 00545 00546 protected: 00547 00548 vtkDataObject(); 00549 ~vtkDataObject(); 00550 00551 // General field data associated with data object 00552 vtkFieldData *FieldData; 00553 00554 // Who generated this data as output? 00555 vtkSource *Source; 00556 00557 // Keep track of data release during network execution 00558 int DataReleased; 00559 00560 // When was this data last generated? 00561 vtkTimeStamp UpdateTime; 00562 00563 // Get the executive that manages this data object. 00564 vtkExecutive* GetExecutive(); 00565 00566 // Get the port number producing this data object. 00567 int GetPortNumber(); 00568 00569 virtual void ReportReferences(vtkGarbageCollector*); 00570 00571 // Arbitrary extra information associated with this data object. 00572 vtkInformation* Information; 00573 00574 // Reference the pipeline information object that owns this data 00575 // object. 00576 vtkInformation* PipelineInformation; 00577 00578 //BTX 00579 // Check whether this data object is owned by a vtkStreamingDemandDrivenPipeline. 00580 vtkStreamingDemandDrivenPipeline* TrySDDP(const char* method); 00581 typedef vtkStreamingDemandDrivenPipeline SDDP; 00582 //ETX 00583 00584 //BTX 00585 friend class vtkStreamingDemandDrivenPipelineToDataObjectFriendship; 00586 //ETX 00587 00588 static const char AssociationNames[NUMBER_OF_ASSOCIATIONS][55]; 00589 00590 private: 00591 // Helper method for the ShallowCopy and DeepCopy methods. 00592 void InternalDataObjectCopy(vtkDataObject *src); 00593 00594 private: 00595 vtkDataObject(const vtkDataObject&); // Not implemented. 00596 void operator=(const vtkDataObject&); // Not implemented. 00597 }; 00598 00599 #endif 00600