#include "Bdef.h"

#if (INTFACE == C_CALL)
void Cblacs_pcoord(ConTxt, nodenum, prow, pcol)
int  ConTxt;
int  nodenum;
int  *prow;
int  *pcol;
#else
void blacs_pcoord_(ConTxt, nodenum, prow, pcol)
int  *ConTxt;
int  *nodenum;
int  *prow;
int  *pcol;
#endif
{
   BLACSCONTEXT *ctxt;
   extern int *pvmtids00, Np00;
   int i;

   MGetConTxt(Mpval(ConTxt), ctxt);
   for (i=0; ( (i<ctxt->Ng) && (ctxt->coord2proc[i] != Mpval(nodenum)) ); i++);
   if (i < ctxt->Ng)
   {
      *prow = i / ctxt->npcol;
      *pcol = i % ctxt->npcol;
   }
   else *prow = *pcol = -1;
}
