// see this paper: https://arxiv.org/abs/2109.11772 #include "dhrg.h" #include "regular.cpp" #include "gridmapping.cpp" #include "mycell.cpp" #include "segment.cpp" #include "dynamic.cpp" #include "loglik.cpp" #include "paths.cpp" #include "embedder.cpp" #include "tests.cpp" #include "betweenness.cpp" #include "groundtruth.cpp" #include "dhrg-rank.cpp" namespace dhrg { int M; vector vertices; void memoryInfo() { string s = ""; ll totalmemory = 0; for(int it=0; it<2; it++) { auto pct = [&] (auto x, auto y) { if(it == 0) totalmemory += x*y; else s += " " + its(x) + "x" + its(y) + "B=" + its((x*y*100)/totalmemory) + "%"; }; pct(cellcount, sizeof(cell)); pct(heptacount, sizeof(heptagon)); pct(mycellcount, sizeof(mycell)); pct(segmentcount, sizeof(segment)); } println(hlog, "Memory info: ", s, " (", int(totalmemory/1048576), " MB)"); fflush(stdout); } void debugtally() { print(hlog, "T"); for(int i=0; i ts_vertices) { PHASE(3); dhrg_init(); graph_from_rv(); ts_vertices = ts_rbase; } if(!ts_vertices) { printf("Error: read vertices with -dhrg or -graph\n"); exit(1); } shift(); embedder_loop(argi()); next_timestamp++; ts_vertices = next_timestamp; } else if(argis("-dorestart")) { dorestart = true; } else if(argis("-dontrestart")) { dorestart = false; } else if(argis("-lctype")) { shift(); lc_type = args()[0]; } else if(argis("-loadtest")) { dhrg_init(); load_test(); } else if(argis("-buildtest")) { shift(); dhrg_init(); build_all(argi()); } else if(argis("-pbv")) { compute_betweenness(true); } else if(argis("-pb")) { compute_betweenness(false); } else if(argis("-gtt")) { shift(); ground_truth_test(args()); } else if(argis("-el-dhrg")) { PHASE(3); shift(); dhrg_init(); load_embedded(args()); next_timestamp++; ts_rogueviz = next_timestamp; ts_vertices = next_timestamp; } else if(argis("-discrete-rank")) { dhrg_ranks(); } else if(argis("-penalty")) { shift(); penalty = argf(); } else return 1; return 0; } void store_gamedata(struct hr::gamedata* gd) { if(true) { for(auto& t: tally) gd->store(t); for(auto& t: edgetally) gd->store(t); #ifdef BUILD_ON_HR gd->store(mymap); #else gd->store(mroot); #endif } } auto hook = addHook(hooks_args, 50, dhrgArgs) + addHook(hooks_gamedata, 230, store_gamedata) + addHook(hooks_clearmemory, 200, clear); #if CAP_SDL #include "visualize.cpp" #endif } #include "legacy.cpp"