void dsk::work() { std::cout << "======Begin dsk model======" << std::endl; double a = 0, b = 1, r; for(auto i = 0; i < bytes.size(); i++){ generator(a,b,r); r >= p ? bytes.at(i) = 0:1; } bl = makeBlocks(Blocks, BlockSize, bytes); pr = new protocol(bl,code); pr->work(dsk::ProtocolType, dsk::PacketSize); std::stringstream res; for(UINT i = 1; i <= dsk::PacketSize; i+=5){ pr->work(dsk::ProtocolType, i); res << pr->getResults() << "\n"; } saveToFile(res.str()); dsk::plot = pr->getPlot(); dsk::delProbPlot = pr->getDelProbPlot(); std::cout << "======End dsk model======" << std::endl; std::stringstream bits; for(auto value : bytes){ bits << value << " "; } std::string bitsName = "ErrorsStreamDSK.txt"; std::ofstream f; f.open(bitsName); f.write(bits.str().c_str(), sizeof(char)*bits.str().size()); f.close(); }
void Chunk::makeBlocks(Block ***b, int shape) { int ids[] = {0, 1, 2, 3}; makeBlocks(b, shape, ids); }
void Chunk::makeBlocks(Block ***b) { int ids[] = {0, 1, 2, 3}; makeBlocks(b, rand() % kShape_last, ids); }
BlockBuilder::BlockBuilder(const Ids& ids, Edges&& edges, Nodes& historynodes) : GraphBuilder(ids, std::move(edges)), m_historyNodes(historynodes), m_blocks() { makeBlocks(); }