VTK
dox/Filtering/vtkGenericAdaptorCell.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkGenericAdaptorCell.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00061 #ifndef __vtkGenericAdaptorCell_h
00062 #define __vtkGenericAdaptorCell_h
00063 
00064 
00065 #include "vtkObject.h"
00066 
00067 class vtkLine;
00068 class vtkTetra;
00069 class vtkPoints;
00070 class vtkVertex;
00071 class vtkTriangle;
00072 class vtkCellData;
00073 class vtkPointData;
00074 class vtkCellArray;
00075 class vtkDoubleArray;
00076 class vtkGenericCellIterator;
00077 class vtkIncrementalPointLocator;
00078 class vtkContourValues;
00079 class vtkImplicitFunction;
00080 class vtkGenericCellTessellator;
00081 class vtkGenericAttributeCollection;
00082 class vtkGenericAttribute;
00083 class vtkGenericPointIterator;
00084 class vtkIdList;
00085 class vtkOrderedTriangulator;
00086 class vtkPolygon;
00087 class vtkUnsignedCharArray;
00088 class vtkQuad;
00089 class vtkHexahedron;
00090 class vtkWedge;
00091 class vtkPyramid;
00092 
00093 class VTK_FILTERING_EXPORT vtkGenericAdaptorCell : public vtkObject
00094 {
00095 public:
00096   vtkTypeMacro(vtkGenericAdaptorCell,vtkObject);
00097   void PrintSelf(ostream& os, vtkIndent indent);
00098 
00101   virtual vtkIdType GetId() = 0;
00102 
00104   virtual int IsInDataSet()=0;
00105   
00110   virtual int GetType()=0;
00111 
00114   virtual int GetDimension() = 0;
00115 
00118   virtual int GetGeometryOrder()=0;
00119   
00122   int IsGeometryLinear();
00123   
00126   virtual int GetAttributeOrder(vtkGenericAttribute *a)=0;
00127   
00131   virtual int GetHighestOrderAttribute(vtkGenericAttributeCollection *ac);
00132   
00135   int IsAttributeLinear(vtkGenericAttribute *a);
00136   
00138   virtual int IsPrimary()=0;
00139 
00142   virtual int GetNumberOfPoints()=0;
00143 
00152   virtual int GetNumberOfBoundaries(int dim=-1)=0;
00153 
00162   virtual int GetNumberOfDOFNodes()=0;
00163   
00165   virtual void GetPointIterator(vtkGenericPointIterator *it)=0;
00166   
00169   virtual vtkGenericCellIterator *NewCellIterator()=0;
00170  
00172 
00176   virtual void GetBoundaryIterator(vtkGenericCellIterator *boundaries,
00177                                    int dim=-1)=0;
00179   
00181 
00186   virtual int CountNeighbors(vtkGenericAdaptorCell *boundary)=0;
00187   virtual void CountEdgeNeighbors( int* sharing ) = 0;
00189 
00191 
00197   virtual void GetNeighbors(vtkGenericAdaptorCell *boundary,
00198                             vtkGenericCellIterator *neighbors)=0;
00200 
00202 
00206   virtual int FindClosestBoundary(int subId,
00207                                   double pcoords[3],
00208                                   vtkGenericCellIterator* &boundary)=0;
00210 
00212 
00220   virtual int EvaluatePosition(double x[3],
00221                                double *closestPoint, 
00222                                int &subId,
00223                                double pcoords[3], 
00224                                double &dist2)=0;
00226   
00228 
00233   virtual void EvaluateLocation(int subId,
00234                                 double pcoords[3],
00235                                 double x[3])=0;
00237   
00239 
00245   virtual void InterpolateTuple(vtkGenericAttribute *a, double pcoords[3],
00246                                 double *val) = 0;
00248 
00250 
00256   virtual void InterpolateTuple(vtkGenericAttributeCollection *c,
00257                                 double pcoords[3],
00258                                 double *val) = 0;
00260   
00262 
00291   virtual void Contour(vtkContourValues *values,
00292                        vtkImplicitFunction *f,
00293                        vtkGenericAttributeCollection *attributes,
00294                        vtkGenericCellTessellator *tess,
00295                        vtkIncrementalPointLocator *locator,
00296                        vtkCellArray *verts,
00297                        vtkCellArray *lines,
00298                        vtkCellArray *polys,
00299                        vtkPointData *outPd,
00300                        vtkCellData *outCd,
00301                        vtkPointData *internalPd,
00302                        vtkPointData *secondaryPd,
00303                        vtkCellData *secondaryCd);
00305 
00307 
00337   virtual void Clip(double value, 
00338                     vtkImplicitFunction *f,
00339                     vtkGenericAttributeCollection *attributes,
00340                     vtkGenericCellTessellator *tess,
00341                     int insideOut,
00342                     vtkIncrementalPointLocator *locator, 
00343                     vtkCellArray *connectivity,
00344                     vtkPointData *outPd,
00345                     vtkCellData *outCd,
00346                     vtkPointData *internalPd,
00347                     vtkPointData *secondaryPd,
00348                     vtkCellData *secondaryCd);
00350   
00352 
00358   virtual int IntersectWithLine(double p1[3],
00359                                 double p2[3], 
00360                                 double tol,
00361                                 double &t,
00362                                 double x[3], 
00363                                 double pcoords[3],
00364                                 int &subId)=0;
00366 
00368 
00377   virtual void Derivatives(int subId,
00378                            double pcoords[3],
00379                            vtkGenericAttribute *attribute,
00380                            double *derivs)=0;
00382 
00385   virtual void GetBounds(double bounds[6])=0;
00386 
00390   virtual double *GetBounds();
00391 
00394   virtual double GetLength2();
00395 
00400   virtual int GetParametricCenter(double pcoords[3])=0;
00401 
00408   virtual double GetParametricDistance(double pcoords[3])=0;
00409 
00418   virtual double *GetParametricCoords()=0;
00419 
00421 
00435   virtual void Tessellate(vtkGenericAttributeCollection *attributes, 
00436                           vtkGenericCellTessellator *tess,
00437                           vtkPoints *points,
00438                           vtkIncrementalPointLocator *locator,
00439                           vtkCellArray* cellArray,
00440                           vtkPointData *internalPd,
00441                           vtkPointData *pd, vtkCellData* cd,
00442                           vtkUnsignedCharArray *types);
00444 
00445   // The following methods are for the internals of the tesselation algorithm
00446   // (the hash table in particular)
00447   
00450   virtual int IsFaceOnBoundary(vtkIdType faceId) = 0;
00451   
00454   virtual int IsOnBoundary() = 0;
00455 
00459   virtual void GetPointIds(vtkIdType *id) = 0;
00460 
00462 
00468   virtual void TriangulateFace(vtkGenericAttributeCollection *attributes,
00469                                vtkGenericCellTessellator *tess, int index, 
00470                                vtkPoints *points,
00471                                vtkIncrementalPointLocator *locator,
00472                                vtkCellArray *cellArray,
00473                                vtkPointData *internalPd,
00474                                vtkPointData *pd, vtkCellData *cd );
00476   
00482   virtual int *GetFaceArray(int faceId)=0;
00483   
00488   virtual int GetNumberOfVerticesOnFace(int faceId)=0;
00489   
00495   virtual int *GetEdgeArray(int edgeId)=0;
00496   
00497 protected:
00498   vtkGenericAdaptorCell();
00499   virtual ~vtkGenericAdaptorCell();
00500 
00502   void Reset();
00503   
00506   void AllocateTuples(int size);
00507   
00508   //Internal tetra used for the contouring/clipping algorithm
00509   vtkTetra       *Tetra;
00510   vtkTriangle    *Triangle;
00511   vtkLine        *Line;
00512   vtkVertex      *Vertex; //is it used ?
00513   vtkQuad *Quad;
00514   vtkHexahedron *Hexa;
00515   vtkWedge *Wedge;
00516   vtkPyramid *Pyramid;
00517   
00518   // Internal locator when tessellating on a cell basis, this is different
00519   // from the main locator used in contour/clip filter, this locator is used for
00520   // points for
00521   // Be carefull the use of a vtkLocator in conjuction with the table fast
00522   // tessellator is very sensitive, we need to keep all the points we used
00523   vtkDoubleArray  *InternalPoints;
00524   vtkCellArray    *InternalCellArray;
00525   vtkDoubleArray  *InternalScalars;
00526   vtkDoubleArray  *PointDataScalars;
00527   
00528   vtkIdList        *InternalIds; // used by Tessellate() and TriangulateFace()
00529   
00530   //Attributes to mimic the vtk cell look and feel, internal use only
00531   vtkDoubleArray  *Scalars;
00532   vtkPointData    *PointData;
00533   vtkCellData     *CellData;
00534   
00535   // Scalar buffer to store the attributes values at some location
00536   // There are variable members to reduce memory allocations.
00537   double *Tuples;
00538   int TuplesCapacity;
00539   
00540   // Cached Bounds.
00541   double Bounds[6];
00542   
00543 private:
00544   vtkGenericAdaptorCell(const vtkGenericAdaptorCell&);  // Not implemented.
00545   void operator=(const vtkGenericAdaptorCell&);  // Not implemented.
00546 };
00547 
00548 #endif