VTK
vtkBridgeCell.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBridgeCell.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 =========================================================================*/
27 #ifndef __vtkBridgeCell_h
28 #define __vtkBridgeCell_h
29 
30 #include "vtkBridgeExport.h"
31 #include "vtkGenericAdaptorCell.h"
32 
33 class vtkCell;
34 class vtkBridgeDataSet;
36 
38 {
39 public:
40  static vtkBridgeCell *New();
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
46  virtual vtkIdType GetId();
47 
49  virtual int IsInDataSet();
50 
54  virtual int GetType();
55 
58  virtual int GetDimension();
59 
61  virtual int GetGeometryOrder();
62 
65  int IsGeometryLinear();
66 
69  virtual int GetAttributeOrder(vtkGenericAttribute *a);
70 
75 
77  virtual int IsPrimary();
78 
81  virtual int GetNumberOfPoints();
82 
91  virtual int GetNumberOfBoundaries(int dim=-1);
92 
101  virtual int GetNumberOfDOFNodes();
102 
104  virtual void GetPointIterator(vtkGenericPointIterator *it);
105 
108 
110 
114  virtual void GetBoundaryIterator(vtkGenericCellIterator *boundaries,
115  int dim=-1);
117 
119 
124  virtual int CountNeighbors(vtkGenericAdaptorCell *boundary);
125  void CountEdgeNeighbors( int* sharing );
127 
129 
135  virtual void GetNeighbors(vtkGenericAdaptorCell *boundary,
136  vtkGenericCellIterator *neighbors);
138 
140 
144  virtual int FindClosestBoundary(int subId,
145  double pcoords[3],
146  vtkGenericCellIterator* &boundary);
148 
150 
158  virtual int EvaluatePosition(double x[3],
159  double *closestPoint,
160  int &subId,
161  double pcoords[3],
162  double &dist2);
164 
166 
170  virtual void EvaluateLocation(int subId,
171  double pcoords[3],
172  double x[3]);
174 
176 
182  virtual void InterpolateTuple(vtkGenericAttribute *a, double pcoords[3],
183  double *val);
185 
187 
193  virtual void InterpolateTuple(vtkGenericAttributeCollection *c, double pcoords[3],
194  double *val);
195 #if 0
196  // Description:
197  // Generate a contour (contouring primitives) for each `values' or with
198  // respect to an implicit function `f'. Contouring
199  // is performed on the scalar attribute (`attributes->GetActiveAttribute()',
200  // `attributes->GetActiveComponent()').
201  // Contouring interpolates the
202  // `attributes->GetNumberOfattributesToInterpolate()' attributes
203  // `attributes->GetAttributesToInterpolate()'.
204  // `locator', `verts', `lines', `polys', `outPd' and `outCd' are cumulative
205  // data arrays over cell iterations: they store the result of each call
206  // to Contour():
207  // - `locator' is points list that merges points as they are inserted (i.e.,
208  // prevents duplicates).
209  // - `verts' is an array of generated vertices
210  // - `lines' is an array of generated lines
211  // - `polys' is an array of generated polygons
212  // - `outPd' is an array of interpolated point data along the edge (if
213  // not-NULL)
214  // - `outCd' is an array of copied cell data of the current cell (if
215  // not-NULL)
216  // Note: the CopyAllocate() method must be invoked on both the output cell
217  // and point data.
218  //
219  // NOTE: `vtkGenericAttributeCollection *attributes' will be replaced by a
220  // `vtkInformation'.
221  //
222  // \pre values_exist: (values!=0 && f==0) || (values==0 && f!=0)
223  // \pre attributes_exist: attributes!=0
224  // \pre locator_exists: locator!=0
225  // \pre verts_exist: verts!=0
226  // \pre lines_exist: lines!=0
227  // \pre polys_exist: polys!=0
228  virtual void Contour(vtkContourValues *values,
230  vtkGenericAttributeCollection *attributes,
231  vtkPointLocator *locator,
232  vtkCellArray *verts,
233  vtkCellArray *lines,
234  vtkCellArray *polys,
235  vtkPointData *outPd,
236  vtkCellData *outCd);
237 #endif
238 #if 0
239  // Description:
240  // Cut (or clip) the current cell with respect to the contour defined by the
241  // `value' or the implicit function `f' of the scalar attribute
242  // (`attributes->GetActiveAttribute()',`attributes->GetActiveComponent()').
243  // If `f' exists, `value' is not used. The output is the part
244  // of the current cell which is inside the contour.
245  // The output is a set of zero, one or more cells of the same topological
246  // dimension as the current cell. Normally, cell points whose scalar value
247  // is greater than "value" are considered inside. If `insideOut' is on, this
248  // is reversed.
249  // Clipping interpolates the
250  // `attributes->GetNumberOfattributesToInterpolate()' attributes
251  // `attributes->GetAttributesToInterpolate()'.
252  // `locator', `connectivity', `outPd' and `outCd' are cumulative
253  // data arrays over cell iterations: they store the result of each call
254  // to Clip():
255  // - `locator' is points list that merges points as they are inserted (i.e.,
256  // prevents duplicates).
257  // - `connectivity' is an array of generated cells
258  // - `outPd' is an array of interpolated point data along the edge (if
259  // not-NULL)
260  // - `outCd' is an array of copied cell data of the current cell (if
261  // not-NULL)
262  // Note: the CopyAllocate() method must be invoked on both the output cell
263  // and point data.
264  // Also, if the output cell data is
265  // non-NULL, the cell data from the clipped cell is passed to the generated
266  // contouring primitives. (Note: the CopyAllocate() method must be invoked on
267  // both the output cell and point data.)
268  //
269  // NOTE: `vtkGenericAttributeCollection *attributes' will be replaced by a
270  // `vtkInformation'.
271  //
272  // \pre attributes_exist: attributes!=0
273  // \pre tess_exists: tess!=0
274  // \pre locator_exists: locator!=0
275  // \pre connectivity_exists: connectivity!=0
276  virtual void Clip(double value,
278  vtkGenericAttributeCollection *attributes,
280  int insideOut,
281  vtkPointLocator *locator,
282  vtkCellArray *connectivity,
283  vtkPointData *outPd,
284  vtkCellData *outCd);
285 #endif
286  // Description:
287  // Is there an intersection between the current cell and the ray (`p1',`p2')
288  // according to a tolerance `tol'? If true, `x' is the global intersection,
289  // `t' is the parametric coordinate for the line, `pcoords' are the
290  // parametric coordinates for cell. `subId' is the sub-cell where
291  // the intersection occurs.
292  // \pre positive_tolerance: tol>0
293  virtual int IntersectWithLine(double p1[3],
294  double p2[3],
295  double tol,
296  double &t,
297  double x[3],
298  double pcoords[3],
299  int &subId);
301 
303 
312  virtual void Derivatives(int subId,
313  double pcoords[3],
314  vtkGenericAttribute *attribute,
315  double *derivs);
317 
320  virtual void GetBounds(double bounds[6]);
321 
325  virtual double *GetBounds();
326 
329  virtual double GetLength2();
330 
335  virtual int GetParametricCenter(double pcoords[3]);
336 
342  virtual double GetParametricDistance(double pcoords[3]);
343 
345 
353  virtual double *GetParametricCoords();
354 #if 0
355  // Description:
356  // Tessellate the cell if it is not linear or if at least one attribute of
357  // `attributes' is not linear. The output are linear cells of the same
358  // dimension than than cell. If the cell is linear and all attributes are
359  // linear, the output is just a copy of the current cell.
360  // `points', `cellArray', `pd' and `cd' are cumulative output data arrays
361  // over cell iterations: they store the result of each call to Tessellate().
362  // \pre attributes_exist: attributes!=0
363  // \pre points_exist: points!=0
364  // \pre cellArray_exists: cellArray!=0
365  // \pre pd_exist: pd!=0
366  // \pre cd_exists: cd!=0
367  virtual void Tessellate(vtkGenericAttributeCollection *attributes,
368  vtkPoints *points, vtkCellArray* cellArray,
369  vtkPointData *pd, vtkCellData* cd);
370 #endif
371  // For the internals of the tesselation algorithm (the hash table in particular)
372  virtual int IsFaceOnBoundary(vtkIdType faceId);
373  virtual int IsOnBoundary();
375 
377 
379  virtual void GetPointIds(vtkIdType *id);
380 #if 0
381  virtual void TriangulateFace(vtkGenericAttributeCollection *attributes,
383  int index,
384  vtkPoints *pts, vtkCellArray *cellArray,
385  vtkPointData *pd,
386  vtkCellData *cd );
387 #endif
388 
389 
394  int *GetFaceArray(int faceId);
395 
400  int GetNumberOfVerticesOnFace(int faceId);
401 
406  int *GetEdgeArray(int edgeId);
407 
409 
412  void Init(vtkBridgeDataSet *ds,
413  vtkIdType cellid);
415 
417 
419  void InitWithCell(vtkCell *c,
420  vtkIdType id);
422 
425  void DeepCopy(vtkBridgeCell *other);
426 
427 protected:
428  vtkBridgeCell();
429  virtual ~vtkBridgeCell();
430 
433  void AllocateWeights();
434 
436  void InterpolationFunctions(double pcoords[3], double *weights);
437 
438  friend class vtkBridgeDataSet;
439  friend class vtkBridgeAttribute;
440  friend class vtkBridgeCellIterator;
445 
448  vtkIdType Id; // what does it mean for boundary cells?
451 
452  double *Weights; // interpolation functions
454 
455 private:
456  vtkBridgeCell(const vtkBridgeCell&); // Not implemented.
457  void operator=(const vtkBridgeCell&); // Not implemented.
458 };
459 
460 #endif