Commit 810ce3ba authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

fix how we look for sub-cell in dosub_subset, i.e. with pointers not location.


Former-commit-id: 190cd1b9cae99df960026932f991a7bb039cad7b
parent 0a34510d
......@@ -208,16 +208,16 @@ void engine_step ( struct engine *e , int sort_queues ) {
u_bar[k] = p->u + hdt * p->u_dt;
/* Move the particles with the velocitie at the half-step. */
// p->x[0] += dt * v_bar[3*k+0];
// p->x[1] += dt * v_bar[3*k+1];
// p->x[2] += dt * v_bar[3*k+2];
p->x[0] += dt * v_bar[3*k+0];
p->x[1] += dt * v_bar[3*k+1];
p->x[2] += dt * v_bar[3*k+2];
/* Update positions and energies at the half-step. */
p->v[0] += dt * p->a[0];
p->v[1] += dt * p->a[1];
p->v[2] += dt * p->a[2];
// p->u *= expf( p->u_dt / p->u * dt );
// p->h *= expf( -1.0f * p->h_dt / p->h * dt );
p->u *= expf( p->u_dt / p->u * dt );
p->h *= expf( -1.0f * p->h_dt / p->h * dt );
/* Integrate other values if this particle will not be updated. */
if ( p->dt > dt_max ) {
......
......@@ -2053,12 +2053,14 @@ void DOSUB_SUBSET ( struct runner *r , struct cell *restrict ci , struct part *p
/* Find out in which sub-cell of ci the parts are. */
for ( k = 0 ; k < 8 ; k++ )
if ( ci->progeny[k] != NULL ) {
if ( parts[ ind[ 0 ] ].x[0] >= ci->progeny[k]->loc[0] &&
parts[ ind[ 0 ] ].x[0] <= ci->progeny[k]->loc[0] + ci->progeny[k]->h[0] &&
parts[ ind[ 0 ] ].x[1] >= ci->progeny[k]->loc[1] &&
parts[ ind[ 0 ] ].x[1] <= ci->progeny[k]->loc[1] + ci->progeny[k]->h[1] &&
parts[ ind[ 0 ] ].x[2] >= ci->progeny[k]->loc[2] &&
parts[ ind[ 0 ] ].x[2] <= ci->progeny[k]->loc[2] + ci->progeny[k]->h[2] ) {
// if ( parts[ ind[ 0 ] ].x[0] >= ci->progeny[k]->loc[0] &&
// parts[ ind[ 0 ] ].x[0] <= ci->progeny[k]->loc[0] + ci->progeny[k]->h[0] &&
// parts[ ind[ 0 ] ].x[1] >= ci->progeny[k]->loc[1] &&
// parts[ ind[ 0 ] ].x[1] <= ci->progeny[k]->loc[1] + ci->progeny[k]->h[1] &&
// parts[ ind[ 0 ] ].x[2] >= ci->progeny[k]->loc[2] &&
// parts[ ind[ 0 ] ].x[2] <= ci->progeny[k]->loc[2] + ci->progeny[k]->h[2] ) {
if ( &parts[ ind[0] ] >= &ci->progeny[k]->parts[0] &&
&parts[ ind[0] ] < &ci->progeny[k]->parts[ci->progeny[k]->count] ) {
sub = ci->progeny[k];
break;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment