diff --git a/src/AgentContainer.cpp b/src/AgentContainer.cpp index 177d87d..b2863bb 100644 --- a/src/AgentContainer.cpp +++ b/src/AgentContainer.cpp @@ -972,7 +972,7 @@ void AgentContainer::interactAgentsHomeWork (MultiFab& mask_behavior, bool home) auto nborhood_ptr = soa.GetIntData(IntIdx::nborhood).data(); auto school_ptr = soa.GetIntData(IntIdx::school).data(); auto withdrawn_ptr = soa.GetIntData(IntIdx::withdrawn).data(); - //auto workgroup_ptr = soa.GetIntData(IntIdx::workgroup).data(); + auto workgroup_ptr = soa.GetIntData(IntIdx::workgroup).data(); auto prob_ptr = soa.GetRealData(RealIdx::prob).data(); auto counter_ptr = soa.GetRealData(RealIdx::disease_counter).data(); @@ -1002,6 +1002,7 @@ void AgentContainer::interactAgentsHomeWork (MultiFab& mask_behavior, bool home) infect *= j_mask; amrex::Real social_scale = 1.0; // TODO this should vary based on cell + amrex::Real work_scale = 1.0; // TODO this should vary based on cell /* Determine what connections these individuals have */ if ((nborhood_ptr[i] == nborhood_ptr[j]) && (family_ptr[i] == family_ptr[2]) && (!DAYTIME)) { @@ -1022,7 +1023,7 @@ void AgentContainer::interactAgentsHomeWork (MultiFab& mask_behavior, bool home) } /* check for common neighborhood cluster: */ else if ((nborhood_ptr[i] == nborhood_ptr[j]) && (family_ptr[i] == family_ptr[j]) && - withdrawn_ptr[i] && withdrawn_ptr[j] && (!DAYTIME)) { + (!withdrawn_ptr[i]) && (!withdrawn_ptr[j]) && (!DAYTIME)) { if (age_group_ptr[i] == 0) { /* Transmitter i is a child */ if (school_ptr[i] < 0) // not attending school, use _SC contacts prob_ptr[j] *= 1.0 - infect * lparm->xmit_nc_child_SC[age_group_ptr[j]] * social_scale; @@ -1038,55 +1039,53 @@ void AgentContainer::interactAgentsHomeWork (MultiFab& mask_behavior, bool home) } // /* Home isolation or household quarantine? */ - // if ( (!(pt1->status & AT_HOME)) && (!(pt2->status & AT_HOME)) ) { - - // /* Should always be in the same community = same cell */ - // if (pt1->school < 0) // not attending school, use _SC contacts - // prob_ptr[j] *= 1.0 - infect * xmit_comm_SC[pt2->status & 7] * cd->social_scale; - // else - // prob_ptr[j] *= 1.0 - infect * xmit_comm[pt2->status & 7] * cd->social_scale; - - // /* Workgroup transmission */ - // if (DAYTIME && pt1->workgroup && (pt1->comm_work.i >= 0)) { // transmitter i at work - // if ((pt2->comm_work.i >= 0) && (pt1->workgroup == pt2->workgroup)) { // coworker - // prob_ptr[j] *= 1.0 - infect * xmit_work * cd->work_scale; - // } - // } - - // /* Neighborhood? */ - // if (nborhood_ptr[i] == nborhood_ptr[j]) { - // if (pt1->school < 0) // not attending school, use _SC contacts - // prob_ptr[j] *= 1.0 - infect * xmit_hood_SC[pt2->status & 7] * cd->social_scale; - // else - // prob_ptr[j] *= 1.0 - infect * xmit_hood[pt2->status & 7] * cd->social_scale; - - // if ((pt1->school == pt2->school) && DAYTIME) { - // if (pt1->school > 5) { - // /* Playgroup */ - // prob_ptr[j] *= 1.0 - infect * xmit_school[6] * cd->social_scale; - // } else if (pt1->school == 5) { - // /* Day care */ - // prob_ptr[j] *= 1.0 - infect * xmit_school[5] * cd->social_scale; - // } - // } - // } /* same neighborhood */ - - // /* Elementary/middle/high school in common */ - // if ((pt1->school == pt2->school) && DAYTIME && - // (pt1->school > 0) && (pt1->school < 5)) { - // if (!(pt1->status & 6)) { /* Transmitter i is a child */ - // if (!(pt2->status & 6)) { /* Receiver j is a child */ - // prob_ptr[j] *= 1.0 - infect * xmit_school[pt1->school] * cd->social_scale; - // } else { // Child student -> adult teacher/staff transmission - // prob_ptr[j] *= 1.0 - infect * xmit_sch_c2a[pt1->school] * cd->social_scale; - // } - // } else if (!(pt2->status & 6)) { // Adult teacher/staff -> child student - // prob_ptr[j] *= 1.0 - infect * xmit_sch_a2c[pt1->school] * cd->social_scale; - // } - // } - // } /* within society */ - - prob_ptr[j] *= 1.0 - infect*lparm->xmit_comm[age_group_ptr[j]]; + if ( (!withdrawn_ptr[i]) && (!withdrawn_ptr[j]) ) { + + /* Should always be in the same community = same cell */ + if (school_ptr[i] < 0) // not attending school, use _SC contacts + prob_ptr[j] *= 1.0 - infect * lparm->xmit_comm_SC[age_group_ptr[j]] * social_scale; + else + prob_ptr[j] *= 1.0 - infect * lparm->xmit_comm[age_group_ptr[j]] * social_scale; + + /* Workgroup transmission */ + if (DAYTIME && workgroup_ptr[i] && (work_i_ptr[i] >= 0)) { // transmitter i at work + if ((work_i_ptr[j] >= 0) && (workgroup_ptr[i] == workgroup_ptr[j])) { // coworker + prob_ptr[j] *= 1.0 - infect * lparm->xmit_work * work_scale; + } + } + + // /* Neighborhood? */ + if (nborhood_ptr[i] == nborhood_ptr[j]) { + if (school_ptr[i] < 0) // not attending school, use _SC contacts + prob_ptr[j] *= 1.0 - infect * lparm->xmit_hood_SC[age_group_ptr[j]] * social_scale; + else + prob_ptr[j] *= 1.0 - infect * lparm->xmit_hood[age_group_ptr[j]] * social_scale; + + if ((school_ptr[i] == school_ptr[j]) && DAYTIME) { + if (school_ptr[i] > 5) { + /* Playgroup */ + prob_ptr[j] *= 1.0 - infect * lparm->xmit_school[6] * social_scale; + } else if (school_ptr[i] == 5) { + /* Day care */ + prob_ptr[j] *= 1.0 - infect * lparm->xmit_school[5] * social_scale; + } + } + } /* same neighborhood */ + + /* Elementary/middle/high school in common */ + if ((school_ptr[i] == school_ptr[j]) && DAYTIME && + (school_ptr[i] > 0) && (school_ptr[i] < 5)) { + if (age_group_ptr[i] == 1) { /* Transmitter i is a child */ + if (age_group_ptr[j] == 1) { /* Receiver j is a child */ + prob_ptr[j] *= 1.0 - infect * lparm->xmit_school[school_ptr[i]] * social_scale; + } else { // Child student -> adult teacher/staff transmission + prob_ptr[j] *= 1.0 - infect * lparm->xmit_sch_c2a[school_ptr[i]] * social_scale; + } + } else if (age_group_ptr[j] == 1) { // Adult teacher/staff -> child student + prob_ptr[j] *= 1.0 - infect * lparm->xmit_sch_a2c[school_ptr[i]] * social_scale; + } + } + } /* within society */ } else if (status_ptr[j] == Status::infected && status_ptr[i] != Status::infected) { // j can infect i amrex::Real infect = lparm->infect;