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
43class vtkInformation;
45class vtkUniformGrid;
49class vtkFieldData;
50class vtkCellData;
51class vtkPointData;
52class vtkIndent;
53
54class vtkAMRBox;
55class VTKFILTERSAMR_EXPORT vtkAMRResampleFilter : public vtkMultiBlockDataSetAlgorithm
56{
57public:
60 void PrintSelf(ostream &oss, vtkIndent indent);
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
135 vtkGetMacro(Controller, vtkMultiProcessController*);
137
138 // Standard pipeline routines
139
145 vtkInformation *rqst,
146 vtkInformationVector **inputVector,
147 vtkInformationVector *outputVector );
148
149 virtual int RequestData(
153
159
160
161protected:
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
190
191 std::vector< int > BlocksToLoad; // Holds the ids of the blocks to load.
192
197
202 bool IsRegionMine( const int regionIdx );
203
208 int GetRegionProcessId( const int regionIdx );
209
214 vtkUniformGrid *g, const vtkIdType cellIdx, double c[3] );
215
223
228 vtkCellData *src, vtkIdType srcIdx );
229
234 bool FoundDonor(double q[3],vtkUniformGrid *&donorGrid,int &cellIdx);
235
236
243 double q[3], vtkOverlappingAMR *amrds,
244 unsigned int level, unsigned int& gridId,
245 int &donorCellIdx);
246
254 double q[3], unsigned int &donorLevel, unsigned int& donorGridId,
255 vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
256
264 unsigned int &donorLevel, unsigned int &donorGridId,
265 vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached);
266
273
280
286
292 vtkOverlappingAMR *metadata );
293
298 bool IsBlockWithinBounds( double *grd );
299
306
311 vtkOverlappingAMR *amrds,
312 int N[3], double min[3], double max[3], double h[3] );
313
319 double domainMin[3], double domainMax[3], double h[3],
320 int dims[3], double &rf );
321
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
342 const int N[3], const double h0[3], const double L[3], const double rf);
343
351 const double h0[3], const double domainMin[3], const double domainMax[3],
352 const int dims[3], bool outside[6] );
353
360 vtkOverlappingAMR *amrds, double h[3] );
361
365 void GetRegion( double h[3] );
366
370 bool GridsIntersect( double *g1, double *g2 );
371
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
408private:
409 vtkAMRResampleFilter(const vtkAMRResampleFilter&) VTK_DELETE_FUNCTION;
410 void operator=(const vtkAMRResampleFilter&) VTK_DELETE_FUNCTION;
411
412};
413
414#endif /* vtkAMRResampleFilter_h */
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:40
This filter is a concrete instance of vtkMultiBlockDataSetAlgorithm and provides functionality for ex...
bool IsBlockWithinBounds(double *grd)
Checks if the AMR block, described by a uniform grid, is within the bounds of the ROI perscribed by t...
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
void SearchGridDecendants(double q[3], vtkOverlappingAMR *amrds, unsigned int maxLevel, unsigned int &level, unsigned int &gridId, int &id)
Writes a uniform grid to a file.
void TransferToGridNodes(vtkUniformGrid *g, vtkOverlappingAMR *amrds)
Transfer the solution from the AMR dataset to the nodes of the given uniform grid.
static vtkAMRResampleFilter * New()
void ExtractRegion(vtkOverlappingAMR *amrds, vtkMultiBlockDataSet *mbds, vtkOverlappingAMR *metadata)
Extract the region (as a multiblock) from the given AMR dataset.
vtkOverlappingAMR * AMRMetaData
bool IsParallel()
Checks if this filter instance is running on more than one processes.
bool GridsIntersect(double *g1, double *g2)
Checks if two uniform grids intersect.
int ProbeGridPointInAMR(double q[3], unsigned int &donorLevel, unsigned int &donorGridId, vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached)
Finds the AMR grid that contains the point q.
void TransferToCellCenters(vtkUniformGrid *g, vtkOverlappingAMR *amrds)
Transfers the solution from the AMR dataset to the cell-centers of the given uniform grid.
bool RegionIntersectsWithAMR(double domainMin[3], double domainMax[3], double regionMin[3], double regionMax[3])
Checks if the domain and requested region intersect.
std::vector< int > BlocksToLoad
void PrintSelf(ostream &oss, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkMultiBlockDataSet * ROI
void CopyData(vtkFieldData *target, vtkIdType targetIdx, vtkCellData *src, vtkIdType srcIdx)
Copies the data to the target from the given source.
vtkUniformGrid * GetReferenceGrid(vtkOverlappingAMR *amrds)
Returns a reference grid from the amrdataset.
void AdjustNumberOfSamplesInRegion(const double Rh[3], const bool outside[6], int N[3])
This method adjust the numbers of samples in the region, N, if the requested region falls outside,...
void ComputeAMRBlocksToLoad(vtkOverlappingAMR *metadata)
Given a user-supplied region of interest and the metadata by a module upstream, this method generates...
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
void ComputeRegionParameters(vtkOverlappingAMR *amrds, int N[3], double min[3], double max[3], double h[3])
Computes the region parameters.
void InitializeFields(vtkFieldData *f, vtkIdType size, vtkCellData *src)
Given the source cell data of an AMR grid, this method initializes the field values,...
void SnapBounds(const double h0[3], const double domainMin[3], const double domainMax[3], const int dims[3], bool outside[6])
This method snaps the bounds s.t.
bool SearchForDonorGridAtLevel(double q[3], vtkOverlappingAMR *amrds, unsigned int level, unsigned int &gridId, int &donorCellIdx)
Given a query point q and a target level, this method finds a suitable grid at the given level that c...
void GetDomainParameters(vtkOverlappingAMR *amr, double domainMin[3], double domainMax[3], double h[3], int dims[3], double &rf)
This method accesses the domain boundaries.
virtual int RequestInformation(vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Gets the metadata from upstream module and determines which blocks should be loaded by this instance.
void ComputeCellCentroid(vtkUniformGrid *g, const vtkIdType cellIdx, double c[3])
Given a cell index and a grid, this method computes the cell centroid.
void TransferSolution(vtkUniformGrid *g, vtkOverlappingAMR *amrds)
Transfers the solution.
vtkMultiProcessController * Controller
bool IsRegionMine(const int regionIdx)
Given the Region ID this function returns whether or not the region belongs to this process or not.
int GetRegionProcessId(const int regionIdx)
Given the Region ID, this method computes the corresponding process ID that owns the region based on ...
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Performs upstream requests to the reader.
bool FoundDonor(double q[3], vtkUniformGrid *&donorGrid, int &cellIdx)
Given a query point q and a candidate donor grid, this method checks for the corresponding donor cell...
void GetRegion(double h[3])
This method gets the region of interest as perscribed by the user.
int ProbeGridPointInAMRGraph(double q[3], unsigned int &donorLevel, unsigned int &donorGridId, vtkOverlappingAMR *amrds, unsigned int maxLevel, bool useCached)
Finds the AMR grid that contains the point q.
void ComputeAndAdjustRegionParameters(vtkOverlappingAMR *amrds, double h[3])
This method computes and adjusts the region parameters s.t.
void ComputeLevelOfResolution(const int N[3], const double h0[3], const double L[3], const double rf)
This method computes the level of resolution based on the number of samples requested,...
virtual ~vtkAMRResampleFilter()
bool SearchGridAncestors(double q[3], vtkOverlappingAMR *amrds, unsigned int &level, unsigned int &gridId, int &id)
Find an ancestor of the specified grid that contains the point.
represent and manipulate cell attribute data
Definition: vtkCellData.h:39
represent and manipulate fields of data
Definition: vtkFieldData.h:57
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
hierarchical dataset of vtkUniformGrids
represent and manipulate point attribute data
Definition: vtkPointData.h:38
image data with blanking
@ info
Definition: vtkX3D.h:376
@ level
Definition: vtkX3D.h:395
@ port
Definition: vtkX3D.h:447
@ size
Definition: vtkX3D.h:253
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287
#define max(a, b)