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  virtual void PrintSelf(ostream &os, vtkIndent indent);
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:
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&) VTK_DELETE_FUNCTION;
142  void operator=(const vtkSubGroup&) VTK_DELETE_FUNCTION;
143 };
144 #endif
vtkSubGroup::New
static vtkSubGroup * New()
vtkSubGroup::AllReduceUniqueList
int AllReduceUniqueList(int *list, int len, int **newList)
vtkCommunicator
Used to send/receive messages in a multiprocess environment.
Definition: vtkCommunicator.h:54
vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkSubGroup::Initialize
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...
vtkX3D::data
@ data
Definition: vtkX3D.h:315
vtkSubGroup::ReduceMin
int ReduceMin(int *data, int *to, int length, int root)
vtkSubGroup::Broadcast
int Broadcast(char *data, int length, int root)
vtkSubGroup::MakeSortedUnique
static int MakeSortedUnique(int *list, int len, int **newList)
vtkSubGroup::PrintSubGroup
void PrintSubGroup() const
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkSubGroup::ReduceMin
int ReduceMin(double *data, double *to, int length, int root)
vtkX3D::length
@ length
Definition: vtkX3D.h:393
vtkSubGroup::Broadcast
int Broadcast(float *data, int length, int root)
vtkSubGroup::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkSubGroup
scalable collective communication for a subset of members of a parallel VTK application
Definition: vtkSubGroup.h:52
vtkSubGroup::Broadcast
int Broadcast(int *data, int length, int root)
vtkSubGroup::Gather
int Gather(char *data, char *to, int length, int root)
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:83
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkSubGroup::MergeSortedUnique
int MergeSortedUnique(int *list1, int len1, int *list2, int len2, int **newList)
vtkSubGroup::Gather
int Gather(float *data, float *to, int length, int root)
vtkObject.h
vtkSubGroup::Broadcast
int Broadcast(double *data, int length, int root)
vtkSubGroup::ReduceMax
int ReduceMax(int *data, int *to, int length, int root)
vtkSubGroup::getLocalRank
int getLocalRank(int processID)
vtkSubGroup::setGatherPattern
void setGatherPattern(int root, int length)
vtkSubGroup::ReduceSum
int ReduceSum(int *data, int *to, int length, int root)
vtkSubGroup::~vtkSubGroup
~vtkSubGroup()
vtkSubGroup::ReduceMax
int ReduceMax(double *data, double *to, int length, int root)
vtkSubGroup::Gather
int Gather(int *data, int *to, int length, int root)
vtkSubGroup::ReduceMax
int ReduceMax(float *data, float *to, int length, int root)
vtkSubGroup::ReduceMin
int ReduceMin(float *data, float *to, int length, int root)
vtkSubGroup::tag
int tag
Definition: vtkSubGroup.h:105
vtkSubGroup::vtkSubGroup
vtkSubGroup()
vtkSubGroup::Barrier
int Barrier()