00001
00002
00003
00004
00005
00006 #ifndef __UIUC_CHARM_LIVEVIZ_H
00007 #define __UIUC_CHARM_LIVEVIZ_H
00008
00009 #include "liveViz0.h"
00010 #include "ckimage.h"
00011 #include "colorScale.h"
00012 #include "pup_toNetwork.h"
00013
00014
00015 #include "liveViz.decl.h"
00016
00017 typedef enum {
00018 sum_image_data,
00019 max_image_data,
00020 sum_float_image_data,
00021 max_float_image_data
00022 } liveVizCombine_t;
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 void liveVizInit(const liveVizConfig &cfg, CkArrayID a, CkCallback c);
00034 void liveVizInit(const liveVizConfig &cfg, CkArrayID a, CkCallback c, CkArrayOptions &opts);
00035
00036 class liveVizRequestMsg : public CMessage_liveVizRequestMsg {
00037 public:
00038 liveVizRequest req;
00039
00042 char *data;
00043 int dataLen;
00044
00045 liveVizRequestMsg() {}
00046 static liveVizRequestMsg *buildNew(const liveVizRequest &req,const void *data,int dataLen);
00047 };
00048
00051 template<class T>
00052 inline void liveVizRequestUnpack(const liveVizRequestMsg *src,T &dest)
00053 {
00054 PUP_toNetwork_unpack p(src->data);
00055 p|dest;
00056 if (p.size()!=src->dataLen) {
00057 CkError("liveVizRequestUnpack: client sent %d bytes, but you wanted %d bytes!\n",
00058 src->dataLen, p.size());
00059 CkAbort("liveVizRequestUnpack size mismatch\n");
00060 }
00061 }
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 void liveVizDeposit(const liveVizRequest &req,
00072 int startx, int starty,
00073 int sizex, int sizey, const byte * imageData,
00074 ArrayElement* client,
00075 liveVizCombine_t combine=sum_image_data);
00076
00077
00078
00079 inline void liveVizDeposit(liveVizRequestMsg *reqMsg,
00080 int startx, int starty,
00081 int sizex, int sizey, const byte * imageData,
00082 ArrayElement* client,
00083 liveVizCombine_t combine=sum_image_data)
00084 {
00085 liveVizDeposit(reqMsg->req,startx,starty,sizex,sizey,imageData,client,
00086 combine);
00087 delete reqMsg;
00088 }
00089
00097 void liveVizFloatToRGB(liveVizRequest &req,
00098 const float *floatSrc, unsigned char *destRgb,
00099 int nPixels);
00100
00101
00102
00103
00104 #include "liveVizPoll.decl.h"
00105
00106
00107
00113 void liveVizPollInit();
00114
00115
00116 typedef liveVizRequestMsg liveVizPollRequestMsg;
00117
00118
00128 void liveVizPollDeposit(ArrayElement *from,
00129 int startx, int starty,
00130 int sizex, int sizey,
00131 int imagewidth, int imageheight,
00132 const byte * imageData,
00133 liveVizCombine_t _image_combine_reducer=sum_image_data,
00134 int bytes_per_pixel=3
00135 );
00136
00137
00138 class LiveVizBoundElement : public CBase_LiveVizBoundElement {
00139 public:
00140 LiveVizBoundElement(){}
00141 LiveVizBoundElement(CkMigrateMessage *msg): CBase_LiveVizBoundElement(msg){}
00142 ~LiveVizBoundElement(){}
00143
00144 void deposit(CkReductionMsg *msg){
00145 contribute(msg);
00146 }
00147 };
00148
00149
00150
00151 #endif