Salome HOME
Merge branch 'V8_0_BR'
[modules/paravis.git] / src / Plugins / GhostCellsGenerator / vtkPUnstructuredGridGhostCellsGenerator.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    vtkPUnstructuredGridGhostCellsGenerator.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 // .NAME vtkPUnstructuredGridGhostCellsGenerator - Builds ghost cells for a
17 //  distributed unstructured grid dataset.
18 //
19 // .SECTION Description
20 // This filter generate ghost cells for distributed a unstructured grid in
21 // parallel - using MPI asynchronous communcations.
22 // The filter can take benefit of the input grid point global ids to perform.
23 //
24 // .SECTION Caveats
25 //  <ul>
26 //    <li> A step of 'all reduce' (each processor send/receive data to/from
27 //         all other processors.
28 //    <li> The code currently assumes one grid per rank. </li>
29 //    <li> PointData and CellData must match across partitions/processes. </li>
30 //  </ul>
31 //
32 // .SECTION See Also
33 // vtkDistributedDataFilter vtkPUnstructuredGridGhostDataGenerator
34 //
35 // .SECTION Thanks
36 // This filter has been developed by Joachim Pouderoux, Kitware SAS 2015.
37
38 #ifndef vtkPUnstructuredGridGhostCellsGenerator_h
39 #define vtkPUnstructuredGridGhostCellsGenerator_h
40
41 #include "vtkUnstructuredGridAlgorithm.h"
42
43 class vtkMultiProcessController;
44 class vtkUnstructuredGrid;
45
46 class vtkPUnstructuredGridGhostCellsGenerator:
47   public vtkUnstructuredGridAlgorithm
48 {
49   vtkTypeMacro(vtkPUnstructuredGridGhostCellsGenerator, vtkUnstructuredGridAlgorithm);
50
51 public:
52   void PrintSelf(ostream& os, vtkIndent indent);
53
54   static vtkPUnstructuredGridGhostCellsGenerator *New();
55
56   // Description:
57   // Set/Get the MPI multi process controller object.
58   void SetController(vtkMultiProcessController *c);
59   vtkGetObjectMacro(Controller, vtkMultiProcessController);
60
61   // Description:
62   // Specify if the filter must take benefit of global point ids if they exist.
63   // If false, point coordinates are used. Default is TRUE.
64   vtkSetMacro(UseGlobalPointIds, bool);
65   vtkGetMacro(UseGlobalPointIds, bool);
66   vtkBooleanMacro(UseGlobalPointIds, bool);
67
68   // Description:
69   // Specify the name of the global point ids data array if the GlobalIds
70   // attribute array is not set. Default is "GlobalNodeIds".
71   vtkSetStringMacro(GlobalPointIdsArrayName);
72   vtkGetStringMacro(GlobalPointIdsArrayName);
73
74 protected:
75   vtkPUnstructuredGridGhostCellsGenerator();
76   ~vtkPUnstructuredGridGhostCellsGenerator();
77
78   virtual int RequestData(vtkInformation *, vtkInformationVector **,
79     vtkInformationVector *);
80
81   void ExtractAndReduceSurfacePoints();
82
83   void ComputeSharedPoints();
84
85   void ExtractAndSendGhostCells();
86
87   void ReceiveAndMergeGhostCells(vtkUnstructuredGrid*);
88
89   vtkMultiProcessController *Controller;
90
91   int NumRanks;
92   int RankId;
93   char* GlobalPointIdsArrayName;
94   bool UseGlobalPointIds;
95
96 private:
97   struct vtkInternals;
98   vtkInternals* Internals;
99
100   vtkPUnstructuredGridGhostCellsGenerator(const vtkPUnstructuredGridGhostCellsGenerator&); // Not implemented
101   void operator=(const vtkPUnstructuredGridGhostCellsGenerator&); // Not implemented
102 };
103
104 #endif