void Tgam::computeNextState(const int time, GrGrid& grid, Stats& stats, bool tnfrDynamics, bool, bool, bool tgammatransition) { // check if it is time to die if (timeToDie(time)) { _nextState = TGAM_DEAD; } // Always pass in false for nfkbDynamics for T cell apoptosis since they DO NOT have NFkB dynamics else if (TNFinducedApoptosis(grid, tnfrDynamics, false)) { ++stats.getTcellApoptosisTNF(); _nextState = TGAM_DEAD; grid.incKillings(_pos); } else { switch (_state) { case TGAM_DEAD: // if dead, stay dead _nextState = TGAM_DEAD; break; case TGAM_ACTIVE: handleActive(time, grid, stats, tgammatransition); break; case TGAM_DOWN_REGULATED: handleDownRegulated(time, grid, stats); break; case TGAM_ACTIVE_DOUBLE: handleActiveDouble(time, grid, stats); break; case TGAM_INDUCED_REG: handleInducedReg(time, grid, stats); break; default: throw std::runtime_error("Unknown Tgam state"); } } }
void Snapshot::takeSnapshot(const int time, const Stats& stats) { _outFile << time; _outFile << (stats.getNrOfMacs()) << ','; for(size_t i=0; i<Mac::NSTATES; i++) _outFile << (stats.getNrOfMacs(Mac::State(i))) << ','; _outFile << (stats.getNrOfTgams()) << ','; for(size_t i=0; i<Tgam::NSTATES; i++) _outFile << (stats.getNrOfTgams(Tgam::State(i))) << ','; _outFile << (stats.getNrOfTcyts()) << ','; for(size_t i=0; i<Tcyt::NSTATES; i++) _outFile << (stats.getNrOfTcyts(Tcyt::State(i))) << ','; _outFile << (stats.getNrOfTregs()) << ','; for(size_t i=0; i<Treg::NSTATES; i++) _outFile << (stats.getNrOfTregs(Treg::State(i))) << ','; _outFile << stats.getTotIntMtb() << ',' << stats.getTotExtMtb() << ',' << stats.getTotNonRepExtMtb() << ',' << (stats.getTotIntMtb() + stats.getTotExtMtb()) << ',' << stats.getTotTNF() << ',' << stats.getTotCCL2() << ',' << stats.getTotCCL5() << ',' << stats.getTotCXCL9() << ',' << stats.getAreaTNF() << ',' << stats.getAreaCellDensity() << ',' << stats.getMDC() << ',' << stats.getN4() << ',' << stats.getTH0() << ',' << stats.getTH1() << ',' << stats.getN8() << ',' << stats.getT80() << ',' << stats.getT8() << ',' << stats.getTC() << ',' << stats.getTH0lung() << ',' << stats.getTH1lung() << ',' << stats.getT80lung() << ',' << stats.getT8lung() << ',' << stats.getTClung(); int startState = 1; // Skip the dead state: apoptosis doesn't occur for an already dead mac. static int totMacApoptosisTNF[Mac::NSTATES] = {0}; //Just temporary for Mohammed Fallahi int sumMacApoptosisTNF = 0; for(int i=startState; i<Mac::NSTATES; i++) //Keep a running sum of deaths { totMacApoptosisTNF[i]+=(stats.getMacApoptosisTNF((Mac::State)i)); sumMacApoptosisTNF+=totMacApoptosisTNF[i]; } _outFile << (stats.getTotNrSources()) << ','; for(size_t i=0; i<NAGENTS; i++) _outFile << (stats.getNrSources((AgentType)i)) << ','; _outFile << stats.getNrCaseated() << ',' << sumMacApoptosisTNF << ','; for(int i=startState; i<Mac::NSTATES; i++) _outFile<<totMacApoptosisTNF[i]<<','; _outFile << stats.getTcellApoptosisTNF(); _outFile << std::endl; }