File: blacs_gridinfo_.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 (32 lines) | stat: -rw-r--r-- 831 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
29
30
31
32
#include "Bdef.h"

#if (INTFACE == C_CALL)
void Cblacs_gridinfo(int ConTxt, int *nprow, int *npcol, int *myrow, int *mycol)
#else
F_VOID_FUNC blacs_gridinfo_(int *ConTxt, int *nprow, int *npcol,
                            int *myrow, int *mycol)
#endif
{
   extern BLACSCONTEXT **BI_MyContxts;
   extern int BI_MaxNCtxt;
   BLACSCONTEXT *ctxt;
/*
 * Make sure context handle is in range
 */
   if ( (Mpval(ConTxt) >= 0) && (Mpval(ConTxt) < BI_MaxNCtxt) )
   {
/*
 *    Make sure context is still defined
 */
      ctxt = BI_MyContxts[Mpval(ConTxt)];
      if (ctxt != NULL)
      {
         *nprow = ctxt->cscp.Np;
         *npcol = ctxt->rscp.Np;
         *myrow = ctxt->cscp.Iam;
         *mycol = ctxt->rscp.Iam;
      }
      else *nprow = *npcol = *myrow = *mycol = -1;
   }
   else *nprow = *npcol = *myrow = *mycol = -1;
}