struct ObjectRecord {
BasicTimeWarp *ptr;
int lpNum;
};
As the name implies, the commHandle is intended to be used to enable simulation objects to communicate with each other. The commHandle in a TimeWarp object points to the simArray in the LP it's associated with, which has an entry for every object in the simulation. If a simulation object is local an LP, the pointer in that LP's simArray points to the object. For objects that are not local to the LP and the ptr points at the CommManager for the LP. The items in the simArray are initialized when the objects call LogicalProcess::register(). This organization allows communication between simulation objects to be uniform whether they are located on the same LP or not. Here is a ``snippet'' of code from TimeWarp::sendEvent:
BasicEvent *toSend; commHandle[toSend->dest].ptr->recvEvent(toSend);
This single line of code will send the message to the the appropriate destination, whether the object is local or not. If the object is local commHandle[toSend].ptr will point at the actual destination of the event, which will simply enqueue the message directly. Otherwise, it will point at the CommManager which will receive the event from the sender, and send the message through MPI on the sender's behalf.