VTK  9.0.1
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:
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 
142  vtkInformationVector* outputVector) override;
143 
147 
152 
153 protected:
156 
158  vtkMultiBlockDataSet* ROI; // Pointer to the region of interest.
159  int NumberOfSamples[3];
160  int GridNumberOfSamples[3];
161  double Min[3];
162  double Max[3];
163  double GridMin[3];
164  double GridMax[3];
171  double BiasVector[3];
172 
173  // Debugging Stuff
181  double AverageLevel;
182 
183  std::vector<int> BlocksToLoad; // Holds the ids of the blocks to load.
184 
188  bool IsParallel();
189 
194  bool IsRegionMine(const int regionIdx);
195 
200  int GetRegionProcessId(const int regionIdx);
201 
205  void ComputeCellCentroid(vtkUniformGrid* g, const vtkIdType cellIdx, double c[3]);
206 
214 
218  void CopyData(vtkFieldData* target, vtkIdType targetIdx, vtkCellData* src, vtkIdType srcIdx);
219 
224  bool FoundDonor(double q[3], vtkUniformGrid*& donorGrid, int& cellIdx);
225 
231  bool SearchForDonorGridAtLevel(double q[3], vtkOverlappingAMR* amrds, unsigned int level,
232  unsigned int& gridId, int& donorCellIdx);
233 
240  int ProbeGridPointInAMR(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
241  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool useCached);
242 
249  int ProbeGridPointInAMRGraph(double q[3], unsigned int& donorLevel, unsigned int& donorGridId,
250  vtkOverlappingAMR* amrds, unsigned int maxLevel, bool useCached);
251 
257 
263 
268 
273  vtkOverlappingAMR* amrds, vtkMultiBlockDataSet* mbds, vtkOverlappingAMR* metadata);
274 
279  bool IsBlockWithinBounds(double* grd);
280 
287 
292  vtkOverlappingAMR* amrds, int N[3], double min[3], double max[3], double h[3]);
293 
297  void GetDomainParameters(vtkOverlappingAMR* amr, double domainMin[3], double domainMax[3],
298  double h[3], int dims[3], double& rf);
299 
304  double domainMin[3], double domainMax[3], double regionMin[3], double regionMax[3]);
305 
310  void AdjustNumberOfSamplesInRegion(const double Rh[3], const bool outside[6], int N[3]);
311 
318  const int N[3], const double h0[3], const double L[3], const double rf);
319 
326  void SnapBounds(const double h0[3], const double domainMin[3], const double domainMax[3],
327  const int dims[3], bool outside[6]);
328 
335 
339  void GetRegion(double h[3]);
340 
344  bool GridsIntersect(double* g1, double* g2);
345 
350 
364  void SearchGridDecendants(double q[3], vtkOverlappingAMR* amrds, unsigned int maxLevel,
365  unsigned int& level, unsigned int& gridId, int& id);
366 
372  double q[3], vtkOverlappingAMR* amrds, unsigned int& level, unsigned int& gridId, int& id);
373 
374 private:
376  void operator=(const vtkAMRResampleFilter&) = delete;
377 };
378 
379 #endif /* vtkAMRResampleFilter_h */
vtkAMRBox
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:34
vtkAMRResampleFilter::GridsIntersect
bool GridsIntersect(double *g1, double *g2)
Checks if two uniform grids intersect.
vtkAMRResampleFilter::AMRMetaData
vtkOverlappingAMR * AMRMetaData
Definition: vtkAMRResampleFilter.h:157
vtkAMRResampleFilter::GetDomainParameters
void GetDomainParameters(vtkOverlappingAMR *amr, double domainMin[3], double domainMax[3], double h[3], int dims[3], double &rf)
This method accesses the domain boundaries.
vtkAMRResampleFilter::~vtkAMRResampleFilter
~vtkAMRResampleFilter() override
vtkAMRResampleFilter::TransferToGridNodes
void TransferToGridNodes(vtkUniformGrid *g, vtkOverlappingAMR *amrds)
Transfer the solution from the AMR dataset to the nodes of the given uniform grid.
vtkAMRResampleFilter::NumberOfTimesLevelUp
int NumberOfTimesLevelUp
Definition: vtkAMRResampleFilter.h:178
vtkAMRResampleFilter::ROI
vtkMultiBlockDataSet * ROI
Definition: vtkAMRResampleFilter.h:158
vtkAMRResampleFilter::TransferSolution
void TransferSolution(vtkUniformGrid *g, vtkOverlappingAMR *amrds)
Transfers the solution.
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:32
vtkAMRResampleFilter::IsRegionMine
bool IsRegionMine(const int regionIdx)
Given the Region ID this function returns whether or not the region belongs to this process or not.
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkAMRResampleFilter::NumberOfTimesFoundOnDonorLevel
int NumberOfTimesFoundOnDonorLevel
Definition: vtkAMRResampleFilter.h:177
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:36
vtkAMRResampleFilter::UseBiasVector
bool UseBiasVector
Definition: vtkAMRResampleFilter.h:170
vtkAMRResampleFilter::AdjustNumberOfSamplesInRegion
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,...
vtkAMRResampleFilter::PrintSelf
void PrintSelf(ostream &oss, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkUniformGrid
image data with blanking
Definition: vtkUniformGrid.h:35
vtkAMRResampleFilter::AverageLevel
double AverageLevel
Definition: vtkAMRResampleFilter.h:181
vtkAMRResampleFilter::NumberOfPartitions
int NumberOfPartitions
Definition: vtkAMRResampleFilter.h:166
vtkAMRResampleFilter::RequestUpdateExtent
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Performs upstream requests to the reader.
vtkAMRResampleFilter::TransferToNodes
int TransferToNodes
Definition: vtkAMRResampleFilter.h:167
vtkAMRResampleFilter::GetRegionProcessId
int GetRegionProcessId(const int regionIdx)
Given the Region ID, this method computes the corresponding process ID that owns the region based on ...
vtkMultiBlockDataSet
Composite dataset that organizes datasets into blocks.
Definition: vtkMultiBlockDataSet.h:46
vtkAMRResampleFilter::LevelOfResolution
int LevelOfResolution
Definition: vtkAMRResampleFilter.h:165
vtkAMRResampleFilter::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkAMRResampleFilter::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:54
vtkAMRResampleFilter::InitializeFields
void InitializeFields(vtkFieldData *f, vtkIdType size, vtkCellData *src)
Given the source cell data of an AMR grid, this method initializes the field values,...
vtkAMRResampleFilter::ComputeAMRBlocksToLoad
void ComputeAMRBlocksToLoad(vtkOverlappingAMR *metadata)
Given a user-supplied region of interest and the metadata by a module upstream, this method generates...
vtkAMRResampleFilter::NumberOfBlocksVisSkipped
int NumberOfBlocksVisSkipped
Definition: vtkAMRResampleFilter.h:176
vtkAMRResampleFilter::ComputeCellCentroid
void ComputeCellCentroid(vtkUniformGrid *g, const vtkIdType cellIdx, double c[3])
Given a cell index and a grid, this method computes the cell centroid.
vtkAMRResampleFilter::NumberOfFailedPoints
int NumberOfFailedPoints
Definition: vtkAMRResampleFilter.h:180
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkX3D::port
@ port
Definition: vtkX3D.h:453
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:965
vtkAMRResampleFilter::ComputeAndAdjustRegionParameters
void ComputeAndAdjustRegionParameters(vtkOverlappingAMR *amrds, double h[3])
This method computes and adjusts the region parameters s.t.
vtkAMRResampleFilter::SearchGridAncestors
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.
vtkAMRResampleFilter::RegionIntersectsWithAMR
bool RegionIntersectsWithAMR(double domainMin[3], double domainMax[3], double regionMin[3], double regionMax[3])
Checks if the domain and requested region intersect.
vtkAMRResampleFilter::GetReferenceGrid
vtkUniformGrid * GetReferenceGrid(vtkOverlappingAMR *amrds)
Returns a reference grid from the amrdataset.
vtkAMRResampleFilter::ExtractRegion
void ExtractRegion(vtkOverlappingAMR *amrds, vtkMultiBlockDataSet *mbds, vtkOverlappingAMR *metadata)
Extract the region (as a multiblock) from the given AMR dataset.
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:76
vtkAMRResampleFilter::FillOutputPortInformation
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkAMRResampleFilter::SearchGridDecendants
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.
vtkAMRResampleFilter::ComputeRegionParameters
void ComputeRegionParameters(vtkOverlappingAMR *amrds, int N[3], double min[3], double max[3], double h[3])
Computes the region parameters.
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:33
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkAMRResampleFilter::IsBlockWithinBounds
bool IsBlockWithinBounds(double *grd)
Checks if the AMR block, described by a uniform grid, is within the bounds of the ROI perscribed by t...
vtkAMRResampleFilter::SnapBounds
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.
vtkAMRResampleFilter::CopyData
void CopyData(vtkFieldData *target, vtkIdType targetIdx, vtkCellData *src, vtkIdType srcIdx)
Copies the data to the target from the given source.
vtkAMRResampleFilter::SearchForDonorGridAtLevel
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...
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkMultiBlockDataSetAlgorithm.h
vtkOverlappingAMR
hierarchical dataset of vtkUniformGrids
Definition: vtkOverlappingAMR.h:41
vtkAMRResampleFilter::NumberOfBlocksTestedForLevel
int NumberOfBlocksTestedForLevel
Definition: vtkAMRResampleFilter.h:174
vtkAMRResampleFilter::GetRegion
void GetRegion(double h[3])
This method gets the region of interest as perscribed by the user.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:65
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkAMRResampleFilter::IsParallel
bool IsParallel()
Checks if this filter instance is running on more than one processes.
vtkAMRResampleFilter::Controller
vtkMultiProcessController * Controller
Definition: vtkAMRResampleFilter.h:169
vtkAMRResampleFilter::NumberOfBlocksTested
int NumberOfBlocksTested
Definition: vtkAMRResampleFilter.h:175
vtkAMRResampleFilter::DemandDrivenMode
int DemandDrivenMode
Definition: vtkAMRResampleFilter.h:168
vtkAMRResampleFilter::TransferToCellCenters
void TransferToCellCenters(vtkUniformGrid *g, vtkOverlappingAMR *amrds)
Transfers the solution from the AMR dataset to the cell-centers of the given uniform grid.
vtkAMRResampleFilter::ComputeLevelOfResolution
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,...
vtkAMRResampleFilter::FoundDonor
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...
vtkAMRResampleFilter::BlocksToLoad
std::vector< int > BlocksToLoad
Definition: vtkAMRResampleFilter.h:183
vtkAMRResampleFilter::ProbeGridPointInAMR
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.
vtkAMRResampleFilter
This filter is a concrete instance of vtkMultiBlockDataSetAlgorithm and provides functionality for ex...
Definition: vtkAMRResampleFilter.h:53
vtkAMRResampleFilter::NumberOfTimesLevelDown
int NumberOfTimesLevelDown
Definition: vtkAMRResampleFilter.h:179
vtkAMRResampleFilter::ProbeGridPointInAMRGraph
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.
h
vtkFrustumSelector is a vtkSelector that selects elements based on whether they are inside or interse...
vtkAMRResampleFilter::vtkAMRResampleFilter
vtkAMRResampleFilter()
vtkAMRResampleFilter::RequestInformation
int RequestInformation(vtkInformation *rqst, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Gets the metadata from upstream module and determines which blocks should be loaded by this instance.
vtkAMRResampleFilter::New
static vtkAMRResampleFilter * New()
vtkMultiBlockDataSetAlgorithm
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Definition: vtkMultiBlockDataSetAlgorithm.h:33