OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
PtclAttribDataSource.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef PARTICLE_ATTRIB_DATA_SOURCE_H
12 #define PARTICLE_ATTRIB_DATA_SOURCE_H
13 
14 /***********************************************************************
15  *
16  * class ParticleAttribDataSource
17  *
18  * ParticleAttribDataSource is a base class for classes which
19  * provides functionality needed to have the attributes check to see if
20  * their associated IpplParticleBase has been previously connected, and if so,
21  * to add this object to the list of connected attributes for that
22  * IpplParticleBase. This also provides virtual functions for transmitting
23  * and receiving attribute data from other nodes.
24  *
25  ***********************************************************************/
26 
27 // include files
29 #include "Message/Message.h"
30 
31 
32 // forward declarations
34 class ParticleAttribBase;
35 class DataSource;
36 
37 
39 
40 public:
41  // constructor: the name, the connection, the transfer method, the attrib
42  ParticleAttribDataSource(const char *, DataConnect *, int,
44 
45  // destructor
46  virtual ~ParticleAttribDataSource();
47 
48  // tell this attribute we're disconnecting it
49  void setDisconnected() { PBase = 0; }
50 
51  //
52  // ParticleAttribDataSource virtual functions
53  //
54 
55  // retrieve the agency-specific data structure
56  virtual void *getConnectStorage() { return 0; }
57 
58  // copy attrib data on the local processor into the given Message.
59  virtual void putMessage(Message *) = 0;
60 
61  // prepare the agency-specific data structures for update; this may
62  // require reallocation of storage memory, etc.
63  // Argument = are we at the start (true) or end (false) of the data update;
64  // # of particles to prepare for.
65  virtual void prepare_data(bool, unsigned) = 0;
66 
67  // take data for N particles out of the given message, and put it
68  // into the proper agency-specific structure.
69  // If the Message pointer is 0, put in the locally-stored particles.
70  // Arguments: num particles,
71  // starting index for inserted particles, Message containing
72  // particles
73  virtual void insert_data(unsigned, unsigned, Message *) = 0;
74 
75 protected:
76  // container holding our particle base ... used for disconnection
78 };
79 
80 
81 #endif // PARTICLE_ATTRIB_DATA_SOURCE_H
82 
83 /***************************************************************************
84  * $RCSfile: PtclAttribDataSource.h,v $ $Author: adelmann $
85  * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:25 $
86  * IPPL_VERSION_ID: $Id: PtclAttribDataSource.h,v 1.1.1.1 2003/01/23 07:40:25 adelmann Exp $
87  ***************************************************************************/
ParticleAttribDataSource(const char *, DataConnect *, int, ParticleAttribBase *, DataSource *)
virtual void * getConnectStorage()
virtual void prepare_data(bool, unsigned)=0
virtual void putMessage(Message *)=0
virtual void insert_data(unsigned, unsigned, Message *)=0
IpplParticleBaseDataSource * PBase