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

◆ fromRaw()

ProxyCombinedResultMsg * ProxyCombinedResultMsg::fromRaw ( ProxyCombinedResultRawMsg msg)
static

Definition at line 302 of file ProxyMgr.C.

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

Referenced by ProxyPatch::depositCombinedResultRawMsg().

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

◆ toRaw()

ProxyCombinedResultRawMsg * ProxyCombinedResultMsg::toRaw ( ProxyCombinedResultMsg msg)
static

Definition at line 247 of file ProxyMgr.C.

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

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

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

Member Data Documentation

◆ forceList

ForceList* ProxyCombinedResultMsg::forceList[Results::maxNumForces]

◆ nodes

NodeIDList ProxyCombinedResultMsg::nodes

◆ patch

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: