VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Filters/Parallel/vtkExtractUserDefinedPiece.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkExtractUserDefinedPiece.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 =========================================================================*/
00015 /*----------------------------------------------------------------------------
00016  Copyright (c) Sandia Corporation
00017  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00018 ----------------------------------------------------------------------------*/
00019 
00035 #ifndef vtkExtractUserDefinedPiece_h
00036 #define vtkExtractUserDefinedPiece_h
00037 
00038 #include "vtkFiltersParallelModule.h" // For export macro
00039 #include "vtkExtractUnstructuredGridPiece.h"
00040 
00041 class VTKFILTERSPARALLEL_EXPORT vtkExtractUserDefinedPiece : public vtkExtractUnstructuredGridPiece
00042 {
00043 public:
00044   vtkTypeMacro(vtkExtractUserDefinedPiece, vtkExtractUnstructuredGridPiece);
00045   static vtkExtractUserDefinedPiece *New();
00046   virtual void PrintSelf(ostream& os, vtkIndent indent);
00047 
00048 //BTX
00049   typedef int (*UserDefFunc)(vtkIdType cellID, vtkUnstructuredGrid *grid, void *constantData);
00050 //ETX
00051 
00052   // Set the function used to identify the piece.  The function should
00053   // return 1 if the cell is in the piece, and 0 otherwise.
00054   void SetPieceFunction(UserDefFunc func) {this->InPiece = func; this->Modified();}
00055 
00056   // Set constant data to be used by the piece identifying function.
00057   void SetConstantData(void *data, int len);
00058 
00059   // Get constant data to be used by the piece identifying function.
00060   // Return the length of the data buffer.
00061   int GetConstantData(void **data);
00062 
00063   // The function should return 1 if the cell
00064   // is in the piece, and 0 otherwise.
00065 
00066 protected:
00067 
00068   vtkExtractUserDefinedPiece();
00069   ~vtkExtractUserDefinedPiece();
00070 
00071   virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00072 
00073   void ComputeCellTagsWithFunction(vtkIntArray *tags, vtkIdList *pointOwnership,
00074                                    vtkUnstructuredGrid *input);
00075 
00076 private:
00077   vtkExtractUserDefinedPiece(const vtkExtractUserDefinedPiece&); // Not implemented
00078   void operator=(const vtkExtractUserDefinedPiece&); // Not implemented
00079 
00080   void *ConstantData;
00081   int ConstantDataLen;
00082 
00083   UserDefFunc InPiece;
00084 };
00085 #endif