-
Notifications
You must be signed in to change notification settings - Fork 0
/
subtractDeaths.cpp
71 lines (57 loc) · 2.41 KB
/
subtractDeaths.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <vector>
#include <time.h>
#include <eigen3/Eigen/Dense>
#include "csvUtil.h"
#include "globals.h"
void subtractDeaths(int time_index){
// For use in the loop
double mu, alpha, diff, count;
for (int hiv : hivBins){
for (int age : ageBins){
for (int male : maleBins){
for (int risk : riskBins){
for (int cd4 : cd4Bins){
for (int vl : vlBins){
for (int circ : circBins){
for (int prep : prepBins){
for (int condom : condomBins){
for (int art : artBins){
count = popCount[hiv][age][male][risk][cd4][vl][circ][prep][condom][art];
diff = 0; // Tracker for number of deaths
// Background mortality applies to everyone - find correct multiplier
mu = back_mort[age][male];
diff += count * mu;
// HIV-specific mortality
if(hiv == 1) {
alpha = hiv_mort[age][cd4][art];
diff += count * alpha;
}
// Add to diff column of pop
popDiff[hiv][age][male][risk][cd4][vl][circ][prep][condom][art] -= diff;
}
}
}
}
}
}
}
}
}
}
}
// clang++ -O3 -std=c++11 -g subtractDeaths.cpp csvUtil.cpp globals.cpp
// int main(){
// int timeIndex = 0;
// clock_t tStart;
// clock_t tEnd;
// initPop("addBirths_0.out");
// tStart = clock();
// subtractDeaths(timeIndex); //0 based
// tEnd = clock();
// std::cout << "time took: " << (double)(tEnd - tStart)/CLOCKS_PER_SEC << std::endl;
// std::stringstream filename;
// filename << "subtractDeaths_" << timeIndex << ".cout";
// writePop(filename.str(), timeIndex);
// return 0;
// }