1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: vtkStaticPlaneCutter.h
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
16 * @class vtkStaticPlaneCutter
17 * @brief StaticMesh aware implementation of vtkPlaneCutter vtk vtkUnstructuredGrid
19 * This class specialize vtkPlaneCutter for vtkUnstructuredGrid input.
20 * It uses a cache when the associated data chage over time but not the geometry.
21 * In order to be able to update the cache, we keep track of cells ids
22 * when the cache is computed.
23 * Contrary to its parent, this class does not interpolate point data,
24 * only transmit cell data.
31 #ifndef vtkStaticPlaneCutter_h
32 #define vtkStaticPlaneCutter_h
34 #include <vtkIdList.h>
36 #include <vtkPlaneCutter.h>
37 #include <vtkSmartPointer.h>
41 class vtkMultiPieceDataSet;
43 class vtkStaticPlaneCutter : public vtkPlaneCutter
46 static vtkStaticPlaneCutter* New();
47 typedef vtkPlaneCutter Superclass; // vtkTypeMacro can't be used with a factory built object
48 void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
50 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) VTK_OVERRIDE;
53 vtkStaticPlaneCutter();
54 ~vtkStaticPlaneCutter() VTK_OVERRIDE;
57 * Check input for "Ids" cell array, if absent, compute and add them.
59 static void AddIdsArray(vtkDataSet* input, vtkDataSet* output);
62 * Update cache point, cell and field data using input
64 void UpdateCacheData(vtkDataSet* input);
67 * Compute the cells ids to be used when updating the cache later
69 void ComputeCellIds();
72 * Remove all point data array of a multipiece input with polydata leafs
74 static void RemovePointData(vtkMultiPieceDataSet* dataset);
76 vtkNew<vtkMultiPieceDataSet> Cache;
77 std::vector<vtkSmartPointer<vtkIdList> > CellToCopyFrom;
78 std::vector<vtkSmartPointer<vtkIdList> > CellToCopyTo;
79 vtkMTimeType InputMeshTime;
80 vtkMTimeType FilterMTime;
83 // Hide these from the user and the compiler.
84 vtkStaticPlaneCutter(const vtkStaticPlaneCutter&) VTK_DELETE_FUNCTION;
85 void operator=(const vtkStaticPlaneCutter&) VTK_DELETE_FUNCTION;