NAMD
Static Public Member Functions | Public Attributes | List of all members
ProxyCombinedResultMsg Class Reference

#include <ProxyMgr.h>

Inheritance diagram for ProxyCombinedResultMsg:

Static Public Member Functions

static ProxyCombinedResultRawMsgtoRaw (ProxyCombinedResultMsg *msg)
 
static ProxyCombinedResultMsgfromRaw (ProxyCombinedResultRawMsg *msg)
 

Public Attributes

PatchID patch
 
NodeIDList nodes
 
ForceListforceList [Results::maxNumForces]
 

Detailed Description

Definition at line 239 of file ProxyMgr.h.

Member Function Documentation

ProxyCombinedResultMsg * ProxyCombinedResultMsg::fromRaw ( ProxyCombinedResultRawMsg msg)
static

Definition at line 303 of file ProxyMgr.C.

References ResizeArray< T >::add(), ResizeArray< T >::begin(), ProxyCombinedResultRawMsg::flLen, ProxyCombinedResultRawMsg::forceArr, forceList, ProxyCombinedResultRawMsg::isForceNonZero, Results::maxNumForces, ProxyCombinedResultRawMsg::nodes, nodes, ProxyCombinedResultRawMsg::nodeSize, ProxyCombinedResultRawMsg::patch, patch, ResizeArray< T >::resize(), Vector::x, Vector::y, and Vector::z.

Referenced by ProxyPatch::depositCombinedResultRawMsg().

303  {
304 
305  //CkPrintf("[%d]: unpacking: plainData=%p\n", CkMyPe(), ptr->plainData);
306 
307  void *vmsg = CkAllocBuffer(ptr,sizeof(ProxyCombinedResultMsg));
309 
310  for (int i=0; i<ptr->nodeSize; i++) {
311  msg->nodes.add(ptr->nodes[i]);
312  }
313  #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
314  msg->destPe = ptr->destPe;
315  #if CMK_SMP && defined(NAMDSRC_IMMQD_HACK)
316  msg->isFromImmMsgCall = ptr->isFromImmMsgCall;
317  #endif
318  #endif
319  msg->patch = ptr->patch;
320 
321  char *nonzero = ptr->isForceNonZero;
322  Force* farr = ptr->forceArr;
323 
324  for ( int j = 0; j < Results::maxNumForces; ++j ) {
325  int array_size = ptr->flLen[j];
326  msg->forceList[j] = &(msg->forceListInternal[j]);
327  msg->forceList[j]->resize(array_size);
328  Force* f = msg->forceList[j]->begin();
329 
330  for ( int i = 0; i < array_size; ++i, nonzero++ ) {
331  if ( *nonzero ) {
332  f[i].x = farr->x;
333  f[i].y = farr->y;
334  f[i].z = farr->z;
335  farr++;
336  } else {
337  f[i].x = 0.; f[i].y = 0.; f[i].z = 0.;
338  }
339  }
340  }
341 
342  delete ptr;
343  return msg;
344 }
Definition: Vector.h:64
BigReal z
Definition: Vector.h:66
BigReal x
Definition: Vector.h:66
ForceList * forceList[Results::maxNumForces]
Definition: ProxyMgr.h:254
int add(const Elem &elem)
Definition: ResizeArray.h:97
void resize(int i)
Definition: ResizeArray.h:84
BigReal y
Definition: Vector.h:66
iterator begin(void)
Definition: ResizeArray.h:36
ProxyCombinedResultRawMsg * ProxyCombinedResultMsg::toRaw ( ProxyCombinedResultMsg msg)
static

Definition at line 248 of file ProxyMgr.C.

References ResizeArray< T >::begin(), ProxyCombinedResultRawMsg::flLen, ProxyCombinedResultRawMsg::forceArr, forceList, ProxyCombinedResultRawMsg::isForceNonZero, Results::maxNumForces, ProxyCombinedResultRawMsg::nodes, nodes, ProxyCombinedResultRawMsg::nodeSize, ProxyCombinedResultRawMsg::patch, patch, PRIORITY_SIZE, ResizeArray< T >::size(), Vector::x, x, Vector::y, y, Vector::z, and z.

Referenced by ProxyMgr::recvImmediateResults(), NodeProxyMgr::recvImmediateResults(), and ProxyMgr::sendResults().

248  {
249  int totalFLLen=0;
250  int nonzero_count = 0;
251  int nodeSize = msg->nodes.size();
252  for (int j = 0; j < Results::maxNumForces; ++j ) {
253  int array_size = msg->forceList[j]->size();
254  totalFLLen += array_size;
255  Force* f = msg->forceList[j]->begin();
256  for ( int i = 0; i < array_size; ++i ) {
257  if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) { ++nonzero_count; }
258  }
259  }
260 
261  ProxyCombinedResultRawMsg *msg_buf = new(nodeSize, totalFLLen, nonzero_count, PRIORITY_SIZE)ProxyCombinedResultRawMsg;
262  //Copy envelope stuff
263  {
264  envelope *oenv = UsrToEnv(msg);
265  envelope *nenv = UsrToEnv(msg_buf);
266  CmiMemcpy(nenv->getPrioPtr(), oenv->getPrioPtr(), nenv->getPrioBytes());
267  }
268 
269  msg_buf->nodeSize = nodeSize;
270  for (int i=0; i<nodeSize; i++) {
271  msg_buf->nodes[i] = msg->nodes[i];
272  }
273  #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
274  msg_buf->destPe = msg->destPe;
275  #if CMK_SMP && defined(NAMDSRC_IMMQD_HACK)
276  msg_buf->isFromImmMsgCall = msg->isFromImmMsgCall;
277  #endif
278  #endif
279  msg_buf->patch = msg->patch;
280 
281  Force *farr = msg_buf->forceArr;
282  char *isNonZeroPtr = msg_buf->isForceNonZero;
283  for ( int j = 0; j < Results::maxNumForces; ++j ) {
284  int array_size = msg->forceList[j]->size();
285  msg_buf->flLen[j] = array_size;
286  Force* f = msg->forceList[j]->begin();
287  for ( int i = 0; i < array_size; ++i , isNonZeroPtr++) {
288  if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) {
289  *isNonZeroPtr = 1;
290  farr->x = f[i].x;
291  farr->y = f[i].y;
292  farr->z = f[i].z;
293  farr ++;
294  } else {
295  *isNonZeroPtr = 0;
296  }
297  }
298  }
299  delete msg;
300  return msg_buf;
301 }
Definition: Vector.h:64
BigReal z
Definition: Vector.h:66
#define PRIORITY_SIZE
Definition: Priorities.h:13
gridSize z
BigReal x
Definition: Vector.h:66
ForceList * forceList[Results::maxNumForces]
Definition: ProxyMgr.h:254
BigReal y
Definition: Vector.h:66
int flLen[Results::maxNumForces]
Definition: ProxyMgr.h:233
gridSize y
int size(void) const
Definition: ResizeArray.h:127
gridSize x
iterator begin(void)
Definition: ResizeArray.h:36

Member Data Documentation

ForceList* ProxyCombinedResultMsg::forceList[Results::maxNumForces]
NodeIDList ProxyCombinedResultMsg::nodes
PatchID ProxyCombinedResultMsg::patch

Definition at line 252 of file ProxyMgr.h.

Referenced by fromRaw(), ProxyMgr::sendResults(), and toRaw().


The documentation for this class was generated from the following files: