diff --git a/phigrape.cpp b/phigrape.cpp index 70804df..a919f70 100644 --- a/phigrape.cpp +++ b/phigrape.cpp @@ -145,6 +145,8 @@ Last redaction : 2019.04.16 12:55 #include #include +#include + /* double aaa; double aaapars[5]; @@ -158,12 +160,12 @@ extern void qwerty_(double *aaa, double *aaapars); #include /* Some "good" functions and constants... */ -#define SIG(x) ( ((x)<0) ? (-1):(1) ) -#define ABS(x) ( ((x)<0) ? (-x):(x) ) -#define MAX(a,b) ( ((a)>(b)) ? (a):(b) ) -#define MIN(a,b) ( ((a)<(b)) ? (a):(b) ) -#define SQR(x) ( (x)*(x) ) -#define POW3(x) ( (x)*SQR(x) ) +#define SIG(x) (((x)<0) ? (-1):(1) ) +#define ABS(x) (((x)<0) ? (-x):(x) ) +#define MAX(a,b) (((a)>(b)) ? (a):(b) ) +#define MIN(a,b) (((a)<(b)) ? (a):(b) ) +#define SQR(x) ((x)*(x) ) +#define POW3(x) ((x)*SQR(x) ) #define Pi 3.14159265358979323846 #define TWOPi 6.283185307179 @@ -477,7 +479,7 @@ return - 0 if everything OK double my_rand(void) { -return( (double)(rand()/(double)RAND_MAX) ); +return((double)(rand()/(double)RAND_MAX) ); } double my_rand2(void) @@ -952,101 +954,6 @@ fclose(out); #endif - - - -void calc_self_grav_zero() -{ - -/* calc the grav for the active particles */ - -g6_set_ti(clusterid, time_cur); - -ni = n_act; - -/* define the local phi, a, adot for these active particles */ - -for (i=0; i 100.0) jerk_i[ii][0] = 100.0; - if (ABS(jerk_i[ii][1]) > 100.0) jerk_i[ii][1] = 100.0; - if (ABS(jerk_i[ii][2]) > 100.0) jerk_i[ii][2] = 100.0; - } - - g6calc_firsthalf(clusterid, n_loc, nn, index_i, x_i, v_i , a_i, jerk_i, p_i, eps2, h2_i); - g6calc_lasthalf(clusterid, n_loc, nn, index_i, x_i, v_i, eps2, h2_i, a_i, jerk_i, p_i); - - for (ii=0; ii dt_min) ) { + if ((dt_new < dt_tmp) && (dt_new > dt_min)) { power = log(dt_new)/log(2.0) - 1; dt_tmp = pow(2.0, (double)power); @@ -2965,9 +2854,9 @@ int main(int argc, char *argv[]) iii = ind_act[i]; - if ( (tmp_r2 < SEMI_a2*R_INF2) ) { + if (tmp_r2 < SEMI_a2*R_INF2) { - if ( (inf_event[iii] == 0) ) { + if (inf_event[iii] == 0) { fprintf(out,"INF1 %.6E %.16E %07d %07d %.6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E \n", Timesteps, time_cur, i, ind_act[i], @@ -2982,7 +2871,7 @@ int main(int argc, char *argv[]) } } else { - if ( (inf_event[iii] == 1) ) { + if (inf_event[iii] == 1) { fprintf(out,"INF2 %.6E %.16E %07d %07d %.6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E %.6E % .6E % .6E % .6E % .6E % .6E % .6E % .6E %.6E \n", Timesteps, time_cur, i, ind_act[i], sqrt(DR2), x_bbhc[0], x_bbhc[1], x_bbhc[2], v_bbhc[0], v_bbhc[1], v_bbhc[2],