VTK
dox/Filters/Parallel/vtkExtractCTHPart.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkExtractCTHPart.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 =========================================================================*/
00028 #ifndef __vtkExtractCTHPart_h
00029 #define __vtkExtractCTHPart_h
00030 
00031 #include "vtkFiltersParallelModule.h" // For export macro
00032 #include "vtkMultiBlockDataSetAlgorithm.h"
00033 
00034 class vtkAppendPolyData;
00035 class vtkBoundingBox;
00036 class vtkClipPolyData;
00037 class vtkContourFilter;
00038 class vtkCutter;
00039 class vtkDataArray;
00040 class vtkDataSet;
00041 class vtkDataSetSurfaceFilter;
00042 class vtkDoubleArray;
00043 class vtkExtractCTHPartInternal;
00044 class vtkImageData;
00045 class vtkInformationDoubleVectorKey;
00046 class vtkCompositeDataSet;
00047 class vtkMultiProcessController;
00048 class vtkPlane;
00049 class vtkPolyData;
00050 class vtkRectilinearGrid;
00051 class vtkUniformGrid;
00052 class vtkUnsignedCharArray;
00053 
00054 //#define EXTRACT_USE_IMAGE_DATA 1
00055 
00056 class VTKFILTERSPARALLEL_EXPORT vtkExtractCTHPart : public vtkMultiBlockDataSetAlgorithm
00057 {
00058 public:
00059   vtkTypeMacro(vtkExtractCTHPart,vtkMultiBlockDataSetAlgorithm);
00060   void PrintSelf(ostream& os, vtkIndent indent);
00061 
00064   static vtkExtractCTHPart *New();
00065 
00067 
00068   void RemoveDoubleVolumeArrayNames();
00069   void RemoveFloatVolumeArrayNames();
00070   void RemoveUnsignedCharVolumeArrayNames();
00071   int GetNumberOfVolumeArrayNames();
00072   const char* GetVolumeArrayName(int idx);
00073   // for backwards compatibility
00074   void RemoveAllVolumeArrayNames();
00076 
00078 
00082   void AddDoubleVolumeArrayName(char* arrayName);
00083   void AddFloatVolumeArrayName(char* arrayName);
00084   void AddUnsignedCharVolumeArrayName(char* arrayName);
00085   //for backwards compatibility
00086   void AddVolumeArrayName(char* arrayName);
00088 
00090 
00091   void SetClipPlane(vtkPlane *clipPlane);
00092   vtkGetObjectMacro(ClipPlane, vtkPlane);
00094 
00096   unsigned long GetMTime();
00097 
00099   void SetController(vtkMultiProcessController* controller);
00100 
00102 
00104   vtkGetObjectMacro(Controller,vtkMultiProcessController);
00106 
00108 
00110   vtkSetClampMacro(VolumeFractionSurfaceValue, double, 0.0, 1.0);
00111   vtkGetMacro(VolumeFractionSurfaceValue, double);
00113 
00114 protected:
00115   vtkExtractCTHPart();
00116   ~vtkExtractCTHPart();
00117 
00118   virtual int RequestInformation(vtkInformation *request,
00119                                  vtkInformationVector **inputVector,
00120                                  vtkInformationVector *outputVector);
00121 
00122   virtual int RequestData(vtkInformation *, vtkInformationVector **,
00123                   vtkInformationVector *);
00124 
00132   void ComputeBounds(vtkCompositeDataSet *input,
00133                      int processNumber,
00134                      int numProcessors);
00136 
00137   void ExecutePart(const char *arrayName,
00138                    vtkCompositeDataSet *input,
00139                    vtkAppendPolyData *appendSurface,
00140                    vtkAppendPolyData *append,
00141                    float minProgress,
00142                    float maxProgress);
00143 
00144   void ExecutePartOnUniformGrid(const char *arrayName,
00145 #ifdef EXTRACT_USE_IMAGE_DATA
00146                                 vtkImageData *input,
00147 #else
00148                                 vtkUniformGrid *input,
00149 #endif
00150                                 vtkAppendPolyData *appendSurface,
00151                                 vtkAppendPolyData *append,
00152                                 float minProgress,
00153                                 float maxProgress);
00154 
00155   void ExecutePartOnRectilinearGrid(const char *arrayName,
00156                                     vtkRectilinearGrid *input,
00157                                     vtkAppendPolyData *appendSurface,
00158                                     vtkAppendPolyData *append,
00159                                     float minProgress,
00160                                     float maxProgress);
00161 
00162   void ExecuteCellDataToPointData(vtkDataArray *cellVolumeFraction,
00163                                   vtkDoubleArray *pointVolumeFraction,
00164                                   int *dims,
00165                                   float minProgress,
00166                                   float maxProgress,
00167                                   int reportProgress);
00168 
00169   virtual int FillInputPortInformation(int port,
00170                                        vtkInformation *info);
00171 
00172   void CreateInternalPipeline();
00173   void DeleteInternalPipeline();
00174 
00176 
00179   int ExtractUniformGridSurface(
00180 #ifdef EXTRACT_USE_IMAGE_DATA
00181     vtkImageData *input,
00182 #else
00183     vtkUniformGrid *input,
00184 #endif
00185     vtkPolyData *output);
00187 
00189 
00192   int ExtractRectilinearGridSurface(vtkRectilinearGrid *input,
00193                                     vtkPolyData *output);
00195 
00196   void ExecuteFaceQuads(vtkDataSet *input,
00197                         vtkPolyData *output,
00198                         int maxFlag,
00199                         int originExtents[3],
00200                         int ext[6],
00201                         int aAxis,
00202                         int bAxis,
00203                         int cAxis);
00204 
00206 
00208   int IsGhostFace(int axis0,
00209                   int maxFlag,
00210                   int dims[3],
00211                   vtkUnsignedCharArray *ghostArray);
00213 
00214   vtkPlane *ClipPlane;
00215   vtkExtractCTHPartInternal* Internals;
00216 
00217   // Internal Pipeline elements
00218   vtkDoubleArray *PointVolumeFraction;
00219 
00220 #ifdef EXTRACT_USE_IMAGE_DATA
00221   vtkImageData *Data;
00222 #else
00223   vtkUniformGrid *Data;
00224 #endif
00225 
00226   vtkContourFilter *Contour;
00227   vtkAppendPolyData *Append2;
00228   vtkClipPolyData *Clip1;
00229   vtkCutter *Cut;
00230   vtkClipPolyData *Clip2;
00231 
00232   vtkPolyData *PolyData;
00233   vtkAlgorithm *PolyDataProducer;
00234   vtkPolyData *RPolyData;
00235   vtkAlgorithm *RPolyDataProducer;
00236   vtkPolyData *SurfacePolyData;
00237 
00238   vtkRectilinearGrid *RData;
00239   vtkContourFilter *RContour;
00240   vtkAppendPolyData *RAppend2;
00241   vtkClipPolyData *RClip1;
00242   vtkCutter *RCut;
00243   vtkClipPolyData *RClip2;
00244 
00245   void EvaluateVolumeFractionType(vtkRectilinearGrid* rg,
00246                                   vtkCompositeDataSet* input);
00247   int VolumeFractionType;
00248   double VolumeFractionSurfaceValue;
00249   double VolumeFractionSurfaceValueInternal;
00250   int OverwriteVolumeFractionSurfaceValue;
00251 
00252   vtkBoundingBox *Bounds; // Whole bounds (dataset over all the processors)
00253 
00254   vtkMultiProcessController *Controller;
00255 private:
00256   vtkExtractCTHPart(const vtkExtractCTHPart&);  // Not implemented.
00257   void operator=(const vtkExtractCTHPart&);  // Not implemented.
00258 };
00259 #endif