static void copy_state_nonatomdata(t_state *state, t_state *state_local) { /* When t_state changes, this code should be updated. */ int ngtc, nnhpres; ngtc = state->ngtc * state->nhchainlength; nnhpres = state->nnhpres* state->nhchainlength; scopy_rvecs(box, DIM); scopy_rvecs(box_rel, DIM); scopy_rvecs(boxv, DIM); state_local->veta = state->veta; state_local->vol0 = state->vol0; scopy_rvecs(svir_prev, DIM); scopy_rvecs(fvir_prev, DIM); scopy_rvecs(pres_prev, DIM); scopy_doubles(nosehoover_xi, ngtc); scopy_doubles(nosehoover_vxi, ngtc); scopy_doubles(nhpres_xi, nnhpres); scopy_doubles(nhpres_vxi, nnhpres); scopy_doubles(therm_integral, state->ngtc); scopy_rvecs(x, state->natoms); scopy_rvecs(v, state->natoms); scopy_rvecs(sd_X, state->natoms); copy_ints(&(state->fep_state), &(state_local->fep_state), 1); scopy_reals(lambda, efptNR); }
int main(int len, char *args[]) { if (len <= 1) { printf("No input file\n"); exit(1); } int *all = (int *) malloc(sizeof(int) * LEN); int num = read_ints(all, args[1]); int *all1 = copy_ints(num,all); int *all2 = copy_ints(num,all); long l1 = quick_sort(all,0,num-1,_partition_first); long l2 = quick_sort(all1,0,num-1,_partition_mid); long l3 = quick_sort(all2,0,num-1,_partition_end); printf("%ld,%ld,%ld\n",l1,l2,l3); // int *help = (int *) malloc(sizeof(int) * LEN); // long res = merge_sort_cal_inversions(all, help, 0, num-1); // printf("result : %ld\n", res); free(all); free(all1); free(all2); }