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

#include <ReductionMgr.h>

Public Member Functions

ReductionSetDatagetData (int seqNum)
 
ReductionSetDataremoveData (int seqNum)
 
 ReductionSet (int setID, int size, int numChildren)
 
 ~ReductionSet ()
 

Public Attributes

int reductionSetID
 
int nextSequenceNumber
 
int submitsRegistered
 
int dataSize
 
ReductionSetDatadataQueue
 
int requireRegistered
 
int threadIsWaiting
 
int waitingForSequenceNumber
 
CthThread waitingThread
 
int * addToRemoteSequenceNumber
 

Detailed Description

Definition at line 213 of file ReductionMgr.h.

Constructor & Destructor Documentation

ReductionSet::ReductionSet ( int  setID,
int  size,
int  numChildren 
)

Definition at line 57 of file ReductionMgr.C.

References addToRemoteSequenceNumber, dataQueue, dataSize, NAMD_bug(), nextSequenceNumber, REDUCTION_MAX_RESERVED, REDUCTIONS_AMD, REDUCTIONS_BASIC, reductionSetID, requireRegistered, submitsRegistered, and threadIsWaiting.

57  {
58  if ( setID == REDUCTIONS_BASIC || setID == REDUCTIONS_AMD ) {
59  if ( size != -1 ) {
60  NAMD_bug("ReductionSet size specified for REDUCTIONS_BASIC or REDUCTIONS_AMD.");
61  }
63  }
64  if ( size == -1 ) NAMD_bug("ReductionSet size not specified.");
65  dataSize = size;
66  reductionSetID = setID;
69  dataQueue = 0;
71  threadIsWaiting = 0;
72  addToRemoteSequenceNumber = new int[numChildren];
73 }
int nextSequenceNumber
Definition: ReductionMgr.h:216
int * addToRemoteSequenceNumber
Definition: ReductionMgr.h:228
void NAMD_bug(const char *err_msg)
Definition: common.C:123
int requireRegistered
Definition: ReductionMgr.h:222
int submitsRegistered
Definition: ReductionMgr.h:217
ReductionSetData * dataQueue
Definition: ReductionMgr.h:219
ReductionSet::~ReductionSet ( )

Definition at line 75 of file ReductionMgr.C.

References addToRemoteSequenceNumber, dataQueue, next(), and ReductionSetData::next.

75  {
76 
77  ReductionSetData *current = dataQueue;
78 
79  while ( current ) {
80  ReductionSetData *next = current->next;
81  delete current;
82  current = next;
83  }
84  delete [] addToRemoteSequenceNumber;
85 }
ReductionSetData * next
Definition: ReductionMgr.h:199
int * addToRemoteSequenceNumber
Definition: ReductionMgr.h:228
static Units next(Units u)
Definition: ParseOptions.C:48
ReductionSetData * dataQueue
Definition: ReductionMgr.h:219

Member Function Documentation

ReductionSetData * ReductionSet::getData ( int  seqNum)

Definition at line 88 of file ReductionMgr.C.

References dataQueue, and dataSize.

Referenced by ReductionMgr::remoteRegister(), ReductionMgr::remoteSubmit(), ReductionMgr::remoteUnregister(), ReductionMgr::willRequire(), and ReductionMgr::willSubmit().

88  {
89 
90  ReductionSetData **current = &dataQueue;
91 
92  while ( *current ) {
93  if ( (*current)->sequenceNumber == seqNum ) return *current;
94  current = &((*current)->next);
95  }
96 
97 //iout << "seq " << seqNum << " created on " << CkMyPe() << "\n" << endi;
98  *current = new ReductionSetData(seqNum, dataSize);
99  return *current;
100 }
ReductionSetData * dataQueue
Definition: ReductionMgr.h:219
ReductionSetData * ReductionSet::removeData ( int  seqNum)

Definition at line 103 of file ReductionMgr.C.

References dataQueue, NAMD_die(), and ReductionSetData::next.

103  {
104 
105  ReductionSetData **current = &dataQueue;
106 
107  while ( *current ) {
108  if ( (*current)->sequenceNumber == seqNum ) break;
109  current = &((*current)->next);
110  }
111 
112  if ( ! *current ) { NAMD_die("ReductionSet::removeData on missing seqNum"); }
113 
114  ReductionSetData *toremove = *current;
115  *current = (*current)->next;
116  return toremove;
117 }
ReductionSetData * next
Definition: ReductionMgr.h:199
void NAMD_die(const char *err_msg)
Definition: common.C:83
ReductionSetData * dataQueue
Definition: ReductionMgr.h:219

Member Data Documentation

int* ReductionSet::addToRemoteSequenceNumber
ReductionSetData* ReductionSet::dataQueue

Definition at line 219 of file ReductionMgr.h.

Referenced by getData(), ReductionSet(), removeData(), and ~ReductionSet().

int ReductionSet::dataSize

Definition at line 218 of file ReductionMgr.h.

Referenced by getData(), ReductionSet(), and ReductionMgr::remoteSubmit().

int ReductionSet::nextSequenceNumber
int ReductionSet::reductionSetID

Definition at line 215 of file ReductionMgr.h.

Referenced by ReductionSet().

int ReductionSet::requireRegistered

Definition at line 222 of file ReductionMgr.h.

Referenced by ReductionSet(), and ReductionMgr::willRequire().

int ReductionSet::submitsRegistered
int ReductionSet::threadIsWaiting

Definition at line 223 of file ReductionMgr.h.

Referenced by ReductionSet().

int ReductionSet::waitingForSequenceNumber

Definition at line 224 of file ReductionMgr.h.

CthThread ReductionSet::waitingThread

Definition at line 225 of file ReductionMgr.h.


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