X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/5d4e709cb8d460b2efc083e6e7999f1c3a0eb602..7af5c69c22148510cf8f042552018c9b966860cd:/Graph.cpp?ds=sidebyside diff --git a/Graph.cpp b/Graph.cpp index d3fd276..999e72a 100644 --- a/Graph.cpp +++ b/Graph.cpp @@ -141,3 +141,34 @@ void Graph::resetPatternComputed() { } } } + +bool Graph::computeOutputPatterns(int nbExec) { + + createPatterns(); + resetPatternComputed(); + // search for all block that are generators. + QList generators; + generators.append(sources); + foreach(AbstractBlock* block, groups) { + GroupBlock* group = AB_TO_GRP(block); + foreach(AbstractBlock* inBlock, group->getBlocks()) { + FunctionalBlock* funBlock = AB_TO_FUN(inBlock); + if ((inBlock->isFunctionalBlock()) && (inBlock->isGeneratorBlock())) { + generators.append(funBlock); + } + } + } + // search for maximum delta + int maxDelta = 0; + foreach(FunctionalBlock* block, generators) { + if (block->getDelta() > maxDelta) maxDelta = block->getDelta(); + } + // compute output for generators + int maxExecLen = maxDelta*nbExec; + foreach(FunctionalBlock* block, generators) { + int d = block->getDelta(); + block->computeOutputPattern((maxExecLen+d-1)/d); + } + // compute output for top group + topGroup->computeOutputPattern(); +}