File: vtkTessellatorFilter.h

package info (click to toggle)
vtk7 7.1.1%2Bdfsg1-12
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 125,776 kB
  • sloc: cpp: 1,539,582; ansic: 106,521; python: 78,038; tcl: 47,013; xml: 8,142; yacc: 5,040; java: 4,439; perl: 3,132; lex: 1,926; sh: 1,500; makefile: 122; objc: 83
file content (218 lines) | stat: -rw-r--r-- 7,569 bytes parent folder | download | duplicates (3)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/*=========================================================================

Program:   Visualization Toolkit
Module:    vtkTessellatorFilter.h
Language:  C++

Copyright 2003 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the
U.S. Government. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that this Notice and any
statement of authorship are reproduced on all copies.

=========================================================================*/
#ifndef vtkTessellatorFilter_h
#define vtkTessellatorFilter_h

/**
 * @class   vtkTessellatorFilter
 * @brief   approximate nonlinear FEM elements with simplices
 *
 * This class approximates nonlinear FEM elements with linear simplices.
 *
 * <b>Warning</b>: This class is temporary and will go away at some point
 * after ParaView 1.4.0.
 *
 * This filter rifles through all the cells in an input vtkDataSet. It
 * tesselates each cell and uses the vtkStreamingTessellator and
 * vtkDataSetEdgeSubdivisionCriterion classes to generate simplices that
 * approximate the nonlinear mesh using some approximation metric (encoded
 * in the particular vtkDataSetEdgeSubdivisionCriterion::EvaluateEdge
 * implementation). The simplices are placed into the filter's output
 * vtkDataSet object by the callback routines AddATetrahedron,
 * AddATriangle, and AddALine, which are registered with the triangulator.
 *
 * The output mesh will have geometry and any fields specified as
 * attributes in the input mesh's point data.  The attribute's copy flags
 * are honored, except for normals.
 *
 *
 * @par Internals:
 * The filter's main member function is RequestData(). This function first
 * calls SetupOutput() which allocates arrays and some temporary variables
 * for the primitive callbacks (OutputTriangle and OutputLine which are
 * called by AddATriangle and AddALine, respectively).  Each cell is given
 * an initial tesselation, which results in one or more calls to
 * OutputTetrahedron, OutputTriangle or OutputLine to add elements to the
 * OutputMesh. Finally, Teardown() is called to free the filter's working
 * space.
 *
 * @sa
 * vtkDataSetToUnstructuredGridFilter vtkDataSet vtkStreamingTessellator
 * vtkDataSetEdgeSubdivisionCriterion
*/

#include "vtkFiltersGeneralModule.h" // For export macro
#include "vtkUnstructuredGridAlgorithm.h"

class vtkDataArray;
class vtkDataSet;
class vtkDataSetEdgeSubdivisionCriterion;
class vtkPointLocator;
class vtkPoints;
class vtkStreamingTessellator;
class vtkEdgeSubdivisionCriterion;
class vtkUnstructuredGrid;

class VTKFILTERSGENERAL_EXPORT vtkTessellatorFilter : public vtkUnstructuredGridAlgorithm
{
public:
  vtkTypeMacro(vtkTessellatorFilter,vtkUnstructuredGridAlgorithm);
  void PrintSelf( ostream& os, vtkIndent indent ) VTK_OVERRIDE;

  static vtkTessellatorFilter* New();

  virtual void SetTessellator( vtkStreamingTessellator* );
  vtkGetObjectMacro(Tessellator, vtkStreamingTessellator);

  virtual void SetSubdivider( vtkDataSetEdgeSubdivisionCriterion* );
  vtkGetObjectMacro(Subdivider, vtkDataSetEdgeSubdivisionCriterion);

  vtkMTimeType GetMTime() VTK_OVERRIDE;

  //@{
  /**
   * Set the dimension of the output tessellation.
   * Cells in dimensions higher than the given value will have
   * their boundaries of dimension \a OutputDimension tessellated.
   * For example, if \a OutputDimension is 2, a hexahedron's
   * quadrilateral faces would be tessellated rather than its
   * interior.
   */
  vtkSetClampMacro(OutputDimension,int,1,3);
  vtkGetMacro(OutputDimension,int);
  //@}

  int GetOutputDimension() const;

  //@{
  /**
   * These are convenience routines for setting properties maintained by the
   * tessellator and subdivider. They are implemented here for ParaView's
   * sake.
   */
  virtual void SetMaximumNumberOfSubdivisions( int num_subdiv_in );
  int GetMaximumNumberOfSubdivisions();
  virtual void SetChordError( double ce );
  double GetChordError();
  //@}

  //@{
  /**
   * These methods are for the ParaView client.
   */
  virtual void ResetFieldCriteria();
  virtual void SetFieldCriterion( int field, double chord );
  //@}

  //@{
  /**
   * The adaptive tessellation will output vertices that are not shared
   * among cells, even where they should be. This can be corrected to
   * some extents with a vtkMergeFilter.
   * By default, the filter is off and vertices will not be shared.
   */
  vtkGetMacro(MergePoints,int);
  vtkSetMacro(MergePoints,int);
  vtkBooleanMacro(MergePoints,int);
  //@}

protected:
  vtkTessellatorFilter();
  ~vtkTessellatorFilter() VTK_OVERRIDE;

  int FillInputPortInformation(int port, vtkInformation* info) VTK_OVERRIDE;

  /**
   * Called by RequestData to set up a multitude of member variables used by
   * the per-primitive output functions (OutputLine, OutputTriangle, and
   * maybe one day... OutputTetrahedron).
   */
  void SetupOutput( vtkDataSet* input, vtkUnstructuredGrid* output );

  /**
   * Called by RequestData to merge output points.
   */
  void MergeOutputPoints( vtkUnstructuredGrid* input, vtkUnstructuredGrid* output );

  /**
   * Reset the temporary variables used during the filter's RequestData() method.
   */
  void Teardown();

  /**
   * Run the filter; produce a polygonal approximation to the grid.
   */
  int RequestData(vtkInformation* request,
                  vtkInformationVector** inputVector,
                  vtkInformationVector* outputVector) VTK_OVERRIDE;

  vtkStreamingTessellator* Tessellator;
  vtkDataSetEdgeSubdivisionCriterion* Subdivider;
  int OutputDimension;
  int MergePoints;
  vtkPointLocator* Locator;

  //@{
  /**
   * These member variables are set by SetupOutput for use inside the
   * callback members OutputLine and OutputTriangle.
   */
  vtkUnstructuredGrid* OutputMesh;
  vtkPoints* OutputPoints;
  vtkDataArray** OutputAttributes;
  int* OutputAttributeIndices;
  //@}

  static void AddAPoint( const double*,
                         vtkEdgeSubdivisionCriterion*,
                         void*,
                         const void* );
  static void AddALine( const double*,
                        const double*,
                        vtkEdgeSubdivisionCriterion*,
                        void*,
                        const void* );
  static void AddATriangle( const double*,
                            const double*,
                            const double*,
                            vtkEdgeSubdivisionCriterion*,
                            void*,
                            const void* );
  static void AddATetrahedron( const double*,
                               const double*,
                               const double*,
                               const double*,
                               vtkEdgeSubdivisionCriterion*,
                               void*,
                               const void* );
  void OutputPoint( const double* );
  void OutputLine( const double*, const double* );
  void OutputTriangle( const double*, const double*, const double* );
  void OutputTetrahedron( const double*,
                          const double*,
                          const double*,
                          const double* );

private:
  vtkTessellatorFilter( const vtkTessellatorFilter& ) VTK_DELETE_FUNCTION;
  void operator = ( const vtkTessellatorFilter& ) VTK_DELETE_FUNCTION;
};

inline int vtkTessellatorFilter::GetOutputDimension() const
{
  return this->OutputDimension;
}

#endif // vtkTessellatorFilter_h