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 
118 
120 
124  vtkGetObjectMacro(Controller, vtkMultiProcessController);
126 
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 
197  { this->SetBoundaryMode(vtkDistributedDataFilter::ASSIGN_TO_ONE_REGION); }
199  { this->SetBoundaryMode(
201  }
203  { this->SetBoundaryMode(vtkDistributedDataFilter::SPLIT_BOUNDARY_CELLS); }
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 
275 
288 
299  void SetDivideBoundaryCells(int val);
300 
313 
322 
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
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
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
Superclass for algorithms that produce only data object as output.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
Distribute data among processors.
void SetUserRegionAssignments(const int *map, int numRegions)
vtkBSPCuts doesn't have information about process assignments for the cuts.
void SetAssignBoundaryCellsToAllIntersectingRegions(int val)
vtkBSPCuts * GetCuts()
You can set the k-d tree decomposition, rather than have D3 compute it.
vtkPKdTree * GetKdtree()
Get a pointer to the parallel k-d tree object.
void AssignBoundaryCellsToAllIntersectingRegionsOff()
void SetAssignBoundaryCellsToOneRegion(int val)
void DivideBoundaryCellsOn()
Another way to set ClipCells and IncludeAllIntersectingCells.
void SingleProcessExecute(vtkDataSet *input, vtkUnstructuredGrid *output)
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
static vtkDistributedDataFilter * New()
void AssignBoundaryCellsToOneRegionOn()
Another way to set ClipCells and IncludeAllIntersectingCells.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Build a vtkUnstructuredGrid for a spatial region from the data distributed across processes.
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Overridden to create the correct type of data output.
void SetCuts(vtkBSPCuts *cuts)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Ensure previous filters don't send up ghost cells.
void SetBoundaryMode(int mode)
Handling of ClipCells and IncludeAllIntersectingCells.
void AssignBoundaryCellsToOneRegionOff()
void AssignBoundaryCellsToAllIntersectingRegionsOn()
Another way to set ClipCells and IncludeAllIntersectingCells.
void SetDivideBoundaryCells(int val)
int RequestDataInternal(vtkDataSet *input, vtkUnstructuredGrid *output)
Implementation for request data.
void SetController(vtkMultiProcessController *c)
Set/Get the communicator object.
virtual int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
list of point or cell ids
Definition: vtkIdList.h:37
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
Multiprocessing communication superclass.
Build a k-d tree decomposition of a list of points.
Definition: vtkPKdTree.h:56
dataset represents arbitrary combinations of all possible cell types
@ info
Definition: vtkX3D.h:376
@ mode
Definition: vtkX3D.h:247
@ port
Definition: vtkX3D.h:447
@ size
Definition: vtkX3D.h:253
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287