1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: vtkPUnstructuredGridGhostCellsGenerator.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 // .NAME vtkPUnstructuredGridGhostCellsGenerator - Builds ghost cells for a
17 // distributed unstructured grid dataset.
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.
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>
33 // vtkDistributedDataFilter vtkPUnstructuredGridGhostDataGenerator
36 // This filter has been developed by Joachim Pouderoux, Kitware SAS 2015.
38 #ifndef vtkPUnstructuredGridGhostCellsGenerator_h
39 #define vtkPUnstructuredGridGhostCellsGenerator_h
41 #include "vtkUnstructuredGridAlgorithm.h"
43 class vtkMultiProcessController;
44 class vtkUnstructuredGrid;
46 class vtkPUnstructuredGridGhostCellsGenerator:
47 public vtkUnstructuredGridAlgorithm
49 vtkTypeMacro(vtkPUnstructuredGridGhostCellsGenerator, vtkUnstructuredGridAlgorithm);
52 void PrintSelf(ostream& os, vtkIndent indent);
54 static vtkPUnstructuredGridGhostCellsGenerator *New();
57 // Set/Get the MPI multi process controller object.
58 void SetController(vtkMultiProcessController *c);
59 vtkGetObjectMacro(Controller, vtkMultiProcessController);
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);
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);
75 vtkPUnstructuredGridGhostCellsGenerator();
76 ~vtkPUnstructuredGridGhostCellsGenerator();
78 virtual int RequestData(vtkInformation *, vtkInformationVector **,
79 vtkInformationVector *);
81 void ExtractAndReduceSurfacePoints();
83 void ComputeSharedPoints();
85 void ExtractAndSendGhostCells();
87 void ReceiveAndMergeGhostCells(vtkUnstructuredGrid*);
89 vtkMultiProcessController *Controller;
93 char* GlobalPointIdsArrayName;
94 bool UseGlobalPointIds;
98 vtkInternals* Internals;
100 vtkPUnstructuredGridGhostCellsGenerator(const vtkPUnstructuredGridGhostCellsGenerator&); // Not implemented
101 void operator=(const vtkPUnstructuredGridGhostCellsGenerator&); // Not implemented