VTK  9.3.20240419
vtkPDistributedDataFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
74 #ifndef vtkPDistributedDataFilter_h
75 #define vtkPDistributedDataFilter_h
76 
78 #include "vtkFiltersParallelGeometryModule.h" // For export macro
79 
80 VTK_ABI_NAMESPACE_BEGIN
81 class vtkBSPCuts;
82 class vtkDataArray;
83 class vtkFloatArray;
84 class vtkIdList;
85 class vtkIdTypeArray;
86 class vtkIntArray;
88 class vtkPDistributedDataFilterSTLCloak;
89 class vtkPKdTree;
91 
92 class VTKFILTERSPARALLELGEOMETRY_EXPORT vtkPDistributedDataFilter : public vtkDistributedDataFilter
93 {
94 public:
96  void PrintSelf(ostream& os, vtkIndent indent) override;
97 
99 
100 protected:
103 
112 
117 
118 private:
119  enum
120  {
121  DeleteNo = 0,
122  DeleteYes = 1
123  };
124 
125  enum
126  {
127  DuplicateCellsNo = 0,
128  DuplicateCellsYes = 1
129  };
130 
131  enum
132  {
133  GhostCellsNo = 0,
134  GhostCellsYes = 1
135  };
136 
137  enum
138  {
139  UnsetGhostLevel = 99
140  };
141 
145  int PartitionDataAndAssignToProcesses(vtkDataSet* set);
146 
150  vtkUnstructuredGrid* RedistributeDataSet(
151  vtkDataSet* set, vtkDataSet* input, int filterOutDuplicateCells);
152 
156  int ClipGridCells(vtkUnstructuredGrid* grid);
157 
161  vtkUnstructuredGrid* AcquireGhostCells(vtkUnstructuredGrid* grid);
162 
166  void ComputeMyRegionBounds();
167 
171  int CheckFieldArrayTypes(vtkDataSet* set);
172 
178  vtkDataSet* TestFixTooFewInputFiles(vtkDataSet* input, int& duplicateCells);
179 
183  vtkUnstructuredGrid* MPIRedistribute(
184  vtkDataSet* in, vtkDataSet* input, int filterOutDuplicateCells);
185 
189  vtkIdList** GetCellIdsForProcess(int proc, int* nlists);
190 
195  void SetUpPairWiseExchange();
196 
198 
201  void FreeIntArrays(vtkIdTypeArray** ar);
202  static void FreeIdLists(vtkIdList** lists, int nlists);
203  static vtkIdType GetIdListSize(vtkIdList** lists, int nlists);
205 
207 
210  vtkIdTypeArray* ExchangeCounts(vtkIdType myCount, int tag);
211  vtkIdTypeArray* ExchangeCountsLean(vtkIdType myCount, int tag);
212  vtkIdTypeArray* ExchangeCountsFast(vtkIdType myCount, int tag);
214 
216 
219  vtkIdTypeArray** ExchangeIdArrays(vtkIdTypeArray** arIn, int deleteSendArrays, int tag);
220  vtkIdTypeArray** ExchangeIdArraysLean(vtkIdTypeArray** arIn, int deleteSendArrays, int tag);
221  vtkIdTypeArray** ExchangeIdArraysFast(vtkIdTypeArray** arIn, int deleteSendArrays, int tag);
223 
225 
228  vtkFloatArray** ExchangeFloatArrays(vtkFloatArray** myArray, int deleteSendArrays, int tag);
229  vtkFloatArray** ExchangeFloatArraysLean(vtkFloatArray** myArray, int deleteSendArrays, int tag);
230  vtkFloatArray** ExchangeFloatArraysFast(vtkFloatArray** myArray, int deleteSendArrays, int tag);
232 
234 
237  vtkUnstructuredGrid* ExchangeMergeSubGrids(vtkIdList** cellIds, int deleteCellIds,
238  vtkDataSet* myGrid, int deleteMyGrid, int filterOutDuplicateCells, int ghostCellFlag, int tag);
239  vtkUnstructuredGrid* ExchangeMergeSubGrids(vtkIdList*** cellIds, int* numLists, int deleteCellIds,
240  vtkDataSet* myGrid, int deleteMyGrid, int filterOutDuplicateCells, int ghostCellFlag, int tag);
241  vtkUnstructuredGrid* ExchangeMergeSubGridsLean(vtkIdList*** cellIds, int* numLists,
242  int deleteCellIds, vtkDataSet* myGrid, int deleteMyGrid, int filterOutDuplicateCells,
243  int ghostCellFlag, int tag);
244  vtkUnstructuredGrid* ExchangeMergeSubGridsFast(vtkIdList*** cellIds, int* numLists,
245  int deleteCellIds, vtkDataSet* myGrid, int deleteMyGrid, int filterOutDuplicateCells,
246  int ghostCellFlag, int tag);
248 
250 
253  char* MarshallDataSet(vtkUnstructuredGrid* extractedGrid, vtkIdType& size);
254  vtkUnstructuredGrid* UnMarshallDataSet(char* buf, vtkIdType size);
256 
258 
261  void ClipCellsToSpatialRegion(vtkUnstructuredGrid* grid);
262 #if 0
263  void ClipWithVtkClipDataSet(vtkUnstructuredGrid *grid, double *bounds,
264  vtkUnstructuredGrid **outside, vtkUnstructuredGrid **inside);
265 #endif
267 
268  void ClipWithBoxClipDataSet(vtkUnstructuredGrid* grid, double* bounds,
269  vtkUnstructuredGrid** outside, vtkUnstructuredGrid** inside);
270 
272 
278  vtkIdTypeArray* GetGlobalNodeIdArray(vtkDataSet* set);
279  vtkIdType* GetGlobalNodeIds(vtkDataSet* set);
280  vtkIdTypeArray* GetGlobalElementIdArray(vtkDataSet* set);
281  vtkIdType* GetGlobalElementIds(vtkDataSet* set);
282  int AssignGlobalNodeIds(vtkUnstructuredGrid* grid);
283  int AssignGlobalElementIds(vtkDataSet* in);
284  vtkIdTypeArray** FindGlobalPointIds(vtkFloatArray** ptarray, vtkIdTypeArray* ids,
285  vtkUnstructuredGrid* grid, vtkIdType& numUniqueMissingPoints);
287 
291  vtkIdTypeArray** MakeProcessLists(
292  vtkIdTypeArray** pointIds, vtkPDistributedDataFilterSTLCloak* procs);
293 
297  vtkIdList** BuildRequestedGrids(vtkIdTypeArray** globalPtIds, vtkUnstructuredGrid* grid,
298  vtkPDistributedDataFilterSTLCloak* ptIdMap);
299 
301 
304  int InMySpatialRegion(float x, float y, float z);
305  int InMySpatialRegion(double x, double y, double z);
306  int StrictlyInsideMyBounds(float x, float y, float z);
307  int StrictlyInsideMyBounds(double x, double y, double z);
309 
311 
314  vtkIdTypeArray** GetGhostPointIds(
315  int ghostLevel, vtkUnstructuredGrid* grid, int AddCellsIAlreadyHave);
316  vtkUnstructuredGrid* AddGhostCellsUniqueCellAssignment(
317  vtkUnstructuredGrid* myGrid, vtkPDistributedDataFilterSTLCloak* globalToLocalMap);
318  vtkUnstructuredGrid* AddGhostCellsDuplicateCellAssignment(
319  vtkUnstructuredGrid* myGrid, vtkPDistributedDataFilterSTLCloak* globalToLocalMap);
320  vtkUnstructuredGrid* SetMergeGhostGrid(vtkUnstructuredGrid* ghostCellGrid,
321  vtkUnstructuredGrid* incomingGhostCells, int ghostLevel,
322  vtkPDistributedDataFilterSTLCloak* idMap);
324 
326 
329  vtkUnstructuredGrid* ExtractCells(vtkIdList* list, int deleteCellLists, vtkDataSet* in);
330  vtkUnstructuredGrid* ExtractCells(
331  vtkIdList** lists, int nlists, int deleteCellLists, vtkDataSet* in);
332  vtkUnstructuredGrid* ExtractZeroCellGrid(vtkDataSet* in);
334 
336 
339  static int GlobalPointIdIsUsed(
340  vtkUnstructuredGrid* grid, int ptId, vtkPDistributedDataFilterSTLCloak* globalToLocal);
341  static int LocalPointIdIsUsed(vtkUnstructuredGrid* grid, int ptId);
342  static vtkIdType FindId(vtkIdTypeArray* ids, vtkIdType gid, vtkIdType startLoc);
344 
348  static vtkIdTypeArray* AddPointAndCells(vtkIdType gid, vtkIdType localId,
349  vtkUnstructuredGrid* grid, vtkIdType* gidCells, vtkIdTypeArray* ids);
350 
352 
355  static void AddConstantUnsignedCharPointArray(
356  vtkUnstructuredGrid* grid, const char* arrayName, unsigned char val);
357  static void AddConstantUnsignedCharCellArray(
358  vtkUnstructuredGrid* grid, const char* arrayName, unsigned char val);
360 
364  static void RemoveRemoteCellsFromList(
365  vtkIdList* cellList, vtkIdType* gidCells, vtkIdType* remoteCells, vtkIdType nRemoteCells);
366 
370  static vtkUnstructuredGrid* MergeGrids(vtkDataSet** sets, int nsets, int deleteDataSets,
371  int useGlobalNodeIds, float pointMergeTolerance, int useGlobalCellIds);
372 
374  void operator=(const vtkPDistributedDataFilter&) = delete;
375 };
376 VTK_ABI_NAMESPACE_END
377 #endif
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:31
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:155
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
Serial stand-in for parallel filter that distributes data among processors.
dynamic, self-adjusting array of float
list of point or cell ids
Definition: vtkIdList.h:133
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:144
Multiprocessing communication superclass.
Distribute data among processors.
void SingleProcessExecute(vtkDataSet *input, vtkUnstructuredGrid *output)
int RequestDataInternal(vtkDataSet *input, vtkUnstructuredGrid *output)
Implementation for request data.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
Build a vtkUnstructuredGrid for a spatial region from the data distributed across processes.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkPDistributedDataFilter * New()
~vtkPDistributedDataFilter() override
Build a k-d tree decomposition of a list of points.
Definition: vtkPKdTree.h:44
dataset represents arbitrary combinations of all possible cell types
const std::string pointIds
@ size
Definition: vtkX3D.h:253
int vtkIdType
Definition: vtkType.h:315