ProxyResultVarsizeMsg Class Reference

#include <ProxyMgr.h>

List of all members.

Static Public Member Functions

static ProxyResultVarsizeMsggetANewMsg (NodeID nid, PatchID pid, int prioSize, ForceList *fls)

Public Attributes

NodeID node
PatchID patch
int flLen [Results::maxNumForces]
ForceforceArr
char * isZero
char padding [(8-(sizeof(envelope)+sizeof(NodeID)+sizeof(PatchID)+sizeof(int)*Results::maxNumForces+2 *sizeof(void *))%8)%8]


Detailed Description

Definition at line 175 of file ProxyMgr.h.


Member Function Documentation

ProxyResultVarsizeMsg * ProxyResultVarsizeMsg::getANewMsg ( NodeID  nid,
PatchID  pid,
int  prioSize,
ForceList fls 
) [static]

Definition at line 150 of file ProxyMgr.C.

00150                                                                                                              {
00151 
00152     //1. decide the length of forceArr and iszero field.
00153     int tmpLen[Results::maxNumForces];
00154     int iszeroLen = 0;
00155     for (int i=0; i<Results::maxNumForces; i++){
00156         tmpLen[i] = fls[i].size();
00157         iszeroLen += tmpLen[i];
00158     }
00159     char *tmpIszero = new char[iszeroLen];
00160     char *iszeroPtr = tmpIszero;
00161     int fArrLen = 0;
00162     for(int i=0; i<Results::maxNumForces; i++) {        
00163         Force *fiPtr = fls[i].begin();
00164         for(int j=0; j<tmpLen[i]; j++, fiPtr++, iszeroPtr++) {         
00165             if(fiPtr->x!=0.0 || fiPtr->y!=0.0 || fiPtr->z!=0) {
00166                 *iszeroPtr=0;
00167                 fArrLen++;
00168             }else{
00169                 *iszeroPtr=1;
00170             }            
00171         }
00172     }
00173 
00174     //2. Ready to create the msg, and set all fields
00175     ProxyResultVarsizeMsg *retmsg = new(fArrLen, iszeroLen, prioSize)ProxyResultVarsizeMsg;
00176     retmsg->node = nid;
00177     retmsg->patch = pid;
00178     memcpy(retmsg->flLen, tmpLen, sizeof(int)*Results::maxNumForces);
00179     iszeroPtr = tmpIszero;
00180     Force *forcePtr = retmsg->forceArr;
00181     for(int i=0; i<Results::maxNumForces; i++) {        
00182         Force *fiPtr = fls[i].begin();
00183         for(int j=0; j<tmpLen[i]; j++, fiPtr++, iszeroPtr++) {
00184             if((*iszeroPtr)!=1) {
00185                 forcePtr->x = fiPtr->x;
00186                 forcePtr->y = fiPtr->y;
00187                 forcePtr->z = fiPtr->z;
00188                 forcePtr++;
00189             }            
00190         }
00191     }
00192     memcpy(retmsg->isZero, tmpIszero, sizeof(char)*iszeroLen);
00193     delete [] tmpIszero;
00194     return retmsg;
00195 }


Member Data Documentation

int ProxyResultVarsizeMsg::flLen[Results::maxNumForces]

Definition at line 179 of file ProxyMgr.h.

Force* ProxyResultVarsizeMsg::forceArr

Definition at line 181 of file ProxyMgr.h.

Referenced by HomePatch::receiveResults().

char* ProxyResultVarsizeMsg::isZero

Definition at line 184 of file ProxyMgr.h.

Referenced by HomePatch::receiveResults().

NodeID ProxyResultVarsizeMsg::node

Definition at line 177 of file ProxyMgr.h.

Referenced by HomePatch::receiveResults().

char ProxyResultVarsizeMsg::padding[(8-(sizeof(envelope)+sizeof(NodeID)+sizeof(PatchID)+sizeof(int)*Results::maxNumForces+2 *sizeof(void *))%8)%8]

Definition at line 190 of file ProxyMgr.h.

PatchID ProxyResultVarsizeMsg::patch

Definition at line 178 of file ProxyMgr.h.

Referenced by ProxyMgr::recvResults(), and ProxyMgr::sendResults().


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