VTK  9.7.1
vtkAMRResampleFilter.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
27 #ifndef vtkAMRResampleFilter_h
28 #define vtkAMRResampleFilter_h
29 
30 #include "vtkFiltersAMRModule.h" // For export macro
32 #include <vector> // For STL vector
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkInformation;
37 class vtkUniformGrid;
38 class vtkOverlappingAMR;
41 class vtkFieldData;
42 class vtkCellData;
43 class vtkPointData;
44 class vtkIndent;
45 
46 class vtkAMRBox;
47 class VTKFILTERSAMR_EXPORT vtkAMRResampleFilter : public vtkMultiBlockDataSetAlgorithm
48 {
49 public:
50  static vtkAMRResampleFilter* New();
52  void PrintSelf(ostream& oss, vtkIndent indent) override;
53 
55 
59  vtkSetVector3Macro(NumberOfSamples, int);
60  vtkGetVector3Macro(NumberOfSamples, int);
62 
64 
67  vtkSetMacro(TransferToNodes, vtkTypeBool);
68  vtkGetMacro(TransferToNodes, vtkTypeBool);
70 
72 
76  vtkSetMacro(DemandDrivenMode, int);
77  vtkGetMacro(DemandDrivenMode, int);
79 
81 
84  vtkSetMacro(NumberOfPartitions, int);
85  vtkGetMacro(NumberOfPartitions, int);
87 
89 
92  vtkSetVector3Macro(Min, double);
93  vtkGetVector3Macro(Min, double);
95 
97 
100  vtkSetVector3Macro(Max, double);
101  vtkGetVector3Macro(Max, double);
103 
105 
108  vtkSetMacro(UseBiasVector, bool);
109  vtkGetMacro(UseBiasVector, bool);
111 
113 
118  vtkSetVector3Macro(BiasVector, double);
119  vtkGetVector3Macro(BiasVector, double);
121 
123 
126  virtual void SetController(vtkMultiProcessController*);
127  vtkGetObjectMacro(Controller, vtkMultiProcessController);
129 
130  // Standard pipeline routines
131 
136  int RequestInformation(vtkInformation* rqst, vtkInformationVector** inputVector,
137  vtkInformationVector* outputVector) override;
138 
140  int FillInputPortInformation(int port, vtkInformation* info) override;
142 
147 
148 protected:
150  ~vtkAMRResampleFilter() override;
151 
153  vtkMultiBlockDataSet* ROI; // Pointer to the region of interest.
154  int NumberOfSamples[3];
155  int GridNumberOfSamples[3];
156  double Min[3];
157  double Max[3];
158  double GridMin[3];
159  double GridMax[3];
166  double BiasVector[3];
167 
168  // Debugging Stuff
176  double AverageLevel;
177 
178  std::vector<int> BlocksToLoad; // Holds the ids of the blocks to load.
179 
183  bool IsParallel();
184 
189  bool IsRegionMine(int regionIdx);
190 
195  int GetRegionProcessId(int regionIdx);
196 
200  void ComputeCellCentroid(vtkUniformGrid* g, vtkIdType cellIdx, double c[3]);
201 
208  void InitializeFields(vtkFieldData* f, vtkIdType size, vtkCellData* src);
209 
213  void CopyData(vtkFieldData* target, vtkIdType targetIdx, vtkCellData* src, vtkIdType srcIdx);
214 
219  bool FoundDonor(double q[3], vtkUniformGrid*& donorGrid, int& cellIdx);
220 
226  bool SearchForDonorGridAtLevel(double q[3], vtkOverlappingAMR* amrds, unsigned int level,
227  unsigned int& gridId, int& donorCellIdx);
228 
235  int ProbeGridPointInAMR(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
236  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool hadDonorGrid);
237 
244  int ProbeGridPointInAMRGraph(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
245  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool useCached);
246 
251  void TransferToCellCenters(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
252 
257  void TransferToGridNodes(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
258 
262  void TransferSolution(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
263 
267  void ExtractRegion(
268  vtkOverlappingAMR* amrds, vtkMultiBlockDataSet* mbds, vtkOverlappingAMR* metadata);
269 
274  bool IsBlockWithinBounds(double* grd);
275 
281  void ComputeAMRBlocksToLoad(vtkOverlappingAMR* metadata);
282 
286  void ComputeRegionParameters(
287  vtkOverlappingAMR* amrds, int N[3], double min[3], double max[3], double h[3]);
288 
292  void GetDomainParameters(vtkOverlappingAMR* amr, double domainMin[3], double domainMax[3],
293  double h[3], int dims[3], double& rf);
294 
298  bool RegionIntersectsWithAMR(
299  double domainMin[3], double domainMax[3], double regionMin[3], double regionMax[3]);
300 
305  void AdjustNumberOfSamplesInRegion(const double Rh[3], const bool outside[6], int N[3]);
306 
312  void ComputeLevelOfResolution(const int N[3], const double h0[3], const double L[3], double rf);
313 
320  void SnapBounds(const double h0[3], const double domainMin[3], const double domainMax[3],
321  const int dims[3], bool outside[6]);
322 
328  void ComputeAndAdjustRegionParameters(vtkOverlappingAMR* amrds, double h[3]);
329 
333  void GetRegion(double h[3]);
334 
338  bool GridsIntersect(double* g1, double* g2);
339 
343  vtkUniformGrid* GetReferenceGrid(vtkOverlappingAMR* amrds);
344 
358  void SearchGridDecendants(double q[3], vtkOverlappingAMR* amrds, unsigned int maxLevel,
359  unsigned int& level, unsigned int& gridId, int& id);
360 
365  bool SearchGridAncestors(
366  double q[3], vtkOverlappingAMR* amrds, unsigned int& level, unsigned int& gridId, int& id);
367 
368 private:
370  void operator=(const vtkAMRResampleFilter&) = delete;
371 };
372 
373 VTK_ABI_NAMESPACE_END
374 #endif /* vtkAMRResampleFilter_h */
vtkMultiProcessController * Controller
represent and manipulate point attribute data
Definition: vtkPointData.h:30
vtkOverlappingAMR * AMRMetaData
vtkMultiBlockDataSet * ROI
Store vtkAlgorithm input/output information.
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:29
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
int vtkIdType
Definition: vtkType.h:363
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
std::vector< int > BlocksToLoad
static vtkMultiBlockDataSetAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
This filter is a concrete instance of vtkMultiBlockDataSetAlgorithm and provides functionality for ex...
a simple class to control print indentation
Definition: vtkIndent.h:28
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Deprecated vtkImageData.
Composite dataset that organizes datasets into blocks.
a multi-resolution dataset based on vtkCartesianGrid allowing overlaps
Store zero or more vtkInformation instances.
#define max(a, b)
Represents and manipulates a collection of data arrays.
Definition: vtkFieldData.h:51
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Multiprocessing communication superclass.