-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathprpl-exchangeMap.cpp
More file actions
29 lines (27 loc) · 903 Bytes
/
prpl-exchangeMap.cpp
File metadata and controls
29 lines (27 loc) · 903 Bytes
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
#include "prpl-exchangeMap.h"
bool pRPL::ExchangeMap::
add(int subspcID, int iDir, int iNbr, int prcID) {
if(prcID < 0) {
cerr << __FILE__ << " function:" << __FUNCTION__ \
<< " Error: invalid process ID (" << prcID \
<< ")" << endl;
return false;
}
if(subspcID < 0) {
cerr << __FILE__ << " function:" << __FUNCTION__ \
<< " Error: invalid SubCellspace ID (" << subspcID \
<< ")" << endl;
return false;
}
if(iDir < 0 || iNbr < 0) {
cerr << __FILE__ << " function:" << __FUNCTION__ \
<< " Error: invalid direction (" << iDir << ")," \
<< " or invalid neighbor ID (" << iNbr << ")" \
<< endl;
return false;
}
pRPL::ExchangeNode newNode = {subspcID, iDir, iNbr};
operator[](prcID).push_back(newNode);
//cout << subspcID << ", " << iDir << ", " << iNbr << " ---- " << prcID << endl;
return true;
}