Salome HOME
Porting to ParaView 5.8
[modules/paravis.git] / src / Plugins / StaticMesh / plugin / StaticMeshModule / vtkStaticPUnstructuredGridGhostCellsGenerator.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    vtkStaticPUnstructuredGridGhostCellsGenerator.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   vtkStaticPUnstructuredGridGhostCellsGenerator
17  * @brief   StaticMesh aware GhostCellGenerator implementation
18  *
19  * This class specialize vtkPUnstructuredGridGhostCellGenerator
20  * This class improves it by making it static mesh aware.
21  * The first time this filter is executed it will store its output
22  * in a cache as well as a list of ghost and point ids to request from other rank
23  * On next execution, if the mesh is static, it will uses the list of ids to request
24  * only point and cell data for the ghost point and cell from other
25  * allowing to update the output without needing to recompute everything
26  *
27  * @sa
28  * vtkPUnstructuredGridGhostCellsGenerator
29 */
30
31 #ifndef vtkStaticPUnstructuredGridGhostCellsGenerator_h
32 #define vtkStaticPUnstructuredGridGhostCellsGenerator_h
33
34 #include <vtkIdList.h>
35 #include <vtkNew.h>
36 #include <vtkPUnstructuredGridGhostCellsGenerator.h>
37 #include <vtkSmartPointer.h>
38
39 #include <vector>
40
41 class vtkUnstructuredGrid;
42
43 class vtkStaticPUnstructuredGridGhostCellsGenerator : public vtkPUnstructuredGridGhostCellsGenerator
44 {
45 public:
46   static vtkStaticPUnstructuredGridGhostCellsGenerator* New();
47   typedef vtkPUnstructuredGridGhostCellsGenerator
48     Superclass; // vtkTypeMacro can't be used with a factory built object
49   void PrintSelf(ostream& os, vtkIndent indent) override;
50
51   int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
52
53 protected:
54   vtkStaticPUnstructuredGridGhostCellsGenerator();
55   ~vtkStaticPUnstructuredGridGhostCellsGenerator() override;
56
57   /**
58    * Check input for "ProcessId" and "Ids" point and cell array,
59    * If absent, compute and add them.
60    */
61   static void AddIdsArrays(vtkDataSet* input, vtkDataSet* output);
62
63   /**
64    * Using the Cache, exchange and update ghost point and cell
65    * ids between ranks
66    */
67   virtual void ProcessGhostIds();
68
69   /**
70    * Update cache with input and with ghost cells info
71    */
72   virtual void UpdateCacheData(vtkDataSet* input);
73
74   /**
75    * Copy input point, cell and field data into cache
76    */
77   virtual void UpdateCacheDataWithInput(vtkDataSet* input);
78
79   /**
80    * Using Cached ghost cell and points info
81    * Update ghost cell and point data in cache
82    * by sending input point and cell data to other ranks
83    */
84   virtual void UpdateCacheGhostCellAndPointData(vtkDataSet* input);
85
86   vtkNew<vtkUnstructuredGrid> Cache;
87   vtkMTimeType InputMeshTime;
88   vtkMTimeType FilterMTime;
89
90   std::vector<vtkSmartPointer<vtkIdList> > GhostCellsToReceive;
91   std::vector<vtkSmartPointer<vtkIdList> > GhostCellsToSend;
92   std::vector<vtkSmartPointer<vtkIdList> > GhostPointsToReceive;
93   std::vector<vtkSmartPointer<vtkIdList> > GhostPointsToSend;
94
95 private:
96   // Hide these from the user and the compiler.
97   vtkStaticPUnstructuredGridGhostCellsGenerator(
98     const vtkStaticPUnstructuredGridGhostCellsGenerator&) = delete;
99   void operator=(const vtkStaticPUnstructuredGridGhostCellsGenerator&) = delete;
100 };
101
102 #endif