#include "Bdef.h"


#if (INTFACE == C_CALL)
void Csetpvmtids(ntasks, tids)
int  ntasks;
int  *tids;
#else
void setpvmtids_(ntasks, tids)
int  *ntasks;
int  *tids;
#endif
{
   extern int *pvmtids00, Np00, Iam00;
   int i, mytid;

   if (pvmtids00 != NULL)
      BlacsErr(-1, __LINE__, __FILE__, "Repeat call to SETPVMTIDS");

   Iam00 = -1;
   Np00 = Mpval(ntasks);
   pvmtids00 = (int *) malloc(Np00 * sizeof(*pvmtids00));
   mytid = pvm_mytid();
   for (i=0; i < Np00; i++)
   {
      pvmtids00[i] = tids[i];
      if (pvmtids00[i] == mytid) Iam00 = i;
   }
   if (Iam00 == -1)
      BlacsErr(-1, __LINE__, __FILE__, "caller of SETPVMTIDS not in tidlist");
}
