Exemplo n.º 1
0
 void recv(PingMsg *msg)
 {
     delete msg;
     recvCnt++;
     if(recvCnt == PEsPerNode * CharesPerPE)
     {
         mainProxy.maindone();
         recvCnt = 0;
     }
 }
Exemplo n.º 2
0
void printCollisionHandler(void *param,int nColl,Collision *colls)
{
	CkPrintf("**********************************************\n");
	CkPrintf("*** Final collision handler called-- %d records:\n",nColl);
	int nPrint=nColl;
	const int maxPrint=30;
	if (nPrint>maxPrint) nPrint=maxPrint;
	for (int c=0;c<nPrint;c++) {
		CkPrintf("%d:%d hits %d:%d\n",
			colls[c].A.chunk,colls[c].A.number,
			colls[c].B.chunk,colls[c].B.number);
	}
	CkPrintf("**********************************************\n");
	mid.maindone();
}
		void Ghost(double *tmpBufX, double *tmpBufY, int pointsReceived)	//Receive and process ghosts.
		{
			ghostCount++;
			valuesX = (double *)realloc(valuesX,sizeof(double)*(count + pointsReceived));//NOTE (count+pointsReceived)!! 
			valuesY = (double *)realloc(valuesY,sizeof(double)*(count + pointsReceived));
			int i;
			for(i=count;i<(pointsReceived + count);i++)
			{
				valuesX[i] = tmpBufX[i - count];
				valuesY[i] = tmpBufY[i - count];
			}
			count = count + pointsReceived;				//Now each chare contains these many points.
			if(ghostCount == 8)
			{			
				ghostCount = 0;					//Re-initialize this variable to zero.
				mainProxy.checkIn(count);
			}
		};
Exemplo n.º 4
0
main::main(CkArgMsg *m) {
    delete m;
    mainProxy=thishandle;
    CmiPrintf("Info: converse header: %d envelope: %d\n", CmiReservedHeaderSize, sizeof(envelope));
    // make a message with 1 payload
    testMsg *msg = new testMsg;
    // get pointer to envelope header
    unsigned char *env= (unsigned char*) UsrToEnv(msg);
    unsigned char *hdr= (unsigned char*) msg;
    hdr-=sizeof(envelope);
    hdr-=CmiReservedHeaderSize;
    // output converse header field by field
    
    // output converse header byte by byte
    CkPrintf("CmiHeader\n");
    for(int i=0;i<CmiReservedHeaderSize;i++)
      CkPrintf("%03u|",hdr[i]);
    CkPrintf("\n");
    CkPrintf("Envelope\n");
    for(int i=0;i<sizeof(envelope);i++)
      CkPrintf("%03u|",env[i]);
    CkPrintf("\n");
    mainProxy.recv(msg);
  }