VTK
|
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 "vtkCommonDataModelModule.h" // For export macro 00066 #include "vtkObject.h" 00067 00068 class vtkLine; 00069 class vtkTetra; 00070 class vtkPoints; 00071 class vtkVertex; 00072 class vtkTriangle; 00073 class vtkCellData; 00074 class vtkPointData; 00075 class vtkCellArray; 00076 class vtkDoubleArray; 00077 class vtkGenericCellIterator; 00078 class vtkIncrementalPointLocator; 00079 class vtkContourValues; 00080 class vtkImplicitFunction; 00081 class vtkGenericCellTessellator; 00082 class vtkGenericAttributeCollection; 00083 class vtkGenericAttribute; 00084 class vtkGenericPointIterator; 00085 class vtkIdList; 00086 class vtkOrderedTriangulator; 00087 class vtkPolygon; 00088 class vtkUnsignedCharArray; 00089 class vtkQuad; 00090 class vtkHexahedron; 00091 class vtkWedge; 00092 class vtkPyramid; 00093 00094 class VTKCOMMONDATAMODEL_EXPORT vtkGenericAdaptorCell : public vtkObject 00095 { 00096 public: 00097 vtkTypeMacro(vtkGenericAdaptorCell,vtkObject); 00098 void PrintSelf(ostream& os, vtkIndent indent); 00099 00102 virtual vtkIdType GetId() = 0; 00103 00105 virtual int IsInDataSet()=0; 00106 00111 virtual int GetType()=0; 00112 00115 virtual int GetDimension() = 0; 00116 00119 virtual int GetGeometryOrder()=0; 00120 00123 int IsGeometryLinear(); 00124 00127 virtual int GetAttributeOrder(vtkGenericAttribute *a)=0; 00128 00132 virtual int GetHighestOrderAttribute(vtkGenericAttributeCollection *ac); 00133 00136 int IsAttributeLinear(vtkGenericAttribute *a); 00137 00139 virtual int IsPrimary()=0; 00140 00143 virtual int GetNumberOfPoints()=0; 00144 00153 virtual int GetNumberOfBoundaries(int dim=-1)=0; 00154 00163 virtual int GetNumberOfDOFNodes()=0; 00164 00166 virtual void GetPointIterator(vtkGenericPointIterator *it)=0; 00167 00170 virtual vtkGenericCellIterator *NewCellIterator()=0; 00171 00173 00177 virtual void GetBoundaryIterator(vtkGenericCellIterator *boundaries, 00178 int dim=-1)=0; 00180 00182 00187 virtual int CountNeighbors(vtkGenericAdaptorCell *boundary)=0; 00188 virtual void CountEdgeNeighbors( int* sharing ) = 0; 00190 00192 00198 virtual void GetNeighbors(vtkGenericAdaptorCell *boundary, 00199 vtkGenericCellIterator *neighbors)=0; 00201 00203 00207 virtual int FindClosestBoundary(int subId, 00208 double pcoords[3], 00209 vtkGenericCellIterator* &boundary)=0; 00211 00213 00221 virtual int EvaluatePosition(double x[3], 00222 double *closestPoint, 00223 int &subId, 00224 double pcoords[3], 00225 double &dist2)=0; 00227 00229 00234 virtual void EvaluateLocation(int subId, 00235 double pcoords[3], 00236 double x[3])=0; 00238 00240 00246 virtual void InterpolateTuple(vtkGenericAttribute *a, double pcoords[3], 00247 double *val) = 0; 00249 00251 00257 virtual void InterpolateTuple(vtkGenericAttributeCollection *c, 00258 double pcoords[3], 00259 double *val) = 0; 00261 00263 00292 virtual void Contour(vtkContourValues *values, 00293 vtkImplicitFunction *f, 00294 vtkGenericAttributeCollection *attributes, 00295 vtkGenericCellTessellator *tess, 00296 vtkIncrementalPointLocator *locator, 00297 vtkCellArray *verts, 00298 vtkCellArray *lines, 00299 vtkCellArray *polys, 00300 vtkPointData *outPd, 00301 vtkCellData *outCd, 00302 vtkPointData *internalPd, 00303 vtkPointData *secondaryPd, 00304 vtkCellData *secondaryCd); 00306 00308 00338 virtual void Clip(double value, 00339 vtkImplicitFunction *f, 00340 vtkGenericAttributeCollection *attributes, 00341 vtkGenericCellTessellator *tess, 00342 int insideOut, 00343 vtkIncrementalPointLocator *locator, 00344 vtkCellArray *connectivity, 00345 vtkPointData *outPd, 00346 vtkCellData *outCd, 00347 vtkPointData *internalPd, 00348 vtkPointData *secondaryPd, 00349 vtkCellData *secondaryCd); 00351 00353 00359 virtual int IntersectWithLine(double p1[3], 00360 double p2[3], 00361 double tol, 00362 double &t, 00363 double x[3], 00364 double pcoords[3], 00365 int &subId)=0; 00367 00369 00378 virtual void Derivatives(int subId, 00379 double pcoords[3], 00380 vtkGenericAttribute *attribute, 00381 double *derivs)=0; 00383 00386 virtual void GetBounds(double bounds[6])=0; 00387 00391 virtual double *GetBounds(); 00392 00395 virtual double GetLength2(); 00396 00401 virtual int GetParametricCenter(double pcoords[3])=0; 00402 00409 virtual double GetParametricDistance(double pcoords[3])=0; 00410 00419 virtual double *GetParametricCoords()=0; 00420 00422 00436 virtual void Tessellate(vtkGenericAttributeCollection *attributes, 00437 vtkGenericCellTessellator *tess, 00438 vtkPoints *points, 00439 vtkIncrementalPointLocator *locator, 00440 vtkCellArray* cellArray, 00441 vtkPointData *internalPd, 00442 vtkPointData *pd, vtkCellData* cd, 00443 vtkUnsignedCharArray *types); 00445 00446 // The following methods are for the internals of the tesselation algorithm 00447 // (the hash table in particular) 00448 00451 virtual int IsFaceOnBoundary(vtkIdType faceId) = 0; 00452 00455 virtual int IsOnBoundary() = 0; 00456 00460 virtual void GetPointIds(vtkIdType *id) = 0; 00461 00463 00469 virtual void TriangulateFace(vtkGenericAttributeCollection *attributes, 00470 vtkGenericCellTessellator *tess, int index, 00471 vtkPoints *points, 00472 vtkIncrementalPointLocator *locator, 00473 vtkCellArray *cellArray, 00474 vtkPointData *internalPd, 00475 vtkPointData *pd, vtkCellData *cd ); 00477 00483 virtual int *GetFaceArray(int faceId)=0; 00484 00489 virtual int GetNumberOfVerticesOnFace(int faceId)=0; 00490 00496 virtual int *GetEdgeArray(int edgeId)=0; 00497 00498 protected: 00499 vtkGenericAdaptorCell(); 00500 virtual ~vtkGenericAdaptorCell(); 00501 00503 void Reset(); 00504 00507 void AllocateTuples(int size); 00508 00509 //Internal tetra used for the contouring/clipping algorithm 00510 vtkTetra *Tetra; 00511 vtkTriangle *Triangle; 00512 vtkLine *Line; 00513 vtkVertex *Vertex; //is it used ? 00514 vtkQuad *Quad; 00515 vtkHexahedron *Hexa; 00516 vtkWedge *Wedge; 00517 vtkPyramid *Pyramid; 00518 00519 // Internal locator when tessellating on a cell basis, this is different 00520 // from the main locator used in contour/clip filter, this locator is used for 00521 // points for 00522 // Be careful the use of a vtkLocator in conjunction with the table fast 00523 // tessellator is very sensitive, we need to keep all the points we used 00524 vtkDoubleArray *InternalPoints; 00525 vtkCellArray *InternalCellArray; 00526 vtkDoubleArray *InternalScalars; 00527 vtkDoubleArray *PointDataScalars; 00528 00529 vtkIdList *InternalIds; // used by Tessellate() and TriangulateFace() 00530 00531 //Attributes to mimic the vtk cell look and feel, internal use only 00532 vtkDoubleArray *Scalars; 00533 vtkPointData *PointData; 00534 vtkCellData *CellData; 00535 00536 // Scalar buffer to store the attributes values at some location 00537 // There are variable members to reduce memory allocations. 00538 double *Tuples; 00539 int TuplesCapacity; 00540 00541 // Cached Bounds. 00542 double Bounds[6]; 00543 00544 private: 00545 vtkGenericAdaptorCell(const vtkGenericAdaptorCell&); // Not implemented. 00546 void operator=(const vtkGenericAdaptorCell&); // Not implemented. 00547 }; 00548 00549 #endif