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) override;
50 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
53 vtkStaticPlaneCutter();
54 ~vtkStaticPlaneCutter() override;
57 * Check input for Ids cell array, if absent, compute and add them.
59 static void AddIdsArray(vtkDataSet* input, vtkDataSet* output);
62 * Remove an Ids cell array in all polydata pieces of output
64 static void RemoveIdsArray(vtkMultiPieceDataSet* output);
67 * Update cache point, cell and field data using input
69 void UpdateCacheData(vtkDataSet* input);
72 * Compute the ids and weights to be used when updating the cache later
74 void ComputeIds(vtkUnstructuredGrid* input);
76 void ClearWeightsVector();
78 vtkNew<vtkMultiPieceDataSet> Cache;
79 std::vector<vtkSmartPointer<vtkIdList> > CellToCopyFrom;
80 std::vector<vtkSmartPointer<vtkIdList> > CellToCopyTo;
81 std::vector<std::vector<std::pair<vtkSmartPointer<vtkIdList>, double*>>> WeightsVectorCompo;
82 vtkMTimeType InputMeshTime;
83 vtkMTimeType FilterMTime;
86 // Hide these from the user and the compiler.
87 vtkStaticPlaneCutter(const vtkStaticPlaneCutter&) = delete;
88 void operator=(const vtkStaticPlaneCutter&) = delete;