VTK
vtkSubGroup.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSubGroup.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 
41 #ifndef vtkSubGroup_h
42 #define vtkSubGroup_h
43 
44 #include "vtkParallelCoreModule.h" // For export macro
45 #include "vtkObject.h"
46 
48 class vtkCommunicator;
49 
51 {
52 public:
53  vtkTypeMacro(vtkSubGroup, vtkObject);
54  virtual void PrintSelf(ostream &os, vtkIndent indent);
55  static vtkSubGroup *New();
56 
57 //BTX
58  // The wrapper gets confused here and falls down.
59  enum {MINOP = 1, MAXOP = 2, SUMOP = 3};
60 //ETX
67  int Initialize(int p0, int p1, int me, int tag, vtkCommunicator *c);
68 
69  int Gather(int *data, int *to, int length, int root);
70  int Gather(char *data, char *to, int length, int root);
71  int Gather(float *data, float *to, int length, int root);
72 #ifdef VTK_USE_64BIT_IDS
73  int Gather(vtkIdType *data, vtkIdType *to, int length, int root);
74 #endif
75  int Broadcast(float *data, int length, int root);
76  int Broadcast(double *data, int length, int root);
77  int Broadcast(int *data, int length, int root);
78  int Broadcast(char *data, int length, int root);
79 #ifdef VTK_USE_64BIT_IDS
80  int Broadcast(vtkIdType *data, int length, int root);
81 #endif
82  int ReduceSum(int *data, int *to, int length, int root);
83  int ReduceMax(float *data, float *to, int length, int root);
84  int ReduceMax(double *data, double *to, int length, int root);
85  int ReduceMax(int *data, int *to, int length, int root);
86  int ReduceMin(float *data, float *to, int length, int root);
87  int ReduceMin(double *data, double *to, int length, int root);
88  int ReduceMin(int *data, int *to, int length, int root);
89 
90  int AllReduceUniqueList(int *list, int len, int **newList);
91  int MergeSortedUnique(int *list1, int len1, int *list2, int len2, int **newList);
92 
93  void setGatherPattern(int root, int length);
94  int getLocalRank(int processID);
95 
96  int Barrier();
97 
98  void PrintSubGroup() const;
99 
100  static int MakeSortedUnique(int *list, int len, int **newList);
101 
102  int tag;
103 
104 protected:
105  vtkSubGroup();
106  ~vtkSubGroup();
107 
108 private:
109  int computeFanInTargets();
110  void restoreRoot(int rootLoc);
111  void moveRoot(int rootLoc);
112  void setUpRoot(int root);
113 
114  int nFrom;
115  int nTo;
116 
117  int sendId; // gather
118  int sendOffset;
119  int sendLength;
120 
121  int recvId[20];
122  int recvOffset[20];
123  int recvLength[20];
124  int fanInFrom[20]; // reduce, broadcast
125 
126  int fanInTo;
127  int nSend;
128  int nRecv;
129  int gatherRoot;
130  int gatherLength;
131 
132  int *members;
133  int nmembers;
134  int myLocalRank;
135 
136  vtkCommunicator *comm;
137 
138  vtkSubGroup(const vtkSubGroup&); // Not implemented
139  void operator=(const vtkSubGroup&); // Not implemented
140 };
141 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
#define VTKPARALLELCORE_EXPORT
int vtkIdType
Definition: vtkType.h:275
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
scalable collective communication for a subset of members of a parallel VTK application ...
Definition: vtkSubGroup.h:50
static vtkObject * New()
Used to send/receive messages in a multiprocess environment.
Multiprocessing communication superclass.