VTK  9.3.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
24 #ifndef vtkAMRResampleFilter_h
25 #define vtkAMRResampleFilter_h
26 
27 #include "vtkFiltersAMRModule.h" // For export macro
29 #include <vector> // For STL vector
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkInformation;
34 class vtkUniformGrid;
35 class vtkOverlappingAMR;
38 class vtkFieldData;
39 class vtkCellData;
40 class vtkPointData;
41 class vtkIndent;
42 
43 class vtkAMRBox;
44 class VTKFILTERSAMR_EXPORT vtkAMRResampleFilter : public vtkMultiBlockDataSetAlgorithm
45 {
46 public:
47  static vtkAMRResampleFilter* New();
49  void PrintSelf(ostream& oss, vtkIndent indent) override;
50 
52 
56  vtkSetVector3Macro(NumberOfSamples, int);
57  vtkGetVector3Macro(NumberOfSamples, int);
59 
61 
64  vtkSetMacro(TransferToNodes, vtkTypeBool);
65  vtkGetMacro(TransferToNodes, vtkTypeBool);
67 
69 
73  vtkSetMacro(DemandDrivenMode, int);
74  vtkGetMacro(DemandDrivenMode, int);
76 
78 
81  vtkSetMacro(NumberOfPartitions, int);
82  vtkGetMacro(NumberOfPartitions, int);
84 
86 
89  vtkSetVector3Macro(Min, double);
90  vtkGetVector3Macro(Min, double);
92 
94 
97  vtkSetVector3Macro(Max, double);
98  vtkGetVector3Macro(Max, double);
100 
102 
105  vtkSetMacro(UseBiasVector, bool);
106  vtkGetMacro(UseBiasVector, bool);
108 
110 
115  vtkSetVector3Macro(BiasVector, double);
116  vtkGetVector3Macro(BiasVector, double);
118 
120 
123  virtual void SetController(vtkMultiProcessController*);
124  vtkGetObjectMacro(Controller, vtkMultiProcessController);
126 
127  // Standard pipeline routines
128 
133  int RequestInformation(vtkInformation* rqst, vtkInformationVector** inputVector,
134  vtkInformationVector* outputVector) override;
135 
137  int FillInputPortInformation(int port, vtkInformation* info) override;
139 
144 
145 protected:
147  ~vtkAMRResampleFilter() override;
148 
150  vtkMultiBlockDataSet* ROI; // Pointer to the region of interest.
151  int NumberOfSamples[3];
152  int GridNumberOfSamples[3];
153  double Min[3];
154  double Max[3];
155  double GridMin[3];
156  double GridMax[3];
163  double BiasVector[3];
164 
165  // Debugging Stuff
173  double AverageLevel;
174 
175  std::vector<int> BlocksToLoad; // Holds the ids of the blocks to load.
176 
180  bool IsParallel();
181 
186  bool IsRegionMine(int regionIdx);
187 
192  int GetRegionProcessId(int regionIdx);
193 
197  void ComputeCellCentroid(vtkUniformGrid* g, vtkIdType cellIdx, double c[3]);
198 
205  void InitializeFields(vtkFieldData* f, vtkIdType size, vtkCellData* src);
206 
210  void CopyData(vtkFieldData* target, vtkIdType targetIdx, vtkCellData* src, vtkIdType srcIdx);
211 
216  bool FoundDonor(double q[3], vtkUniformGrid*& donorGrid, int& cellIdx);
217 
223  bool SearchForDonorGridAtLevel(double q[3], vtkOverlappingAMR* amrds, unsigned int level,
224  unsigned int& gridId, int& donorCellIdx);
225 
232  int ProbeGridPointInAMR(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
233  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool hadDonorGrid);
234 
241  int ProbeGridPointInAMRGraph(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
242  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool useCached);
243 
248  void TransferToCellCenters(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
249 
254  void TransferToGridNodes(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
255 
259  void TransferSolution(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
260 
264  void ExtractRegion(
265  vtkOverlappingAMR* amrds, vtkMultiBlockDataSet* mbds, vtkOverlappingAMR* metadata);
266 
271  bool IsBlockWithinBounds(double* grd);
272 
278  void ComputeAMRBlocksToLoad(vtkOverlappingAMR* metadata);
279 
283  void ComputeRegionParameters(
284  vtkOverlappingAMR* amrds, int N[3], double min[3], double max[3], double h[3]);
285 
289  void GetDomainParameters(vtkOverlappingAMR* amr, double domainMin[3], double domainMax[3],
290  double h[3], int dims[3], double& rf);
291 
295  bool RegionIntersectsWithAMR(
296  double domainMin[3], double domainMax[3], double regionMin[3], double regionMax[3]);
297 
302  void AdjustNumberOfSamplesInRegion(const double Rh[3], const bool outside[6], int N[3]);
303 
309  void ComputeLevelOfResolution(const int N[3], const double h0[3], const double L[3], double rf);
310 
317  void SnapBounds(const double h0[3], const double domainMin[3], const double domainMax[3],
318  const int dims[3], bool outside[6]);
319 
325  void ComputeAndAdjustRegionParameters(vtkOverlappingAMR* amrds, double h[3]);
326 
330  void GetRegion(double h[3]);
331 
335  bool GridsIntersect(double* g1, double* g2);
336 
340  vtkUniformGrid* GetReferenceGrid(vtkOverlappingAMR* amrds);
341 
355  void SearchGridDecendants(double q[3], vtkOverlappingAMR* amrds, unsigned int maxLevel,
356  unsigned int& level, unsigned int& gridId, int& id);
357 
362  bool SearchGridAncestors(
363  double q[3], vtkOverlappingAMR* amrds, unsigned int& level, unsigned int& gridId, int& id);
364 
365 private:
367  void operator=(const vtkAMRResampleFilter&) = delete;
368 };
369 
370 VTK_ABI_NAMESPACE_END
371 #endif /* vtkAMRResampleFilter_h */
vtkMultiProcessController * Controller
represent and manipulate point attribute data
Definition: vtkPointData.h:29
vtkOverlappingAMR * AMRMetaData
vtkMultiBlockDataSet * ROI
Store vtkAlgorithm input/output information.
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:28
represent and manipulate cell attribute data
Definition: vtkCellData.h:30
int vtkIdType
Definition: vtkType.h:315
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.
image data with blanking
Composite dataset that organizes datasets into blocks.
hierarchical dataset of vtkUniformGrids
Store zero or more vtkInformation instances.
#define max(a, b)
represent and manipulate fields of data
Definition: vtkFieldData.h:51
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Multiprocessing communication superclass.