Exemplo n.º 1
0
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();
}
Exemplo n.º 2
0
void Chunk::makeBlocks(Block ***b, int shape)
{
    int ids[] = {0, 1, 2, 3};
    makeBlocks(b, shape, ids);
}
Exemplo n.º 3
0
void Chunk::makeBlocks(Block ***b)
{
    int ids[] = {0, 1, 2, 3};
    makeBlocks(b, rand() % kShape_last, ids);
}
Exemplo n.º 4
0
BlockBuilder::BlockBuilder(const Ids& ids, Edges&& edges, Nodes& historynodes)
    : GraphBuilder(ids, std::move(edges)), m_historyNodes(historynodes), m_blocks() {
  makeBlocks();
}