VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkBridgeCell.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 =========================================================================*/ 00027 #ifndef __vtkBridgeCell_h 00028 #define __vtkBridgeCell_h 00029 00030 #include "vtkBridgeExport.h" 00031 #include "vtkGenericAdaptorCell.h" 00032 00033 class vtkCell; 00034 class vtkBridgeDataSet; 00035 class vtkBridgeCellIterator; 00036 00037 class VTK_BRIDGE_EXPORT vtkBridgeCell : public vtkGenericAdaptorCell 00038 { 00039 public: 00040 static vtkBridgeCell *New(); 00041 vtkTypeMacro(vtkBridgeCell,vtkGenericAdaptorCell); 00042 void PrintSelf(ostream& os, vtkIndent indent); 00043 00046 virtual vtkIdType GetId(); 00047 00049 virtual int IsInDataSet(); 00050 00054 virtual int GetType(); 00055 00058 virtual int GetDimension(); 00059 00061 virtual int GetGeometryOrder(); 00062 00065 int IsGeometryLinear(); 00066 00069 virtual int GetAttributeOrder(vtkGenericAttribute *a); 00070 00074 int IsAttributeLinear(vtkGenericAttribute *a); 00075 00077 virtual int IsPrimary(); 00078 00081 virtual int GetNumberOfPoints(); 00082 00091 virtual int GetNumberOfBoundaries(int dim=-1); 00092 00101 virtual int GetNumberOfDOFNodes(); 00102 00104 virtual void GetPointIterator(vtkGenericPointIterator *it); 00105 00107 virtual vtkGenericCellIterator *NewCellIterator(); 00108 00110 00114 virtual void GetBoundaryIterator(vtkGenericCellIterator *boundaries, 00115 int dim=-1); 00117 00119 00124 virtual int CountNeighbors(vtkGenericAdaptorCell *boundary); 00125 void CountEdgeNeighbors( int* sharing ); 00127 00129 00135 virtual void GetNeighbors(vtkGenericAdaptorCell *boundary, 00136 vtkGenericCellIterator *neighbors); 00138 00140 00144 virtual int FindClosestBoundary(int subId, 00145 double pcoords[3], 00146 vtkGenericCellIterator* &boundary); 00148 00150 00158 virtual int EvaluatePosition(double x[3], 00159 double *closestPoint, 00160 int &subId, 00161 double pcoords[3], 00162 double &dist2); 00164 00166 00170 virtual void EvaluateLocation(int subId, 00171 double pcoords[3], 00172 double x[3]); 00174 00176 00182 virtual void InterpolateTuple(vtkGenericAttribute *a, double pcoords[3], 00183 double *val); 00185 00187 00193 virtual void InterpolateTuple(vtkGenericAttributeCollection *c, double pcoords[3], 00194 double *val); 00195 #if 0 00196 // Description: 00197 // Generate a contour (contouring primitives) for each `values' or with 00198 // respect to an implicit function `f'. Contouring 00199 // is performed on the scalar attribute (`attributes->GetActiveAttribute()', 00200 // `attributes->GetActiveComponent()'). 00201 // Contouring interpolates the 00202 // `attributes->GetNumberOfattributesToInterpolate()' attributes 00203 // `attributes->GetAttributesToInterpolate()'. 00204 // `locator', `verts', `lines', `polys', `outPd' and `outCd' are cumulative 00205 // data arrays over cell iterations: they store the result of each call 00206 // to Contour(): 00207 // - `locator' is points list that merges points as they are inserted (i.e., 00208 // prevents duplicates). 00209 // - `verts' is an array of generated vertices 00210 // - `lines' is an array of generated lines 00211 // - `polys' is an array of generated polygons 00212 // - `outPd' is an array of interpolated point data along the edge (if 00213 // not-NULL) 00214 // - `outCd' is an array of copied cell data of the current cell (if 00215 // not-NULL) 00216 // Note: the CopyAllocate() method must be invoked on both the output cell 00217 // and point data. 00218 // 00219 // NOTE: `vtkGenericAttributeCollection *attributes' will be replaced by a 00220 // `vtkInformation'. 00221 // 00222 // \pre values_exist: (values!=0 && f==0) || (values==0 && f!=0) 00223 // \pre attributes_exist: attributes!=0 00224 // \pre locator_exists: locator!=0 00225 // \pre verts_exist: verts!=0 00226 // \pre lines_exist: lines!=0 00227 // \pre polys_exist: polys!=0 00228 virtual void Contour(vtkContourValues *values, 00229 vtkImplicitFunction *f, 00230 vtkGenericAttributeCollection *attributes, 00231 vtkPointLocator *locator, 00232 vtkCellArray *verts, 00233 vtkCellArray *lines, 00234 vtkCellArray *polys, 00235 vtkPointData *outPd, 00236 vtkCellData *outCd); 00238 #endif 00239 #if 0 00240 00241 00267 virtual void Clip(double value, 00268 vtkImplicitFunction *f, 00269 vtkGenericAttributeCollection *attributes, 00270 vtkGenericCellTessellator *tess, 00271 int insideOut, 00272 vtkPointLocator *locator, 00273 vtkCellArray *connectivity, 00274 vtkPointData *outPd, 00275 vtkCellData *outCd); 00277 #endif 00278 00279 00285 virtual int IntersectWithLine(double p1[3], 00286 double p2[3], 00287 double tol, 00288 double &t, 00289 double x[3], 00290 double pcoords[3], 00291 int &subId); 00293 00295 00304 virtual void Derivatives(int subId, 00305 double pcoords[3], 00306 vtkGenericAttribute *attribute, 00307 double *derivs); 00309 00312 virtual void GetBounds(double bounds[6]); 00313 00317 virtual double *GetBounds(); 00318 00321 virtual double GetLength2(); 00322 00327 virtual int GetParametricCenter(double pcoords[3]); 00328 00334 virtual double GetParametricDistance(double pcoords[3]); 00335 00337 00345 virtual double *GetParametricCoords(); 00346 #if 0 00347 // Description: 00348 // Tessellate the cell if it is not linear or if at least one attribute of 00349 // `attributes' is not linear. The output are linear cells of the same 00350 // dimension than than cell. If the cell is linear and all attributes are 00351 // linear, the output is just a copy of the current cell. 00352 // `points', `cellArray', `pd' and `cd' are cumulative output data arrays 00353 // over cell iterations: they store the result of each call to Tessellate(). 00354 // \pre attributes_exist: attributes!=0 00355 // \pre points_exist: points!=0 00356 // \pre cellArray_exists: cellArray!=0 00357 // \pre pd_exist: pd!=0 00358 // \pre cd_exists: cd!=0 00359 virtual void Tessellate(vtkGenericAttributeCollection *attributes, 00360 vtkPoints *points, vtkCellArray* cellArray, 00361 vtkPointData *pd, vtkCellData* cd); 00363 #endif 00364 // For the internals of the tesselation algorithm (the hash table in particular) 00365 virtual int IsFaceOnBoundary(vtkIdType faceId); 00366 virtual int IsOnBoundary(); 00367 00369 00371 virtual void GetPointIds(vtkIdType *id); 00372 #if 0 00373 virtual void TriangulateFace(vtkGenericAttributeCollection *attributes, 00374 vtkGenericCellTessellator *tess, 00375 int index, 00376 vtkPoints *pts, vtkCellArray *cellArray, 00377 vtkPointData *pd, 00378 vtkCellData *cd ); 00380 #endif 00381 00386 int *GetFaceArray(int faceId); 00387 00392 int GetNumberOfVerticesOnFace(int faceId); 00393 00398 int *GetEdgeArray(int edgeId); 00399 00401 00404 void Init(vtkBridgeDataSet *ds, 00405 vtkIdType cellid); 00407 00409 00411 void InitWithCell(vtkCell *c, 00412 vtkIdType id); 00414 00417 void DeepCopy(vtkBridgeCell *other); 00418 00419 protected: 00420 vtkBridgeCell(); 00421 virtual ~vtkBridgeCell(); 00422 00425 void AllocateWeights(); 00426 00428 void InterpolationFunctions(double pcoords[3], double *weights); 00429 00430 friend class vtkBridgeDataSet; 00431 friend class vtkBridgeAttribute; 00432 friend class vtkBridgeCellIterator; 00433 friend class vtkBridgeCellIteratorOnDataSet; 00434 friend class vtkBridgeCellIteratorOne; 00435 friend class vtkBridgeCellIteratorOnCellBoundaries; 00436 friend class vtkBridgePointIteratorOnCell; 00437 00438 vtkCell *Cell; 00439 vtkBridgeDataSet *DataSet; 00440 vtkIdType Id; // what does it mean for boundary cells? 00441 int BoolIsInDataSet; 00442 vtkBridgeCellIterator *InternalIterator; // used in Contour 00443 00444 double *Weights; // interpolation functions 00445 int WeightsCapacity; 00446 00447 private: 00448 vtkBridgeCell(const vtkBridgeCell&); // Not implemented. 00449 void operator=(const vtkBridgeCell&); // Not implemented. 00450 }; 00451 00452 #endif