Fix legacy grav_diff not being updated correctly

This commit is contained in:
Simon Robertshaw 2011-12-20 01:07:46 +00:00
parent 138fa2f590
commit b1532d6433

View File

@ -96,6 +96,11 @@ void gravity_update_async()
if(th_gravchanged) if(th_gravchanged)
{ {
#if !defined(GRAVFFT) && defined(GRAV_DIFF)
memcpy(gravy, th_gravy, (XRES/CELL)*(YRES/CELL)*sizeof(float));
memcpy(gravx, th_gravx, (XRES/CELL)*(YRES/CELL)*sizeof(float));
memcpy(gravp, th_gravp, (XRES/CELL)*(YRES/CELL)*sizeof(float));
#else
tmpf = gravy; tmpf = gravy;
gravy = th_gravy; gravy = th_gravy;
th_gravy = tmpf; th_gravy = tmpf;
@ -107,6 +112,7 @@ void gravity_update_async()
tmpf = gravp; tmpf = gravp;
gravp = th_gravp; gravp = th_gravp;
th_gravp = tmpf; th_gravp = tmpf;
#endif
} }
tmpf = gravmap; tmpf = gravmap;
@ -121,6 +127,7 @@ void gravity_update_async()
//Apply the gravity mask //Apply the gravity mask
membwand(gravy, gravmask, (XRES/CELL)*(YRES/CELL)*sizeof(float), (XRES/CELL)*(YRES/CELL)*sizeof(unsigned)); membwand(gravy, gravmask, (XRES/CELL)*(YRES/CELL)*sizeof(float), (XRES/CELL)*(YRES/CELL)*sizeof(unsigned));
membwand(gravx, gravmask, (XRES/CELL)*(YRES/CELL)*sizeof(float), (XRES/CELL)*(YRES/CELL)*sizeof(unsigned)); membwand(gravx, gravmask, (XRES/CELL)*(YRES/CELL)*sizeof(float), (XRES/CELL)*(YRES/CELL)*sizeof(unsigned));
memset(gravmap, 0, (XRES/CELL)*(YRES/CELL)*sizeof(float));
} }
} }
@ -344,7 +351,6 @@ void update_grav()
th_gravchanged = 0; th_gravchanged = 0;
} }
memcpy(th_ogravmap, th_gravmap, (XRES/CELL)*(YRES/CELL)*sizeof(float)); memcpy(th_ogravmap, th_gravmap, (XRES/CELL)*(YRES/CELL)*sizeof(float));
memset(th_gravmap, 0, (XRES/CELL)*(YRES/CELL)*sizeof(float));
} }
#else #else
@ -404,7 +410,6 @@ void update_grav(void)
} }
fin: fin:
memcpy(th_ogravmap, th_gravmap, (XRES/CELL)*(YRES/CELL)*sizeof(float)); memcpy(th_ogravmap, th_gravmap, (XRES/CELL)*(YRES/CELL)*sizeof(float));
memset(th_gravmap, 0, (XRES/CELL)*(YRES/CELL)*sizeof(float));
} }
#endif #endif