-
Notifications
You must be signed in to change notification settings - Fork 0
/
Request.cpp
61 lines (47 loc) · 1.49 KB
/
Request.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
#include "Request.h"
#include "State.h"
#include "Worker.h"
#include "Traversal_decls.h"
#include "Node.h"
#include "TreePiece.h"
void Request::deliverParticles(int num){
for(int i = 0; i < requestors.length(); i++){
Requestor &req = requestors[i];
CutoffWorker<ForceData> *worker = req.worker;
void *saveContext = worker->getContext();
worker->setContext(req.context);
ExternalParticle *externalParticles = (ExternalParticle *)data;
for(int j = 0; j < num; j++){
CkAssert(!isnan((externalParticles+j)->position.length()));
worker->work(externalParticles+j);
}
worker->bucketDone(parent->getKey());
worker->setContext(saveContext);
State *state = req.state;
if(state->decrPending()){
worker->done();
}
}
requestors.clear();
}
void Request::deliverNode(){
for(int i = 0; i < requestors.length(); i++){
Requestor &req = requestors[i];
CutoffWorker<ForceData> *worker = req.worker;
void *saveContext = worker->getContext();
worker->setContext(req.context);
Traversal<ForceData> *traversal = req.traversal;
State *state = req.state;
Node<ForceData> *firstChild = (Node<ForceData>*) data;
// start the traversal for each of the received children
for(int j = 0; j < BRANCH_FACTOR; j++){
traversal->topDownTraversal(firstChild+j,worker,state);
}
worker->setContext(saveContext);
if(state->decrPending()){
worker->done();
}
}
requestors.clear();
}
#include "Traversal_defs.h"