]> SALOME platform Git repositories - modules/paravis.git/blob - src/Plugins/StaticMesh/plugin/StaticMeshModule/vtkStaticPUnstructuredGridGhostCellsGenerator.h
Salome HOME
StaticMeshPlugin porting for PV5.11
[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 vtkGhostCellsGenerator
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  * vtkGhostCellsGenerator
29  */
30
31 #ifndef vtkStaticPUnstructuredGridGhostCellsGenerator_h
32 #define vtkStaticPUnstructuredGridGhostCellsGenerator_h
33
34 #include <vtkNew.h>
35 #include <vtkGhostCellsGenerator.h>
36
37 #include <vector>
38
39 #include "StaticMeshModuleModule.h"
40
41 class vtkIdList;
42 class vtkDataSet;
43 class vtkUnstructuredGrid;
44
45 class STATICMESHMODULE_EXPORT vtkStaticPUnstructuredGridGhostCellsGenerator
46   : public vtkGhostCellsGenerator
47 {
48 public:
49   static vtkStaticPUnstructuredGridGhostCellsGenerator* New();
50   typedef vtkGhostCellsGenerator
51     Superclass; // vtkTypeMacro can't be used with a factory built object
52   void PrintSelf(ostream& os, vtkIndent indent) override;
53
54   int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
55
56 protected:
57   vtkStaticPUnstructuredGridGhostCellsGenerator();
58   ~vtkStaticPUnstructuredGridGhostCellsGenerator() override = default;
59
60   /**
61    * Check input for "ProcessId" and "Ids" point and cell array,
62    * If absent, compute and add them.
63    */
64   static void AddIdsArrays(vtkDataSet* input, vtkDataSet* output);
65
66   /**
67    * Using the Cache, exchange and update ghost point and cell
68    * ids between ranks
69    */
70   virtual void ProcessGhostIds();
71
72   /**
73    * Update cache with input and with ghost cells info
74    */
75   virtual void UpdateCacheData(vtkDataSet* input);
76
77   /**
78    * Copy input point, cell and field data into cache
79    */
80   virtual void UpdateCacheDataWithInput(vtkDataSet* input);
81
82   /**
83    * Using Cached ghost cell and points info
84    * Update ghost cell and point data in cache
85    * by sending input point and cell data to other ranks
86    */
87   virtual void UpdateCacheGhostCellAndPointData(vtkDataSet* input);
88
89 private:
90   vtkStaticPUnstructuredGridGhostCellsGenerator(
91     const vtkStaticPUnstructuredGridGhostCellsGenerator&) = delete;
92   void operator=(const vtkStaticPUnstructuredGridGhostCellsGenerator&) = delete;
93
94   vtkNew<vtkUnstructuredGrid> Cache;
95   vtkMTimeType InputMeshTime = 0;
96   vtkMTimeType FilterMTime = 0;
97
98   std::vector<vtkNew<vtkIdList> > GhostCellsToReceive;
99   std::vector<vtkNew<vtkIdList> > GhostCellsToSend;
100   std::vector<vtkNew<vtkIdList> > GhostPointsToReceive;
101   std::vector<vtkNew<vtkIdList> > GhostPointsToSend;
102 };
103
104 #endif