File: vtkAMRSliceFilter.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 (197 lines) | stat: -rw-r--r-- 5,555 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
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
/*=========================================================================

 Program:   Visualization Toolkit
 Module:    vtkAMRSliceFilter.h

 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.

 =========================================================================*/
/**
 * @class   vtkAMRSliceFilter
 *
 *
 *  A concrete instance of vtkOverlappingAMRAlgorithm which implements
 *  functionality for extracting slices from AMR data. Unlike the conventional
 *  slice filter, the output of this filter is a 2-D AMR dataset itself.
*/

#ifndef vtkAMRSliceFilter_h
#define vtkAMRSliceFilter_h

#include "vtkFiltersAMRModule.h" // For export macro
#include "vtkOverlappingAMRAlgorithm.h"

#include <vector> // For STL vector

class vtkInformation;
class vtkInformationVector;
class vtkOverlappingAMR;
class vtkMultiProcessController;
class vtkPlane;
class vtkAMRBox;
class vtkUniformGrid;

class VTKFILTERSAMR_EXPORT vtkAMRSliceFilter :
  public vtkOverlappingAMRAlgorithm
{
public:
  static vtkAMRSliceFilter* New();
  vtkTypeMacro( vtkAMRSliceFilter, vtkOverlappingAMRAlgorithm );
  void PrintSelf(ostream &os, vtkIndent indent );

  // Inline Gettters & Setters
  vtkSetMacro(OffSetFromOrigin,double);
  vtkGetMacro(OffSetFromOrigin,double);

  //@{
  /**
   * Set/Get ForwardUpstream property
   */
  vtkSetMacro( ForwardUpstream, int );
  vtkGetMacro( ForwardUpstream, int );
  vtkBooleanMacro( ForwardUpstream, int );
  //@}

  //@{
  /**
   * Set/Get EnablePrefetching property
   */
  vtkSetMacro( EnablePrefetching, int );
  vtkGetMacro( EnablePrefetching, int );
  vtkBooleanMacro( EnablePrefetching, int );
  //@}

  //@{
  /**
   * Set/Get the maximum resolution used in this instance.
   */
  vtkSetMacro(MaxResolution,int);
  vtkGetMacro(MaxResolution,int);
  //@}

  //@{
  /**
   * Set/Get the Axis normal. There are only 3 acceptable values
   * 1-(X-Normal); 2-(Y-Normal); 3-(Z-Normal)
   */
  vtkSetMacro(Normal,int);
  vtkGetMacro(Normal,int);
  //@}

  //@{
  /**
   * Set/Get a multiprocess controller for paralle processing.
   * By default this parameter is set to NULL by the constructor.
   */
  vtkSetMacro( Controller, vtkMultiProcessController* );
  vtkGetMacro( Controller, vtkMultiProcessController* );
  //@}

  // Standard Pipeline methods
  virtual int RequestData(
     vtkInformation*,vtkInformationVector**,vtkInformationVector*);
  virtual int FillInputPortInformation(int port, vtkInformation *info);
  virtual int FillOutputPortInformation(int port, vtkInformation *info);

  /**
   * Makes upstream request to a source, typically, a concrete instance of
   * vtkAMRBaseReader, for which blocks to load.
   */
  virtual int RequestInformation(
      vtkInformation *rqst,
      vtkInformationVector **inputVector,
      vtkInformationVector *outputVector );

  /**
   * Performs upstream requests to the reader
   */
  virtual int RequestUpdateExtent(
      vtkInformation*, vtkInformationVector**,vtkInformationVector* );

protected:
  vtkAMRSliceFilter();
  ~vtkAMRSliceFilter();

  /**
   * Returns the cell index w.r.t. the given input grid which contains
   * the query point x. A -1 is returned if the point is not found.
   */
  int GetDonorCellIdx( double x[3], vtkUniformGrid *ug );

  /**
   * Computes the cell center of the cell corresponding to the supplied
   * cell index w.r.t. the input uniform grid.
   */
  void ComputeCellCenter(
      vtkUniformGrid *ug, const int cellIdx, double centroid[3] );

  /**
   * Gets the slice from the given grid given the plane origin & the
   * user-supplied normal associated with this class instance.
   */
  vtkUniformGrid* GetSlice( double origin[3], int* dims, double* gorigin, double* spacing );

  /**
   * Copies the cell data for the cells in the slice from the 3-D grid.
   */
  void GetSliceCellData( vtkUniformGrid *slice, vtkUniformGrid *grid3D );

  /**
   * Determines if a plane intersects with an AMR box
   */
  bool PlaneIntersectsAMRBox( double plane[4], double bounds[6] );

  /**
   * Given the cut-plane and the metadata provided by a module upstream,
   * this method generates the list of linear AMR block indices that need
   * to be loaded.
   */
  void ComputeAMRBlocksToLoad(
      vtkPlane *p, vtkOverlappingAMR *metadata );

  /**
   * Extracts a 2-D AMR slice from the dataset.
   */
  void GetAMRSliceInPlane(
      vtkPlane *p, vtkOverlappingAMR *inp,
      vtkOverlappingAMR *out );

  /**
   * A utility function that checks if the input AMR data is 2-D.
   */
  bool IsAMRData2D( vtkOverlappingAMR *input );

  /**
   * Returns the axis-aligned cut plane.
   */
  vtkPlane* GetCutPlane( vtkOverlappingAMR *input );

  /**
   * Initializes the off-set to be at the center of the input data-set.
   */
  void InitializeOffSet(
    vtkOverlappingAMR *inp, double *min, double *max );

  double OffSetFromOrigin;
  int    Normal; // 1=>X-Normal, 2=>Y-Normal, 3=>Z-Normal
  bool   initialRequest;
  int    MaxResolution;
  vtkMultiProcessController *Controller;

  int ForwardUpstream;
  int EnablePrefetching;

  std::vector< int > BlocksToLoad;

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

#endif /* vtkAMRSliceFilter_h */