void VectorCohortIndividual::AcquireNewInfection( const IStrainIdentity *infstrain, int incubation_period_override )
 {
     if ( state != VectorStateEnum::STATE_ADULT )
     {
         // removing this as a mosquito can be exposed to multiple contagion populations (one for each antigen each time step) throw IllegalOperationException( __FILE__, __LINE__, __FUNCTION__, "Error trying to infect an already infected mosquito." );
     }
     else
     {
         progress = 0;
         state    = VectorStateEnum::STATE_INFECTED;
         m_strain = StrainIdentity( infstrain );
     }
 }
Beispiel #2
0
    Kernel::StrainIdentity* Outbreak::GetNewStrainIdentity(INodeEventContext *context)
    {
        StrainIdentity *outbreak_strainID = nullptr;

        // Important: Use the instance method to obtain the intervention factory obj instead of static method to cross the DLL boundary
        // NO usage of GET_CONFIGURABLE(SimulationConfig)->number_substrains in DLL
        IGlobalContext *pGC = nullptr;
        const SimulationConfig* simConfigObj = nullptr;
        if (s_OK == context->QueryInterface(GET_IID(IGlobalContext), (void**)&pGC))
        {
            simConfigObj = pGC->GetSimulationConfigObj();
        }
        if (!simConfigObj)
        {
            throw GeneralConfigurationException( __FILE__, __LINE__, __FUNCTION__, "The pointer to IInterventionFactory object is not valid (could be DLL specific)" );
        }

        if (( antigen < 0 ) || ( antigen >= simConfigObj->number_basestrains ))
        {
            throw IncoherentConfigurationException( __FILE__, __LINE__, __FUNCTION__, "antigen", antigen, "number_basestrains", simConfigObj->number_basestrains );
        }

        if ( genome < 0 )
        {
            int ss = simConfigObj->number_substrains;
            if (ss & (ss-1))
            {
                throw GeneralConfigurationException( __FILE__, __LINE__, __FUNCTION__, "Only supporting random genome generation for Number_Substrains as factor of two." );
            }
            unsigned int BARCODE_BITS = 0;
            while(ss >>= 1) ++BARCODE_BITS;
            uint32_t genome = context->GetRng()->ul() & ((1 << BARCODE_BITS)-1);
            //genome = context->GetRng()->i(simConfigObj->number_substrains);
            outbreak_strainID = _new_ StrainIdentity(antigen, genome);
            LOG_DEBUG_F("random genome generation... antigen: %d\t genome: %d\n", antigen, genome);
        }
 void IndividualHumanMalaria::DepositFractionalContagionByStrain(float weight, IVectorInterventionsEffects* ivie, float antigenID, float geneticID)
 {
     StrainIdentity id = StrainIdentity(antigenID, geneticID);
     parent->DepositFromIndividual( &id, weight*ivie->GetblockIndoorVectorTransmit(), &NodeVector::human_to_vector_indoor );
     parent->DepositFromIndividual( &id, weight*ivie->GetblockOutdoorVectorTransmit(), &NodeVector::human_to_vector_outdoor );
 }