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  =========================================================================*/
33 #ifndef vtkAMRResampleFilter_h
34 #define vtkAMRResampleFilter_h
35 
36 #include "vtkFiltersAMRModule.h" // For export macro
38 #include <vector> // For STL vector
39 
40 class vtkInformation;
42 class vtkUniformGrid;
43 class vtkOverlappingAMR;
46 class vtkFieldData;
47 class vtkCellData;
48 class vtkPointData;
49 class vtkIndent;
50 
51 class vtkAMRBox;
52 class VTKFILTERSAMR_EXPORT vtkAMRResampleFilter : public vtkMultiBlockDataSetAlgorithm
53 {
54 public:
55  static vtkAMRResampleFilter *New();
57  void PrintSelf(ostream &oss, vtkIndent indent) override;
58 
60 
64  vtkSetVector3Macro(NumberOfSamples,int);
65  vtkGetVector3Macro(NumberOfSamples,int);
67 
69 
72  vtkSetMacro(TransferToNodes,int);
73  vtkGetMacro(TransferToNodes,int);
75 
77 
81  vtkSetMacro(DemandDrivenMode,int);
82  vtkGetMacro(DemandDrivenMode,int);
84 
86 
89  vtkSetMacro(NumberOfPartitions,int);
90  vtkGetMacro(NumberOfPartitions,int);
92 
94 
97  vtkSetVector3Macro(Min,double);
98  vtkGetVector3Macro(Min,double);
100 
102 
105  vtkSetVector3Macro(Max,double);
106  vtkGetVector3Macro(Max,double);
108 
110 
113  vtkSetMacro(UseBiasVector,bool);
114  vtkGetMacro(UseBiasVector,bool);
116 
118 
123  vtkSetVector3Macro(BiasVector,double);
124  vtkGetVector3Macro(BiasVector,double);
126 
128 
131  vtkSetMacro(Controller, vtkMultiProcessController*);
132  vtkGetMacro(Controller, vtkMultiProcessController*);
134 
135  // Standard pipeline routines
136 
141  int RequestInformation(
142  vtkInformation *rqst,
143  vtkInformationVector **inputVector,
144  vtkInformationVector *outputVector ) override;
145 
146  int RequestData(
148  int FillInputPortInformation(int port, vtkInformation *info) override;
150 
156 
157 
158 protected:
160  ~vtkAMRResampleFilter() override;
161 
163  vtkMultiBlockDataSet *ROI; // Pointer to the region of interest.
164  int NumberOfSamples[3];
165  int GridNumberOfSamples[3];
166  double Min[3];
167  double Max[3];
168  double GridMin[3];
169  double GridMax[3];
176  double BiasVector[3];
177 
178  // Debugging Stuff
186  double AverageLevel;
187 
188  std::vector< int > BlocksToLoad; // Holds the ids of the blocks to load.
189 
193  bool IsParallel();
194 
199  bool IsRegionMine( const int regionIdx );
200 
205  int GetRegionProcessId( const int regionIdx );
206 
210  void ComputeCellCentroid(
211  vtkUniformGrid *g, const vtkIdType cellIdx, double c[3] );
212 
219  void InitializeFields( vtkFieldData *f, vtkIdType size, vtkCellData *src );
220 
224  void CopyData( vtkFieldData *target, vtkIdType targetIdx,
225  vtkCellData *src, vtkIdType srcIdx );
226 
231  bool FoundDonor(double q[3],vtkUniformGrid *&donorGrid,int &cellIdx);
232 
233 
239  bool SearchForDonorGridAtLevel(
240  double q[3], vtkOverlappingAMR *amrds,
241  unsigned int level, unsigned int& gridId,
242  int &donorCellIdx);
243 
250  int ProbeGridPointInAMR(
251  double q[3], unsigned int &donorLevel, unsigned int& donorGridId,
252  vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
253 
260  int ProbeGridPointInAMRGraph(double q[3],
261  unsigned int &donorLevel, unsigned int &donorGridId,
262  vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
263 
268  void TransferToCellCenters(
269  vtkUniformGrid *g, vtkOverlappingAMR *amrds );
270 
275  void TransferToGridNodes(
276  vtkUniformGrid *g, vtkOverlappingAMR *amrds );
277 
281  void TransferSolution(
282  vtkUniformGrid *g, vtkOverlappingAMR *amrds);
283 
287  void ExtractRegion(
289  vtkOverlappingAMR *metadata );
290 
295  bool IsBlockWithinBounds( double *grd );
296 
302  void ComputeAMRBlocksToLoad( vtkOverlappingAMR *metadata );
303 
307  void ComputeRegionParameters(
308  vtkOverlappingAMR *amrds,
309  int N[3], double min[3], double max[3], double h[3] );
310 
314  void GetDomainParameters(
315  vtkOverlappingAMR *amr,
316  double domainMin[3], double domainMax[3], double h[3],
317  int dims[3], double &rf );
318 
322  bool RegionIntersectsWithAMR(
323  double domainMin[3], double domainMax[3],
324  double regionMin[3], double regionMax[3] );
325 
330  void AdjustNumberOfSamplesInRegion(const double Rh[3],
331  const bool outside[6], int N[3] );
332 
338  void ComputeLevelOfResolution(
339  const int N[3], const double h0[3], const double L[3], const double rf);
340 
347  void SnapBounds(
348  const double h0[3], const double domainMin[3], const double domainMax[3],
349  const int dims[3], bool outside[6] );
350 
356  void ComputeAndAdjustRegionParameters(
357  vtkOverlappingAMR *amrds, double h[3] );
358 
362  void GetRegion( double h[3] );
363 
367  bool GridsIntersect( double *g1, double *g2 );
368 
372  vtkUniformGrid* GetReferenceGrid( vtkOverlappingAMR *amrds );
373 
387  void SearchGridDecendants(double q[3],
388  vtkOverlappingAMR *amrds,
389  unsigned int maxLevel,
390  unsigned int &level,
391  unsigned int &gridId,
392  int &id);
393 
398  bool SearchGridAncestors(double q[3],
399  vtkOverlappingAMR *amrds,
400  unsigned int &level,
401  unsigned int &gridId,
402  int &id);
403 
404 
405 private:
407  void operator=(const vtkAMRResampleFilter&) = delete;
408 
409 };
410 
411 #endif /* vtkAMRResampleFilter_h */
vtkAMRBox
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:33
vtkAMRResampleFilter::AMRMetaData
vtkOverlappingAMR * AMRMetaData
Definition: vtkAMRResampleFilter.h:162
vtkAMRResampleFilter::NumberOfTimesLevelUp
int NumberOfTimesLevelUp
Definition: vtkAMRResampleFilter.h:183
vtkAMRResampleFilter::ROI
vtkMultiBlockDataSet * ROI
Definition: vtkAMRResampleFilter.h:163
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:31
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkAMRResampleFilter::NumberOfTimesFoundOnDonorLevel
int NumberOfTimesFoundOnDonorLevel
Definition: vtkAMRResampleFilter.h:182
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkAMRResampleFilter::UseBiasVector
bool UseBiasVector
Definition: vtkAMRResampleFilter.h:175
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:34
vtkAMRResampleFilter::AverageLevel
double AverageLevel
Definition: vtkAMRResampleFilter.h:186
vtkMultiBlockDataSetAlgorithm::New
static vtkMultiBlockDataSetAlgorithm * New()
vtkAMRResampleFilter::NumberOfPartitions
int NumberOfPartitions
Definition: vtkAMRResampleFilter.h:171
vtkAMRResampleFilter::TransferToNodes
int TransferToNodes
Definition: vtkAMRResampleFilter.h:172
vtkMultiBlockDataSetAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkMultiBlockDataSetAlgorithm.h:97
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:45
vtkAMRResampleFilter::LevelOfResolution
int LevelOfResolution
Definition: vtkAMRResampleFilter.h:170
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:53
vtkAMRResampleFilter::NumberOfBlocksVisSkipped
int NumberOfBlocksVisSkipped
Definition: vtkAMRResampleFilter.h:181
vtkMultiBlockDataSetAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkMultiBlockDataSetAlgorithm.h:88
vtkAMRResampleFilter::NumberOfFailedPoints
int NumberOfFailedPoints
Definition: vtkAMRResampleFilter.h:185
vtkX3D::level
Definition: vtkX3D.h:395
vtkX3D::port
Definition: vtkX3D.h:447
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:76
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkX3D::size
Definition: vtkX3D.h:253
vtkMultiBlockDataSetAlgorithm.h
vtkAMRResampleFilter::BlocksToLoad
std::vector< int > BlocksToLoad
Definition: vtkAMRResampleFilter.h:188
vtkOverlappingAMR
hierarchical dataset of vtkUniformGrids
Definition: vtkOverlappingAMR.h:40
vtkAMRResampleFilter::NumberOfBlocksTestedForLevel
int NumberOfBlocksTestedForLevel
Definition: vtkAMRResampleFilter.h:179
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:80
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:174
vtkAMRResampleFilter::NumberOfBlocksTested
int NumberOfBlocksTested
Definition: vtkAMRResampleFilter.h:180
vtkAMRResampleFilter::DemandDrivenMode
int DemandDrivenMode
Definition: vtkAMRResampleFilter.h:173
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:832
vtkAMRResampleFilter
Definition: vtkAMRResampleFilter.h:52
vtkAMRResampleFilter::NumberOfTimesLevelDown
int NumberOfTimesLevelDown
Definition: vtkAMRResampleFilter.h:184
vtkMultiBlockDataSetAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkMultiBlockDataSetAlgorithm.h:80
h
vtkMultiBlockDataSetAlgorithm
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Definition: vtkMultiBlockDataSetAlgorithm.h:32