changa  3.5
 All Classes Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
CacheInterface.h
Go to the documentation of this file.
1 #ifndef __CACHEINTERFACE_H__
2 #define __CACHEINTERFACE_H__
3 
10 #include <CkCache.h>
11 #include "config.h"
12 #include "gravity.h"
13 #include "GenericTreeNode.h"
14 #include "keytype.h"
15 
16 /*********************************************************
17  * Gravity interface: Particles
18  *********************************************************/
19 
22 public:
24  CkCacheFillMsg<KeyType> *msg;
26  int begin;
28  int end;
33 };
34 
37 class EntryTypeGravityParticle : public CkCacheEntryType<KeyType> {
38 public:
41  void * request(CkArrayIndexMax&, KeyType);
43  void * unpack(CkCacheFillMsg<KeyType> *, int, CkArrayIndexMax &);
45  void writeback(CkArrayIndexMax&, KeyType, void *);
47  void free(void *);
49  int size(void *);
50 
52  static void callback(CkArrayID, CkArrayIndexMax&, KeyType, CkCacheUserData &, void*, int);
53 };
54 
55 /*********************************************************
56  * Smooth interface: Particles
57  *********************************************************/
58 
61 public:
62  int begin;
63  int end;
64  int nActual;
65  KeyType key;
69 };
70 
73 class EntryTypeSmoothParticle : public CkCacheEntryType<KeyType> {
74  // N.B. can't have helpful attributes because of the static function.
75 public:
78  void * request(CkArrayIndexMax&, KeyType);
80  void * unpack(CkCacheFillMsg<KeyType> *, int, CkArrayIndexMax &);
81  void writeback(CkArrayIndexMax&, KeyType, void *);
83  void free(void *);
85  int size(void *);
86 
88  static void callback(CkArrayID, CkArrayIndexMax&, KeyType, CkCacheUserData &, void*, int);
89 };
90 
91 /*********************************************************
92  * Gravity interface: Nodes
93  *********************************************************/
94 
96 class EntryTypeGravityNode : public CkCacheEntryType<KeyType> {
97  void *vptr; // For saving a copy of the virtual function table.
98  // It's use will be compiler dependent.
99  void unpackSingle(CkCacheFillMsg<KeyType> *, Tree::BinaryTreeNode *, int, CkArrayIndexMax &, bool);
100 public:
102  void * request(CkArrayIndexMax&, KeyType);
103  void * unpack(CkCacheFillMsg<KeyType> *, int, CkArrayIndexMax &);
104  void writeback(CkArrayIndexMax&, KeyType, void *);
105  void free(void *);
106  int size(void *);
107 
108  static void callback(CkArrayID, CkArrayIndexMax&, KeyType, CkCacheUserData &, void*, int);
109 };
110 
111 #endif
112 
113 
Class for cross processor data needed for smooth operations.
Definition: GravityParticle.h:568
Cache interface to the particles for smooth calculations. This cache is a writeback cache...
Definition: CacheInterface.h:73
The data in a GravityParticle cache entry.
Definition: CacheInterface.h:21
void writeback(CkArrayIndexMax &, KeyType, void *)
Send the message back to the original TreePiece.
Definition: CacheInterface.cpp:145
KeyType key
Key of this bucket (for writeback)
Definition: CacheInterface.h:65
static void callback(CkArrayID, CkArrayIndexMax &, KeyType, CkCacheUserData &, void *, int)
callback to TreePiece after data is received.
Definition: CacheInterface.cpp:61
static void callback(CkArrayID, CkArrayIndexMax &, KeyType, CkCacheUserData &, void *, int)
callback to TreePiece after data is received.
Definition: CacheInterface.cpp:182
int end
Index of the last particle in the home processor&#39;s myParticles array.
Definition: CacheInterface.h:28
int begin
Index of the first particle in the home processor&#39;s myParticles array.
Definition: CacheInterface.h:26
Cache interface to particles for the gravity calculation. This is a read-only cache of particles...
Definition: CacheInterface.h:37
GravityParticle * partCached
particle data
Definition: CacheInterface.h:66
void * unpack(CkCacheFillMsg< KeyType > *, int, CkArrayIndexMax &)
Return data from fufilled cache request.
Definition: CacheInterface.cpp:37
void free(void *)
free cached data.
Definition: CacheInterface.cpp:45
int size(void *)
return size of cached data.
Definition: CacheInterface.cpp:176
ExternalSmoothParticle partExt[1]
particle data in the message
Definition: CacheInterface.h:68
Extra data needed for SPH.
Definition: GravityParticle.h:50
int size(void *)
return size of cached data.
Definition: CacheInterface.cpp:49
void * request(CkArrayIndexMax &, KeyType)
Request a bucket of particles from a TreePiece.
Definition: CacheInterface.cpp:23
Information needed to calculate gravity.
Definition: GravityParticle.h:33
int end
ending Particle number
Definition: CacheInterface.h:63
int begin
Beginning particle number.
Definition: CacheInterface.h:62
void writeback(CkArrayIndexMax &, KeyType, void *)
Do nothing: this is a read-only cache.
Definition: CacheInterface.cpp:43
void * unpack(CkCacheFillMsg< KeyType > *, int, CkArrayIndexMax &)
Return data from fufilled cache request.
Definition: CacheInterface.cpp:108
Cache interface to the Tree Nodes.
Definition: CacheInterface.h:96
CkCacheFillMsg< KeyType > * msg
Message containing the data for this entry.
Definition: CacheInterface.h:24
Fundamental type for a particle.
Definition: GravityParticle.h:316
extraSPHData * extraSPHCached
particle extraData
Definition: CacheInterface.h:67
particle data in the smooth particle cache messages
Definition: CacheInterface.h:60
void * request(CkArrayIndexMax &, KeyType)
Request a bucket of particles from a TreePiece.
Definition: CacheInterface.cpp:100
A TreeNode with two children.
Definition: GenericTreeNode.h:347
int nActual
actual number of particles sent
Definition: CacheInterface.h:64
ExternalGravityParticle part[1]
Definition: CacheInterface.h:32
void free(void *)
free cached data.
Definition: CacheInterface.cpp:169