00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00044 #ifndef __vtkSubGroup_h
00045 #define __vtkSubGroup_h
00046
00047 #include "vtkObject.h"
00048
00049 class vtkMultiProcessController;
00050 class vtkCommunicator;
00051
00052 class VTK_PARALLEL_EXPORT vtkSubGroup : public vtkObject
00053 {
00054 public:
00055 vtkTypeRevisionMacro(vtkSubGroup, vtkObject);
00056 virtual void PrintSelf(ostream &os, vtkIndent indent);
00057 static vtkSubGroup *New();
00058
00059
00060
00061 enum {MINOP = 1, MAXOP = 2, SUMOP = 3};
00062
00069 int Initialize(int p0, int p1, int me, int tag, vtkCommunicator *c);
00070
00071 int Gather(int *data, int *to, int length, int root);
00072 int Gather(char *data, char *to, int length, int root);
00073 int Gather(float *data, float *to, int length, int root);
00074 int Broadcast(float *data, int length, int root);
00075 int Broadcast(double *data, int length, int root);
00076 int Broadcast(int *data, int length, int root);
00077 int Broadcast(char *data, int length, int root);
00078 int ReduceSum(int *data, int *to, int length, int root);
00079 int ReduceMax(float *data, float *to, int length, int root);
00080 int ReduceMax(double *data, double *to, int length, int root);
00081 int ReduceMax(int *data, int *to, int length, int root);
00082 int ReduceMin(float *data, float *to, int length, int root);
00083 int ReduceMin(double *data, double *to, int length, int root);
00084 int ReduceMin(int *data, int *to, int length, int root);
00085
00086 int AllReduceUniqueList(int *list, int len, int **newList);
00087 int MergeSortedUnique(int *list1, int len1, int *list2, int len2, int **newList);
00088
00089 void setGatherPattern(int root, int length);
00090 int getLocalRank(int processID);
00091
00092 int Barrier();
00093
00094 void PrintSubGroup() const;
00095
00096 static int MakeSortedUnique(int *list, int len, int **newList);
00097
00098 int tag;
00099
00100 protected:
00101 vtkSubGroup();
00102 ~vtkSubGroup();
00103
00104 private:
00105 int computeFanInTargets();
00106 void restoreRoot(int rootLoc);
00107 void moveRoot(int rootLoc);
00108 void setUpRoot(int root);
00109
00110 int nFrom;
00111 int nTo;
00112
00113 int sendId;
00114 int sendOffset;
00115 int sendLength;
00116
00117 int recvId[20];
00118 int recvOffset[20];
00119 int recvLength[20];
00120 int fanInFrom[20];
00121
00122 int fanInTo;
00123 int nSend;
00124 int nRecv;
00125 int gatherRoot;
00126 int gatherLength;
00127
00128 int *members;
00129 int nmembers;
00130 int myLocalRank;
00131
00132 vtkCommunicator *comm;
00133
00134 vtkSubGroup(const vtkSubGroup&);
00135 void operator=(const vtkSubGroup&);
00136 };
00137 #endif