Newer
Older
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
#include "PthreadSimulation.hpp"
namespace nbody {
PthreadSimulation::PthreadSimulation() {
this->correctState = -1;
}
PthreadSimulation::~PthreadSimulation() {
}
void PthreadSimulation::cleanup() {
}
int PthreadSimulation::getNumberOfProcesses() {
return this->threads.size();
}
int PthreadSimulation::getProcessId() {
vector<pthread_t>::iterator it = this->threads.begin();
int id = 0;
while (*it != pthread_self() && it != this->threads.end()) {
id++;
it++;
}
if (it != this->threads.end()) {
return id;
} else {
return -1;
}
}
bool PthreadSimulation::readInputData(string filename) {
this->bodies = Tree::dubinskiParse(filename);
return !this->bodies.empty();
}
void PthreadSimulation::runStep() {
}
}