00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkExtractUserDefinedPiece.h,v $ 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 "vtkExtractUnstructuredGridPiece.h" 00039 00040 class VTK_PARALLEL_EXPORT vtkExtractUserDefinedPiece : public vtkExtractUnstructuredGridPiece 00041 { 00042 public: 00043 vtkTypeRevisionMacro(vtkExtractUserDefinedPiece, vtkExtractUnstructuredGridPiece); 00044 static vtkExtractUserDefinedPiece *New(); 00045 virtual void PrintSelf(ostream& os, vtkIndent indent); 00046 00047 //BTX 00048 typedef int (*UserDefFunc)(vtkIdType cellID, vtkUnstructuredGrid *grid, void *constantData); 00049 //ETX 00050 00051 // Set the function used to identify the piece. The function should 00052 // return 1 if the cell is in the piece, and 0 otherwise. 00053 void SetPieceFunction(UserDefFunc func) {this->InPiece = func; this->Modified();} 00054 00055 // Set constant data to be used by the piece identifying function. 00056 void SetConstantData(void *data, int len); 00057 00058 // Get constant data to be used by the piece identifying function. 00059 // Return the length of the data buffer. 00060 int GetConstantData(void **data); 00061 00062 // The function should return 1 if the cell 00063 // is in the piece, and 0 otherwise. 00064 00065 protected: 00066 00067 vtkExtractUserDefinedPiece(); 00068 ~vtkExtractUserDefinedPiece(); 00069 00070 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00071 00072 void ComputeCellTagsWithFunction(vtkIntArray *tags, vtkIdList *pointOwnership, 00073 vtkUnstructuredGrid *input); 00074 00075 private: 00076 vtkExtractUserDefinedPiece(const vtkExtractUserDefinedPiece&); // Not implemented 00077 void operator=(const vtkExtractUserDefinedPiece&); // Not implemented 00078 00079 void *ConstantData; 00080 int ConstantDataLen; 00081 00082 UserDefFunc InPiece; 00083 }; 00084 #endif