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
00035 class liveVizRequestMsg : public CMessage_liveVizRequestMsg {
00036 public:
00037 liveVizRequest req;
00038
00041 char *data;
00042 int dataLen;
00043
00044 liveVizRequestMsg() {}
00045 static liveVizRequestMsg *buildNew(const liveVizRequest &req,const void *data,int dataLen);
00046 };
00047
00050 template<class T>
00051 inline void liveVizRequestUnpack(const liveVizRequestMsg *src,T &dest)
00052 {
00053 PUP_toNetwork_unpack p(src->data);
00054 p|dest;
00055 if (p.size()!=src->dataLen) {
00056 CkError("liveVizRequestUnpack: client sent %d bytes, but you wanted %d bytes!\n",
00057 src->dataLen, p.size());
00058 CkAbort("liveVizRequestUnpack size mismatch\n");
00059 }
00060 }
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 void liveVizDeposit(const liveVizRequest &req,
00071 int startx, int starty,
00072 int sizex, int sizey, const byte * imageData,
00073 ArrayElement* client,
00074 liveVizCombine_t combine=sum_image_data);
00075
00076
00077
00078 inline void liveVizDeposit(liveVizRequestMsg *reqMsg,
00079 int startx, int starty,
00080 int sizex, int sizey, const byte * imageData,
00081 ArrayElement* client,
00082 liveVizCombine_t combine=sum_image_data)
00083 {
00084 liveVizDeposit(reqMsg->req,startx,starty,sizex,sizey,imageData,client,
00085 combine);
00086 delete reqMsg;
00087 }
00088
00096 extern "C"
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
00139
00140 #endif