topology.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef __GNUG__
00029 #pragma interface
00030 #endif
00031
00032 #ifndef _util_group_topology_h
00033 #define _util_group_topology_h
00034
00035 #include <util/class/class.h>
00036 #include <util/keyval/keyval.h>
00037
00038 namespace sc {
00039
00040 class GlobalMsgIter: public DescribedClass {
00041 protected:
00042 int me_;
00043 int nproc_;
00044 int root_;
00045 int i_;
00046 int n_;
00047 int fwd_;
00048
00049
00050 virtual int fwdsendto() = 0;
00051 virtual int fwdsend() = 0;
00052 virtual int fwdrecvfrom() = 0;
00053 virtual int fwdrecv() = 0;
00054 public:
00055 GlobalMsgIter(int nproc, int me, int root = 0);
00056 void backwards() { fwd_ = 0; i_ = n_ - 1; }
00057 void forwards() { fwd_ = 1; i_ = 0; }
00058 void next() { if (fwd_) i_++; else i_--; }
00059 int done() { return i_<0 || i_>=n_; }
00060 int n() { return n_; }
00061 int sendto() { return fwd_?fwdsendto():fwdrecvfrom(); }
00062 int send() { return fwd_?fwdsend():fwdrecv(); }
00063 int recvfrom() { return fwd_?fwdrecvfrom():fwdsendto(); }
00064 int recv() { return fwd_?fwdrecv():fwdsend(); }
00065 };
00066
00067
00068 class MessageGrp;
00069 class MachineTopology: public DescribedClass {
00070 public:
00071 MachineTopology();
00072 MachineTopology(const Ref<KeyVal>&);
00073 ~MachineTopology();
00074
00075 virtual Ref<GlobalMsgIter> global_msg_iter(const Ref<MessageGrp>&,
00076 int target) = 0;
00077 };
00078
00079 }
00080
00081 #endif
00082
00083
00084
00085
00086
Generated at Thu Jul 29 19:53:51 2004 for MPQC
2.2.1 using the documentation package Doxygen
1.3.7.