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); 00237 #endif 00238 #if 0 00239 // Description: 00240 // Cut (or clip) the current cell with respect to the contour defined by the 00241 // `value' or the implicit function `f' of the scalar attribute 00242 // (`attributes->GetActiveAttribute()',`attributes->GetActiveComponent()'). 00243 // If `f' exists, `value' is not used. The output is the part 00244 // of the current cell which is inside the contour. 00245 // The output is a set of zero, one or more cells of the same topological 00246 // dimension as the current cell. Normally, cell points whose scalar value 00247 // is greater than "value" are considered inside. If `insideOut' is on, this 00248 // is reversed. 00249 // Clipping interpolates the 00250 // `attributes->GetNumberOfattributesToInterpolate()' attributes 00251 // `attributes->GetAttributesToInterpolate()'. 00252 // `locator', `connectivity', `outPd' and `outCd' are cumulative 00253 // data arrays over cell iterations: they store the result of each call 00254 // to Clip(): 00255 // - `locator' is points list that merges points as they are inserted (i.e., 00256 // prevents duplicates). 00257 // - `connectivity' is an array of generated cells 00258 // - `outPd' is an array of interpolated point data along the edge (if 00259 // not-NULL) 00260 // - `outCd' is an array of copied cell data of the current cell (if 00261 // not-NULL) 00262 // Note: the CopyAllocate() method must be invoked on both the output cell 00263 // and point data. 00264 // Also, if the output cell data is 00265 // non-NULL, the cell data from the clipped cell is passed to the generated 00266 // contouring primitives. (Note: the CopyAllocate() method must be invoked on 00267 // both the output cell and point data.) 00268 // 00269 // NOTE: `vtkGenericAttributeCollection *attributes' will be replaced by a 00270 // `vtkInformation'. 00271 // 00272 // \pre attributes_exist: attributes!=0 00273 // \pre tess_exists: tess!=0 00274 // \pre locator_exists: locator!=0 00275 // \pre connectivity_exists: connectivity!=0 00276 virtual void Clip(double value, 00277 vtkImplicitFunction *f, 00278 vtkGenericAttributeCollection *attributes, 00279 vtkGenericCellTessellator *tess, 00280 int insideOut, 00281 vtkPointLocator *locator, 00282 vtkCellArray *connectivity, 00283 vtkPointData *outPd, 00284 vtkCellData *outCd); 00285 #endif 00286 // Description: 00287 // Is there an intersection between the current cell and the ray (`p1',`p2') 00288 // according to a tolerance `tol'? If true, `x' is the global intersection, 00289 // `t' is the parametric coordinate for the line, `pcoords' are the 00290 // parametric coordinates for cell. `subId' is the sub-cell where 00291 // the intersection occurs. 00292 // \pre positive_tolerance: tol>0 00293 virtual int IntersectWithLine(double p1[3], 00294 double p2[3], 00295 double tol, 00296 double &t, 00297 double x[3], 00298 double pcoords[3], 00299 int &subId); 00301 00303 00312 virtual void Derivatives(int subId, 00313 double pcoords[3], 00314 vtkGenericAttribute *attribute, 00315 double *derivs); 00317 00320 virtual void GetBounds(double bounds[6]); 00321 00325 virtual double *GetBounds(); 00326 00329 virtual double GetLength2(); 00330 00335 virtual int GetParametricCenter(double pcoords[3]); 00336 00342 virtual double GetParametricDistance(double pcoords[3]); 00343 00345 00353 virtual double *GetParametricCoords(); 00354 #if 0 00355 // Description: 00356 // Tessellate the cell if it is not linear or if at least one attribute of 00357 // `attributes' is not linear. The output are linear cells of the same 00358 // dimension than than cell. If the cell is linear and all attributes are 00359 // linear, the output is just a copy of the current cell. 00360 // `points', `cellArray', `pd' and `cd' are cumulative output data arrays 00361 // over cell iterations: they store the result of each call to Tessellate(). 00362 // \pre attributes_exist: attributes!=0 00363 // \pre points_exist: points!=0 00364 // \pre cellArray_exists: cellArray!=0 00365 // \pre pd_exist: pd!=0 00366 // \pre cd_exists: cd!=0 00367 virtual void Tessellate(vtkGenericAttributeCollection *attributes, 00368 vtkPoints *points, vtkCellArray* cellArray, 00369 vtkPointData *pd, vtkCellData* cd); 00370 #endif 00371 // For the internals of the tesselation algorithm (the hash table in particular) 00372 virtual int IsFaceOnBoundary(vtkIdType faceId); 00373 virtual int IsOnBoundary(); 00375 00377 00379 virtual void GetPointIds(vtkIdType *id); 00380 #if 0 00381 virtual void TriangulateFace(vtkGenericAttributeCollection *attributes, 00382 vtkGenericCellTessellator *tess, 00383 int index, 00384 vtkPoints *pts, vtkCellArray *cellArray, 00385 vtkPointData *pd, 00386 vtkCellData *cd ); 00387 #endif 00388 00389 00394 int *GetFaceArray(int faceId); 00395 00400 int GetNumberOfVerticesOnFace(int faceId); 00401 00406 int *GetEdgeArray(int edgeId); 00407 00409 00412 void Init(vtkBridgeDataSet *ds, 00413 vtkIdType cellid); 00415 00417 00419 void InitWithCell(vtkCell *c, 00420 vtkIdType id); 00422 00425 void DeepCopy(vtkBridgeCell *other); 00426 00427 protected: 00428 vtkBridgeCell(); 00429 virtual ~vtkBridgeCell(); 00430 00433 void AllocateWeights(); 00434 00436 void InterpolationFunctions(double pcoords[3], double *weights); 00437 00438 friend class vtkBridgeDataSet; 00439 friend class vtkBridgeAttribute; 00440 friend class vtkBridgeCellIterator; 00441 friend class vtkBridgeCellIteratorOnDataSet; 00442 friend class vtkBridgeCellIteratorOne; 00443 friend class vtkBridgeCellIteratorOnCellBoundaries; 00444 friend class vtkBridgePointIteratorOnCell; 00445 00446 vtkCell *Cell; 00447 vtkBridgeDataSet *DataSet; 00448 vtkIdType Id; // what does it mean for boundary cells? 00449 int BoolIsInDataSet; 00450 vtkBridgeCellIterator *InternalIterator; // used in Contour 00451 00452 double *Weights; // interpolation functions 00453 int WeightsCapacity; 00454 00455 private: 00456 vtkBridgeCell(const vtkBridgeCell&); // Not implemented. 00457 void operator=(const vtkBridgeCell&); // Not implemented. 00458 }; 00459 00460 #endif