CollectionMgr Class Reference

#include <CollectionMgr.h>

List of all members.

Public Member Functions

 CollectionMgr (SlaveInitMsg *msg)
 ~CollectionMgr (void)
void submitPositions (int seq, FullAtomList &a, Lattice l, int prec)
void submitVelocities (int seq, int zero, FullAtomList &a)
void submitForces (int seq, FullAtomList &a, int maxForceUsed, ForceList *f)
void sendDataStream (const char *)
CkChareID getMasterChareID ()

Static Public Member Functions

static CollectionMgrObject ()

Classes

class  CollectVectorInstance
class  CollectVectorSequence


Detailed Description

Definition at line 26 of file CollectionMgr.h.


Constructor & Destructor Documentation

CollectionMgr::CollectionMgr ( SlaveInitMsg msg  ) 

Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000 by The Board of Trustees of the University of Illinois. All rights reserved.

Definition at line 20 of file CollectionMgr.C.

References DebugM.

00020                                               : master(msg->master)
00021 {
00022   delete msg;
00023   if (CkpvAccess(CollectionMgr_instance) == 0) {
00024     CkpvAccess(CollectionMgr_instance) = this;
00025   } else {
00026     DebugM(1, "CollectionMgr::CollectionMgr() - another instance of CollectionMgr exists!\n");
00027   }
00028 }

CollectionMgr::~CollectionMgr ( void   ) 

Definition at line 31 of file CollectionMgr.C.

00032 {
00033 }


Member Function Documentation

CkChareID CollectionMgr::getMasterChareID (  )  [inline]

Definition at line 41 of file CollectionMgr.h.

Referenced by ParallelIOMgr::initialize().

00041 { return master; }  

static CollectionMgr* CollectionMgr::Object (  )  [inline, static]

Definition at line 30 of file CollectionMgr.h.

Referenced by ComputeStir::doForce(), datastream::endd(), and ParallelIOMgr::initialize().

00030                                  { 
00031     return CkpvAccess(CollectionMgr_instance); 
00032   }

void CollectionMgr::sendDataStream ( const char *   ) 

Definition at line 308 of file CollectionMgr.C.

References ResizeArray< Elem >::begin(), DataStreamMsg::data, and ResizeArray< Elem >::resize().

Referenced by ComputeStir::doForce(), and datastream::endd().

00308                                                    {
00309   DataStreamMsg *msg = new DataStreamMsg;
00310   msg->data.resize(strlen(data)+1);
00311   strcpy(msg->data.begin(),data);
00312   CProxy_CollectionMaster cm(master);
00313   cm.receiveDataStream(msg);
00314 }

void CollectionMgr::submitForces ( int  seq,
FullAtomList a,
int  maxForceUsed,
ForceList f 
)

Definition at line 269 of file CollectionMgr.C.

References f, and ResizeArray< Elem >::size().

Referenced by Sequencer::submitCollections().

00270 {
00271   int numAtoms = a.size();
00272   AtomIDList aid(numAtoms);
00273   ForceList d(numAtoms);
00274   for ( int i=0; i<numAtoms; ++i ) {
00275     aid[i] = a[i].id;
00276     d[i] = 0.;
00277   }
00278   for ( int j=0; j<=maxForceUsed; ++j ) {
00279     Force *fptr = f[j].begin();
00280     for ( int i=0; i<numAtoms; ++i ) {
00281       d[i] += fptr[i];
00282     }
00283   }
00284   if ( Node::Object()->simParameters->fixedAtomsOn && !Node::Object()->simParameters->fixedAtomsForceOutput) {
00285     for ( int i=0; i<numAtoms; ++i ) {
00286       if ( a[i].atomFixed ) d[i] = 0.;
00287     }
00288   }
00289   CollectVectorInstance *c;
00290   if ( ( c = forces.submitData(seq,aid,d) ) )
00291   {
00292     int aid_size = c->aid.size();
00293     int data_size = c->data.size();
00294     CollectVectorMsg *msg = new (aid_size, data_size, 0, 0) CollectVectorMsg;
00295     msg->seq = c->seq;
00296     msg->aid_size = aid_size;
00297     msg->data_size = data_size;
00298     msg->fdata_size = 0;
00299     memcpy(msg->aid,c->aid.begin(),aid_size*sizeof(AtomID));
00300     memcpy(msg->data,c->data.begin(),data_size*sizeof(Vector));
00301     CProxy_CollectionMaster cm(master);
00302     cm.receiveForces(msg);
00303     c->free();
00304   }
00305 }

void CollectionMgr::submitPositions ( int  seq,
FullAtomList a,
Lattice  l,
int  prec 
)

Definition at line 210 of file CollectionMgr.C.

References CollectVectorMsg::aid, CollectionMgr::CollectVectorInstance::aid, CollectVectorMsg::aid_size, ResizeArray< Elem >::begin(), CollectVectorMsg::data, CollectionMgr::CollectVectorInstance::data, CollectVectorMsg::data_size, CollectVectorMsg::fdata, CollectionMgr::CollectVectorInstance::fdata, CollectVectorMsg::fdata_size, CollectionMgr::CollectVectorInstance::free(), Lattice::reverse_transform(), CollectionMgr::CollectVectorInstance::seq, CollectVectorMsg::seq, ResizeArray< Elem >::size(), and CollectionMgr::CollectVectorSequence::submitData().

Referenced by Sequencer::submitCollections().

00212 {  
00213   int numAtoms = a.size();
00214   AtomIDList aid(numAtoms);
00215   PositionList d(numAtoms);
00216   for ( int i=0; i<numAtoms; ++i ) {
00217     aid[i] = a[i].id;
00218     d[i] = l.reverse_transform(a[i].position,a[i].transform);
00219   }
00220   CollectVectorInstance *c;
00221   if ( ( c = positions.submitData(seq,aid,d,prec) ) )
00222   {
00223     int aid_size = c->aid.size();
00224     int data_size = c->data.size();
00225     int fdata_size = c->fdata.size();
00226     CollectVectorMsg *msg
00227       = new (aid_size, data_size, fdata_size,0) CollectVectorMsg;
00228     msg->seq = c->seq;
00229     msg->aid_size = aid_size;
00230     msg->data_size = data_size;
00231     msg->fdata_size = fdata_size;
00232     memcpy(msg->aid,c->aid.begin(),aid_size*sizeof(AtomID));
00233     memcpy(msg->data,c->data.begin(),data_size*sizeof(Vector));
00234     memcpy(msg->fdata,c->fdata.begin(),fdata_size*sizeof(FloatVector));
00235     CProxy_CollectionMaster cm(master);
00236     cm.receivePositions(msg);
00237     c->free();
00238   }
00239 }

void CollectionMgr::submitVelocities ( int  seq,
int  zero,
FullAtomList a 
)

Definition at line 241 of file CollectionMgr.C.

References CollectVectorMsg::aid, CollectionMgr::CollectVectorInstance::aid, CollectVectorMsg::aid_size, ResizeArray< Elem >::begin(), CollectVectorMsg::data, CollectionMgr::CollectVectorInstance::data, CollectVectorMsg::data_size, CollectVectorMsg::fdata_size, CollectionMgr::CollectVectorInstance::free(), CollectionMgr::CollectVectorInstance::seq, CollectVectorMsg::seq, ResizeArray< Elem >::size(), and CollectionMgr::CollectVectorSequence::submitData().

Referenced by Sequencer::submitCollections().

00242 {
00243   int numAtoms = a.size();
00244   AtomIDList aid(numAtoms);
00245   PositionList d(numAtoms);
00246   for ( int i=0; i<numAtoms; ++i ) {
00247     aid[i] = a[i].id;
00248     if ( zero ) d[i] = 0.;
00249     else d[i] = a[i].velocity;
00250   }
00251   CollectVectorInstance *c;
00252   if ( ( c = velocities.submitData(seq,aid,d) ) )
00253   {
00254     int aid_size = c->aid.size();
00255     int data_size = c->data.size();
00256     CollectVectorMsg *msg = new (aid_size, data_size, 0, 0) CollectVectorMsg;
00257     msg->seq = c->seq;
00258     msg->aid_size = aid_size;
00259     msg->data_size = data_size;
00260     msg->fdata_size = 0;
00261     memcpy(msg->aid,c->aid.begin(),aid_size*sizeof(AtomID));
00262     memcpy(msg->data,c->data.begin(),data_size*sizeof(Vector));
00263     CProxy_CollectionMaster cm(master);
00264     cm.receiveVelocities(msg);
00265     c->free();
00266   }
00267 }


The documentation for this class was generated from the following files:
Generated on Wed Nov 22 01:17:19 2017 for NAMD by  doxygen 1.4.7