VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkDataObject.h,v $ 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 =========================================================================*/ 00037 #ifndef __vtkDataObject_h 00038 #define __vtkDataObject_h 00039 00040 #include "vtkObject.h" 00041 00042 class vtkAlgorithmOutput; 00043 class vtkExecutive; 00044 class vtkFieldData; 00045 class vtkInformation; 00046 class vtkProcessObject; 00047 class vtkSource; 00048 class vtkStreamingDemandDrivenPipelineToDataObjectFriendship; 00049 class vtkExtentTranslator; 00050 class vtkInformationDataObjectKey; 00051 class vtkInformationDoubleKey; 00052 class vtkInformationDoubleVectorKey; 00053 class vtkInformationIntegerKey; 00054 class vtkInformationIntegerPointerKey; 00055 class vtkInformationIntegerVectorKey; 00056 class vtkInformationStringKey; 00057 class vtkInformationVector; 00058 class vtkStreamingDemandDrivenPipeline; 00059 class vtkInformationInformationVectorKey; 00060 00061 #define VTK_PIECES_EXTENT 0 00062 #define VTK_3D_EXTENT 1 00063 #define VTK_TIME_EXTENT 2 00064 00065 class VTK_FILTERING_EXPORT vtkDataObject : public vtkObject 00066 { 00067 public: 00068 static vtkDataObject *New(); 00069 00070 vtkTypeRevisionMacro(vtkDataObject,vtkObject); 00071 void PrintSelf(ostream& os, vtkIndent indent); 00072 00074 00075 vtkGetObjectMacro(Source,vtkSource); 00076 void SetSource(vtkSource *s); 00078 00080 00081 vtkGetObjectMacro(Information, vtkInformation); 00082 virtual void SetInformation(vtkInformation*); 00084 00086 00087 vtkGetObjectMacro(PipelineInformation, vtkInformation); 00088 virtual void SetPipelineInformation(vtkInformation*); 00090 00092 virtual vtkAlgorithmOutput* GetProducerPort(); 00093 00096 unsigned long int GetMTime(); 00097 00099 virtual void Initialize(); 00100 00105 void ReleaseData(); 00106 00109 int ShouldIReleaseData(); 00110 00112 00113 vtkGetMacro(DataReleased,int); 00115 00117 00119 void SetReleaseDataFlag(int); 00120 int GetReleaseDataFlag(); 00121 vtkBooleanMacro(ReleaseDataFlag,int); 00123 00125 00127 static void SetGlobalReleaseDataFlag(int val); 00128 void GlobalReleaseDataFlagOn() {this->SetGlobalReleaseDataFlag(1);}; 00129 void GlobalReleaseDataFlagOff() {this->SetGlobalReleaseDataFlag(0);}; 00130 static int GetGlobalReleaseDataFlag(); 00132 00134 00135 virtual void SetFieldData(vtkFieldData*); 00136 vtkGetObjectMacro(FieldData,vtkFieldData); 00138 00139 // Handle the source/data loop. 00140 virtual void Register(vtkObjectBase* o); 00141 virtual void UnRegister(vtkObjectBase* o); 00142 00148 virtual void Update(); 00149 00155 virtual void UpdateInformation(); 00156 00161 virtual void PropagateUpdateExtent(); 00162 00168 virtual void TriggerAsynchronousUpdate(); 00169 00176 virtual void UpdateData(); 00177 00183 virtual unsigned long GetEstimatedMemorySize(); 00184 00186 00189 virtual void SetUpdateExtent(int piece,int numPieces, int ghostLevel); 00190 void SetUpdateExtent(int piece, int numPieces) 00191 {this->SetUpdateExtent(piece, numPieces, 0);} 00193 00195 00202 virtual void SetUpdateExtent(int x0, int x1, int y0, int y1, int z0, int z1); 00203 virtual void SetUpdateExtent(int extent[6]); 00204 virtual int* GetUpdateExtent(); 00205 virtual void GetUpdateExtent(int& x0, int& x1, int& y0, int& y1, 00206 int& z0, int& z1); 00207 virtual void GetUpdateExtent(int extent[6]); 00209 00214 virtual int GetDataObjectType() {return VTK_DATA_OBJECT;} 00215 00218 unsigned long GetUpdateTime(); 00219 00224 void SetUpdateExtentToWholeExtent(); 00225 00228 unsigned long GetPipelineMTime(); 00229 00235 virtual unsigned long GetActualMemorySize(); 00236 00238 void CopyInformation( vtkDataObject *data ); 00239 00241 00242 virtual void CopyTypeSpecificInformation( vtkDataObject *data ) 00243 {this->CopyInformation( data );}; 00245 00247 00249 void SetUpdatePiece(int piece); 00250 void SetUpdateNumberOfPieces(int num); 00251 virtual int GetUpdatePiece(); 00252 virtual int GetUpdateNumberOfPieces(); 00254 00256 00258 void SetUpdateGhostLevel(int level); 00259 virtual int GetUpdateGhostLevel(); 00261 00263 00268 virtual void SetRequestExactExtent(int flag); 00269 virtual int GetRequestExactExtent(); 00270 vtkBooleanMacro(RequestExactExtent, int); 00272 00274 00277 virtual void SetWholeExtent(int x0, int x1, int y0, int y1, int z0, int z1); 00278 virtual void SetWholeExtent(int extent[6]); 00279 virtual int* GetWholeExtent(); 00280 virtual void GetWholeExtent(int& x0, int& x1, int& y0, int& y1, 00281 int& z0, int& z1); 00282 virtual void GetWholeExtent(int extent[6]); 00284 00286 00289 virtual void SetWholeBoundingBox(double x0, double x1, double y0, 00290 double y1, double z0, double z1); 00291 virtual void SetWholeBoundingBox(double bb[6]); 00292 virtual double* GetWholeBoundingBox(); 00293 virtual void GetWholeBoundingBox(double& x0, double& x1, double& y0, 00294 double& y1, double& z0, double& z1); 00295 virtual void GetWholeBoundingBox(double extent[6]); 00297 00299 00303 virtual void SetMaximumNumberOfPieces(int); 00304 virtual int GetMaximumNumberOfPieces(); 00306 00308 00313 virtual void CopyInformationToPipeline(vtkInformation* request, 00314 vtkInformation* input, 00315 vtkInformation* output, 00316 int forceCopy); 00318 00320 00323 void CopyInformationToPipeline(vtkInformation* request, 00324 vtkInformation* input) 00325 { 00326 this->CopyInformationToPipeline(request, input, this->PipelineInformation, 0); 00327 } 00329 00332 virtual void CopyInformationFromPipeline(vtkInformation* request); 00333 00335 00339 static vtkInformation *GetActiveFieldInformation(vtkInformation *info, 00340 int fieldAssociation, int attributeType); 00342 00344 00347 static vtkInformation *GetNamedFieldInformation(vtkInformation *info, 00348 int fieldAssociation, const char *name); 00350 00352 00353 static void RemoveNamedFieldInformation(vtkInformation *info, 00354 int fieldAssociation, 00355 const char *name); 00357 00359 00364 static vtkInformation *SetActiveAttribute(vtkInformation *info, 00365 int fieldAssociation, const char *attributeName, int attributeType); 00367 00369 00376 static void SetActiveAttributeInfo(vtkInformation *info, 00377 int fieldAssociation, int attributeType, const char *name, int arrayType, 00378 int numComponents, int numTuples); 00380 00382 00385 static void SetPointDataActiveScalarInfo(vtkInformation *info, 00386 int arrayType, int numComponents); 00388 00392 void DataHasBeenGenerated(); 00393 00397 virtual void PrepareForNewData() {this->Initialize();}; 00398 00400 00402 virtual void ShallowCopy(vtkDataObject *src); 00403 virtual void DeepCopy(vtkDataObject *src); 00405 00407 00408 void SetExtentTranslator(vtkExtentTranslator* translator); 00409 vtkExtentTranslator* GetExtentTranslator(); 00411 00418 virtual int GetExtentType() { return VTK_PIECES_EXTENT; }; 00419 00422 virtual void Crop(); 00423 00424 //BTX 00426 00427 enum FieldAssociations 00428 { 00429 FIELD_ASSOCIATION_POINTS, 00430 FIELD_ASSOCIATION_CELLS, 00431 FIELD_ASSOCIATION_NONE, 00432 FIELD_ASSOCIATION_POINTS_THEN_CELLS, 00433 FIELD_ASSOCIATION_VERTICES, 00434 FIELD_ASSOCIATION_EDGES, 00435 FIELD_ASSOCIATION_ROWS, 00436 NUMBER_OF_ASSOCIATIONS 00437 }; 00438 //ETX 00440 00441 //BTX 00443 00444 enum FieldOperations 00445 { 00446 FIELD_OPERATION_PRESERVED, 00447 FIELD_OPERATION_REINTERPOLATED, 00448 FIELD_OPERATION_MODIFIED, 00449 FIELD_OPERATION_REMOVED 00450 }; 00451 //ETX 00453 00456 static const char* GetAssociationTypeAsString(int associationType); 00457 00458 static vtkInformationStringKey* DATA_TYPE_NAME(); 00459 static vtkInformationDataObjectKey* DATA_OBJECT(); 00460 static vtkInformationIntegerKey* DATA_EXTENT_TYPE(); 00461 static vtkInformationIntegerPointerKey* DATA_EXTENT(); 00462 static vtkInformationIntegerKey* DATA_PIECE_NUMBER(); 00463 static vtkInformationIntegerKey* DATA_NUMBER_OF_PIECES(); 00464 static vtkInformationIntegerKey* DATA_NUMBER_OF_GHOST_LEVELS(); 00465 static vtkInformationDoubleVectorKey* DATA_TIME_STEPS(); 00466 static vtkInformationInformationVectorKey* POINT_DATA_VECTOR(); 00467 static vtkInformationInformationVectorKey* CELL_DATA_VECTOR(); 00468 static vtkInformationInformationVectorKey* VERTEX_DATA_VECTOR(); 00469 static vtkInformationInformationVectorKey* EDGE_DATA_VECTOR(); 00470 static vtkInformationIntegerKey* FIELD_ARRAY_TYPE(); 00471 static vtkInformationIntegerKey* FIELD_ASSOCIATION(); 00472 static vtkInformationIntegerKey* FIELD_ATTRIBUTE_TYPE(); 00473 static vtkInformationIntegerKey* FIELD_ACTIVE_ATTRIBUTE(); 00474 static vtkInformationIntegerKey* FIELD_NUMBER_OF_COMPONENTS(); 00475 static vtkInformationIntegerKey* FIELD_NUMBER_OF_TUPLES(); 00476 static vtkInformationIntegerKey* FIELD_OPERATION(); 00477 static vtkInformationDoubleVectorKey* FIELD_RANGE(); 00478 static vtkInformationDoubleVectorKey* PIECE_FIELD_RANGE(); 00479 static vtkInformationIntegerVectorKey* PIECE_EXTENT(); 00480 static vtkInformationStringKey* FIELD_NAME(); 00481 static vtkInformationDoubleVectorKey* ORIGIN(); 00482 static vtkInformationDoubleVectorKey* SPACING(); 00483 static vtkInformationIntegerKey* DATA_GEOMETRY_UNMODIFIED(); 00484 00485 // Key used to put SIL information in the output information by readers. 00486 static vtkInformationDataObjectKey* SIL(); 00487 00488 //BTX 00490 00491 static vtkDataObject* GetData(vtkInformation* info); 00492 static vtkDataObject* GetData(vtkInformationVector* v, int i=0); 00493 //ETX 00495 00496 protected: 00497 00498 vtkDataObject(); 00499 ~vtkDataObject(); 00500 00501 // General field data associated with data object 00502 vtkFieldData *FieldData; 00503 00504 // Who generated this data as output? 00505 vtkSource *Source; 00506 00507 // Keep track of data release during network execution 00508 int DataReleased; 00509 00510 // When was this data last generated? 00511 vtkTimeStamp UpdateTime; 00512 00513 // Get the executive that manages this data object. 00514 vtkExecutive* GetExecutive(); 00515 00516 // Get the port number producing this data object. 00517 int GetPortNumber(); 00518 00519 virtual void ReportReferences(vtkGarbageCollector*); 00520 00521 // Arbitrary extra information associated with this data object. 00522 vtkInformation* Information; 00523 00524 // Reference the pipeline information object that owns this data 00525 // object. 00526 vtkInformation* PipelineInformation; 00527 00528 //BTX 00529 // Check whether this data object is owned by a vtkStreamingDemandDrivenPipeline. 00530 vtkStreamingDemandDrivenPipeline* TrySDDP(const char* method); 00531 typedef vtkStreamingDemandDrivenPipeline SDDP; 00532 //ETX 00533 00534 //BTX 00535 friend class vtkStreamingDemandDrivenPipelineToDataObjectFriendship; 00536 //ETX 00537 00538 static const char AssociationNames[NUMBER_OF_ASSOCIATIONS][55]; 00539 00540 private: 00541 // Helper method for the ShallowCopy and DeepCopy methods. 00542 void InternalDataObjectCopy(vtkDataObject *src); 00543 00544 private: 00545 vtkDataObject(const vtkDataObject&); // Not implemented. 00546 void operator=(const vtkDataObject&); // Not implemented. 00547 }; 00548 00549 #endif 00550