ProxyCombinedResultMsg Class Reference

#include <ProxyMgr.h>

List of all members.

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< Elem >::add(), ResizeArray< Elem >::begin(), f, ProxyCombinedResultRawMsg::flLen, ProxyCombinedResultRawMsg::forceArr, forceList, forceListInternal, ProxyCombinedResultRawMsg::isForceNonZero, ProxyCombinedResultRawMsg::nodes, nodes, ProxyCombinedResultRawMsg::nodeSize, ProxyCombinedResultRawMsg::patch, patch, ResizeArray< Elem >::resize(), Vector::x, x, Vector::y, and Vector::z.

Referenced by ProxyPatch::depositCombinedResultRawMsg().

00303                                                                                       {
00304 
00305   //CkPrintf("[%d]: unpacking: plainData=%p\n", CkMyPe(), ptr->plainData);      
00306 
00307   void *vmsg = CkAllocBuffer(ptr,sizeof(ProxyCombinedResultMsg));
00308   ProxyCombinedResultMsg *msg = new (vmsg) ProxyCombinedResultMsg;
00309 
00310   for (int i=0; i<ptr->nodeSize; i++) {
00311     msg->nodes.add(ptr->nodes[i]);
00312   }
00313   #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00314   msg->destPe = ptr->destPe;
00315   #if CMK_SMP && defined(NAMDSRC_IMMQD_HACK)
00316   msg->isFromImmMsgCall = ptr->isFromImmMsgCall;
00317   #endif
00318   #endif
00319   msg->patch = ptr->patch;
00320 
00321   char *nonzero = ptr->isForceNonZero;
00322   Force* farr = ptr->forceArr;
00323 
00324   for ( int j = 0; j < Results::maxNumForces; ++j ) {
00325     int array_size = ptr->flLen[j];
00326     msg->forceList[j] = &(msg->forceListInternal[j]);
00327     msg->forceList[j]->resize(array_size);
00328     Force* f = msg->forceList[j]->begin();
00329 
00330     for ( int i = 0; i < array_size; ++i, nonzero++ ) {
00331       if ( *nonzero ) {
00332                 f[i].x = farr->x;
00333                 f[i].y = farr->y;
00334                 f[i].z = farr->z;
00335                 farr++;
00336       } else {
00337         f[i].x = 0.;  f[i].y = 0.;  f[i].z = 0.;
00338       }
00339     }
00340   }
00341 
00342   delete ptr;
00343   return msg;
00344 }

ProxyCombinedResultRawMsg * ProxyCombinedResultMsg::toRaw ( ProxyCombinedResultMsg msg  )  [static]

Definition at line 248 of file ProxyMgr.C.

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

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

00248                                                                                     {
00249   int totalFLLen=0;
00250   int nonzero_count = 0;
00251   int nodeSize = msg->nodes.size();
00252   for (int j = 0; j < Results::maxNumForces; ++j ) {
00253         int array_size = msg->forceList[j]->size();
00254     totalFLLen +=  array_size;
00255     Force* f = msg->forceList[j]->begin();
00256     for ( int i = 0; i < array_size; ++i ) {
00257       if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) { ++nonzero_count; }
00258     }
00259   }
00260 
00261   ProxyCombinedResultRawMsg *msg_buf = new(nodeSize, totalFLLen, nonzero_count, PRIORITY_SIZE)ProxyCombinedResultRawMsg;
00262   //Copy envelope stuff
00263   {
00264          envelope *oenv = UsrToEnv(msg);
00265          envelope *nenv = UsrToEnv(msg_buf);
00266          CmiMemcpy(nenv->getPrioPtr(), oenv->getPrioPtr(), nenv->getPrioBytes());
00267   }
00268 
00269   msg_buf->nodeSize = nodeSize;
00270   for (int i=0; i<nodeSize; i++) {
00271     msg_buf->nodes[i] = msg->nodes[i];
00272   }
00273   #if defined(NODEAWARE_PROXY_SPANNINGTREE) && defined(USE_NODEPATCHMGR)
00274   msg_buf->destPe = msg->destPe;
00275   #if CMK_SMP && defined(NAMDSRC_IMMQD_HACK)
00276   msg_buf->isFromImmMsgCall = msg->isFromImmMsgCall;
00277   #endif
00278   #endif
00279   msg_buf->patch = msg->patch;
00280 
00281   Force *farr = msg_buf->forceArr;
00282   char *isNonZeroPtr = msg_buf->isForceNonZero;
00283   for ( int j = 0; j < Results::maxNumForces; ++j ) {
00284         int array_size = msg->forceList[j]->size();
00285     msg_buf->flLen[j] = array_size;
00286     Force* f = msg->forceList[j]->begin();
00287     for ( int i = 0; i < array_size; ++i , isNonZeroPtr++) {
00288       if ( f[i].x != 0. || f[i].y != 0. || f[i].z != 0. ) {
00289         *isNonZeroPtr = 1;
00290                 farr->x  =  f[i].x;
00291         farr->y  =  f[i].y;
00292         farr->z  =  f[i].z;
00293         farr ++;
00294       } else {
00295         *isNonZeroPtr = 0;
00296       }
00297     }
00298   }
00299   delete msg;
00300   return msg_buf;
00301 }


Member Data Documentation

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

Definition at line 254 of file ProxyMgr.h.

Referenced by ProxyPatch::depositCombinedResultMsg(), ProxyPatch::depositCombinedResultRawMsg(), fromRaw(), and toRaw().

NodeIDList ProxyCombinedResultMsg::nodes

Definition at line 253 of file ProxyMgr.h.

Referenced by ProxyPatch::depositCombinedResultMsg(), ProxyPatch::depositCombinedResultRawMsg(), fromRaw(), and toRaw().

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:
Generated on Fri Nov 24 01:17:20 2017 for NAMD by  doxygen 1.4.7