File: BI_SringBR.c

package info (click to toggle)
blacs-mpi 1.1-28.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,320 kB
  • ctags: 2,031
  • sloc: fortran: 14,968; ansic: 12,353; makefile: 531; sh: 1
file content (28 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "Bdef.h"

void BI_SringBR(BLACSCONTEXT *ctxt, BLACBUFF *bp, SDRVPTR send, int src)
{
   void BI_Srecv(BLACSCONTEXT *, int, int, BLACBUFF *);

   int mydist;  	/* my distance from source */
   int Np, Iam, msgid, rightedge;

   Np = ctxt->scp->Np;
   Iam = ctxt->scp->Iam;
   msgid = Mscopeid(ctxt);

   mydist = (Np + Iam - src) % Np;
   rightedge = Np/2;
   BI_Srecv(ctxt, BANYNODE, msgid, bp);

/*
 * If I'm between source & right edge of split ring, send to right
 */
   if (mydist < rightedge)
      send(ctxt, (Iam+1)%Np, msgid, bp);
/*
 * If I'm between source and left edge of split ring, send to left
 */
   else if (mydist > rightedge+1)
      send(ctxt, (Np+Iam-1)%Np, msgid, bp);
}