ScaLAPACK  2.0.2
ScaLAPACK: Scalable Linear Algebra PACKage
blacs_info_.c
Go to the documentation of this file.
00001 #include "Bdef.h"
00002 
00003 #if (INTFACE == C_CALL)
00004 void Cblacs_gridinfo(int ConTxt, int *nprow, int *npcol, int *myrow, int *mycol)
00005 #else
00006 F_VOID_FUNC blacs_gridinfo_(int *ConTxt, int *nprow, int *npcol,
00007                             int *myrow, int *mycol)
00008 #endif
00009 {
00010    extern BLACSCONTEXT **BI_MyContxts;
00011    extern int BI_MaxNCtxt;
00012    BLACSCONTEXT *ctxt;
00013 /*
00014  * Make sure context handle is in range
00015  */
00016    if ( (Mpval(ConTxt) >= 0) && (Mpval(ConTxt) < BI_MaxNCtxt) )
00017    {
00018 /*
00019  *    Make sure context is still defined
00020  */
00021       ctxt = BI_MyContxts[Mpval(ConTxt)];
00022       if (ctxt != NULL)
00023       {
00024          *nprow = ctxt->cscp.Np;
00025          *npcol = ctxt->rscp.Np;
00026          *myrow = ctxt->cscp.Iam;
00027          *mycol = ctxt->rscp.Iam;
00028       }
00029       else *nprow = *npcol = *myrow = *mycol = -1;
00030    }
00031    else *nprow = *npcol = *myrow = *mycol = -1;
00032 }