VTK  9.3.20240329
vtkAMRSliceFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkAMRSliceFilter_h
16 #define vtkAMRSliceFilter_h
17 
18 #include "vtkFiltersAMRModule.h" // For export macro
20 
21 #include <vector> // For STL vector
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkInformation;
26 class vtkOverlappingAMR;
28 class vtkPlane;
29 class vtkAMRBox;
30 class vtkUniformGrid;
31 
32 class VTKFILTERSAMR_EXPORT vtkAMRSliceFilter : public vtkOverlappingAMRAlgorithm
33 {
34 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
39  // Inline Getters & Setters
40 
42 
45  vtkSetMacro(OffsetFromOrigin, double);
46  vtkGetMacro(OffsetFromOrigin, double);
48 
50 
53  vtkSetMacro(MaxResolution, unsigned int);
54  vtkGetMacro(MaxResolution, unsigned int);
56 
60  enum NormalTag : char
61  {
62  X_NORMAL = 1,
63  Y_NORMAL = 2,
64  Z_NORMAL = 4
65  };
66 
68 
72  vtkSetMacro(Normal, int);
73  vtkGetMacro(Normal, int);
75 
77 
82  vtkGetObjectMacro(Controller, vtkMultiProcessController);
84 
85  // Standard Pipeline methods
89 
95  vtkInformationVector* outputVector) override;
96 
101 
102 protected:
104  ~vtkAMRSliceFilter() override;
105 
110  int GetDonorCellIdx(double x[3], vtkUniformGrid* ug);
111 
116  int GetDonorPointIdx(double x[3], vtkUniformGrid* ug);
117 
122  void ComputeCellCenter(vtkUniformGrid* ug, int cellIdx, double centroid[3]);
123 
128  vtkUniformGrid* GetSlice(double origin[3], int* dims, double* gorigin, double* spacing);
129 
134 
139 
143  bool PlaneIntersectsAMRBox(double plane[4], double bounds[6]);
144 
151 
156 
161 
166 
168  int Normal;
169  unsigned int MaxResolution;
171 
172  std::vector<int> BlocksToLoad;
173 
174 private:
175  vtkAMRSliceFilter(const vtkAMRSliceFilter&) = delete;
176  void operator=(const vtkAMRSliceFilter&) = delete;
177 };
178 
179 VTK_ABI_NAMESPACE_END
180 #endif /* vtkAMRSliceFilter_h */
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:68
A concrete instance of vtkOverlappingAMRAlgorithm which implements functionality for extracting slice...
bool IsAMRData2D(vtkOverlappingAMR *input)
A utility function that checks if the input AMR data is 2-D.
void ComputeAMRBlocksToLoad(vtkPlane *p, vtkOverlappingAMR *metadata)
Given the cut-plane and the metadata provided by a module upstream, this method generates the list of...
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Performs upstream requests to the reader.
void GetSlicePointData(vtkUniformGrid *slice, vtkUniformGrid *grid3D)
Copies the point data for the cells in the slice from the 3-D grid.
void GetSliceCellData(vtkUniformGrid *slice, vtkUniformGrid *grid3D)
Copies the cell data for the cells in the slice from the 3-D grid.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkAMRSliceFilter * New()
vtkMultiProcessController * Controller
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int FillInputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
int FillOutputPortInformation(int port, vtkInformation *info) override
See algorithm for more info.
vtkPlane * GetCutPlane(vtkOverlappingAMR *input)
Returns the axis-aligned cut plane.
bool PlaneIntersectsAMRBox(double plane[4], double bounds[6])
Determines if a plane intersects with an AMR box.
int GetDonorCellIdx(double x[3], vtkUniformGrid *ug)
Returns the cell index w.r.t.
void ComputeCellCenter(vtkUniformGrid *ug, int cellIdx, double centroid[3])
Computes the cell center of the cell corresponding to the supplied cell index w.r....
std::vector< int > BlocksToLoad
int GetDonorPointIdx(double x[3], vtkUniformGrid *ug)
Returns the point index w.r.t.
~vtkAMRSliceFilter() override
vtkUniformGrid * GetSlice(double origin[3], int *dims, double *gorigin, double *spacing)
Gets the slice from the given grid given the plane origin & the user-supplied normal associated with ...
NormalTag
Tags to identify normals along the X, Y and Z directions.
virtual void SetController(vtkMultiProcessController *)
Set/Get a multiprocess controller for parallel processing.
void GetAMRSliceInPlane(vtkPlane *p, vtkOverlappingAMR *inp, vtkOverlappingAMR *out)
Extracts a 2-D AMR slice from the dataset.
unsigned int MaxResolution
int RequestInformation(vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Makes upstream request to a source, typically, a concrete instance of vtkAMRBaseReader,...
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
A base class for all algorithms that take as input vtkOverlappingAMR and produce vtkOverlappingAMR.
hierarchical dataset of vtkUniformGrids
perform various plane computations
Definition: vtkPlane.h:135
image data with blanking
@ Normal
Definition: vtkX3D.h:45
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ spacing
Definition: vtkX3D.h:481