File: vtkExtractTensorComponents.h

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (242 lines) | stat: -rw-r--r-- 7,783 bytes parent folder | download | duplicates (7)
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
 * @class   vtkExtractTensorComponents
 * @brief   extract parts of tensor and create a scalar, vector, normal, or texture coordinates.
 *
 * vtkExtractTensorComponents is a filter that extracts components of a
 * tensor to create a scalar, vector, normal, and/or texture coords. For
 * example, if the tensor contains components of stress, then you could
 * extract the normal stress in the x-direction as a scalar (i.e., tensor
 * component (0,0)).
 *
 * To use this filter, you must set some boolean flags to control
 * which data is extracted from the tensors, and whether you want to
 * pass the tensor data through to the output. Also, you must specify
 * the tensor component(s) for each type of data you want to
 * extract. The tensor component(s) is(are) specified using matrix notation
 * into a 3x3 matrix. That is, use the (row,column) address to specify
 * a particular tensor component; and if the data you are extracting
 * requires more than one component, use a list of addresses. (Note
 * that the addresses are 0-offset -> (0,0) specifies the upper left
 * corner of the tensor.)
 *
 * There are two optional methods to extract scalar data. You can
 * extract the determinant of the tensor, or you can extract the
 * effective stress of the tensor. These require that the ivar
 * ExtractScalars is on, and the appropriate scalar extraction mode is
 * set.
 *
 * @warning
 * This class has been threaded with vtkSMPTools. Using TBB or other
 * non-sequential type (set in the CMake variable
 * VTK_SMP_IMPLEMENTATION_TYPE) may improve performance significantly.
 *
 * @sa
 * vtkTensorWidget vtkTensorGlyph vtkPointSmoothingFilter
 * vtkHyperStreamline
 */

#ifndef vtkExtractTensorComponents_h
#define vtkExtractTensorComponents_h

#include "vtkDataSetAlgorithm.h"
#include "vtkFiltersExtractionModule.h" // For export macro

#define VTK_EXTRACT_COMPONENT 0
#define VTK_EXTRACT_EFFECTIVE_STRESS 1
#define VTK_EXTRACT_DETERMINANT 2
#define VTK_EXTRACT_NONNEGATIVE_DETERMINANT 3
#define VTK_EXTRACT_TRACE 4

VTK_ABI_NAMESPACE_BEGIN
class VTKFILTERSEXTRACTION_EXPORT vtkExtractTensorComponents : public vtkDataSetAlgorithm
{
public:
  ///@{
  /**
   * Standard methods for obtaining type information, and printing.
   */
  vtkTypeMacro(vtkExtractTensorComponents, vtkDataSetAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent) override;
  ///@}

  /**
   * Construct object to extract nothing and to not pass tensor data
   * through the pipeline.
   */
  static vtkExtractTensorComponents* New();

  ///@{
  /**
   * Boolean controls whether tensor data is passed through to the output.
   */
  vtkSetMacro(PassTensorsToOutput, vtkTypeBool);
  vtkGetMacro(PassTensorsToOutput, vtkTypeBool);
  vtkBooleanMacro(PassTensorsToOutput, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Boolean controls whether scalar data is extracted from the tensors.
   */
  vtkSetMacro(ExtractScalars, vtkTypeBool);
  vtkGetMacro(ExtractScalars, vtkTypeBool);
  vtkBooleanMacro(ExtractScalars, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Specify the (row,column) tensor component to extract as a scalar.
   */
  vtkSetVector2Macro(ScalarComponents, int);
  vtkGetVectorMacro(ScalarComponents, int, 2);
  ///@}

  ///@{
  /**
   * Specify how to extract the scalar. You can extract it as one of the
   * components of the tensor, as effective stress, as the determinant of the
   * tensor, a non-negative determinant, or the trace of the tensor
   * matrix. If you extract a component make sure that you set the
   * ScalarComponents ivar.
   */
  vtkSetMacro(ScalarMode, int);
  vtkGetMacro(ScalarMode, int);
  void SetScalarModeToComponent() { this->SetScalarMode(VTK_EXTRACT_COMPONENT); }
  void SetScalarModeToEffectiveStress() { this->SetScalarMode(VTK_EXTRACT_EFFECTIVE_STRESS); }
  void SetScalarModeToDeterminant() { this->SetScalarMode(VTK_EXTRACT_DETERMINANT); }
  void SetScalarModeToNonNegativeDeterminant()
  {
    this->SetScalarMode(VTK_EXTRACT_NONNEGATIVE_DETERMINANT);
  }
  void SetScalarModeToTrace() { this->SetScalarMode(VTK_EXTRACT_TRACE); }
  void ScalarIsComponent() { this->SetScalarMode(VTK_EXTRACT_COMPONENT); }
  void ScalarIsEffectiveStress() { this->SetScalarMode(VTK_EXTRACT_EFFECTIVE_STRESS); }
  void ScalarIsDeterminant() { this->SetScalarMode(VTK_EXTRACT_DETERMINANT); }
  void ScalarIsNonNegativeDeterminant()
  {
    this->SetScalarMode(VTK_EXTRACT_NONNEGATIVE_DETERMINANT);
  }
  void ScalarIsTrace() { this->SetScalarMode(VTK_EXTRACT_TRACE); }
  ///@}

  ///@{
  /**
   * Boolean controls whether vector data is extracted from tensor.
   */
  vtkSetMacro(ExtractVectors, vtkTypeBool);
  vtkGetMacro(ExtractVectors, vtkTypeBool);
  vtkBooleanMacro(ExtractVectors, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Specify the ((row,column)0,(row,column)1,(row,column)2) tensor
   * components to extract as a vector.
   */
  vtkSetVector6Macro(VectorComponents, int);
  vtkGetVectorMacro(VectorComponents, int, 6);
  ///@}

  ///@{
  /**
   * Boolean controls whether normal data is extracted from tensor.
   */
  vtkSetMacro(ExtractNormals, vtkTypeBool);
  vtkGetMacro(ExtractNormals, vtkTypeBool);
  vtkBooleanMacro(ExtractNormals, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Boolean controls whether normal vector is converted to unit normal
   * after extraction.
   */
  vtkSetMacro(NormalizeNormals, vtkTypeBool);
  vtkGetMacro(NormalizeNormals, vtkTypeBool);
  vtkBooleanMacro(NormalizeNormals, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Specify the ((row,column)0,(row,column)1,(row,column)2) tensor
   * components to extract as a vector.
   */
  vtkSetVector6Macro(NormalComponents, int);
  vtkGetVectorMacro(NormalComponents, int, 6);
  ///@}

  ///@{
  /**
   * Boolean controls whether texture coordinates are extracted from tensor.
   */
  vtkSetMacro(ExtractTCoords, vtkTypeBool);
  vtkGetMacro(ExtractTCoords, vtkTypeBool);
  vtkBooleanMacro(ExtractTCoords, vtkTypeBool);
  ///@}

  ///@{
  /**
   * Set the dimension of the texture coordinates to extract.
   */
  vtkSetClampMacro(NumberOfTCoords, int, 1, 3);
  vtkGetMacro(NumberOfTCoords, int);
  ///@}

  ///@{
  /**
   * Specify the ((row,column)0,(row,column)1,(row,column)2) tensor
   * components to extract as a vector. Up to NumberOfTCoords
   * components are extracted.
   */
  vtkSetVector6Macro(TCoordComponents, int);
  vtkGetVectorMacro(TCoordComponents, int, 6);
  ///@}

  ///@{
  /**
   * Set/get the desired precision for the output types. See the
   * documentation for the vtkAlgorithm::DesiredOutputPrecision enum for an
   * explanation of the available precision settings. Note that any data that
   * is simply passed through the filter to its output retains its input
   * type, only newly created data added to the output is affected by this
   * flag. By default the output type is the same as the input tensor type.
   */
  vtkSetMacro(OutputPrecision, int);
  vtkGetMacro(OutputPrecision, int);
  ///@}

protected:
  vtkExtractTensorComponents();
  ~vtkExtractTensorComponents() override = default;

  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;

  vtkTypeBool PassTensorsToOutput;

  vtkTypeBool ExtractScalars;
  vtkTypeBool ExtractVectors;
  vtkTypeBool ExtractNormals;
  vtkTypeBool ExtractTCoords;

  int ScalarMode;
  int ScalarComponents[2];

  int VectorComponents[6];

  vtkTypeBool NormalizeNormals;
  int NormalComponents[6];

  int NumberOfTCoords;
  int TCoordComponents[6];

  int OutputPrecision;

private:
  vtkExtractTensorComponents(const vtkExtractTensorComponents&) = delete;
  void operator=(const vtkExtractTensorComponents&) = delete;
};

VTK_ABI_NAMESPACE_END
#endif