VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkDataSet.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataSet.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 =========================================================================*/
45 #ifndef __vtkDataSet_h
46 #define __vtkDataSet_h
47 
48 #include "vtkCommonDataModelModule.h" // For export macro
49 #include "vtkDataObject.h"
50 
51 class vtkCell;
52 class vtkCellData;
53 class vtkCellTypes;
55 class vtkGenericCell;
56 class vtkIdList;
57 class vtkPointData;
58 
59 class VTKCOMMONDATAMODEL_EXPORT vtkDataSet : public vtkDataObject
60 {
61 public:
62  vtkTypeMacro(vtkDataSet,vtkDataObject);
63  void PrintSelf(ostream& os, vtkIndent indent);
64 
68  virtual void CopyStructure(vtkDataSet *ds) = 0;
69 
72  virtual void CopyAttributes(vtkDataSet *ds);
73 
76  virtual vtkIdType GetNumberOfPoints() = 0;
77 
80  virtual vtkIdType GetNumberOfCells() = 0;
81 
84  virtual double *GetPoint(vtkIdType ptId) = 0;
85 
89  virtual void GetPoint(vtkIdType id, double x[3]);
90 
93  virtual vtkCell *GetCell(vtkIdType cellId) = 0;
94 
99  virtual void GetCell(vtkIdType cellId, vtkGenericCell *cell) = 0;
100 
109  virtual void GetCellBounds(vtkIdType cellId, double bounds[6]);
110 
114  virtual int GetCellType(vtkIdType cellId) = 0;
115 
123  virtual void GetCellTypes(vtkCellTypes *types);
124 
128  virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) = 0;
129 
133  virtual void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) = 0;
134 
136 
140  virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
141  vtkIdList *cellIds);
143 
145 
149  vtkIdType FindPoint(double x, double y, double z)
150  {
151  double xyz[3];
152  xyz[0] = x; xyz[1] = y; xyz[2] = z;
153  return this->FindPoint (xyz);
154  }
155  virtual vtkIdType FindPoint(double x[3]) = 0;
157 
159 
167  virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId,
168  double tol2, int& subId, double pcoords[3],
169  double *weights) = 0;
171 
173 
178  virtual vtkIdType FindCell(double x[3], vtkCell *cell,
179  vtkGenericCell *gencell, vtkIdType cellId,
180  double tol2, int& subId, double pcoords[3],
181  double *weights) = 0;
183 
185 
191  virtual vtkCell *FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId,
192  double tol2, int& subId, double pcoords[3],
193  double *weights);
195 
198  unsigned long int GetMTime();
199 
202  vtkCellData *GetCellData() {return this->CellData;};
203 
206  vtkPointData *GetPointData() {return this->PointData;};
207 
210  virtual void Squeeze();
211 
214  virtual void ComputeBounds();
215 
218  double *GetBounds();
219 
223  void GetBounds(double bounds[6]);
224 
226  double *GetCenter();
227 
230  void GetCenter(double center[3]);
231 
235  double GetLength();
236 
238  void Initialize();
239 
248  virtual void GetScalarRange(double range[2]);
249 
257  double *GetScalarRange();
258 
262  virtual int GetMaxCellSize() = 0;
263 
269  unsigned long GetActualMemorySize();
270 
272 
274  {return VTK_DATA_SET;}
276 
278 
279  void ShallowCopy(vtkDataObject *src);
280  void DeepCopy(vtkDataObject *src);
282 
283 //BTX
285  {
286  DATA_OBJECT_FIELD=0,
287  POINT_DATA_FIELD=1,
288  CELL_DATA_FIELD=2
289  };
290 //ETX
291 
298  int CheckAttributes();
299 
301 
303  virtual void GenerateGhostLevelArray(int update_piece,
304  int update_num_pieces,
305  int update_ghost_level,
306  int* whole_extent,
307  vtkExtentTranslator* translator);
309 
310  //BTX
312 
313  static vtkDataSet* GetData(vtkInformation* info);
314  static vtkDataSet* GetData(vtkInformationVector* v, int i=0);
315  //ETX
317 
322  virtual vtkFieldData* GetAttributesAsFieldData(int type);
323 
326  virtual vtkIdType GetNumberOfElements(int type);
327 
328 protected:
329  // Constructor with default bounds (0,1, 0,1, 0,1).
330  vtkDataSet();
331  ~vtkDataSet();
332 
335  virtual void ComputeScalarRange();
336 
337  vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell
338  vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point
339  vtkTimeStamp ComputeTime; // Time at which bounds, center, etc. computed
340  double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
341  double Center[3];
342 
343  // Cached scalar range
344  double ScalarRange[2];
345 
346  // Time at which scalar range is computed
348 
349 private:
350  void InternalDataSetCopy(vtkDataSet *src);
351  //BTX
352  friend class vtkImageAlgorithmToDataSetFriendship;
353  //ETX
354 private:
355  vtkDataSet(const vtkDataSet&); // Not implemented.
356  void operator=(const vtkDataSet&); // Not implemented.
357 };
358 
359 inline void vtkDataSet::GetPoint(vtkIdType id, double x[3])
360 {
361  double *pt = this->GetPoint(id);
362  x[0] = pt[0]; x[1] = pt[1]; x[2] = pt[2];
363 }
364 
365 #endif
static vtkDataObject * GetData(vtkInformation *info)
virtual vtkFieldData * GetAttributesAsFieldData(int type)
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:59
vtkCellData * CellData
Definition: vtkDataSet.h:337
vtkPointData * PointData
Definition: vtkDataSet.h:338
record modification and/or execution time
Definition: vtkTimeStamp.h:34
represent and manipulate cell attribute data
Definition: vtkCellData.h:37
unsigned long int GetMTime()
Generates a structured extent from unstructured.
vtkCellData * GetCellData()
Definition: vtkDataSet.h:202
virtual void Initialize()
int vtkIdType
Definition: vtkType.h:268
vtkTimeStamp ScalarRangeComputeTime
Definition: vtkDataSet.h:347
vtkPointData * GetPointData()
Definition: vtkDataSet.h:206
abstract class to specify cell behavior
Definition: vtkCell.h:58
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
#define VTK_DATA_SET
Definition: vtkType.h:74
int GetDataObjectType()
Definition: vtkDataSet.h:273
void PrintSelf(ostream &os, vtkIndent indent)
virtual unsigned long GetActualMemorySize()
virtual vtkIdType GetNumberOfElements(int type)
vtkTimeStamp ComputeTime
Definition: vtkDataSet.h:339
Store zero or more vtkInformation instances.
virtual double * GetPoint(vtkIdType ptId)=0
general representation of visualization data
Definition: vtkDataObject.h:64
vtkIdType FindPoint(double x, double y, double z)
Definition: vtkDataSet.h:149
object provides direct access to cells in vtkCellArray and type information
Definition: vtkCellTypes.h:51
virtual void DeepCopy(vtkDataObject *src)
virtual void ShallowCopy(vtkDataObject *src)
represent and manipulate fields of data
Definition: vtkFieldData.h:55