VTK
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  vtkSetMacro(Controller, vtkMultiProcessController*);
135  vtkGetMacro(Controller, vtkMultiProcessController*);
137 
138  // Standard pipeline routines
139 
144  int RequestInformation(
145  vtkInformation *rqst,
146  vtkInformationVector **inputVector,
147  vtkInformationVector *outputVector ) override;
148 
149  int RequestData(
151  int FillInputPortInformation(int port, vtkInformation *info) override;
153 
159 
160 
161 protected:
163  ~vtkAMRResampleFilter() override;
164 
166  vtkMultiBlockDataSet *ROI; // Pointer to the region of interest.
167  int NumberOfSamples[3];
168  int GridNumberOfSamples[3];
169  double Min[3];
170  double Max[3];
171  double GridMin[3];
172  double GridMax[3];
179  double BiasVector[3];
180 
181  // Debugging Stuff
189  double AverageLevel;
190 
191  std::vector< int > BlocksToLoad; // Holds the ids of the blocks to load.
192 
196  bool IsParallel();
197 
202  bool IsRegionMine( const int regionIdx );
203 
208  int GetRegionProcessId( const int regionIdx );
209 
213  void ComputeCellCentroid(
214  vtkUniformGrid *g, const vtkIdType cellIdx, double c[3] );
215 
222  void InitializeFields( vtkFieldData *f, vtkIdType size, vtkCellData *src );
223 
227  void CopyData( vtkFieldData *target, vtkIdType targetIdx,
228  vtkCellData *src, vtkIdType srcIdx );
229 
234  bool FoundDonor(double q[3],vtkUniformGrid *&donorGrid,int &cellIdx);
235 
236 
242  bool SearchForDonorGridAtLevel(
243  double q[3], vtkOverlappingAMR *amrds,
244  unsigned int level, unsigned int& gridId,
245  int &donorCellIdx);
246 
253  int ProbeGridPointInAMR(
254  double q[3], unsigned int &donorLevel, unsigned int& donorGridId,
255  vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
256 
263  int ProbeGridPointInAMRGraph(double q[3],
264  unsigned int &donorLevel, unsigned int &donorGridId,
265  vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
266 
271  void TransferToCellCenters(
272  vtkUniformGrid *g, vtkOverlappingAMR *amrds );
273 
278  void TransferToGridNodes(
279  vtkUniformGrid *g, vtkOverlappingAMR *amrds );
280 
284  void TransferSolution(
285  vtkUniformGrid *g, vtkOverlappingAMR *amrds);
286 
290  void ExtractRegion(
292  vtkOverlappingAMR *metadata );
293 
298  bool IsBlockWithinBounds( double *grd );
299 
305  void ComputeAMRBlocksToLoad( vtkOverlappingAMR *metadata );
306 
310  void ComputeRegionParameters(
311  vtkOverlappingAMR *amrds,
312  int N[3], double min[3], double max[3], double h[3] );
313 
317  void GetDomainParameters(
318  vtkOverlappingAMR *amr,
319  double domainMin[3], double domainMax[3], double h[3],
320  int dims[3], double &rf );
321 
325  bool RegionIntersectsWithAMR(
326  double domainMin[3], double domainMax[3],
327  double regionMin[3], double regionMax[3] );
328 
333  void AdjustNumberOfSamplesInRegion(const double Rh[3],
334  const bool outside[6], int N[3] );
335 
341  void ComputeLevelOfResolution(
342  const int N[3], const double h0[3], const double L[3], const double rf);
343 
350  void SnapBounds(
351  const double h0[3], const double domainMin[3], const double domainMax[3],
352  const int dims[3], bool outside[6] );
353 
359  void ComputeAndAdjustRegionParameters(
360  vtkOverlappingAMR *amrds, double h[3] );
361 
365  void GetRegion( double h[3] );
366 
370  bool GridsIntersect( double *g1, double *g2 );
371 
375  vtkUniformGrid* GetReferenceGrid( vtkOverlappingAMR *amrds );
376 
390  void SearchGridDecendants(double q[3],
391  vtkOverlappingAMR *amrds,
392  unsigned int maxLevel,
393  unsigned int &level,
394  unsigned int &gridId,
395  int &id);
396 
401  bool SearchGridAncestors(double q[3],
402  vtkOverlappingAMR *amrds,
403  unsigned int &level,
404  unsigned int &gridId,
405  int &id);
406 
407 
408 private:
410  void operator=(const vtkAMRResampleFilter&) = delete;
411 
412 };
413 
414 #endif /* vtkAMRResampleFilter_h */
vtkAMRBox
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:39
vtkAMRResampleFilter::AMRMetaData
vtkOverlappingAMR * AMRMetaData
Definition: vtkAMRResampleFilter.h:165
vtkAMRResampleFilter::NumberOfTimesLevelUp
int NumberOfTimesLevelUp
Definition: vtkAMRResampleFilter.h:186
vtkAMRResampleFilter::ROI
vtkMultiBlockDataSet * ROI
Definition: vtkAMRResampleFilter.h:166
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:37
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkAMRResampleFilter::NumberOfTimesFoundOnDonorLevel
int NumberOfTimesFoundOnDonorLevel
Definition: vtkAMRResampleFilter.h:185
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkAMRResampleFilter::UseBiasVector
bool UseBiasVector
Definition: vtkAMRResampleFilter.h:178
vtkMultiBlockDataSetAlgorithm::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:40
vtkAMRResampleFilter::AverageLevel
double AverageLevel
Definition: vtkAMRResampleFilter.h:189
vtkMultiBlockDataSetAlgorithm::New
static vtkMultiBlockDataSetAlgorithm * New()
vtkAMRResampleFilter::NumberOfPartitions
int NumberOfPartitions
Definition: vtkAMRResampleFilter.h:174
vtkAMRResampleFilter::TransferToNodes
int TransferToNodes
Definition: vtkAMRResampleFilter.h:175
vtkMultiBlockDataSetAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkMultiBlockDataSetAlgorithm.h:100
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:51
vtkAMRResampleFilter::LevelOfResolution
int LevelOfResolution
Definition: vtkAMRResampleFilter.h:173
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:56
vtkAMRResampleFilter::NumberOfBlocksVisSkipped
int NumberOfBlocksVisSkipped
Definition: vtkAMRResampleFilter.h:184
vtkMultiBlockDataSetAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkMultiBlockDataSetAlgorithm.h:91
vtkAMRResampleFilter::NumberOfFailedPoints
int NumberOfFailedPoints
Definition: vtkAMRResampleFilter.h:188
vtkX3D::level
Definition: vtkX3D.h:395
vtkX3D::port
Definition: vtkX3D.h:447
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:82
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:38
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkX3D::size
Definition: vtkX3D.h:253
vtkMultiBlockDataSetAlgorithm.h
vtkAMRResampleFilter::BlocksToLoad
std::vector< int > BlocksToLoad
Definition: vtkAMRResampleFilter.h:191
vtkOverlappingAMR
hierarchical dataset of vtkUniformGrids
Definition: vtkOverlappingAMR.h:46
vtkAMRResampleFilter::NumberOfBlocksTestedForLevel
int NumberOfBlocksTestedForLevel
Definition: vtkAMRResampleFilter.h:182
vtkMultiBlockDataSetAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkMultiBlockDataSetAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkAMRResampleFilter::Controller
vtkMultiProcessController * Controller
Definition: vtkAMRResampleFilter.h:177
vtkAMRResampleFilter::NumberOfBlocksTested
int NumberOfBlocksTested
Definition: vtkAMRResampleFilter.h:183
vtkAMRResampleFilter::DemandDrivenMode
int DemandDrivenMode
Definition: vtkAMRResampleFilter.h:176
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:832
vtkAMRResampleFilter
Definition: vtkAMRResampleFilter.h:55
vtkAMRResampleFilter::NumberOfTimesLevelDown
int NumberOfTimesLevelDown
Definition: vtkAMRResampleFilter.h:187
vtkMultiBlockDataSetAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkMultiBlockDataSetAlgorithm.h:83
h
vtkMultiBlockDataSetAlgorithm
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Definition: vtkMultiBlockDataSetAlgorithm.h:35