00001 #ifndef DATA_ITEM_TYPES_H 00002 #define DATA_ITEM_TYPES_H 00003 00004 #define CHUNK_SIZE 256 00005 00006 template<class dtype, class itype> 00007 class ArrayDataItem { 00008 00009 public: 00010 itype arrayIndex; 00011 int sourcePe; 00012 dtype dataItem; 00013 00014 ArrayDataItem(){} 00015 00016 ArrayDataItem(itype i, int srcPe, const dtype d) 00017 : arrayIndex(i), sourcePe(srcPe), dataItem(d) {} 00018 00019 void pup(PUP::er &p) { 00020 p|arrayIndex; 00021 p|sourcePe; 00022 p|dataItem; 00023 } 00024 }; 00025 00026 class ChunkDataItem { 00027 00028 public: 00029 short chunkSize; 00030 int bufferNumber; 00031 int sourcePe; 00032 int chunkNumber; 00033 int numChunks; 00034 int numItems; 00035 char rawData[CHUNK_SIZE]; 00036 00037 ChunkDataItem& operator=(const ChunkDataItem &rhs) { 00038 00039 if (this != &rhs) { 00040 chunkSize = rhs.chunkSize; 00041 bufferNumber = rhs.bufferNumber; 00042 sourcePe = rhs.sourcePe; 00043 chunkNumber = rhs.chunkNumber; 00044 numChunks = rhs.numChunks; 00045 numItems = rhs.numItems; 00046 memcpy(rawData, rhs.rawData, CHUNK_SIZE); 00047 } 00048 00049 return *this; 00050 } 00051 00052 }; 00053 00054 template <class dtype, class ClientType> 00055 inline int defaultMeshStreamerDeliver(char *data, void *clientObj_) 00056 { 00057 ((ClientType *) clientObj_)->process(*((dtype *) data)); 00058 return 0; 00059 } 00060 00061 #endif