VTK  9.1.0
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 "vtkObject.h"
46#include "vtkParallelCoreModule.h" // For export macro
47
49class vtkCommunicator;
50
51class VTKPARALLELCORE_EXPORT vtkSubGroup : public vtkObject
52{
53public:
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
60 {
61 MINOP = 1,
62 MAXOP = 2,
63 SUMOP = 3
64 };
65
75 int Initialize(int p0, int p1, int me, int tag, vtkCommunicator* c);
76
77 int Gather(int* data, int* to, int length, int root);
78 int Gather(char* data, char* to, int length, int root);
79 int Gather(float* data, float* to, int length, int root);
80#ifdef VTK_USE_64BIT_IDS
81 int Gather(vtkIdType* data, vtkIdType* to, int length, int root);
82#endif
83 int Broadcast(float* data, int length, int root);
84 int Broadcast(double* data, int length, int root);
85 int Broadcast(int* data, int length, int root);
86 int Broadcast(char* data, int length, int root);
87#ifdef VTK_USE_64BIT_IDS
88 int Broadcast(vtkIdType* data, int length, int root);
89#endif
90 int ReduceSum(int* data, int* to, int length, int root);
91 int ReduceMax(float* data, float* to, int length, int root);
92 int ReduceMax(double* data, double* to, int length, int root);
93 int ReduceMax(int* data, int* to, int length, int root);
94 int ReduceMin(float* data, float* to, int length, int root);
95 int ReduceMin(double* data, double* to, int length, int root);
96 int ReduceMin(int* data, int* to, int length, int root);
97
98 int AllReduceUniqueList(int* list, int len, int** newList);
99 int MergeSortedUnique(int* list1, int len1, int* list2, int len2, int** newList);
100
101 void setGatherPattern(int root, int length);
102 int getLocalRank(int processID);
103
104 int Barrier();
105
106 void PrintSubGroup() const;
107
108 static int MakeSortedUnique(int* list, int len, int** newList);
109
110 int tag;
111
112protected:
114 ~vtkSubGroup() override;
115
116private:
117 int computeFanInTargets();
118 void restoreRoot(int rootLoc);
119 void moveRoot(int rootLoc);
120 void setUpRoot(int root);
121
122 int nFrom;
123 int nTo;
124
125 int sendId; // gather
126 int sendOffset;
127 int sendLength;
128
129 int recvId[20];
130 int recvOffset[20];
131 int recvLength[20];
132 int fanInFrom[20]; // reduce, broadcast
133
134 int fanInTo;
135 int nSend;
136 int nRecv;
137 int gatherRoot;
138 int gatherLength;
139
140 int* members;
141 int nmembers;
142 int myLocalRank;
143
144 vtkCommunicator* comm;
145
146 vtkSubGroup(const vtkSubGroup&) = delete;
147 void operator=(const vtkSubGroup&) = delete;
148};
149#endif
Used to send/receive messages in a multiprocess environment.
a simple class to control print indentation
Definition: vtkIndent.h:113
Multiprocessing communication superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:73
scalable collective communication for a subset of members of a parallel VTK application
Definition: vtkSubGroup.h:52
int Gather(float *data, float *to, int length, int root)
int ReduceMin(int *data, int *to, int length, int root)
~vtkSubGroup() override
void PrintSubGroup() const
void setGatherPattern(int root, int length)
int Broadcast(float *data, int length, int root)
int Gather(char *data, char *to, int length, int root)
int ReduceMin(float *data, float *to, int length, int root)
int Broadcast(char *data, int length, int root)
int Broadcast(double *data, int length, int root)
int MergeSortedUnique(int *list1, int len1, int *list2, int len2, int **newList)
int Broadcast(int *data, int length, int root)
static vtkSubGroup * New()
int Gather(int *data, int *to, int length, int root)
int ReduceMax(int *data, int *to, int length, int root)
int ReduceSum(int *data, int *to, int length, int root)
int Initialize(int p0, int p1, int me, int tag, vtkCommunicator *c)
Initialize a communication subgroup for the processes with rank p0 through p1 of the given communicat...
int AllReduceUniqueList(int *list, int len, int **newList)
int ReduceMax(float *data, float *to, int length, int root)
int getLocalRank(int processID)
int ReduceMax(double *data, double *to, int length, int root)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int ReduceMin(double *data, double *to, int length, int root)
static int MakeSortedUnique(int *list, int len, int **newList)
@ length
Definition: vtkX3D.h:399
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:332