void IndividualHumanMalaria::ApplyTotalBitingExposure() { // Unlike for vector sims, don't do the draw on probability of *any* infectious bites, i.e. EXPCDF(-m_total_exposure) // We will instead do a Poisson draw on how many infectious bites, with the equivalent behavior for zero bites. // Downstream (in createInfection), we will use the number of infected hepatocytes to initialize new infections. // First calculate number of infectious bites int n_infectious_bites = CalculateInfectiousBites(); if ( n_infectious_bites == 0 ) return; // Then do sporozoite challenge (caching inital infected hepatocyte count for createInfection) if ( ChallengeWithBites( n_infectious_bites ) ) { // If there is a non-zero number of initial infected hepatocytes, // choose a strain based on a weighted draw over values from all vector-to-human pools and acquire infection float strain_cdf_draw = randgen->e() * m_total_exposure; std::vector<strain_exposure_t>::iterator it = std::lower_bound( m_strain_exposure.begin(), m_strain_exposure.end(), strain_cdf_draw, compare_strain_exposure_float_less()); AcquireNewInfection(&(it->first)); } }
void IndividualHumanVector::ApplyTotalBitingExposure() { // Make random draw whether to acquire new infection // dt incorporated already in ExposeIndividual function arguments float acquisition_probability = float(EXPCDF(-m_total_exposure)); if ( randgen->e() >= acquisition_probability ) return; // Choose a strain based on a weighted draw over values from all vector-to-human pools float strain_cdf_draw = randgen->e() * m_total_exposure; std::vector<strain_exposure_t>::iterator it = std::lower_bound( m_strain_exposure.begin(), m_strain_exposure.end(), strain_cdf_draw, compare_strain_exposure_float_less()); AcquireNewInfection(&(it->first)); }