File: vtkNonLinearCell.h

package info (click to toggle)
vtk 5.0.4-1.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 51,084 kB
  • ctags: 70,426
  • sloc: cpp: 524,166; ansic: 220,276; tcl: 43,377; python: 14,037; perl: 3,102; java: 1,436; yacc: 1,033; sh: 339; lex: 248; makefile: 197; asm: 154
file content (121 lines) | stat: -rw-r--r-- 4,900 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    $RCSfile: vtkNonLinearCell.h,v $

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkNonLinearCell - abstract superclass for non-linear cells
// .SECTION Description
// vtkNonLinearCell is an abstract superclass for non-linear cell types.
// Cells that are a direct subclass of vtkCell or vtkCell3D are linear;
// cells that are a subclass of vtkNonLinearCell have non-linear interpolation
// functions. Non-linear cells require special treatment when tessellating
// or converting to graphics primitives. Note that the linearity of the cell
// is a function of whether the cell needs tessellation, which does not 
// strictly correlate with interpolation order (e.g., vtkHexahedron has
// non-linear interpolation functions (a product of three linear functions
// in r-s-t) even thought vtkHexahedron is considered linear.)
//
// The Error instance variable is used to control the tessellation of the
// cell. Error is normalized between (0.001,1) and typically measures the
// chordal deviation of linear (tessellated) primitives from the actual
// cell boundary. Each cell may have its own interpretation of this error
// measure.

#ifndef __vtkNonLinearCell_h
#define __vtkNonLinearCell_h

#include "vtkCell.h"

#include "vtkPointLocator.h" // Needed for inline method
#include "vtkPoints.h" // Needed for inline method

class vtkPolyData;
class vtkDataSet;
class vtkUnstructuredGrid;

class VTK_FILTERING_EXPORT vtkNonLinearCell : public vtkCell
{
public:
  vtkTypeRevisionMacro(vtkNonLinearCell,vtkCell);  
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set/Get the normalized error measure used to control the 
  // tessellation of the cell.
  vtkSetClampMacro(Error,double,0.001,1.0);
  vtkGetMacro(Error,double);

  // Description:
  // Non-linear cells require special treatment (tessellation) when 
  // converting to graphics primitives (during mapping). The vtkCell 
  // API IsLinear() is modified to indicate this requirement.
  virtual int IsLinear() {return 0;}
  
  // Description:
  // This method tessellates the cell returning polydata. (The Error ivar
  // controls the tessellation depth.) The new dataset will contain polydata
  // primitives, possibly new points as well as interpolated point and cell
  // data.  The user must provide (the output) polydata which is filled in by
  // the method. If the optional PointLocator is supplied, then any new
  // points that are created are inserted through the vtkPointLocator, rather
  // than directly in the vtkPolyData.  (Note: the input dataset and cellId
  // are used if the cell requires access to its owning dataset.) This method
  // is called when the topological dimension of the cell is 2D or less.
  virtual void Tessellate(vtkIdType cellId, 
                          vtkDataSet *input, vtkPolyData *output, 
                          vtkPointLocator *locator=NULL);
  
  // Description:
  // This method tessellates the cell returning unstructured grid. (The Error
  // ivar controls the tessellation depth.) The new dataset will contain
  // unstructured grid primitives, possibly new points as well as
  // interpolated point and cell data.  The user must provide (the output)
  // unstructured grid which is filled in by the method. If the optional
  // PointLocator is supplied, then any new points that are created are
  // inserted through the vtkPointLocator, rather than directly in the
  // vtkUnstructuredGrid.  (Note: the input dataset and cellId are used if
  // the cell requires access to its owning dataset.) This method is called
  // when the topological dimension of the cell is 3D.
  virtual void Tessellate(vtkIdType cellId, 
                          vtkDataSet *input, vtkUnstructuredGrid *output, 
                          vtkPointLocator *locator=NULL);
  

protected:
  vtkNonLinearCell();
  ~vtkNonLinearCell() {}

  double Error;

  // inline helper for tessellation- used by subclasses
  vtkIdType InsertPoint(vtkPointLocator *locator, vtkPoints *pts, double *x)
    {
      if ( locator != NULL ) 
        {
        vtkIdType p;
        locator->InsertUniquePoint(x,p);
        return p;
        }
      else
        {
        return pts->InsertNextPoint(x);
        }
    }
  
private:
  vtkNonLinearCell(const vtkNonLinearCell&);  // Not implemented.
  void operator=(const vtkNonLinearCell&);  // Not implemented.
};

#endif