#include "main.h"
#include "jacobi.h"

CkChareID mainhandle;

main::main(CkArgMsg *m)
{
  int nblocks = jacobi::numBlocks();
  numDone = 0;
  CProxy_jacobi jarray(nblocks);
  for(int i=0; i< nblocks; i++)
    jarray[i].run();
  // CkStartQD(EntryIndex(main,done,CkQdMsg), &thishandle);
  delete m;
  mainhandle = thishandle;
}

void
main::done(void)
{
  numDone++;
  if(numDone==jacobi::numBlocks()) {
    ckout << "Exiting" << endl;
    CkExit();
  }
}

#include "main.def.h"
