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 =========================================================================*/
40 #ifndef vtkCell_h
41 #define vtkCell_h
42 
43 #define VTK_CELL_SIZE 512
44 #define VTK_TOL 1.e-05 // Tolerance for geometric calculation
45 
46 #include "vtkCommonDataModelModule.h" // For export macro
47 #include "vtkObject.h"
48 
49 #include "vtkIdList.h" // Needed for inline methods
50 #include "vtkCellType.h" // Needed to define cell types
51 
52 class vtkCellArray;
53 class vtkCellData;
54 class vtkDataArray;
55 class vtkPointData;
57 class vtkPoints;
58 
59 class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject
60 {
61 public:
62  vtkTypeMacro(vtkCell,vtkObject);
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
69  void Initialize(int npts, vtkIdType *pts, vtkPoints *p);
70 
77  void Initialize(int npts, vtkPoints *p);
78 
84  virtual void ShallowCopy(vtkCell *c);
85 
90  virtual void DeepCopy(vtkCell *c);
91 
95  virtual int GetCellType() = 0;
96 
100  virtual int GetCellDimension() = 0;
101 
107  virtual int IsLinear() {return 1;}
108 
113  virtual int RequiresInitialization() {return 0;}
114  virtual void Initialize() {}
115 
121  virtual int IsExplicitCell() {return 0;}
122 
128  virtual int RequiresExplicitFaceRepresentation() {return 0;}
129  virtual void SetFaces(vtkIdType *vtkNotUsed(faces)) {}
130  virtual vtkIdType *GetFaces() {return nullptr;}
131 
135  vtkPoints *GetPoints() {return this->Points;}
136 
140  vtkIdType GetNumberOfPoints() {return this->PointIds->GetNumberOfIds();}
141 
145  virtual int GetNumberOfEdges() = 0;
146 
150  virtual int GetNumberOfFaces() = 0;
151 
155  vtkIdList *GetPointIds() {return this->PointIds;}
156 
161  VTK_EXPECTS(0 <= ptId && ptId < GetPointIds()->GetNumberOfIds())
162  {return this->PointIds->GetId(ptId);}
163 
167  virtual vtkCell *GetEdge(int edgeId) = 0;
168 
172  virtual vtkCell *GetFace(int faceId) = 0;
173 
181  virtual int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts) = 0;
182 
200  virtual int EvaluatePosition(const double x[3], double closestPoint[3],
201  int& subId, double pcoords[3],
202  double& dist2, double weights[]) = 0;
203 
209  virtual void EvaluateLocation(int& subId, const double pcoords[3],
210  double x[3], double *weights) = 0;
211 
225  virtual void Contour(double value, vtkDataArray *cellScalars,
226  vtkIncrementalPointLocator *locator, vtkCellArray *verts,
227  vtkCellArray *lines, vtkCellArray *polys,
228  vtkPointData *inPd, vtkPointData *outPd,
229  vtkCellData *inCd, vtkIdType cellId,
230  vtkCellData *outCd) = 0;
231 
244  virtual void Clip(double value, vtkDataArray *cellScalars,
245  vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
246  vtkPointData *inPd, vtkPointData *outPd,
247  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
248  int insideOut) = 0;
249 
258  virtual int IntersectWithLine(const double p1[3], const double p2[3],
259  double tol, double& t, double x[3],
260  double pcoords[3], int& subId) = 0;
261 
272  virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) = 0;
273 
288  virtual void Derivatives(int subId, const double pcoords[3], const double *values,
289  int dim, double *derivs) = 0;
290 
291 
296  void GetBounds(double bounds[6]);
297 
298 
303  double *GetBounds() VTK_SIZEHINT(6);
304 
305 
309  double GetLength2();
310 
311 
318  virtual int GetParametricCenter(double pcoords[3]);
319 
320 
328  virtual double GetParametricDistance(const double pcoords[3]);
329 
330 
338  virtual int IsPrimaryCell() {return 1;}
339 
340 
350  virtual double *GetParametricCoords() VTK_SIZEHINT(3*GetNumberOfPoints());
351 
357  virtual void InterpolateFunctions(const double vtkNotUsed(pcoords)[3], double* vtkNotUsed(weight))
358  {
359  }
360  virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double* vtkNotUsed(derivs))
361  {
362  }
363 
364  // left public for quick computational access
367 
368 protected:
369  vtkCell();
370  ~vtkCell() override;
371 
372  double Bounds[6];
373 
374 private:
375  vtkCell(const vtkCell&) = delete;
376  void operator=(const vtkCell&) = delete;
377 };
378 
379 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
VTK_EXPECTS
#define VTK_EXPECTS(x)
Definition: vtkWrappingHints.h:44
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:37
vtkX3D::value
Definition: vtkX3D.h:220
vtkCell::RequiresExplicitFaceRepresentation
virtual int RequiresExplicitFaceRepresentation()
Determine whether the cell requires explicit face representation, and methods for setting and getting...
Definition: vtkCell.h:128
vtkIdType
int vtkIdType
Definition: vtkType.h:349
vtkCell::Points
vtkPoints * Points
Definition: vtkCell.h:365
vtkCell::Initialize
virtual void Initialize()
Definition: vtkCell.h:114
vtkX3D::weight
Definition: vtkX3D.h:532
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkCell::IsLinear
virtual int IsLinear()
Non-linear cells require special treatment beyond the usual cell type and connectivity list informati...
Definition: vtkCell.h:107
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkCell::GetPointIds
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
Definition: vtkCell.h:155
vtkCell::GetFaces
virtual vtkIdType * GetFaces()
Definition: vtkCell.h:130
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkCellType.h
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:51
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCell::IsExplicitCell
virtual int IsExplicitCell()
Explicit cells require additional representational information beyond the usual cell type and connect...
Definition: vtkCell.h:121
vtkCell::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
Return the number of points in the cell.
Definition: vtkCell.h:140
vtkObject.h
vtkCell::RequiresInitialization
virtual int RequiresInitialization()
Some cells require initialization prior to access.
Definition: vtkCell.h:113
vtkCell::InterpolateDerivs
virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double *vtkNotUsed(derivs))
Definition: vtkCell.h:360
vtkCell::SetFaces
virtual void SetFaces(vtkIdType *vtkNotUsed(faces))
Definition: vtkCell.h:129
vtkCell::PointIds
vtkIdList * PointIds
Definition: vtkCell.h:366
vtkCell::GetPointId
vtkIdType GetPointId(int ptId)
For cell point i, return the actual point id.
Definition: vtkCell.h:160
vtkCell::GetPoints
vtkPoints * GetPoints()
Get the point coordinates for the cell.
Definition: vtkCell.h:135
vtkX3D::index
Definition: vtkX3D.h:246
vtkIdList.h