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) VTK_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 NULL;}
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 
157  vtkIdType GetPointId(int ptId) {return this->PointIds->GetId(ptId);}
158 
162  virtual vtkCell *GetEdge(int edgeId) = 0;
163 
167  virtual vtkCell *GetFace(int faceId) = 0;
168 
176  virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) = 0;
177 
195  virtual int EvaluatePosition(double x[3], double* closestPoint,
196  int& subId, double pcoords[3],
197  double& dist2, double *weights) = 0;
198 
204  virtual void EvaluateLocation(int& subId, double pcoords[3],
205  double x[3], double *weights) = 0;
206 
220  virtual void Contour(double value, vtkDataArray *cellScalars,
221  vtkIncrementalPointLocator *locator, vtkCellArray *verts,
222  vtkCellArray *lines, vtkCellArray *polys,
223  vtkPointData *inPd, vtkPointData *outPd,
224  vtkCellData *inCd, vtkIdType cellId,
225  vtkCellData *outCd) = 0;
226 
239  virtual void Clip(double value, vtkDataArray *cellScalars,
240  vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
241  vtkPointData *inPd, vtkPointData *outPd,
242  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
243  int insideOut) = 0;
244 
253  virtual int IntersectWithLine(double p1[3], double p2[3],
254  double tol, double& t, double x[3],
255  double pcoords[3], int& subId) = 0;
256 
267  virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
268 
283  virtual void Derivatives(int subId, double pcoords[3], double *values,
284  int dim, double *derivs) = 0;
285 
286 
291  void GetBounds(double bounds[6]);
292 
293 
298  double *GetBounds();
299 
300 
304  double GetLength2();
305 
306 
313  virtual int GetParametricCenter(double pcoords[3]);
314 
315 
323  virtual double GetParametricDistance(double pcoords[3]);
324 
325 
333  virtual int IsPrimaryCell() {return 1;}
334 
335 
345  virtual double *GetParametricCoords();
346 
352  virtual void InterpolateFunctions(double vtkNotUsed(pcoords)[3], double* vtkNotUsed(weight))
353  {
354  }
355  virtual void InterpolateDerivs(double vtkNotUsed(pcoords)[3], double* vtkNotUsed(derivs))
356  {
357  }
358 
359  // left public for quick computational access
362 
363 protected:
364  vtkCell();
365  ~vtkCell() VTK_OVERRIDE;
366 
367  double Bounds[6];
368 
369 private:
370  vtkCell(const vtkCell&) VTK_DELETE_FUNCTION;
371  void operator=(const vtkCell&) VTK_DELETE_FUNCTION;
372 };
373 
374 #endif
vtkIdList * PointIds
Definition: vtkCell.h:361
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.
virtual void InterpolateFunctions(double vtkNotUsed(pcoords)[3], double *vtkNotUsed(weight))
Compute the interpolation functions/derivatives (aka shape functions/derivatives) No-ops at this leve...
Definition: vtkCell.h:352
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:360
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
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:355
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
virtual int IsPrimaryCell()
Return whether this cell type has a fixed topology or whether the topology varies depending on the da...
Definition: vtkCell.h:333
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
represent and manipulate 3D points
Definition: vtkPoints.h:33