VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Common/DataModel/vtkExtractStructuredGridHelper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkExtractGrid.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 =========================================================================*/
00029 #ifndef vtkExtractStructuredGridHelper_h
00030 #define vtkExtractStructuredGridHelper_h
00031 
00032 #include "vtkCommonDataModelModule.h" // For export macro
00033 #include "vtkObject.h"
00034 
00035 // Forward declarations
00036 class vtkCellData;
00037 class vtkPointData;
00038 class vtkPoints;
00039 
00040 namespace vtk
00041 {
00042 namespace detail
00043 {
00044 
00045 struct vtkIndexMap;
00046 
00047 } // END namespace detail
00048 } // END namespace vtk
00049 
00050 class VTKCOMMONDATAMODEL_EXPORT vtkExtractStructuredGridHelper :
00051   public vtkObject
00052 {
00053 public:
00054   static vtkExtractStructuredGridHelper *New();
00055   vtkTypeMacro(vtkExtractStructuredGridHelper,vtkObject);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00058   // Get & Set Macros
00059   vtkGetVector6Macro(OutputWholeExtent,int);
00060 
00062 
00066   void Initialize(int voi[6], int wholeExt[6], int sampleRate[3],
00067                   bool includeBoundary);
00069 
00071   bool IsValid() const;
00072 
00075   int GetSize(const int dim);
00076 
00084   int GetMappedIndex(int dim, int outIdx);
00085 
00095   int GetMappedIndexFromExtentValue(int dim, int outExtVal);
00096 
00105   int GetMappedExtentValue(int dim, int outExtVal);
00106 
00114   int GetMappedExtentValueFromIndex(int dim, int outIdx);
00115 
00119   void ComputeBeginAndEnd(int inExt[6], int voi[6], int begin[3], int end[3]);
00120 
00122 
00130   void CopyPointsAndPointData( int inExt[6], int outExt[6],
00131                     vtkPointData* pd, vtkPoints* inpnts,
00132                     vtkPointData* outPD, vtkPoints* outpnts,
00133                     int sampleRate[3] = NULL);
00135 
00137 
00142   void CopyCellData(int inExt[6], int outExt[6],
00143                     vtkCellData* cd, vtkCellData* outCD,
00144                     int sampleRate[3] = NULL);
00146 
00148 
00159   static void GetPartitionedVOI(const int globalVOI[6],
00160                                 const int partitionedExtent[6],
00161                                 const int sampleRate[3],
00162                                 bool includeBoundary,
00163                                 int partitionedVOI[6]);
00165 
00166 
00178   static void GetPartitionedOutputExtent(const int globalVOI[6],
00179                                          const int partitionedVOI[6],
00180                                          const int outputWholeExtent[6],
00181                                          const int sampleRate[3],
00182                                          bool includeBoundary,
00183                                          int partitionedOutputExtent[6]);
00185 
00186 protected:
00187   vtkExtractStructuredGridHelper();
00188   ~vtkExtractStructuredGridHelper();
00189 
00190   // Input parameters -- used to reinitialize when data changes.
00191   int VOI[6];
00192   int InputWholeExtent[6];
00193   int SampleRate[3];
00194   bool IncludeBoundary;
00195 
00196   int OutputWholeExtent[6];
00197   vtk::detail::vtkIndexMap* IndexMap;
00198 
00200   void Invalidate();
00201 
00202 private:
00203   vtkExtractStructuredGridHelper(const vtkExtractStructuredGridHelper&); // Not implemented.
00204   void operator=(const vtkExtractStructuredGridHelper&); // Not implemented.
00205 };
00206 
00207 #endif /* VTKEXTRACTSTRUCTUREDGRIDHELPER_H_ */