VTK
vtkCell.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCell.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 =========================================================================*/
37 #ifndef vtkCell_h
38 #define vtkCell_h
39 
40 #define VTK_CELL_SIZE 512
41 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
42 
43 #include "vtkCommonDataModelModule.h" // For export macro
44 #include "vtkObject.h"
45 
46 #include "vtkIdList.h" // Needed for inline methods
47 #include "vtkCellType.h" // Needed to define cell types
48 
49 class vtkCellArray;
50 class vtkCellData;
51 class vtkDataArray;
52 class vtkPointData;
54 class vtkPoints;
55 
56 class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject
57 {
58 public:
59  vtkTypeMacro(vtkCell,vtkObject);
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
66  void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
67 
74  void Initialize(int npts, vtkPoints *p);
75 
81  virtual void ShallowCopy(vtkCell *c);
82 
87  virtual void DeepCopy(vtkCell *c);
88 
92  virtual int GetCellType() = 0;
93 
97  virtual int GetCellDimension() = 0;
98 
104  virtual int IsLinear() {return 1;}
105 
110  virtual int RequiresInitialization() {return 0;}
111  virtual void Initialize() {}
112 
118  virtual int IsExplicitCell() {return 0;}
119 
125  virtual int RequiresExplicitFaceRepresentation() {return 0;}
126  virtual void SetFaces(vtkIdType *vtkNotUsed(faces)) {}
127  virtual vtkIdType *GetFaces() {return nullptr;}
128 
132  vtkPoints *GetPoints() {return this->Points;}
133 
137  vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
138 
142  virtual int GetNumberOfEdges() = 0;
143 
147  virtual int GetNumberOfFaces() = 0;
148 
152  vtkIdList *GetPointIds() {return this->PointIds;}
153 
158  VTK_EXPECTS(0 <= ptId && ptId < GetPointIds()->GetNumberOfIds())
159  {return this->PointIds->GetId(ptId);}
160 
164  virtual vtkCell *GetEdge(int edgeId) = 0;
165 
169  virtual vtkCell *GetFace(int faceId) = 0;
170 
178  virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0;
179 
197  virtual int EvaluatePosition(double x[3], double* closestPoint,
198  int& subId, double pcoords[3],
199  double& dist2, double *weights) = 0;
200 
206  virtual void EvaluateLocation(int& subId, double pcoords[3],
207  double x[3], double *weights) = 0;
208 
222  virtual void Contour(double value, vtkDataArray *cellScalars,
223  vtkIncrementalPointLocator *locator, vtkCellArray *verts,
224  vtkCellArray *lines, vtkCellArray *polys,
225  vtkPointData *inPd, vtkPointData *outPd,
226  vtkCellData *inCd, vtkIdType cellId,
227  vtkCellData *outCd) = 0;
228 
241  virtual void Clip(double value, vtkDataArray *cellScalars,
242  vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
243  vtkPointData *inPd, vtkPointData *outPd,
244  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
245  int insideOut) = 0;
246 
255  virtual int IntersectWithLine(double p1[3], double p2[3],
256  double tol, double& t, double x[3],
257  double pcoords[3], int& subId) = 0;
258 
269  virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
270 
285  virtual void Derivatives(int subId, double pcoords[3], double *values,
286  int dim, double *derivs) = 0;
287 
288 
293  void GetBounds(double bounds[6]);
294 
295 
300  double *GetBounds() VTK_SIZEHINT(6);
301 
302 
306  double GetLength2();
307 
308 
315  virtual int GetParametricCenter(double pcoords[3]);
316 
317 
325  virtual double GetParametricDistance(double pcoords[3]);
326 
327 
335  virtual int IsPrimaryCell() {return 1;}
336 
337 
347  virtual double *GetParametricCoords() VTK_SIZEHINT(3*GetNumberOfPoints());
348 
354  virtual void InterpolateFunctions(double vtkNotUsed(pcoords)[3], double* vtkNotUsed(weight))
355  {
356  }
357  virtual void InterpolateDerivs(double vtkNotUsed(pcoords)[3], double* vtkNotUsed(derivs))
358  {
359  }
360 
361  // left public for quick computational access
364 
365 protected:
366  vtkCell();
367  ~vtkCell() override;
368 
369  double Bounds[6];
370 
371 private:
372  vtkCell(const vtkCell&) = delete;
373  void operator=(const vtkCell&) = delete;
374 };
375 
376 #endif
vtkIdList * PointIds
Definition: vtkCell.h:363
vtkIdType GetNumberOfPoints()
Return the number of points in the cell.
Definition: vtkCell.h:137
abstract base class for most VTK objects
Definition: vtkObject.h:53
represent and manipulate point attribute data
Definition: vtkPointData.h:31
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPoints * GetPoints()
Get the point coordinates for the cell.
Definition: vtkCell.h:132
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
Abstract class in support of both point location and point insertion.
int vtkIdType
Definition: vtkType.h:345
vtkIdType GetPointId(int ptId)
For cell point i, return the actual point id.
Definition: vtkCell.h:157
virtual int IsLinear()
Non-linear cells require special treatment beyond the usual cell type and connectivity list informati...
Definition: vtkCell.h:104
virtual void SetFaces(vtkIdType *vtkNotUsed(faces))
Definition: vtkCell.h:126
abstract class to specify cell behavior
Definition: vtkCell.h:56
vtkPoints * Points
Definition: vtkCell.h:362
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
virtual int RequiresInitialization()
Some cells require initialization prior to access.
Definition: vtkCell.h:110
#define VTK_SIZEHINT(...)
virtual int RequiresExplicitFaceRepresentation()
Determine whether the cell requires explicit face representation, and methods for setting and getting...
Definition: vtkCell.h:125
virtual void InterpolateDerivs(double vtkNotUsed(pcoords)[3], double *vtkNotUsed(derivs))
Definition: vtkCell.h:357
object to represent cell connectivity
Definition: vtkCellArray.h:44
virtual int IsExplicitCell()
Explicit cells require additional representational information beyond the usual cell type and connect...
Definition: vtkCell.h:118
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
Definition: vtkCell.h:152
virtual vtkIdType * GetFaces()
Definition: vtkCell.h:127
virtual void Initialize()
Definition: vtkCell.h:111
#define VTK_EXPECTS(x)
represent and manipulate 3D points
Definition: vtkPoints.h:33