]> SALOME platform Git repositories - modules/paravis.git/blob - src/Plugins/StaticMesh/plugin/StaticMeshModule/vtkStaticPlaneCutter.h
Salome HOME
bos #42937: [CEA 41954] Integration of UB24.04 patches
[modules/paravis.git] / src / Plugins / StaticMesh / plugin / StaticMeshModule / vtkStaticPlaneCutter.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    vtkStaticPlaneCutter.h
5
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
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.
13
14 =========================================================================*/
15 /**
16  * @class   vtkStaticPlaneCutter
17  * @brief   StaticMesh aware implementation of vtkPlaneCutter for vtkUnstructuredGrid
18  *
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.
25  *
26  * @sa
27  * vtkPlaneCutter
28  */
29
30 #ifndef vtkStaticPlaneCutter_h
31 #define vtkStaticPlaneCutter_h
32
33 #include <vtkIdList.h>
34 #include <vtkNew.h>
35 #include <vtkPlaneCutter.h>
36 #include <vtkSmartPointer.h>
37
38 #include <vector>
39
40 #include "StaticMeshModuleModule.h"
41
42 class vtkUnstructuredGrid;
43 class vtkMultiPieceDataSet;
44
45 class STATICMESHMODULE_EXPORT vtkStaticPlaneCutter : public vtkPlaneCutter
46 {
47 public:
48   static vtkStaticPlaneCutter* New();
49   typedef vtkPlaneCutter Superclass; // vtkTypeMacro can't be used with a factory built object
50   void PrintSelf(ostream& os, vtkIndent indent) override;
51
52   /**
53    * see vtkDataSetAlgorithm
54    */
55   int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
56
57 protected:
58   vtkStaticPlaneCutter() = default;
59   ~vtkStaticPlaneCutter() override = default;
60
61   /**
62    * Check input for Ids cell array, if absent, compute and add them.
63    */
64   static void AddIdsArray(vtkDataSet* input, vtkDataSet* output);
65
66   /**
67    * Remove an Ids cell array in all polydata pieces of output
68    */
69   static void RemoveIdsArray(vtkDataObject* output);
70
71   /**
72    * Update cache point, cell and field data using input
73    */
74   void UpdateCacheData(vtkDataSet* input);
75
76   /**
77    * Compute the ids and weights to be used when updating the cache later
78    */
79   void ComputeIds(vtkUnstructuredGrid* input);
80
81   /**
82    * Fill the output using the Cache, depending on its type
83    */
84    void SetOutputFromCache(vtkDataObject* output);
85
86 private:
87   // Hide these from the user and the compiler.
88   vtkStaticPlaneCutter(const vtkStaticPlaneCutter&) = delete;
89   void operator=(const vtkStaticPlaneCutter&) = delete;
90
91   struct WeightsVectorElmt
92   {
93     vtkSmartPointer<vtkIdList> pointsList;
94     std::vector<double> pointsWeights;
95   };
96
97   vtkNew<vtkMultiPieceDataSet> Cache;
98   std::vector<vtkNew<vtkIdList> > CellToCopyFrom;
99   std::vector<vtkNew<vtkIdList> > CellToCopyTo;
100   std::vector<std::vector<WeightsVectorElmt> > WeightsVectorCompo;
101   vtkMTimeType InputMeshTime = 0;
102   vtkMTimeType FilterMTime = 0;
103 };
104
105 #endif