VTK
vtkDistributedDataFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDistributedDataFilter.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  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
92 #ifndef vtkDistributedDataFilter_h
93 #define vtkDistributedDataFilter_h
94 
95 #include "vtkFiltersParallelMPIModule.h" // For export macro
96 #include "vtkDataObjectAlgorithm.h"
97 
98 class vtkBSPCuts;
99 class vtkDataArray;
100 class vtkDistributedDataFilterSTLCloak;
101 class vtkFloatArray;
102 class vtkIdList;
103 class vtkIdTypeArray;
104 class vtkIntArray;
106 class vtkPKdTree;
107 class vtkUnstructuredGrid;
108 
109 class VTKFILTERSPARALLELMPI_EXPORT vtkDistributedDataFilter: public vtkDataObjectAlgorithm
110 {
111  vtkTypeMacro(vtkDistributedDataFilter,
113 
114 public:
115  void PrintSelf(ostream& os, vtkIndent indent);
116 
117  static vtkDistributedDataFilter *New();
118 
120 
123  void SetController(vtkMultiProcessController *c);
124  vtkGetObjectMacro(Controller, vtkMultiProcessController);
126 
137  vtkPKdTree *GetKdtree();
138 
156  vtkBooleanMacro(RetainKdtree, int);
157  vtkGetMacro(RetainKdtree, int);
158  vtkSetMacro(RetainKdtree, int);
159 
171  vtkBooleanMacro(IncludeAllIntersectingCells, int);
172  vtkGetMacro(IncludeAllIntersectingCells, int);
173  vtkSetMacro(IncludeAllIntersectingCells, int);
174 
181  vtkBooleanMacro(ClipCells, int);
182  vtkGetMacro(ClipCells, int);
183  vtkSetMacro(ClipCells, int);
184 
186  ASSIGN_TO_ONE_REGION=0,
187  ASSIGN_TO_ALL_INTERSECTING_REGIONS=1,
188  SPLIT_BOUNDARY_CELLS=2
189  };
190 
192 
195  void SetBoundaryMode(int mode);
197  { this->SetBoundaryMode(vtkDistributedDataFilter::ASSIGN_TO_ONE_REGION); }
199  { this->SetBoundaryMode(
201  }
203  { this->SetBoundaryMode(vtkDistributedDataFilter::SPLIT_BOUNDARY_CELLS); }
204  int GetBoundaryMode();
206 
211 
222  vtkBooleanMacro(UseMinimalMemory, int);
223  vtkGetMacro(UseMinimalMemory, int);
224  vtkSetMacro(UseMinimalMemory, int);
225 
226 
231  vtkBooleanMacro(Timing, int);
232  vtkSetMacro(Timing, int);
233  vtkGetMacro(Timing, int);
234 
247  vtkBSPCuts* GetCuts() {return this->UserCuts;}
248  void SetCuts(vtkBSPCuts* cuts);
249 
259  void SetUserRegionAssignments(const int *map, int numRegions);
260 
261 protected:
264 
272  void AssignBoundaryCellsToOneRegionOn();
273  void AssignBoundaryCellsToOneRegionOff();
274  void SetAssignBoundaryCellsToOneRegion(int val);
275 
285  void AssignBoundaryCellsToAllIntersectingRegionsOn();
286  void AssignBoundaryCellsToAllIntersectingRegionsOff();
287  void SetAssignBoundaryCellsToAllIntersectingRegions(int val);
288 
297  void DivideBoundaryCellsOn();
298  void DivideBoundaryCellsOff();
299  void SetDivideBoundaryCells(int val);
300 
309  void SingleProcessExecute(vtkDataSet *input, vtkUnstructuredGrid *output);
313 
319  virtual int RequestDataObject(vtkInformation*,
322 
326  int RequestDataInternal(vtkDataSet* input, vtkUnstructuredGrid* output);
327 
328 private:
329 
330  enum{
331  DeleteNo = 0,
332  DeleteYes = 1
333  };
334 
335  enum{
336  DuplicateCellsNo = 0,
337  DuplicateCellsYes = 1
338  };
339 
340  enum{
341  GhostCellsNo = 0,
342  GhostCellsYes = 1
343  };
344 
345  enum{
346  UnsetGhostLevel = 99
347  };
348 
352  int PartitionDataAndAssignToProcesses(vtkDataSet *set);
353 
357  vtkUnstructuredGrid *RedistributeDataSet(vtkDataSet *set, vtkDataSet *input);
358 
362  int ClipGridCells(vtkUnstructuredGrid *grid);
363 
367  vtkUnstructuredGrid * AcquireGhostCells(vtkUnstructuredGrid *grid);
368 
372  void ComputeMyRegionBounds();
373 
377  int CheckFieldArrayTypes(vtkDataSet *set);
378 
384  vtkDataSet *TestFixTooFewInputFiles(vtkDataSet *input);
385 
389  vtkUnstructuredGrid *MPIRedistribute(vtkDataSet *in, vtkDataSet *input);
390 
394  vtkIdList **GetCellIdsForProcess(int proc, int *nlists);
395 
400  void SetUpPairWiseExchange();
401 
403 
406  void FreeIntArrays(vtkIdTypeArray **ar);
407  static void FreeIdLists(vtkIdList**lists, int nlists);
408  static vtkIdType GetIdListSize(vtkIdList**lists, int nlists);
410 
412 
415  vtkIdTypeArray *ExchangeCounts(vtkIdType myCount, int tag);
416  vtkIdTypeArray *ExchangeCountsLean(vtkIdType myCount, int tag);
417  vtkIdTypeArray *ExchangeCountsFast(vtkIdType myCount, int tag);
419 
421 
424  vtkIdTypeArray **ExchangeIdArrays(vtkIdTypeArray **arIn,
425  int deleteSendArrays, int tag);
426  vtkIdTypeArray **ExchangeIdArraysLean(vtkIdTypeArray **arIn,
427  int deleteSendArrays, int tag);
428  vtkIdTypeArray **ExchangeIdArraysFast(vtkIdTypeArray **arIn,
429  int deleteSendArrays, int tag);
431 
433 
436  vtkFloatArray **ExchangeFloatArrays(vtkFloatArray **myArray,
437  int deleteSendArrays, int tag);
438  vtkFloatArray **ExchangeFloatArraysLean(vtkFloatArray **myArray,
439  int deleteSendArrays, int tag);
440  vtkFloatArray **ExchangeFloatArraysFast(vtkFloatArray **myArray,
441  int deleteSendArrays, int tag);
443 
445 
448  vtkUnstructuredGrid *ExchangeMergeSubGrids(vtkIdList **cellIds, int deleteCellIds,
449  vtkDataSet *myGrid, int deleteMyGrid,
450  int filterOutDuplicateCells, int ghostCellFlag, int tag);
451  vtkUnstructuredGrid *ExchangeMergeSubGrids(vtkIdList ***cellIds, int *numLists,
452  int deleteCellIds,
453  vtkDataSet *myGrid, int deleteMyGrid,
454  int filterOutDuplicateCells, int ghostCellFlag, int tag);
455  vtkUnstructuredGrid *ExchangeMergeSubGridsLean(
456  vtkIdList ***cellIds, int *numLists,
457  int deleteCellIds,
458  vtkDataSet *myGrid, int deleteMyGrid,
459  int filterOutDuplicateCells, int ghostCellFlag, int tag);
460  vtkUnstructuredGrid *ExchangeMergeSubGridsFast(
461  vtkIdList ***cellIds, int *numLists,
462  int deleteCellIds,
463  vtkDataSet *myGrid, int deleteMyGrid,
464  int filterOutDuplicateCells, int ghostCellFlag, int tag);
466 
467 
469 
472  char *MarshallDataSet(vtkUnstructuredGrid *extractedGrid, int &size);
473  vtkUnstructuredGrid *UnMarshallDataSet(char *buf, int size);
475 
477 
480  void ClipCellsToSpatialRegion(vtkUnstructuredGrid *grid);
481 #if 0
482  void ClipWithVtkClipDataSet(vtkUnstructuredGrid *grid, double *bounds,
483  vtkUnstructuredGrid **outside, vtkUnstructuredGrid **inside);
484 #endif
485 
486 
487  void ClipWithBoxClipDataSet(vtkUnstructuredGrid *grid, double *bounds,
488  vtkUnstructuredGrid **outside, vtkUnstructuredGrid **inside);
489 
491 
497  vtkIdTypeArray *GetGlobalNodeIdArray(vtkDataSet *set);
498  vtkIdType *GetGlobalNodeIds(vtkDataSet *set);
499  vtkIdTypeArray *GetGlobalElementIdArray(vtkDataSet *set);
500  vtkIdType *GetGlobalElementIds(vtkDataSet *set);
501  int AssignGlobalNodeIds(vtkUnstructuredGrid *grid);
502  int AssignGlobalElementIds(vtkDataSet *in);
503  vtkIdTypeArray **FindGlobalPointIds(vtkFloatArray **ptarray,
504  vtkIdTypeArray *ids, vtkUnstructuredGrid *grid, vtkIdType &numUniqueMissingPoints);
506 
510  vtkIdTypeArray **MakeProcessLists(vtkIdTypeArray **pointIds,
511  vtkDistributedDataFilterSTLCloak *procs);
512 
516  vtkIdList **BuildRequestedGrids( vtkIdTypeArray **globalPtIds,
517  vtkUnstructuredGrid *grid,
518  vtkDistributedDataFilterSTLCloak *ptIdMap);
519 
521 
524  int InMySpatialRegion(float x, float y, float z);
525  int InMySpatialRegion(double x, double y, double z);
526  int StrictlyInsideMyBounds(float x, float y, float z);
527  int StrictlyInsideMyBounds(double x, double y, double z);
529 
531 
534  vtkIdTypeArray **GetGhostPointIds(int ghostLevel, vtkUnstructuredGrid *grid,
535  int AddCellsIAlreadyHave);
536  vtkUnstructuredGrid *AddGhostCellsUniqueCellAssignment(
537  vtkUnstructuredGrid *myGrid,
538  vtkDistributedDataFilterSTLCloak *globalToLocalMap);
539  vtkUnstructuredGrid *AddGhostCellsDuplicateCellAssignment(
540  vtkUnstructuredGrid *myGrid,
541  vtkDistributedDataFilterSTLCloak *globalToLocalMap);
542  vtkUnstructuredGrid *SetMergeGhostGrid(
543  vtkUnstructuredGrid *ghostCellGrid,
544  vtkUnstructuredGrid *incomingGhostCells,
545  int ghostLevel, vtkDistributedDataFilterSTLCloak *idMap);
547 
549 
552  vtkUnstructuredGrid *ExtractCells(vtkIdList *list,
553  int deleteCellLists, vtkDataSet *in);
554  vtkUnstructuredGrid *ExtractCells(vtkIdList **lists, int nlists,
555  int deleteCellLists, vtkDataSet *in);
556  vtkUnstructuredGrid *ExtractZeroCellGrid(vtkDataSet *in);
558 
560 
563  static int GlobalPointIdIsUsed(vtkUnstructuredGrid *grid,
564  int ptId, vtkDistributedDataFilterSTLCloak *globalToLocal);
565  static int LocalPointIdIsUsed(vtkUnstructuredGrid *grid, int ptId);
566  static vtkIdType FindId(vtkIdTypeArray *ids, vtkIdType gid, vtkIdType startLoc);
568 
572  static vtkIdTypeArray *AddPointAndCells(vtkIdType gid,
573  vtkIdType localId,
574  vtkUnstructuredGrid *grid,
575  vtkIdType *gidCells,
576  vtkIdTypeArray *ids);
577 
579 
582  static void AddConstantUnsignedCharPointArray(vtkUnstructuredGrid *grid,
583  const char *arrayName, unsigned char val);
584  static void AddConstantUnsignedCharCellArray(vtkUnstructuredGrid *grid,
585  const char *arrayName, unsigned char val);
587 
591  static void RemoveRemoteCellsFromList(vtkIdList *cellList,
592  vtkIdType *gidCells,
593  vtkIdType *remoteCells,
594  vtkIdType nRemoteCells);
595 
599  static vtkUnstructuredGrid *MergeGrids(vtkDataSet **sets, int nsets,
600  int deleteDataSets,
601  int useGlobalNodeIds, float pointMergeTolerance,
602  int useGlobalCellIds);
603 
604  vtkPKdTree *Kdtree;
605  vtkMultiProcessController *Controller;
606 
607  int NumProcesses;
608  int MyId;
609 
610  int *Target;
611  int *Source;
612 
613  int NumConvexSubRegions;
614  double *ConvexSubRegionBounds;
615 
616  int GhostLevel;
617 
618  int RetainKdtree;
619  int IncludeAllIntersectingCells;
620  int ClipCells;
621  int AssignBoundaryCellsToOneRegion;
622  int AssignBoundaryCellsToAllIntersectingRegions;
623  int DivideBoundaryCells;
624 
625  int Timing;
626 
627  int NextProgressStep;
628  double ProgressIncrement;
629 
630  int UseMinimalMemory;
631 
632  vtkBSPCuts* UserCuts;
633 
634  vtkDistributedDataFilter(const vtkDistributedDataFilter&) VTK_DELETE_FUNCTION;
635  void operator=(const vtkDistributedDataFilter&) VTK_DELETE_FUNCTION;
636 
637  class vtkInternals;
638  vtkInternals* Internals;
639 
640 };
641 #endif
vtkDistributedDataFilter
Distribute data among processors.
Definition: vtkDistributedDataFilter.h:109
vtkDataObjectAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkDataObjectAlgorithm
Superclass for algorithms that produce only data object as output.
Definition: vtkDataObjectAlgorithm.h:43
vtkDistributedDataFilter::BoundaryModes
BoundaryModes
Definition: vtkDistributedDataFilter.h:185
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkPKdTree
Build a k-d tree decomposition of a list of points.
Definition: vtkPKdTree.h:55
vtkDistributedDataFilter::ASSIGN_TO_ALL_INTERSECTING_REGIONS
@ ASSIGN_TO_ALL_INTERSECTING_REGIONS
Definition: vtkDistributedDataFilter.h:187
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkDataObjectAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkDataObjectAlgorithm.h:115
vtkDistributedDataFilter::SetBoundaryModeToAssignToOneRegion
void SetBoundaryModeToAssignToOneRegion()
Definition: vtkDistributedDataFilter.h:196
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:82
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkIntArray
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
vtkBSPCuts
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:44
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkDistributedDataFilter::GetCuts
vtkBSPCuts * GetCuts()
You can set the k-d tree decomposition, rather than have D3 compute it.
Definition: vtkDistributedDataFilter.h:247
vtkDistributedDataFilter::ASSIGN_TO_ONE_REGION
@ ASSIGN_TO_ONE_REGION
Definition: vtkDistributedDataFilter.h:186
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkDistributedDataFilter::SetBoundaryModeToSplitBoundaryCells
void SetBoundaryModeToSplitBoundaryCells()
Definition: vtkDistributedDataFilter.h:202
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:41
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
vtkX3D::mode
@ mode
Definition: vtkX3D.h:247
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Definition: vtkDataObjectAlgorithm.h:122
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:81
vtkDataObjectAlgorithm.h
vtkDataObjectAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataObjectAlgorithm::RequestDataObject
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkDataObjectAlgorithm.h:104
vtkDataObjectAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkDistributedDataFilter::SetBoundaryModeToAssignToAllIntersectingRegions
void SetBoundaryModeToAssignToAllIntersectingRegions()
Definition: vtkDistributedDataFilter.h:198
vtkDistributedDataFilter::SPLIT_BOUNDARY_CELLS
@ SPLIT_BOUNDARY_CELLS
Definition: vtkDistributedDataFilter.h:188