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