Skip to content

Commit

Permalink
Fixed some includes, and references to dist2_mm.
Browse files Browse the repository at this point in the history
  • Loading branch information
CloneDeath committed May 26, 2020
1 parent 8a56310 commit 70edac8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#include <iostream>
#include "Kernels.h"
#include "Error.h"
#include "Dist.h"
#include "Param.h"
#include "Model.h"

// To speed up calculation of kernel values we provide a couple of lookup
// tables.
Expand Down
6 changes: 3 additions & 3 deletions src/Models/Person.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include "../Model.h"

double Person::distance_to(const Person *other) const {
double Person::distance_to(const Person &other) const {
return std::sqrt(this->distance_squared_to(other));
}

double Person::distance_squared_to(const Person *other) const {
return Households[this->hh].distance_squared_to(Households[other->hh]);
double Person::distance_squared_to(const Person &other) const {
return Households[this->hh].distance_squared_to(Households[other.hh]);
}
4 changes: 2 additions & 2 deletions src/Models/Person.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ struct Person
unsigned short int dct_start_time, dct_end_time, dct_trigger_time, dct_test_time; //digital contact tracing start and end time: ggilani 10/03/20
int ncontacts; //added this in to record total number of contacts each index case records: ggilani 13/04/20

double distance_to(const Person* other) const;
double distance_squared_to(const Person* other) const;
double distance_to(const Person &other) const;
double distance_squared_to(const Person &other) const;
};
12 changes: 7 additions & 5 deletions src/Sweep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ void InfectSweep(double t, int run) //added run number as argument in order to r
///// pick random person m within susceptibles of cell ct (S0 initial number susceptibles within cell).
int m = (int)(ranf_mt(tn) * ((double)ct->S0));
int i3 = ct->susceptible[m];
s2 = dist2(Hosts + i3, Hosts + ci); /// calculate distance squared between this susceptible person and person ci/si identified earlier
s2 = Hosts[i3].distance_squared_to(Hosts[ci]); /// calculate distance squared between this susceptible person and person ci/si identified earlier
s = numKernel(s2) / c->max_trans[l]; //// acceptance probability
f2 = 0;
if ((ranf_mt(tn) >= s) || (abs(Hosts[i3].inf) == InfStat_Dead)) //// if rejected, or infectee i3/m already dead, ensure do-while evaluated again (i.e. choose a new infectee).
Expand Down Expand Up @@ -1351,7 +1351,9 @@ int TreatSweep(double t)
if (P.TreatByAdminUnit)
f4 = (AdUnits[Mcells[k].adunit].id / P.TreatAdminUnitDivisor == ad2);
else
f4 = ((r = dist2_mm(Mcells + b, Mcells + k)) < P.TreatRadius2);
{
f4 = ((r = Mcells[b].distance_squared_to(&Mcells[k])) < P.TreatRadius2);
}
if (f4)
{
f = f2 = 1;
Expand Down Expand Up @@ -1440,7 +1442,7 @@ int TreatSweep(double t)
r = 1e20;
}
else
f4 = ((r = dist2_mm(Mcells + b, Mcells + k)) < P.VaccRadius2);
f4 = ((r = Mcells[b].distance_squared_to(&Mcells[k])) < P.VaccRadius2);
if (f4)
{
f = f2 = 1;
Expand Down Expand Up @@ -1602,7 +1604,7 @@ int TreatSweep(double t)
if (P.MoveRestrByAdminUnit)
f4 = (AdUnits[Mcells[k].adunit].id / P.MoveRestrAdminUnitDivisor == ad2);
else
f4 = ((r = dist2_mm(Mcells + b, Mcells + k)) < P.MoveRestrRadius2);
f4 = ((r = Mcells[b].distance_squared_to(&Mcells[k])) < P.MoveRestrRadius2);
if (f4)
{
f = f2 = 1;
Expand Down Expand Up @@ -1722,7 +1724,7 @@ int TreatSweep(double t)
do
{
if (P.is_in_bounds(min))
if (dist2_mm(Mcells + b, Mcells + k) < P.KeyWorkerProphRadius2)
if (Mcells[b].distance_squared_to(&Mcells[k]) < P.KeyWorkerProphRadius2)
{
f = f2 = 1;
if ((Mcells[k].n > 0) && (Mcells[k].keyworkerproph == 0))
Expand Down

0 comments on commit 70edac8

Please sign in to comment.