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 
42 #ifndef vtkSubGroup_h
43 #define vtkSubGroup_h
44 
45 #include "vtkParallelCoreModule.h" // For export macro
46 #include "vtkObject.h"
47 
49 class vtkCommunicator;
50 
51 class VTKPARALLELCORE_EXPORT vtkSubGroup : public vtkObject
52 {
53 public:
54  vtkTypeMacro(vtkSubGroup, vtkObject);
55  void PrintSelf(ostream &os, vtkIndent indent) override;
56  static vtkSubGroup *New();
57 
58  // The wrapper gets confused here and falls down.
59  enum {MINOP = 1, MAXOP = 2, SUMOP = 3};
60 
70  int Initialize(int p0, int p1, int me, int tag, vtkCommunicator *c);
71 
72  int Gather(int *data, int *to, int length, int root);
73  int Gather(char *data, char *to, int length, int root);
74  int Gather(float *data, float *to, int length, int root);
75 #ifdef VTK_USE_64BIT_IDS
76  int Gather(vtkIdType *data, vtkIdType *to, int length, int root);
77 #endif
78  int Broadcast(float *data, int length, int root);
79  int Broadcast(double *data, int length, int root);
80  int Broadcast(int *data, int length, int root);
81  int Broadcast(char *data, int length, int root);
82 #ifdef VTK_USE_64BIT_IDS
83  int Broadcast(vtkIdType *data, int length, int root);
84 #endif
85  int ReduceSum(int *data, int *to, int length, int root);
86  int ReduceMax(float *data, float *to, int length, int root);
87  int ReduceMax(double *data, double *to, int length, int root);
88  int ReduceMax(int *data, int *to, int length, int root);
89  int ReduceMin(float *data, float *to, int length, int root);
90  int ReduceMin(double *data, double *to, int length, int root);
91  int ReduceMin(int *data, int *to, int length, int root);
92 
93  int AllReduceUniqueList(int *list, int len, int **newList);
94  int MergeSortedUnique(int *list1, int len1, int *list2, int len2, int **newList);
95 
96  void setGatherPattern(int root, int length);
97  int getLocalRank(int processID);
98 
99  int Barrier();
100 
101  void PrintSubGroup() const;
102 
103  static int MakeSortedUnique(int *list, int len, int **newList);
104 
105  int tag;
106 
107 protected:
108  vtkSubGroup();
109  ~vtkSubGroup() override;
110 
111 private:
112  int computeFanInTargets();
113  void restoreRoot(int rootLoc);
114  void moveRoot(int rootLoc);
115  void setUpRoot(int root);
116 
117  int nFrom;
118  int nTo;
119 
120  int sendId; // gather
121  int sendOffset;
122  int sendLength;
123 
124  int recvId[20];
125  int recvOffset[20];
126  int recvLength[20];
127  int fanInFrom[20]; // reduce, broadcast
128 
129  int fanInTo;
130  int nSend;
131  int nRecv;
132  int gatherRoot;
133  int gatherLength;
134 
135  int *members;
136  int nmembers;
137  int myLocalRank;
138 
139  vtkCommunicator *comm;
140 
141  vtkSubGroup(const vtkSubGroup&) = delete;
142  void operator=(const vtkSubGroup&) = delete;
143 };
144 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:347
a simple class to control print indentation
Definition: vtkIndent.h:39
scalable collective communication for a subset of members of a parallel VTK application ...
Definition: vtkSubGroup.h:51
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
Used to send/receive messages in a multiprocess environment.
Multiprocessing communication superclass.