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 
91 #ifndef vtkDistributedDataFilter_h
92 #define vtkDistributedDataFilter_h
93 
94 #include "vtkFiltersParallelMPIModule.h" // For export macro
95 #include "vtkDataObjectAlgorithm.h"
96 
97 class vtkBSPCuts;
98 class vtkDataArray;
99 class vtkDistributedDataFilterSTLCloak;
100 class vtkFloatArray;
101 class vtkIdList;
102 class vtkIdTypeArray;
103 class vtkIntArray;
105 class vtkPKdTree;
106 class vtkUnstructuredGrid;
107 
108 class VTKFILTERSPARALLELMPI_EXPORT vtkDistributedDataFilter: public vtkDataObjectAlgorithm
109 {
110  vtkTypeMacro(vtkDistributedDataFilter,
112 
113 public:
114  void PrintSelf(ostream& os, vtkIndent indent);
115 
116  static vtkDistributedDataFilter *New();
117 
119 
120  void SetController(vtkMultiProcessController *c);
121  vtkGetObjectMacro(Controller, vtkMultiProcessController);
123 
132  vtkPKdTree *GetKdtree();
133 
148  vtkBooleanMacro(RetainKdtree, int);
149  vtkGetMacro(RetainKdtree, int);
150  vtkSetMacro(RetainKdtree, int);
151 
161  vtkBooleanMacro(IncludeAllIntersectingCells, int);
162  vtkGetMacro(IncludeAllIntersectingCells, int);
163  vtkSetMacro(IncludeAllIntersectingCells, int);
164 
169  vtkBooleanMacro(ClipCells, int);
170  vtkGetMacro(ClipCells, int);
171  vtkSetMacro(ClipCells, int);
172 
173 //BTX
175  ASSIGN_TO_ONE_REGION=0,
176  ASSIGN_TO_ALL_INTERSECTING_REGIONS=1,
177  SPLIT_BOUNDARY_CELLS=2
178  };
179 //ETX
180 
182 
183  void SetBoundaryMode(int mode);
185  { this->SetBoundaryMode(vtkDistributedDataFilter::ASSIGN_TO_ONE_REGION); }
187  { this->SetBoundaryMode(
189  }
191  { this->SetBoundaryMode(vtkDistributedDataFilter::SPLIT_BOUNDARY_CELLS); }
192  int GetBoundaryMode();
194 
197 
205  vtkBooleanMacro(UseMinimalMemory, int);
206  vtkGetMacro(UseMinimalMemory, int);
207  vtkSetMacro(UseMinimalMemory, int);
208 
209 
212  vtkBooleanMacro(Timing, int);
213  vtkSetMacro(Timing, int);
214  vtkGetMacro(Timing, int);
215 
217 
222  vtkBSPCuts* GetCuts() {return this->UserCuts;}
223  void SetCuts(vtkBSPCuts* cuts);
225 
234  void SetUserRegionAssignments(const int *map, int numRegions);
235 
236 protected:
239 
245  void AssignBoundaryCellsToOneRegionOn();
246  void AssignBoundaryCellsToOneRegionOff();
247  void SetAssignBoundaryCellsToOneRegion(int val);
248 
256  void AssignBoundaryCellsToAllIntersectingRegionsOn();
257  void AssignBoundaryCellsToAllIntersectingRegionsOff();
258  void SetAssignBoundaryCellsToAllIntersectingRegions(int val);
259 
266  void DivideBoundaryCellsOn();
267  void DivideBoundaryCellsOff();
268  void SetDivideBoundaryCells(int val);
269 
276  void SingleProcessExecute(vtkDataSet *input, vtkUnstructuredGrid *output);
280 
282 
285  virtual int RequestDataObject(vtkInformation*,
289 
291 
292  int RequestDataInternal(vtkDataSet* input, vtkUnstructuredGrid* output);
293 //BTX
294 private:
296 
297  enum{
298  DeleteNo = 0,
299  DeleteYes = 1
300  };
301 
302  enum{
303  DuplicateCellsNo = 0,
304  DuplicateCellsYes = 1
305  };
306 
307  enum{
308  GhostCellsNo = 0,
309  GhostCellsYes = 1
310  };
311 
312  enum{
313  UnsetGhostLevel = 99
314  };
315 
317  int PartitionDataAndAssignToProcesses(vtkDataSet *set);
318 
320  vtkUnstructuredGrid *RedistributeDataSet(vtkDataSet *set, vtkDataSet *input);
321 
323  int ClipGridCells(vtkUnstructuredGrid *grid);
324 
326  vtkUnstructuredGrid * AcquireGhostCells(vtkUnstructuredGrid *grid);
327 
329  void ComputeMyRegionBounds();
330 
332  int CheckFieldArrayTypes(vtkDataSet *set);
333 
336  vtkDataSet *TestFixTooFewInputFiles(vtkDataSet *input);
337 
339  vtkUnstructuredGrid *MPIRedistribute(vtkDataSet *in, vtkDataSet *input);
340 
342  vtkIdList **GetCellIdsForProcess(int proc, int *nlists);
343 
346  void SetUpPairWiseExchange();
347 
349 
350  void FreeIntArrays(vtkIdTypeArray **ar);
351  static void FreeIdLists(vtkIdList**lists, int nlists);
352  static vtkIdType GetIdListSize(vtkIdList**lists, int nlists);
354 
356 
357  vtkIdTypeArray *ExchangeCounts(vtkIdType myCount, int tag);
358  vtkIdTypeArray *ExchangeCountsLean(vtkIdType myCount, int tag);
359  vtkIdTypeArray *ExchangeCountsFast(vtkIdType myCount, int tag);
361 
363 
364  vtkIdTypeArray **ExchangeIdArrays(vtkIdTypeArray **arIn,
365  int deleteSendArrays, int tag);
366  vtkIdTypeArray **ExchangeIdArraysLean(vtkIdTypeArray **arIn,
367  int deleteSendArrays, int tag);
368  vtkIdTypeArray **ExchangeIdArraysFast(vtkIdTypeArray **arIn,
369  int deleteSendArrays, int tag);
371 
373 
374  vtkFloatArray **ExchangeFloatArrays(vtkFloatArray **myArray,
375  int deleteSendArrays, int tag);
376  vtkFloatArray **ExchangeFloatArraysLean(vtkFloatArray **myArray,
377  int deleteSendArrays, int tag);
378  vtkFloatArray **ExchangeFloatArraysFast(vtkFloatArray **myArray,
379  int deleteSendArrays, int tag);
381 
383 
384  vtkUnstructuredGrid *ExchangeMergeSubGrids(vtkIdList **cellIds, int deleteCellIds,
385  vtkDataSet *myGrid, int deleteMyGrid,
386  int filterOutDuplicateCells, int ghostCellFlag, int tag);
387  vtkUnstructuredGrid *ExchangeMergeSubGrids(vtkIdList ***cellIds, int *numLists,
388  int deleteCellIds,
389  vtkDataSet *myGrid, int deleteMyGrid,
390  int filterOutDuplicateCells, int ghostCellFlag, int tag);
391  vtkUnstructuredGrid *ExchangeMergeSubGridsLean(
392  vtkIdList ***cellIds, int *numLists,
393  int deleteCellIds,
394  vtkDataSet *myGrid, int deleteMyGrid,
395  int filterOutDuplicateCells, int ghostCellFlag, int tag);
396  vtkUnstructuredGrid *ExchangeMergeSubGridsFast(
397  vtkIdList ***cellIds, int *numLists,
398  int deleteCellIds,
399  vtkDataSet *myGrid, int deleteMyGrid,
400  int filterOutDuplicateCells, int ghostCellFlag, int tag);
402 
403 
405 
406  char *MarshallDataSet(vtkUnstructuredGrid *extractedGrid, int &size);
407  vtkUnstructuredGrid *UnMarshallDataSet(char *buf, int size);
409 
411 
412  void ClipCellsToSpatialRegion(vtkUnstructuredGrid *grid);
413 #if 0
414  void ClipWithVtkClipDataSet(vtkUnstructuredGrid *grid, double *bounds,
415  vtkUnstructuredGrid **outside, vtkUnstructuredGrid **inside);
416 #endif
417 
418 
419  void ClipWithBoxClipDataSet(vtkUnstructuredGrid *grid, double *bounds,
420  vtkUnstructuredGrid **outside, vtkUnstructuredGrid **inside);
421 
423 
427  vtkIdTypeArray *GetGlobalNodeIdArray(vtkDataSet *set);
428  vtkIdType *GetGlobalNodeIds(vtkDataSet *set);
429  vtkIdTypeArray *GetGlobalElementIdArray(vtkDataSet *set);
430  vtkIdType *GetGlobalElementIds(vtkDataSet *set);
431  int AssignGlobalNodeIds(vtkUnstructuredGrid *grid);
432  int AssignGlobalElementIds(vtkDataSet *in);
433  vtkIdTypeArray **FindGlobalPointIds(vtkFloatArray **ptarray,
434  vtkIdTypeArray *ids, vtkUnstructuredGrid *grid, vtkIdType &numUniqueMissingPoints);
436 
438 
439  vtkIdTypeArray **MakeProcessLists(vtkIdTypeArray **pointIds,
440  vtkDistributedDataFilterSTLCloak *procs);
442 
444 
445  vtkIdList **BuildRequestedGrids( vtkIdTypeArray **globalPtIds,
446  vtkUnstructuredGrid *grid,
447  vtkDistributedDataFilterSTLCloak *ptIdMap);
449 
451 
452  int InMySpatialRegion(float x, float y, float z);
453  int InMySpatialRegion(double x, double y, double z);
454  int StrictlyInsideMyBounds(float x, float y, float z);
455  int StrictlyInsideMyBounds(double x, double y, double z);
457 
459 
460  vtkIdTypeArray **GetGhostPointIds(int ghostLevel, vtkUnstructuredGrid *grid,
461  int AddCellsIAlreadyHave);
462  vtkUnstructuredGrid *AddGhostCellsUniqueCellAssignment(
463  vtkUnstructuredGrid *myGrid,
464  vtkDistributedDataFilterSTLCloak *globalToLocalMap);
465  vtkUnstructuredGrid *AddGhostCellsDuplicateCellAssignment(
466  vtkUnstructuredGrid *myGrid,
467  vtkDistributedDataFilterSTLCloak *globalToLocalMap);
468  vtkUnstructuredGrid *SetMergeGhostGrid(
469  vtkUnstructuredGrid *ghostCellGrid,
470  vtkUnstructuredGrid *incomingGhostCells,
471  int ghostLevel, vtkDistributedDataFilterSTLCloak *idMap);
473 
475 
476  vtkUnstructuredGrid *ExtractCells(vtkIdList *list,
477  int deleteCellLists, vtkDataSet *in);
478  vtkUnstructuredGrid *ExtractCells(vtkIdList **lists, int nlists,
479  int deleteCellLists, vtkDataSet *in);
480  vtkUnstructuredGrid *ExtractZeroCellGrid(vtkDataSet *in);
482 
484 
485  static int GlobalPointIdIsUsed(vtkUnstructuredGrid *grid,
486  int ptId, vtkDistributedDataFilterSTLCloak *globalToLocal);
487  static int LocalPointIdIsUsed(vtkUnstructuredGrid *grid, int ptId);
488  static vtkIdType FindId(vtkIdTypeArray *ids, vtkIdType gid, vtkIdType startLoc);
490 
492 
493  static vtkIdTypeArray *AddPointAndCells(vtkIdType gid,
494  vtkIdType localId,
495  vtkUnstructuredGrid *grid,
496  vtkIdType *gidCells,
497  vtkIdTypeArray *ids);
499 
501 
502  static void AddConstantUnsignedCharPointArray(vtkUnstructuredGrid *grid,
503  const char *arrayName, unsigned char val);
504  static void AddConstantUnsignedCharCellArray(vtkUnstructuredGrid *grid,
505  const char *arrayName, unsigned char val);
507 
509 
510  static void RemoveRemoteCellsFromList(vtkIdList *cellList,
511  vtkIdType *gidCells,
512  vtkIdType *remoteCells,
513  vtkIdType nRemoteCells);
515 
517 
518  static vtkUnstructuredGrid *MergeGrids(vtkDataSet **sets, int nsets,
519  int deleteDataSets,
520  int useGlobalNodeIds, float pointMergeTolerance,
521  int useGlobalCellIds);
523 
524  vtkPKdTree *Kdtree;
525  vtkMultiProcessController *Controller;
526 
527  int NumProcesses;
528  int MyId;
529 
530  int *Target;
531  int *Source;
532 
533  int NumConvexSubRegions;
534  double *ConvexSubRegionBounds;
535 
536  int GhostLevel;
537 
538  int RetainKdtree;
539  int IncludeAllIntersectingCells;
540  int ClipCells;
541  int AssignBoundaryCellsToOneRegion;
542  int AssignBoundaryCellsToAllIntersectingRegions;
543  int DivideBoundaryCells;
544 
545  int Timing;
546 
547  int NextProgressStep;
548  double ProgressIncrement;
549 
550  int UseMinimalMemory;
551 
552  vtkBSPCuts* UserCuts;
553 
554  vtkDistributedDataFilter(const vtkDistributedDataFilter&); // Not implemented
555  void operator=(const vtkDistributedDataFilter&); // Not implemented
556 
557  class vtkInternals;
558  vtkInternals* Internals;
559 //ETX
560 };
561 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Build a k-d tree decomposition of a list of points.
Definition: vtkPKdTree.h:54
Store vtkAlgorithm input/output information.
This class represents an axis-aligned Binary Spatial Partitioning of a 3D space.
Definition: vtkBSPCuts.h:43
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
static vtkDataObjectAlgorithm * New()
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
void PrintSelf(ostream &os, vtkIndent indent)
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:275
Distribute data among processors.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
a simple class to control print indentation
Definition: vtkIndent.h:38
list of point or cell ids
Definition: vtkIdList.h:35
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int FillInputPortInformation(int port, vtkInformation *info)
Superclass for algorithms that produce only data object as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store zero or more vtkInformation instances.
Multiprocessing communication superclass.