int lbboundary_get_force(int no, double* f) { #if defined (LB_BOUNDARIES) || defined (LB_BOUNDARIES_GPU) double* forces = (double *) Utils::malloc(3*n_lb_boundaries*sizeof(double)); if (lattice_switch & LATTICE_LB_GPU) { #if defined (LB_BOUNDARIES_GPU) && defined (LB_GPU) lb_gpu_get_boundary_forces(forces); f[0]=-forces[3*no+0]; f[1]=-forces[3*no+1]; f[2]=-forces[3*no+2]; #else return ES_ERROR; #endif } else { #if defined (LB_BOUNDARIES) && defined (LB) mpi_gather_stats(8, forces, NULL, NULL, NULL); f[0]=forces[3*no+0]*lbpar.agrid/lbpar.tau/lbpar.tau; f[1]=forces[3*no+1]*lbpar.agrid/lbpar.tau/lbpar.tau; f[2]=forces[3*no+2]*lbpar.agrid/lbpar.tau/lbpar.tau; #else return ES_ERROR; #endif } free(forces); #endif return 0; }
int lbboundary_get_force(int no, double* f) { #if defined (LB_BOUNDARIES) || defined (LB_BOUNDARIES_GPU) double* forces=malloc(3*n_lb_boundaries*sizeof(double)); if (lattice_switch & LATTICE_LB_GPU) { #if defined (LB_BOUNDARIES_GPU) && defined (LB_GPU) lb_gpu_get_boundary_forces(forces); // ***** I THINK BECAUSE OF THE WAY YOU DEFINE THE FORCES YOU WANT TO PRINT THE NEGATIVE f[0]=-forces[3*no+0]; f[1]=-forces[3*no+1]; f[2]=-forces[3*no+2]; #else return ES_ERROR; #endif } else { #if defined (LB_BOUNDARIES) && defined (LB) mpi_gather_stats(8, forces, NULL, NULL, NULL); f[0]=forces[3*no+0]*lbpar.agrid/lbpar.tau/lbpar.tau; f[1]=forces[3*no+1]*lbpar.agrid/lbpar.tau/lbpar.tau; f[2]=forces[3*no+2]*lbpar.agrid/lbpar.tau/lbpar.tau; #else return ES_ERROR; #endif } free(forces); #endif return 0; }