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  =========================================================================*/
35 #ifndef vtkAMRResampleFilter_h
36 #define vtkAMRResampleFilter_h
37 
38 #include "vtkFiltersAMRModule.h" // For export macro
40 #include <vector> // For STL vector
41 
42 class vtkInformation;
44 class vtkUniformGrid;
45 class vtkOverlappingAMR;
48 class vtkFieldData;
49 class vtkCellData;
50 class vtkPointData;
51 class vtkIndent;
52 
53 class vtkAMRBox;
55 {
56 public:
57  static vtkAMRResampleFilter *New();
59  void PrintSelf(ostream &oss, vtkIndent indent);
60 
62 
64  vtkSetVector3Macro(NumberOfSamples,int);
65  vtkGetVector3Macro(NumberOfSamples,int);
67 
69 
70  vtkSetMacro(TransferToNodes,int);
71  vtkGetMacro(TransferToNodes,int);
73 
75 
77  vtkSetMacro(DemandDrivenMode,int);
78  vtkGetMacro(DemandDrivenMode,int);
80 
82 
83  vtkSetMacro(NumberOfPartitions,int);
84  vtkGetMacro(NumberOfPartitions,int);
86 
88 
89  vtkSetVector3Macro(Min,double);
90  vtkGetVector3Macro(Min,double);
92 
94 
95  vtkSetVector3Macro(Max,double);
96  vtkGetVector3Macro(Max,double);
98 
100 
101  vtkSetMacro(UseBiasVector,bool);
102  vtkGetMacro(UseBiasVector,bool);
104 
106 
109  vtkSetVector3Macro(BiasVector,double);
110  vtkGetVector3Macro(BiasVector,double);
112 
114 
115  vtkSetMacro(Controller, vtkMultiProcessController*);
116  vtkGetMacro(Controller, vtkMultiProcessController*);
118 
119  // Standard pipeline routines
120 
122 
124  virtual int RequestInformation(
125  vtkInformation *rqst,
126  vtkInformationVector **inputVector,
127  vtkInformationVector *outputVector );
129 
130  virtual int RequestData(
134 
136 
137  virtual int RequestUpdateExtent(
140 
141 
142 protected:
144  virtual ~vtkAMRResampleFilter();
145 
147  vtkMultiBlockDataSet *ROI; // Pointer to the region of interest.
148  int NumberOfSamples[3];
149  int GridNumberOfSamples[3];
150  double Min[3];
151  double Max[3];
152  double GridMin[3];
153  double GridMax[3];
160  double BiasVector[3];
161 
162  // Debugging Stuff
170  double AverageLevel;
171 // BTX
172  std::vector< int > BlocksToLoad; // Holds the ids of the blocks to load.
173 // ETX
174 
176  bool IsParallel();
177 
180  bool IsRegionMine( const int regionIdx );
181 
184  int GetRegionProcessId( const int regionIdx );
185 
187 
189  void ComputeCellCentroid(
190  vtkUniformGrid *g, const vtkIdType cellIdx, double c[3] );
192 
197  void InitializeFields( vtkFieldData *f, vtkIdType size, vtkCellData *src );
198 
200 
201  void CopyData( vtkFieldData *target, vtkIdType targetIdx,
202  vtkCellData *src, vtkIdType srcIdx );
204 
208  bool FoundDonor(double q[3],vtkUniformGrid *&donorGrid,int &cellIdx);
209 
210 
212 
215  bool SearchForDonorGridAtLevel(
216  double q[3], vtkOverlappingAMR *amrds,
217  unsigned int level, unsigned int& gridId,
218  int &donorCellIdx);
220 
222 
226  int ProbeGridPointInAMR(
227  double q[3], unsigned int &donorLevel, unsigned int& donorGridId,
228  vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
230 
232 
237  int ProbeGridPointInAMRGraph(double q[3],
238  unsigned int &donorLevel, unsigned int &donorGridId,
239  vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
241 
243 
245  void TransferToCellCenters(
246  vtkUniformGrid *g, vtkOverlappingAMR *amrds );
248 
250 
252  void TransferToGridNodes(
253  vtkUniformGrid *g, vtkOverlappingAMR *amrds );
255 
257 
258  void TransferSolution(
259  vtkUniformGrid *g, vtkOverlappingAMR *amrds);
261 
263 
264  void ExtractRegion(
266  vtkOverlappingAMR *metadata );
268 
271  bool IsBlockWithinBounds( double *grd );
272 
276  void ComputeAMRBlocksToLoad( vtkOverlappingAMR *metadata );
277 
279 
280  void ComputeRegionParameters(
281  vtkOverlappingAMR *amrds,
282  int N[3], double min[3], double max[3], double h[3] );
284 
286 
287  void GetDomainParameters(
288  vtkOverlappingAMR *amr,
289  double domainMin[3], double domainMax[3], double h[3],
290  int dims[3], double &rf );
292 
294 
295  bool RegionIntersectsWithAMR(
296  double domainMin[3], double domainMax[3],
297  double regionMin[3], double regionMax[3] );
299 
301 
303  void AdjustNumberOfSamplesInRegion(const double Rh[3],
304  const bool outside[6], int N[3] );
306 
308 
311  void ComputeLevelOfResolution(
312  const int N[3], const double h0[3], const double L[3], const double rf);
314 
316 
321  void SnapBounds(
322  const double h0[3], const double domainMin[3], const double domainMax[3],
323  const int dims[3], bool outside[6] );
325 
327 
331  void ComputeAndAdjustRegionParameters(
332  vtkOverlappingAMR *amrds, double h[3] );
334 
336  void GetRegion( double h[3] );
337 
339  bool GridsIntersect( double *g1, double *g2 );
340 
342  vtkUniformGrid* GetReferenceGrid( vtkOverlappingAMR *amrds );
343 
353  void SearchGridDecendants(double q[3],
354  vtkOverlappingAMR *amrds,
355  unsigned int maxLevel,
356  unsigned int &level,
357  unsigned int &gridId,
358  int &id);
360 
362 
364  bool SearchGridAncestors(double q[3],
365  vtkOverlappingAMR *amrds,
366  unsigned int &level,
367  unsigned int &gridId,
368  int &id);
370 
371 
372 private:
373  vtkAMRResampleFilter(const vtkAMRResampleFilter&); // Not implemented
374  void operator=(const vtkAMRResampleFilter&); // Not implemented
375 
376 };
377 
378 #endif /* vtkAMRResampleFilter_h */
vtkMultiProcessController * Controller
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
represent and manipulate point attribute data
Definition: vtkPointData.h:36
vtkOverlappingAMR * AMRMetaData
vtkMultiBlockDataSet * ROI
Store vtkAlgorithm input/output information.
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:38
std::vector< int > BlocksToLoad
represent and manipulate cell attribute data
Definition: vtkCellData.h:37
#define VTKFILTERSAMR_EXPORT
int vtkIdType
Definition: vtkType.h:275
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
static vtkMultiBlockDataSetAlgorithm * New()
virtual int FillOutputPortInformation(int port, vtkInformation *info)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
a simple class to control print indentation
Definition: vtkIndent.h:38
image data with blanking
Composite dataset that organizes datasets into blocks.
virtual int FillInputPortInformation(int port, vtkInformation *info)
hierarchical dataset of vtkUniformGrids
void PrintSelf(ostream &os, vtkIndent indent)
Store zero or more vtkInformation instances.
VTKWRAPPINGJAVA_EXPORT jlong q(JNIEnv *env, jobject obj)
#define max(a, b)
represent and manipulate fields of data
Definition: vtkFieldData.h:55
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Multiprocessing communication superclass.