VTK  9.2.6
vtkAMRResampleFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMRResampleFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14  =========================================================================*/
36 #ifndef vtkAMRResampleFilter_h
37 #define vtkAMRResampleFilter_h
38 
39 #include "vtkFiltersAMRModule.h" // For export macro
41 #include <vector> // For STL vector
42 
43 class vtkInformation;
45 class vtkUniformGrid;
46 class vtkOverlappingAMR;
49 class vtkFieldData;
50 class vtkCellData;
51 class vtkPointData;
52 class vtkIndent;
53 
54 class vtkAMRBox;
55 class VTKFILTERSAMR_EXPORT vtkAMRResampleFilter : public vtkMultiBlockDataSetAlgorithm
56 {
57 public:
58  static vtkAMRResampleFilter* New();
60  void PrintSelf(ostream& oss, vtkIndent indent) override;
61 
63 
67  vtkSetVector3Macro(NumberOfSamples, int);
68  vtkGetVector3Macro(NumberOfSamples, int);
70 
72 
75  vtkSetMacro(TransferToNodes, int);
76  vtkGetMacro(TransferToNodes, int);
78 
80 
84  vtkSetMacro(DemandDrivenMode, int);
85  vtkGetMacro(DemandDrivenMode, int);
87 
89 
92  vtkSetMacro(NumberOfPartitions, int);
93  vtkGetMacro(NumberOfPartitions, int);
95 
97 
100  vtkSetVector3Macro(Min, double);
101  vtkGetVector3Macro(Min, double);
103 
105 
108  vtkSetVector3Macro(Max, double);
109  vtkGetVector3Macro(Max, double);
111 
113 
116  vtkSetMacro(UseBiasVector, bool);
117  vtkGetMacro(UseBiasVector, bool);
119 
121 
126  vtkSetVector3Macro(BiasVector, double);
127  vtkGetVector3Macro(BiasVector, double);
129 
131 
134  virtual void SetController(vtkMultiProcessController*);
135  vtkGetObjectMacro(Controller, vtkMultiProcessController);
137 
138  // Standard pipeline routines
139 
144  int RequestInformation(vtkInformation* rqst, vtkInformationVector** inputVector,
145  vtkInformationVector* outputVector) override;
146 
148  int FillInputPortInformation(int port, vtkInformation* info) override;
150 
155 
156 protected:
158  ~vtkAMRResampleFilter() override;
159 
161  vtkMultiBlockDataSet* ROI; // Pointer to the region of interest.
162  int NumberOfSamples[3];
163  int GridNumberOfSamples[3];
164  double Min[3];
165  double Max[3];
166  double GridMin[3];
167  double GridMax[3];
174  double BiasVector[3];
175 
176  // Debugging Stuff
184  double AverageLevel;
185 
186  std::vector<int> BlocksToLoad; // Holds the ids of the blocks to load.
187 
191  bool IsParallel();
192 
197  bool IsRegionMine(const int regionIdx);
198 
203  int GetRegionProcessId(const int regionIdx);
204 
208  void ComputeCellCentroid(vtkUniformGrid* g, const vtkIdType cellIdx, double c[3]);
209 
216  void InitializeFields(vtkFieldData* f, vtkIdType size, vtkCellData* src);
217 
221  void CopyData(vtkFieldData* target, vtkIdType targetIdx, vtkCellData* src, vtkIdType srcIdx);
222 
227  bool FoundDonor(double q[3], vtkUniformGrid*& donorGrid, int& cellIdx);
228 
234  bool SearchForDonorGridAtLevel(double q[3], vtkOverlappingAMR* amrds, unsigned int level,
235  unsigned int& gridId, int& donorCellIdx);
236 
243  int ProbeGridPointInAMR(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
244  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool hadDonorGrid);
245 
252  int ProbeGridPointInAMRGraph(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
253  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool useCached);
254 
259  void TransferToCellCenters(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
260 
265  void TransferToGridNodes(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
266 
270  void TransferSolution(vtkUniformGrid* g, vtkOverlappingAMR* amrds);
271 
275  void ExtractRegion(
276  vtkOverlappingAMR* amrds, vtkMultiBlockDataSet* mbds, vtkOverlappingAMR* metadata);
277 
282  bool IsBlockWithinBounds(double* grd);
283 
289  void ComputeAMRBlocksToLoad(vtkOverlappingAMR* metadata);
290 
294  void ComputeRegionParameters(
295  vtkOverlappingAMR* amrds, int N[3], double min[3], double max[3], double h[3]);
296 
300  void GetDomainParameters(vtkOverlappingAMR* amr, double domainMin[3], double domainMax[3],
301  double h[3], int dims[3], double& rf);
302 
306  bool RegionIntersectsWithAMR(
307  double domainMin[3], double domainMax[3], double regionMin[3], double regionMax[3]);
308 
313  void AdjustNumberOfSamplesInRegion(const double Rh[3], const bool outside[6], int N[3]);
314 
320  void ComputeLevelOfResolution(
321  const int N[3], const double h0[3], const double L[3], const double rf);
322 
329  void SnapBounds(const double h0[3], const double domainMin[3], const double domainMax[3],
330  const int dims[3], bool outside[6]);
331 
337  void ComputeAndAdjustRegionParameters(vtkOverlappingAMR* amrds, double h[3]);
338 
342  void GetRegion(double h[3]);
343 
347  bool GridsIntersect(double* g1, double* g2);
348 
352  vtkUniformGrid* GetReferenceGrid(vtkOverlappingAMR* amrds);
353 
367  void SearchGridDecendants(double q[3], vtkOverlappingAMR* amrds, unsigned int maxLevel,
368  unsigned int& level, unsigned int& gridId, int& id);
369 
374  bool SearchGridAncestors(
375  double q[3], vtkOverlappingAMR* amrds, unsigned int& level, unsigned int& gridId, int& id);
376 
377 private:
379  void operator=(const vtkAMRResampleFilter&) = delete;
380 };
381 
382 #endif /* vtkAMRResampleFilter_h */
vtkMultiProcessController * Controller
represent and manipulate point attribute data
Definition: vtkPointData.h:41
vtkOverlappingAMR * AMRMetaData
vtkMultiBlockDataSet * ROI
Store vtkAlgorithm input/output information.
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:39
represent and manipulate cell attribute data
Definition: vtkCellData.h:41
int vtkIdType
Definition: vtkType.h:332
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()
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:39
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:62
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Multiprocessing communication superclass.