VTK
vtkGenericAdaptorCell.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericAdaptorCell.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 =========================================================================*/
62 #ifndef vtkGenericAdaptorCell_h
63 #define vtkGenericAdaptorCell_h
64 
65 
66 #include "vtkCommonDataModelModule.h" // For export macro
67 #include "vtkObject.h"
68 
69 class vtkLine;
70 class vtkTetra;
71 class vtkPoints;
72 class vtkVertex;
73 class vtkTriangle;
74 class vtkCellData;
75 class vtkPointData;
76 class vtkCellArray;
77 class vtkDoubleArray;
80 class vtkContourValues;
86 class vtkIdList;
88 class vtkPolygon;
90 class vtkQuad;
91 class vtkHexahedron;
92 class vtkWedge;
93 class vtkPyramid;
94 
95 class VTKCOMMONDATAMODEL_EXPORT vtkGenericAdaptorCell : public vtkObject
96 {
97 public:
99  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
100 
105  virtual vtkIdType GetId() = 0;
106 
110  virtual int IsInDataSet()=0;
111 
118  virtual int GetType()=0;
119 
124  virtual int GetDimension() = 0;
125 
130  virtual int GetGeometryOrder()=0;
131 
137 
145 
153 
160 
164  virtual int IsPrimary()=0;
165 
170  virtual int GetNumberOfPoints()=0;
171 
182  virtual int GetNumberOfBoundaries(int dim=-1)=0;
183 
196  virtual int GetNumberOfDOFNodes()=0;
197 
203 
209 
216  virtual void GetBoundaryIterator(vtkGenericCellIterator *boundaries,
217  int dim=-1)=0;
218 
220 
230  virtual int CountNeighbors(vtkGenericAdaptorCell *boundary)=0;
231  virtual void CountEdgeNeighbors( int* sharing ) = 0;
233 
244  virtual void GetNeighbors(vtkGenericAdaptorCell *boundary,
245  vtkGenericCellIterator *neighbors)=0;
246 
254  virtual int FindClosestBoundary(int subId,
255  double pcoords[3],
256  vtkGenericCellIterator* &boundary)=0;
257 
269  virtual int EvaluatePosition(double x[3],
270  double *closestPoint,
271  int &subId,
272  double pcoords[3],
273  double &dist2)=0;
274 
282  virtual void EvaluateLocation(int subId,
283  double pcoords[3],
284  double x[3])=0;
285 
296  virtual void InterpolateTuple(vtkGenericAttribute *a, double pcoords[3],
297  double *val) = 0;
298 
310  double pcoords[3],
311  double *val) = 0;
312 
354  virtual void Contour(vtkContourValues *values,
356  vtkGenericAttributeCollection *attributes,
359  vtkCellArray *verts,
360  vtkCellArray *lines,
361  vtkCellArray *polys,
362  vtkPointData *outPd,
363  vtkCellData *outCd,
364  vtkPointData *internalPd,
365  vtkPointData *secondaryPd,
366  vtkCellData *secondaryCd);
367 
408  virtual void Clip(double value,
410  vtkGenericAttributeCollection *attributes,
412  int insideOut,
414  vtkCellArray *connectivity,
415  vtkPointData *outPd,
416  vtkCellData *outCd,
417  vtkPointData *internalPd,
418  vtkPointData *secondaryPd,
419  vtkCellData *secondaryCd);
420 
429  virtual int IntersectWithLine(double p1[3],
430  double p2[3],
431  double tol,
432  double &t,
433  double x[3],
434  double pcoords[3],
435  int &subId)=0;
436 
449  virtual void Derivatives(int subId,
450  double pcoords[3],
451  vtkGenericAttribute *attribute,
452  double *derivs)=0;
453 
459  virtual void GetBounds(double bounds[6])=0;
460 
467  virtual double *GetBounds();
468 
473  virtual double GetLength2();
474 
481  virtual int GetParametricCenter(double pcoords[3])=0;
482 
490  virtual double GetParametricDistance(double pcoords[3])=0;
491 
502  virtual double *GetParametricCoords()=0;
503 
524  virtual void Tessellate(vtkGenericAttributeCollection *attributes,
526  vtkPoints *points,
528  vtkCellArray* cellArray,
529  vtkPointData *internalPd,
530  vtkPointData *pd, vtkCellData* cd,
531  vtkUnsignedCharArray *types);
532 
533  // The following methods are for the internals of the tesselation algorithm
534  // (the hash table in particular)
535 
541  virtual int IsFaceOnBoundary(vtkIdType faceId) = 0;
542 
547  virtual int IsOnBoundary() = 0;
548 
555  virtual void GetPointIds(vtkIdType *id) = 0;
556 
571  vtkGenericCellTessellator *tess, int index,
572  vtkPoints *points,
574  vtkCellArray *cellArray,
575  vtkPointData *internalPd,
576  vtkPointData *pd, vtkCellData *cd );
577 
586  virtual int *GetFaceArray(int faceId)=0;
587 
594  virtual int GetNumberOfVerticesOnFace(int faceId)=0;
595 
604  virtual int *GetEdgeArray(int edgeId)=0;
605 
606 protected:
608  ~vtkGenericAdaptorCell() VTK_OVERRIDE;
609 
613  void Reset();
614 
619  void AllocateTuples(int size);
620 
621  //Internal tetra used for the contouring/clipping algorithm
622  vtkTetra *Tetra;
623  vtkTriangle *Triangle;
624  vtkLine *Line;
625  vtkVertex *Vertex; //is it used ?
626  vtkQuad *Quad;
628  vtkWedge *Wedge;
629  vtkPyramid *Pyramid;
630 
631  // Internal locator when tessellating on a cell basis, this is different
632  // from the main locator used in contour/clip filter, this locator is used for
633  // points for
634  // Be careful the use of a vtkLocator in conjunction with the table fast
635  // tessellator is very sensitive, we need to keep all the points we used
636  vtkDoubleArray *InternalPoints;
637  vtkCellArray *InternalCellArray;
638  vtkDoubleArray *InternalScalars;
639  vtkDoubleArray *PointDataScalars;
640 
641  vtkIdList *InternalIds; // used by Tessellate() and TriangulateFace()
642 
643  //Attributes to mimic the vtk cell look and feel, internal use only
644  vtkDoubleArray *Scalars;
645  vtkPointData *PointData;
646  vtkCellData *CellData;
647 
648  // Scalar buffer to store the attributes values at some location
649  // There are variable members to reduce memory allocations.
650  double *Tuples;
651  int TuplesCapacity;
652 
653  // Cached Bounds.
654  double Bounds[6];
655 
656 private:
657  vtkGenericAdaptorCell(const vtkGenericAdaptorCell&) VTK_DELETE_FUNCTION;
658  void operator=(const vtkGenericAdaptorCell&) VTK_DELETE_FUNCTION;
659 };
660 
661 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkGenericAdaptorCell::GetAttributeOrder
virtual int GetAttributeOrder(vtkGenericAttribute *a)=0
Return the interpolation order of attribute ‘a’ on the cell (may differ by cell).
vtkGenericPointIterator
iterator used to traverse points
Definition: vtkGenericPointIterator.h:43
vtkGenericAdaptorCell::GetNumberOfDOFNodes
virtual int GetNumberOfDOFNodes()=0
Accumulated number of DOF nodes of the current cell.
vtkGenericAdaptorCell::InterpolateTuple
virtual void InterpolateTuple(vtkGenericAttribute *a, double pcoords[3], double *val)=0
Interpolate the attribute ‘a’ at local position ‘pcoords’ of the cell into ‘val’.
vtkGenericAdaptorCell::FindClosestBoundary
virtual int FindClosestBoundary(int subId, double pcoords[3], vtkGenericCellIterator *&boundary)=0
Compute the closest boundary of the current sub-cell ‘subId’ for point ‘pcoord’ (in parametric coordi...
vtkGenericAdaptorCell::InterpolateTuple
virtual void InterpolateTuple(vtkGenericAttributeCollection *c, double pcoords[3], double *val)=0
Interpolate the whole collection of attributes ‘c’ at local position ‘pcoords’ of the cell into ‘val’...
vtkGenericAdaptorCell::GetNumberOfPoints
virtual int GetNumberOfPoints()=0
Return the number of corner points that compose the cell.
vtkHexahedron
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:48
vtkGenericAdaptorCell::GetDimension
virtual int GetDimension()=0
Return the topological dimension of the current cell.
vtkGenericAdaptorCell::Tessellate
virtual void Tessellate(vtkGenericAttributeCollection *attributes, vtkGenericCellTessellator *tess, vtkPoints *points, vtkIncrementalPointLocator *locator, vtkCellArray *cellArray, vtkPointData *internalPd, vtkPointData *pd, vtkCellData *cd, vtkUnsignedCharArray *types)
Tessellate the cell if it is not linear or if at least one attribute of ‘attributes’ is not linear.
vtkGenericAdaptorCell::EvaluateLocation
virtual void EvaluateLocation(int subId, double pcoords[3], double x[3])=0
Determine the global coordinates ‘x’ from sub-cell ‘subId’ and parametric coordinates ‘pcoords’ in th...
vtkGenericAdaptorCell::IsPrimary
virtual int IsPrimary()=0
Is the cell primary (i.e.
vtkGenericAdaptorCell::GetPointIterator
virtual void GetPointIterator(vtkGenericPointIterator *it)=0
Return the points of cell into ‘it’.
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:38
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkPolygon
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:46
vtkGenericAdaptorCell::IsAttributeLinear
int IsAttributeLinear(vtkGenericAttribute *a)
Does the attribute ‘a’ have a non-linear interpolation?
vtkGenericAdaptorCell::GetPointIds
virtual void GetPointIds(vtkIdType *id)=0
Put into ‘id’ the list of the dataset points that define the corner points of the cell.
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:42
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkGenericAdaptorCell
defines cell interface
Definition: vtkGenericAdaptorCell.h:96
vtkGenericAdaptorCell::IsInDataSet
virtual int IsInDataSet()=0
Does ‘this’ a cell of a dataset? (otherwise, it is a boundary cell)
vtkGenericAdaptorCell::~vtkGenericAdaptorCell
~vtkGenericAdaptorCell() override
vtkGenericCellIterator
iterator used to traverse cells
Definition: vtkGenericCellIterator.h:45
vtkPyramid
a 3D cell that represents a linear pyramid
Definition: vtkPyramid.h:50
vtkVertex
a cell that represents a 3D point
Definition: vtkVertex.h:37
vtkLine
cell represents a 1D line
Definition: vtkLine.h:36
vtkOrderedTriangulator
helper class to generate triangulations
Definition: vtkOrderedTriangulator.h:118
vtkGenericAdaptorCell::Contour
virtual void Contour(vtkContourValues *values, vtkImplicitFunction *f, vtkGenericAttributeCollection *attributes, vtkGenericCellTessellator *tess, vtkIncrementalPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *outPd, vtkCellData *outCd, vtkPointData *internalPd, vtkPointData *secondaryPd, vtkCellData *secondaryCd)
Generate a contour (contouring primitives) for each ‘values’ or with respect to an implicit function ...
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:59
vtkX3D::points
@ points
Definition: vtkX3D.h:446
vtkGenericCellTessellator
helper class to perform cell tessellation
Definition: vtkGenericCellTessellator.h:59
vtkGenericAdaptorCell::GetType
virtual int GetType()=0
Return the type of the current cell.
vtkGenericAdaptorCell::IsFaceOnBoundary
virtual int IsFaceOnBoundary(vtkIdType faceId)=0
Is the face ‘faceId’ of the current cell on the exterior boundary of the dataset?
vtkGenericAdaptorCell::GetEdgeArray
virtual int * GetEdgeArray(int edgeId)=0
Return the ids of the vertices defining edge ‘edgeId’.
vtkGenericAdaptorCell::IntersectWithLine
virtual int IntersectWithLine(double p1[3], double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId)=0
Is there an intersection between the current cell and the ray (‘p1’,‘p2’) according to a tolerance ‘t...
vtkGenericAdaptorCell::GetBounds
virtual double * GetBounds()
Return the bounding box of the current cell in global coordinates.
vtkGenericAdaptorCell::EvaluatePosition
virtual int EvaluatePosition(double x[3], double *closestPoint, int &subId, double pcoords[3], double &dist2)=0
Is ‘x’ inside the current cell? It also evaluates parametric coordinates ‘pcoords’,...
vtkWedge
a 3D cell that represents a linear wedge
Definition: vtkWedge.h:50
vtkGenericAdaptorCell::Clip
virtual void Clip(double value, vtkImplicitFunction *f, vtkGenericAttributeCollection *attributes, vtkGenericCellTessellator *tess, int insideOut, vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, vtkPointData *outPd, vtkCellData *outCd, vtkPointData *internalPd, vtkPointData *secondaryPd, vtkCellData *secondaryCd)
Cut (or clip) the current cell with respect to the contour defined by the ‘value’ or the implicit fun...
vtkContourValues
helper object to manage setting and generating contour values
Definition: vtkContourValues.h:36
vtkGenericAdaptorCell::GetBoundaryIterator
virtual void GetBoundaryIterator(vtkGenericCellIterator *boundaries, int dim=-1)=0
Return the ‘boundaries’ cells of dimension ‘dim’ (or all dimensions less than GetDimension() if -1) t...
vtkGenericAdaptorCell::GetParametricCoords
virtual double * GetParametricCoords()=0
Return a contiguous array of parametric coordinates of the corrner points defining the current cell.
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:39
vtkGenericAdaptorCell::CountNeighbors
virtual int CountNeighbors(vtkGenericAdaptorCell *boundary)=0
Number of cells (dimension>boundary->GetDimension()) of the dataset that share the boundary ‘boundary...
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:51
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:52
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:37
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkGenericAdaptorCell::GetNumberOfBoundaries
virtual int GetNumberOfBoundaries(int dim=-1)=0
Return the number of boundaries of dimension ‘dim’ (or all dimensions greater than 0 and less than Ge...
vtkGenericAdaptorCell::vtkGenericAdaptorCell
vtkGenericAdaptorCell()
vtkGenericAdaptorCell::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTriangle
a cell that represents a triangle
Definition: vtkTriangle.h:42
vtkObject.h
vtkGenericAdaptorCell::GetGeometryOrder
virtual int GetGeometryOrder()=0
Return the interpolation order of the geometry.
vtkGenericAdaptorCell::GetParametricCenter
virtual int GetParametricCenter(double pcoords[3])=0
Get the center of the current cell (in parametric coordinates) and place it in ‘pcoords’.
vtkGenericAdaptorCell::GetLength2
virtual double GetLength2()
Return the bounding box diagonal squared of the current cell.
vtkGenericAdaptorCell::NewCellIterator
virtual vtkGenericCellIterator * NewCellIterator()=0
Create an empty cell iterator.
vtkGenericAdaptorCell::CountEdgeNeighbors
virtual void CountEdgeNeighbors(int *sharing)=0
vtkGenericAdaptorCell::GetFaceArray
virtual int * GetFaceArray(int faceId)=0
Return the ids of the vertices defining face ‘faceId’.
vtkGenericAdaptorCell::GetNeighbors
virtual void GetNeighbors(vtkGenericAdaptorCell *boundary, vtkGenericCellIterator *neighbors)=0
Put into ‘neighbors’ the cells (dimension>boundary->GetDimension()) of the dataset that share the bou...
vtkGenericAdaptorCell::GetHighestOrderAttribute
virtual int GetHighestOrderAttribute(vtkGenericAttributeCollection *ac)
Return the index of the first point centered attribute with the highest order in ‘ac’.
vtkGenericAdaptorCell::IsOnBoundary
virtual int IsOnBoundary()=0
Is the cell on the exterior boundary of the dataset?
vtkGenericAdaptorCell::IsGeometryLinear
int IsGeometryLinear()
Does the cell have a non-linear interpolation for the geometry?
vtkGenericAttributeCollection
a collection of attributes
Definition: vtkGenericAttributeCollection.h:37
vtkGenericAttribute
abstract class defined API for attribute data
Definition: vtkGenericAttribute.h:51
vtkDoubleArray
dynamic, self-adjusting array of double
Definition: vtkDoubleArray.h:42
vtkGenericAdaptorCell::Derivatives
virtual void Derivatives(int subId, double pcoords[3], vtkGenericAttribute *attribute, double *derivs)=0
Compute derivatives ‘derivs’ of the attribute ‘attribute’ (from its values at the corner points of th...
vtkGenericAdaptorCell::GetId
virtual vtkIdType GetId()=0
Unique identification number of the cell over the whole data set.
vtkGenericAdaptorCell::GetBounds
virtual void GetBounds(double bounds[6])=0
Compute the bounding box of the current cell in ‘bounds’ in global coordinates.
vtkGenericAdaptorCell::GetParametricDistance
virtual double GetParametricDistance(double pcoords[3])=0
Return the distance of the parametric coordinate ‘pcoords’ to the current cell.
vtkTetra
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:48
vtkX3D::index
@ index
Definition: vtkX3D.h:246
vtkGenericAdaptorCell::GetNumberOfVerticesOnFace
virtual int GetNumberOfVerticesOnFace(int faceId)=0
Return the number of vertices defining face ‘faceId’.
vtkQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:42
vtkGenericAdaptorCell::TriangulateFace
virtual void TriangulateFace(vtkGenericAttributeCollection *attributes, vtkGenericCellTessellator *tess, int index, vtkPoints *points, vtkIncrementalPointLocator *locator, vtkCellArray *cellArray, vtkPointData *internalPd, vtkPointData *pd, vtkCellData *cd)
Tessellate face ‘index’ of the cell.