Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkExtractUserDefinedPiece.h

Go to the documentation of this file.
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 
00046 #ifndef __vtkExtractUserDefinedPiece_h
00047 #define __vtkExtractUserDefinedPiece_h
00048 
00049 #include "vtkExtractUnstructuredGridPiece.h"
00050 
00051 class VTK_PARALLEL_EXPORT vtkExtractUserDefinedPiece : public vtkExtractUnstructuredGridPiece
00052 {
00053 public:
00054   vtkTypeRevisionMacro(vtkExtractUserDefinedPiece, vtkExtractUnstructuredGridPiece);
00055   static vtkExtractUserDefinedPiece *New();
00056   virtual void PrintSelf(ostream& os, vtkIndent indent);
00057 
00058 //BTX
00059   typedef int (*UserDefFunc)(vtkIdType cellID, vtkUnstructuredGrid *grid, void *constantData);
00060 //ETX
00061 
00062   // Set the function used to identify the piece.  The function should 
00063   // return 1 if the cell is in the piece, and 0 otherwise.
00064   void SetPieceFunction(UserDefFunc func) {this->InPiece = func; this->Modified();}
00065 
00066   // Set constant data to be used by the piece identifying function.
00067   void SetConstantData(void *data, int len);
00068 
00069   // Get constant data to be used by the piece identifying function.
00070   // Return the length of the data buffer.
00071   int GetConstantData(void **data);
00072 
00073   // The function should return 1 if the cell
00074   // is in the piece, and 0 otherwise.
00075 
00076 protected:
00077 
00078   vtkExtractUserDefinedPiece();
00079   ~vtkExtractUserDefinedPiece();
00080 
00081   void Execute();
00082 
00083   void ComputeCellTagsWithFunction(vtkIntArray *tags, vtkIdList *pointOwnership);
00084 
00085 private:
00086   vtkExtractUserDefinedPiece(const vtkExtractUserDefinedPiece&); // Not implemented
00087   void operator=(const vtkExtractUserDefinedPiece&); // Not implemented
00088 
00089   void *ConstantData;
00090   int ConstantDataLen;
00091 
00092   UserDefFunc InPiece;
00093 };
00094 #endif