Commit 9505d699 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

fixed rather nasty hidden bug.


Former-commit-id: 409cb4852ca9b083add7c431ecfdebbc9c5d3309
parent a5d97bbf
...@@ -64,8 +64,8 @@ void engine_prepare ( struct engine *e , int force ) { ...@@ -64,8 +64,8 @@ void engine_prepare ( struct engine *e , int force ) {
struct space *s = e->s; struct space *s = e->s;
/* Rebuild the space. */ /* Rebuild the space. */
changes = space_rebuild( e->s , force ); changes = space_rebuild( e->s , force , 0 );
printf( "engine_prepare: space_rebuild with %i changes.\n" , changes ); // printf( "engine_prepare: space_rebuild with %i changes.\n" , changes );
/* Has anything changed? */ /* Has anything changed? */
if ( changes ) { if ( changes ) {
......
...@@ -321,7 +321,7 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags ) { ...@@ -321,7 +321,7 @@ void runner_dosort ( struct runner *r , struct cell *c , int flags ) {
void runner_doghost ( struct runner *r , struct cell *c ) { void runner_doghost ( struct runner *r , struct cell *c ) {
struct part *p; struct part *p;
struct cell *finger; struct cell *finger, *finger_prev;;
int i, k, redo, count = c->count; int i, k, redo, count = c->count;
int *pid; int *pid;
float ihg, ihg2; float ihg, ihg2;
...@@ -365,7 +365,8 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -365,7 +365,8 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Did we get the right number density? */ /* Did we get the right number density? */
if ( p->wcount + kernel_root > const_nwneigh + 1 || if ( p->wcount + kernel_root > const_nwneigh + 1 ||
p->wcount + kernel_root < const_nwneigh - 1 ) { p->wcount + kernel_root < const_nwneigh - 1 ) {
// printf( "runner_doghost: particle %i (h=%e) has bad wcount=%f.\n" , p->id , p->h , p->wcount + kernel_root ); fflush(stdout); // printf( "runner_doghost: particle %lli (h=%e,depth=%i) has bad wcount=%f.\n" , p->id , p->h , c->depth , p->wcount + kernel_root ); fflush(stdout);
// p->h += ( p->wcount + kernel_root - const_nwneigh ) / p->wcount_dh;
pid[redo] = pid[i]; pid[redo] = pid[i];
redo += 1; redo += 1;
p->wcount = 0.0; p->wcount = 0.0;
...@@ -401,6 +402,7 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -401,6 +402,7 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
// error( "Bad smoothing length, fixing this isn't implemented yet." ); // error( "Bad smoothing length, fixing this isn't implemented yet." );
/* Climb up the cell hierarchy. */ /* Climb up the cell hierarchy. */
finger_prev = c;
for ( finger = c ; finger != NULL ; finger = finger->parent ) { for ( finger = c ; finger != NULL ; finger = finger->parent ) {
/* Run through this cell's density interactions. */ /* Run through this cell's density interactions. */
...@@ -423,9 +425,12 @@ void runner_doghost ( struct runner *r , struct cell *c ) { ...@@ -423,9 +425,12 @@ void runner_doghost ( struct runner *r , struct cell *c ) {
/* Otherwise, sub interaction? */ /* Otherwise, sub interaction? */
else if ( finger->density[k]->type == task_type_sub ) else if ( finger->density[k]->type == task_type_sub )
runner_dosub_subset_density( r , finger->density[k]->ci , finger->density[k]->cj , c , c->parts , pid , count , finger->density[k]->flags ); runner_dosub_subset_density( r , finger->density[k]->ci , finger->density[k]->cj , finger_prev , c->parts , pid , count , finger->density[k]->flags );
} }
/* Keep a finger on the previous cell. */
finger_prev = finger;
} }
......
...@@ -223,7 +223,7 @@ void DOPAIR_SUBSET ( struct runner *r , struct cell *restrict ci , struct part * ...@@ -223,7 +223,7 @@ void DOPAIR_SUBSET ( struct runner *r , struct cell *restrict ci , struct part *
if ( r2 < hi2 ) { if ( r2 < hi2 ) {
IACT_NONSYM( r2 , dx , hi , pj->h , pi , pj ); IACT_NONSYM( r2 , dx , hi , pj->h , pi , pj );
} }
} /* loop over the parts in cj. */ } /* loop over the parts in cj. */
...@@ -797,17 +797,20 @@ void DOSUB_SUBSET ( struct runner *r , struct cell *restrict ci , struct cell *r ...@@ -797,17 +797,20 @@ void DOSUB_SUBSET ( struct runner *r , struct cell *restrict ci , struct cell *r
// TIMER_TIC // TIMER_TIC
// printf( "dosub_subset: doing sub with flags=%i, depth=%i.\n" , flags , ci->depth ); fflush(stdout);
/* Different types of flags. */ /* Different types of flags. */
switch ( flags ) { switch ( flags ) {
/* Regular sub-cell interactions of a single cell. */ /* Regular sub-cell interactions of a single cell. */
case 0: case 0:
for ( j = 0 ; j < 7 ; j++ ) for ( j = 0 ; j < 7 ; j++ )
for ( k = j + 1 ; k < 8 ; k++ ) for ( k = j + 1 ; k < 8 ; k++ ) {
if ( ci->progeny[j] == sub && ci->progeny[k] != NULL ) if ( ci->progeny[j] == sub && ci->progeny[k] != NULL )
DOPAIR_SUBSET( r , ci->progeny[j] , parts_i , ind , count , ci->progeny[k] ); DOPAIR_SUBSET( r , ci->progeny[j] , parts_i , ind , count , ci->progeny[k] );
else if ( ci->progeny[k] == sub && ci->progeny[j] != NULL) else if ( ci->progeny[k] == sub && ci->progeny[j] != NULL )
DOPAIR_SUBSET( r , ci->progeny[k] , parts_i , ind , count , ci->progeny[j] ); DOPAIR_SUBSET( r , ci->progeny[k] , parts_i , ind , count , ci->progeny[j] );
}
break; break;
case 1: /* ( 1 , 1 , 0 ) */ case 1: /* ( 1 , 1 , 0 ) */
......
This diff is collapsed.
...@@ -103,7 +103,7 @@ void space_init ( struct space *s , double dim[3] , struct part *parts , int N , ...@@ -103,7 +103,7 @@ void space_init ( struct space *s , double dim[3] , struct part *parts , int N ,
void space_maketasks ( struct space *s , int do_sort ); void space_maketasks ( struct space *s , int do_sort );
void space_map_cells ( struct space *s , int full , void (*fun)( struct cell *c , void *data ) , void *data ); void space_map_cells ( struct space *s , int full , void (*fun)( struct cell *c , void *data ) , void *data );
void space_map_parts ( struct space *s , void (*fun)( struct part *p , struct cell *c , void *data ) , void *data ); void space_map_parts ( struct space *s , void (*fun)( struct part *p , struct cell *c , void *data ) , void *data );
int space_rebuild ( struct space *s , int force ); int space_rebuild ( struct space *s , int force , double h_max );
void space_recycle ( struct space *s , struct cell *c ); void space_recycle ( struct space *s , struct cell *c );
void space_split ( struct space *s , struct cell *c ); void space_split ( struct space *s , struct cell *c );
......
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