VTK
dox/Filters/AMR/vtkAMRCutPlane.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003  Program:   Visualization Toolkit
00004  Module:    vtkAMRCutPlane.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  =========================================================================*/
00023 #ifndef VTKAMRCUTPLANE_H_
00024 #define VTKAMRCUTPLANE_H_
00025 
00026 #include "vtkFiltersAMRModule.h" // For export macro
00027 #include "vtkMultiBlockDataSetAlgorithm.h"
00028 
00029 #include <vector> // For STL vector
00030 #include <map> // For STL map
00031 
00032 class vtkMultiBlockDataSet;
00033 class vtkOverlappingAMR;
00034 class vtkMultiProcessController;
00035 class vtkInformation;
00036 class vtkInformationVector;
00037 class vtkIndent;
00038 class vtkPlane;
00039 class vtkUniformGrid;
00040 class vtkCell;
00041 class vtkPoints;
00042 class vtkCellArray;
00043 class vtkPointData;
00044 class vtkCellData;
00045 
00046 class VTKFILTERSAMR_EXPORT vtkAMRCutPlane : public vtkMultiBlockDataSetAlgorithm
00047 {
00048 public:
00049   static vtkAMRCutPlane *New();
00050   vtkTypeMacro(vtkAMRCutPlane, vtkMultiBlockDataSetAlgorithm);
00051   void PrintSelf(ostream &oss, vtkIndent indent );
00052 
00054 
00055   vtkSetVector3Macro(Center, double);
00057 
00059 
00060   vtkSetVector3Macro(Normal, double);
00062 
00064 
00065   vtkSetMacro(LevelOfResolution, int);
00066   vtkGetMacro(LevelOfResolution, int);
00068 
00070  */
00071   vtkSetMacro(UseNativeCutter, bool);
00072   vtkGetMacro(UseNativeCutter, bool);
00073   vtkBooleanMacro(UseNativeCutter, bool);
00075 
00077 
00079   vtkSetMacro(Controller, vtkMultiProcessController*);
00080   vtkGetMacro(Controller, vtkMultiProcessController*);
00082 
00083   // Standard pipeline routines
00084 
00085   virtual int RequestData(
00086        vtkInformation*,vtkInformationVector**,vtkInformationVector*);
00087   virtual int FillInputPortInformation(int port, vtkInformation *info);
00088   virtual int FillOutputPortInformation(int port, vtkInformation *info);
00089 
00090 
00092 
00094   virtual int RequestInformation(
00095       vtkInformation *rqst,
00096       vtkInformationVector **inputVector,
00097       vtkInformationVector *outputVector );
00099 
00101 
00102   virtual int RequestUpdateExtent(
00103       vtkInformation*, vtkInformationVector**, vtkInformationVector* );
00105 
00106 protected:
00107   vtkAMRCutPlane();
00108   virtual ~vtkAMRCutPlane();
00109 
00112   vtkPlane* GetCutPlane( vtkOverlappingAMR *metadata );
00113 
00115 
00116   void ExtractCellFromGrid(
00117       vtkUniformGrid *grid, vtkCell* cell,
00118       std::map<vtkIdType,vtkIdType>& gridPntMapping,
00119       vtkPoints *nodes,
00120       vtkCellArray *cells );
00122 
00124 
00126   void ExtractPointDataFromGrid(
00127       vtkUniformGrid *grid,
00128       std::map<vtkIdType,vtkIdType>& gridPntMapping,
00129       vtkIdType NumNodes,
00130       vtkPointData *PD );
00132 
00134 
00136   void ExtractCellDataFromGrid(
00137       vtkUniformGrid *grid,
00138       std::vector<vtkIdType>& cellIdxList,
00139       vtkCellData *CD);
00141 
00146   void ComputeAMRBlocksToLoad( vtkPlane* p, vtkOverlappingAMR* m);
00147 
00148   // Descriription:
00149   // Initializes the cut-plane center given the min/max bounds.
00150   void InitializeCenter( double min[3], double max[3] );
00151 
00153 
00154   bool PlaneIntersectsAMRBox( vtkPlane* pl, double bounds[6] );
00155   bool PlaneIntersectsAMRBox( double plane[4], double bounds[6] );
00157 
00159   bool PlaneIntersectsCell( vtkPlane *pl, vtkCell *cell );
00160 
00162   bool IsAMRData2D( vtkOverlappingAMR *input );
00163 
00165 
00166   void CutAMRBlock(
00167       vtkPlane *cutPlane,
00168       unsigned int blockIdx,
00169       vtkUniformGrid *grid, vtkMultiBlockDataSet *dataSet );
00171 
00172   int    LevelOfResolution;
00173   double Center[3];
00174   double Normal[3];
00175   bool initialRequest;
00176   bool UseNativeCutter;
00177   vtkMultiProcessController *Controller;
00178 
00179 // BTX
00180   std::vector<int> BlocksToLoad;
00181 // ETX
00182 
00183 private:
00184   vtkAMRCutPlane(const vtkAMRCutPlane& ); // Not implemented
00185   void operator=(const vtkAMRCutPlane& ); // Not implemented
00186 };
00187 
00188 #endif /* VTKAMRCUTPLANE_H_ */