void add_results(Group *g,double *beta, double *lambda, double *slope, int *index, int *row){ set<int>::iterator s_it; for(s_it = (g->grps).begin(); s_it!=(g->grps).end(); ++s_it){ beta[*row]=g->beta; lambda[*row]=g->lambda; slope[*row]=g->slope; index[*row]= *s_it+1; // because groups are noted from 0 in method *row+=1; } // if a split has happened we add normally for childup but we don't want to add it again if(g->childup != NullGroup){ if(g->childup->fatherdown != g){ // so we do not pass 2 times at the same point in case of split add_results(g->childup,beta,lambda,slope,index,row); } } if (g->childdown != NullGroup){ add_results(g->childdown,beta,lambda,slope,index,row); } }
void ndfs_reduce (run_t *run, wctx_t *ctx) { if (run->reduced == NULL) { run->reduced = RTmallocZero (sizeof (alg_reduced_t)); } alg_reduced_t *reduced = run->reduced; counter_t *blue = &ctx->local->counters; counter_t *red = &ctx->local->red; work_counter_t *blue_work = ctx->counters; work_counter_t *red_work = &ctx->local->red_work; add_results (&reduced->blue, blue); add_results (&reduced->red, red); work_add_results (&reduced->red_work, red_work); // publish local memory statistics for run class run->total.local_states += blue_work->level_max + red_work->level_max; if (W >= 4 || !log_active(infoLong)) return; // print some local info float runtime = RTrealTime(ctx->timer); Warning (info, "Nested depth-first search worker ran %.3f sec", runtime); work_report ("[Blue]", blue_work); work_report ("[Red ]", red_work); }
// merge results in result list into one void merge_results_by_readgroup( std::vector< std::map<std::string, ScanResults> >& resultlist){ std::vector< std::map<std::string, ScanResults> > mergedresultslist; std::map<std::string, ScanResults> mergedresults; for(size_t i =0; i< resultlist.size(); i++){ auto rmap = resultlist[i]; for(std::map<std::string, ScanResults>::iterator it= rmap.begin(); it != rmap.end(); ++it){ std::string rg = it ->first; ScanResults result = it -> second; if(mergedresults.find(rg) == mergedresults.end()){ mergedresults[rg] = result; }else{ add_results(mergedresults[rg], result); } } } mergedresultslist.push_back(mergedresults); resultlist = mergedresultslist; }
void tg_collect_results(ffsb_tg_t *tg, ffsb_op_results_t *r) { int i; for (i = 0; i < tg_get_numthreads(tg); i++) add_results(r, ft_get_results(tg->threads + i)); }