changa 3.5
Loading...
Searching...
No Matches
CacheInterface.h
Go to the documentation of this file.
1#ifndef __CACHEINTERFACE_H__
2#define __CACHEINTERFACE_H__
3
9
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
22public:
24 CkCacheFillMsg<KeyType> *msg;
26 int begin;
28 int end;
33};
34
37class EntryTypeGravityParticle : public CkCacheEntryType<KeyType> {
38public:
39 EntryTypeGravityParticle();
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
70
73class EntryTypeSmoothParticle : public CkCacheEntryType<KeyType> {
74 // N.B. can't have helpful attributes because of the static function.
75public:
76 EntryTypeSmoothParticle();
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
96class 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);
100public:
101 EntryTypeGravityNode();
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
The data in a GravityParticle cache entry.
Definition CacheInterface.h:21
ExternalGravityParticle part[1]
Definition CacheInterface.h:32
int begin
Index of the first particle in the home processor's myParticles array.
Definition CacheInterface.h:26
CkCacheFillMsg< KeyType > * msg
Message containing the data for this entry.
Definition CacheInterface.h:24
int end
Index of the last particle in the home processor's myParticles array.
Definition CacheInterface.h:28
particle data in the smooth particle cache messages
Definition CacheInterface.h:60
int nActual
actual number of particles sent
Definition CacheInterface.h:64
KeyType key
Key of this bucket (for writeback)
Definition CacheInterface.h:65
GravityParticle * partCached
particle data
Definition CacheInterface.h:66
int begin
Beginning particle number.
Definition CacheInterface.h:62
extraSPHData * extraSPHCached
particle extraData
Definition CacheInterface.h:67
int end
ending Particle number
Definition CacheInterface.h:63
ExternalSmoothParticle partExt[1]
particle data in the message
Definition CacheInterface.h:68
void free(void *)
free cached data.
Definition CacheInterface.cpp:45
void * request(CkArrayIndexMax &, KeyType)
Request a bucket of particles from a TreePiece.
Definition CacheInterface.cpp:23
void writeback(CkArrayIndexMax &, KeyType, void *)
Do nothing: this is a read-only cache.
Definition CacheInterface.cpp:43
int size(void *)
return size of cached data.
Definition CacheInterface.cpp:49
void * unpack(CkCacheFillMsg< KeyType > *, int, CkArrayIndexMax &)
Return data from fufilled cache request.
Definition CacheInterface.cpp:37
static void callback(CkArrayID, CkArrayIndexMax &, KeyType, CkCacheUserData &, void *, int)
callback to TreePiece after data is received.
Definition CacheInterface.cpp:61
int size(void *)
return size of cached data.
Definition CacheInterface.cpp:176
void writeback(CkArrayIndexMax &, KeyType, void *)
Send the message back to the original TreePiece.
Definition CacheInterface.cpp:145
void * unpack(CkCacheFillMsg< KeyType > *, int, CkArrayIndexMax &)
Return data from fufilled cache request.
Definition CacheInterface.cpp:108
void * request(CkArrayIndexMax &, KeyType)
Request a bucket of particles from a TreePiece.
Definition CacheInterface.cpp:100
void free(void *)
free cached data.
Definition CacheInterface.cpp:169
static void callback(CkArrayID, CkArrayIndexMax &, KeyType, CkCacheUserData &, void *, int)
callback to TreePiece after data is received.
Definition CacheInterface.cpp:182
Information needed to calculate gravity.
Definition GravityParticle.h:33
Class for cross processor data needed for smooth operations.
Definition GravityParticle.h:649
Fundamental type for a particle.
Definition GravityParticle.h:364
A TreeNode with two children.
Definition GenericTreeNode.h:355
Extra data needed for SPH.
Definition GravityParticle.h:51