VTK
dox/Filters/AMR/vtkAMRSliceFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003  Program:   Visualization Toolkit
00004  Module:    vtkAMRSliceFilter.h
00005 
00006  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007  All rights reserved.
00008  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010  This software is distributed WITHOUT ANY WARRANTY; without even
00011  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012  PURPOSE.  See the above copyright notice for more information.
00013 
00014  =========================================================================*/
00026 #ifndef VTKAMRSLICEFILTER_H_
00027 #define VTKAMRSLICEFILTER_H_
00028 
00029 #include "vtkFiltersAMRModule.h" // For export macro
00030 #include "vtkOverlappingAMRAlgorithm.h"
00031 
00032 #include <vector> // For STL vector
00033 
00034 class vtkInformation;
00035 class vtkInformationVector;
00036 class vtkOverlappingAMR;
00037 class vtkMultiProcessController;
00038 class vtkPlane;
00039 class vtkAMRBox;
00040 class vtkUniformGrid;
00041 
00042 class VTKFILTERSAMR_EXPORT vtkAMRSliceFilter :
00043   public vtkOverlappingAMRAlgorithm
00044 {
00045 public:
00046   static vtkAMRSliceFilter* New();
00047   vtkTypeMacro( vtkAMRSliceFilter, vtkOverlappingAMRAlgorithm );
00048   void PrintSelf(ostream &os, vtkIndent indent );
00049 
00050   // Inline Gettters & Setters
00051   vtkSetMacro(OffSetFromOrigin,double);
00052   vtkGetMacro(OffSetFromOrigin,double);
00053 
00055 
00056   vtkSetMacro( ForwardUpstream, int );
00057   vtkGetMacro( ForwardUpstream, int );
00058   vtkBooleanMacro( ForwardUpstream, int );
00060 
00062 
00063   vtkSetMacro( EnablePrefetching, int );
00064   vtkGetMacro( EnablePrefetching, int );
00065   vtkBooleanMacro( EnablePrefetching, int );
00067 
00069 
00070   vtkSetMacro(MaxResolution,int);
00071   vtkGetMacro(MaxResolution,int);
00073 
00075 
00077   vtkSetMacro(Normal,int);
00078   vtkGetMacro(Normal,int);
00080 
00082 
00084   vtkSetMacro( Controller, vtkMultiProcessController* );
00085   vtkGetMacro( Controller, vtkMultiProcessController* );
00087 
00088   // Standard Pipeline methods
00089   virtual int RequestData(
00090      vtkInformation*,vtkInformationVector**,vtkInformationVector*);
00091   virtual int FillInputPortInformation(int port, vtkInformation *info);
00092   virtual int FillOutputPortInformation(int port, vtkInformation *info);
00093 
00095 
00097   virtual int RequestInformation(
00098       vtkInformation *rqst,
00099       vtkInformationVector **inputVector,
00100       vtkInformationVector *outputVector );
00102 
00104 
00105   virtual int RequestUpdateExtent(
00106       vtkInformation*, vtkInformationVector**,vtkInformationVector* );
00108 
00109 protected:
00110   vtkAMRSliceFilter();
00111   ~vtkAMRSliceFilter();
00112 
00115   int GetDonorCellIdx( double x[3], vtkUniformGrid *ug );
00116 
00118 
00120   void ComputeCellCenter(
00121       vtkUniformGrid *ug, const int cellIdx, double centroid[3] );
00123 
00126   vtkUniformGrid* GetSlice( double origin[3], int* dims, double* gorigin, double* spacing );
00127 
00129   void GetSliceCellData( vtkUniformGrid *slice, vtkUniformGrid *grid3D );
00130 
00132   bool PlaneIntersectsAMRBox( double plane[4], double bounds[6] );
00133 
00135 
00138   void ComputeAMRBlocksToLoad(
00139       vtkPlane *p, vtkOverlappingAMR *metadata );
00141 
00143 
00144   void GetAMRSliceInPlane(
00145       vtkPlane *p, vtkOverlappingAMR *inp,
00146       vtkOverlappingAMR *out );
00148 
00150   bool IsAMRData2D( vtkOverlappingAMR *input );
00151 
00153   vtkPlane* GetCutPlane( vtkOverlappingAMR *input );
00154 
00156 
00157   void InitializeOffSet(
00158     vtkOverlappingAMR *inp, double *min, double *max );
00160 
00161   double OffSetFromOrigin;
00162   int    Normal; // 1=>X-Normal, 2=>Y-Normal, 3=>Z-Normal
00163   bool   initialRequest;
00164   int    MaxResolution;
00165   vtkMultiProcessController *Controller;
00166 
00167   int ForwardUpstream;
00168   int EnablePrefetching;
00169   // BTX
00170   std::vector< int > BlocksToLoad;
00171   // ETX
00172 
00173 private:
00174   vtkAMRSliceFilter( const vtkAMRSliceFilter& ); // Not implemented
00175   void operator=( const vtkAMRSliceFilter& ); // Not implemented
00176 };
00177 
00178 #endif /* VTKAMRSLICEFILTER_H_ */