2 @addtogroup ConvComlibRouter
9 #include "prefixrouter.h"
12 #define PREFIXDEB printf
14 #define PREFIXDEB /* printf */
17 void PrefixRouter::EachToManyMulticastQ(comID id, CkQ<MessageHolder *> &msgq) {
18 PREFIXDEB("[%d]Sending through prefix router: ",CmiMyPe());
20 MessageHolder *mhdl = msgq[0];
21 if(mhdl->dest_proc<0) // broadcast or multicast
24 sendPointToPoint(msgq);
29 void PrefixRouter::sendMulticast(CkQ<MessageHolder *> &msgq) {
31 PREFIXDEB("with a multicast\n");
32 while(!msgq.isEmpty()){
33 MessageHolder *mhdl = msgq.deq();
35 if(mhdl->dest_proc == IS_BROADCAST) {
36 for(count = 0; count < npes; count ++) {
37 int curDest = gpes[MyPe ^ count];
38 char *msg = mhdl->getMessage();
39 CmiSyncSend(curDest, mhdl->size, msg);
43 CmiAbort("Implement later");
48 void PrefixRouter::sendPointToPoint(CkQ<MessageHolder *> &msgq) {
50 PREFIXDEB("with a point-to-point\n");
51 int len = msgq.length();
52 for(count = 0; count < npes; count ++) {
53 int curDest = gpes[MyPe ^ count];
55 for(i = 0; i < len; i++) {
56 MessageHolder *mhdl = msgq[i];
58 CmiAssert(mhdl->dest_proc >= 0);
59 if(mhdl->dest_proc == curDest) {
60 char *msg = mhdl->getMessage();
61 CmiSyncSendAndFree(curDest, mhdl->size, msg);
66 for(i = 0; i < len; i++) {
67 MessageHolder *mhdl = msgq.deq();