/// /// Feedback main method /// void Main::StellarFeedback(double dTime, double dDelta) { if(verbosity) CkPrintf("Stellar Feedback ... \n"); double startTime = CkWallTimer(); CkReductionMsg *msgFeedback; treeProxy.Feedback(*(param.feedback), dTime, dDelta, CkCallbackResumeThread((void*&)msgFeedback)); double *dFeedback = (double *)msgFeedback->getData(); if(verbosity) { CkPrintf("Feedback totals: mass, energy, metalicity\n"); for(int i = 0; i < NFEEDBACKS; i++){ CkPrintf("feedback %d: %g %g %g\n", i, dFeedback[i*3], dFeedback[i*3 + 1], dFeedback[i*3] != 0.0 ? dFeedback[i*3 + 2]/dFeedback[i*3] : 0.0); } } delete msgFeedback; CkReductionMsg *msgChk; treeProxy.massMetalsEnergyCheck(1, CkCallbackResumeThread((void*&)msgChk)); if(verbosity) CkPrintf("Distribute Stellar Feedback ... "); // Need to build tree since we just did addDelParticle. // treeProxy.buildTree(bucketSize, CkCallbackResumeThread()); DistStellarFeedbackSmoothParams pDSFB(TYPE_GAS, 0, param.csm, dTime, param.dConstGamma, param.feedback); double dfBall2OverSoft2 = 4.0*param.dhMinOverSoft*param.dhMinOverSoft; treeProxy.startSmooth(&pDSFB, 0, param.feedback->nSmoothFeedback, dfBall2OverSoft2, CkCallbackResumeThread()); treeProxy.finishNodeCache(CkCallbackResumeThread()); CkPrintf("Stellar Feedback Calculated, Wallclock %f secs\n", CkWallTimer() - startTime); CkReductionMsg *msgChk2; treeProxy.massMetalsEnergyCheck(0, CkCallbackResumeThread((void*&)msgChk2)); double *dTotals = (double *)msgChk->getData(); double *dTotals2 = (double *)msgChk2->getData(); int i; for(i = 0; i < 5; i++) { std::string labels[5] = {"Mass", "Metals", "Oxygen", "Iron", "Energy"}; if(verbosity > 1) CkPrintf("Total %s: %g\n", labels[i].c_str(), dTotals[i]); if(fabs(dTotals[i] - dTotals2[i]) > 1e-12*(dTotals[i])) { CkError("ERROR: %s not conserved: %.15e != %.15e!\n", labels[i].c_str(), dTotals[i], dTotals2[i]); } } delete msgChk; delete msgChk2; }
/// Collect GVT iteration counts void POSE_sumGVTIterations(void *param, void *msg) { CkReductionMsg *m = (CkReductionMsg *)msg; CkPrintf("Final basic stats: GVT iterations: %d\n", *((int*)m->getData())); delete m; CProxy_pose POSE_Coordinator(POSE_Coordinator_ID); POSE_Coordinator.prepExit(); }
/// Exit simulation program after terminus reduction void POSE_prepExit(void *param, void *msg) { CkReductionMsg *m = (CkReductionMsg *)msg; long long *finalBasicStats = ((long long*)m->getData()); CkPrintf("Final basic stats: Commits: %lld Rollbacks: %lld\n", finalBasicStats[0], finalBasicStats[1]); delete m; #ifdef SEQUENTIAL_POSE CProxy_pose POSE_Coordinator(POSE_Coordinator_ID); POSE_Coordinator.prepExit(); #else CProxy_GVT g(TheGVT); g.sumGVTIterationCounts(); #endif }