-
Notifications
You must be signed in to change notification settings - Fork 28
/
DumpFrameData.h
37 lines (32 loc) · 1.04 KB
/
DumpFrameData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef DUMP_FRAME_DATA_H
#define DUMP_FRAME_DATA_H
#include "ParallelGravity.h"
#include "Reductions.h"
/// @brief Group to hold the frame buffer memory.
class DumpFrameData : public CBase_DumpFrameData
{
void *bufImage;
int nImage;
public:
void *Image;
DumpFrameData() { bufImage = NULL; }
DumpFrameData(CkMigrateMessage *m) : CBase_DumpFrameData(m) { bufImage = NULL;}
void pup(PUP::er &p) { CBase_DumpFrameData::pup(p); }
~DumpFrameData() { if(bufImage) free(bufImage); }
/// @brief
void clearFrame(InDumpFrame in, const CkCallback& cb) {
if(bufImage == NULL)
bufImage = malloc(sizeof(in) + in.nxPix*in.nyPix*sizeof(DFIMAGE));
Image = ((char *)bufImage) + sizeof(in);
*((struct inDumpFrame *)bufImage) = in; //start of reduction
//message is the parameters
dfClearImage( &in, Image, &nImage);
contribute(cb);
}
void combineFrame(InDumpFrame in, const CkCallback& cb) {
contribute(sizeof(in) + nImage, bufImage, dfImageReduction, cb);
free(bufImage);
bufImage = NULL;
}
};
#endif