bool FoF::friendship (const Zbin &zbin, const Galaxy &gal1, const Galaxy &gal2, double rfriend) { //! Function that checks if two galaxies are friends in a given redshift bin. bool final_check; bool check0 = gal1.num != gal2.num; bool check1 = bin_check(zbin, gal2); bool check2 = !gal2.in_cluster[zbin.num]; double dist = astro.angsep(gal1.ra, gal1.dec, gal2.ra, gal2.dec); bool check3 = dist <= rfriend; if (mode == "spec") { bool check4 = fabs(gal1.v - gal2.v) <= (link_z / (1 + gal1.z)); final_check = check0 && check1 && check2 && check3 && check4; } else final_check = check0 && check1 && check2 && check3; return final_check; }
void FoF::friends_of_friends (int bin_num) { //! Funciton that find friends-of-friends in a given redshift bin. cluster_count = -1; Zbin zbin = zbin_list[bin_num]; double rfriend = zbin.rfriend; /**< Loop through galaxies */ for(int i = 0; i < gal_list.size(); i++) { /**< Modify rfriend for spectroscopic mode*/ if (mode == "spec") rfriend = zbin_list[gal_list[i].bin].link_r / gal_list[i].da; /**< Check if galaxy is already in a cluster (f-loop)*/ if(!gal_list[i].in_cluster[zbin.num] && bin_check(zbin, gal_list[i])) { find_friends(zbin, gal_list[i], rfriend); /**< Check if galaxy is now in a cluster (fof-loop)*/ if(gal_list[i].in_cluster[zbin.num]) find_friends_of_friends(zbin, list_of_clusters[cluster_count], rfriend); } } //end of galaxy loop }
void do_break(void) { int i; #ifdef __WIN32__ char *mode; /* enough for storing "window" */ /* check if we're in console mode and, if so, halt immediately if break is called */ mode = erts_read_env("ERL_CONSOLE_MODE"); if (mode && strcmp(mode, "window") != 0) erl_exit(0, ""); erts_free_read_env(mode); #endif /* __WIN32__ */ erts_printf("\n" "BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded\n" " (v)ersion (k)ill (D)b-tables (d)istribution\n"); while (1) { if ((i = sys_get_key(0)) <= 0) erl_exit(0, ""); switch (i) { case 'q': case 'a': case '*': /* * The asterisk is an read error on windows, * where sys_get_key isn't that great in console mode. * The usual reason for a read error is Ctrl-C. Treat this as * 'a' to avoid infinite loop. */ erl_exit(0, ""); case 'A': /* Halt generating crash dump */ erl_exit(1, "Crash dump requested by user"); case 'c': return; case 'p': process_info(ERTS_PRINT_STDOUT, NULL); return; case 'm': return; case 'o': port_info(ERTS_PRINT_STDOUT, NULL); return; case 'i': info(ERTS_PRINT_STDOUT, NULL); return; case 'l': loaded(ERTS_PRINT_STDOUT, NULL); return; case 'v': erts_printf("Erlang (%s) emulator version " ERLANG_VERSION "\n", EMULATOR); erts_printf("Compiled on " ERLANG_COMPILE_DATE "\n"); return; case 'd': distribution_info(ERTS_PRINT_STDOUT, NULL); return; case 'D': db_info(ERTS_PRINT_STDOUT, NULL, 1); return; case 'k': process_killer(); return; #ifdef OPPROF case 'X': dump_frequencies(); return; case 'x': { int i; for (i = 0; i <= HIGHEST_OP; i++) { if (opc[i].name != NULL) { erts_printf("%-16s %8d\n", opc[i].name, opc[i].count); } } } return; case 'z': { int i; for (i = 0; i <= HIGHEST_OP; i++) opc[i].count = 0; } return; #endif #ifdef DEBUG case 't': erts_p_slpq(); return; case 'b': bin_check(); return; case 'C': abort(); #endif case '\n': continue; default: erts_printf("Eh?\n\n"); } } }