Skip to content
Snippets Groups Projects
Commit 76f86ea0 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

bound splitting depth.

Former-commit-id: a14a4574dd6e3ad9d78a6adc7d4b49f69be0eaae
parent 8d16a7f2
No related branches found
No related tags found
No related merge requests found
...@@ -55,7 +55,7 @@ struct cell { ...@@ -55,7 +55,7 @@ struct cell {
float dx_max; float dx_max;
/* The depth of this cell in the tree. */ /* The depth of this cell in the tree. */
int depth, split; int depth, split, maxdepth;
/* Nr of parts. */ /* Nr of parts. */
int count; int count;
......
...@@ -922,7 +922,7 @@ void space_splittasks ( struct space *s ) { ...@@ -922,7 +922,7 @@ void space_splittasks ( struct space *s ) {
if ( ci->split ) { if ( ci->split ) {
/* Make a sub? */ /* Make a sub? */
if ( space_dosub && ci->count < space_subsize ) { if ( space_dosub && ci->count < space_subsize && ci->maxdepth - ci->depth < space_maxsubdepth ) {
/* convert to a self-subtask. */ /* convert to a self-subtask. */
t->type = task_type_sub; t->type = task_type_sub;
...@@ -981,6 +981,7 @@ void space_splittasks ( struct space *s ) { ...@@ -981,6 +981,7 @@ void space_splittasks ( struct space *s ) {
/* Replace by a single sub-task? */ /* Replace by a single sub-task? */
if ( space_dosub && if ( space_dosub &&
ci->count < space_subsize && cj->count < space_subsize && ci->count < space_subsize && cj->count < space_subsize &&
ci->maxdepth - ci->depth < space_maxsubdepth && cj->maxdepth - cj->depth < space_maxsubdepth &&
sid != 0 && sid != 2 && sid != 6 && sid != 8 ) { sid != 0 && sid != 2 && sid != 6 && sid != 8 ) {
/* Make this task a sub task. */ /* Make this task a sub task. */
...@@ -1344,7 +1345,7 @@ void space_maketasks ( struct space *s , int do_sort ) { ...@@ -1344,7 +1345,7 @@ void space_maketasks ( struct space *s , int do_sort ) {
void space_split ( struct space *s , struct cell *c ) { void space_split ( struct space *s , struct cell *c ) {
int k, count = c->count; int k, count = c->count, maxdepth = 0;
float h, h_max = 0.0f, dt, dt_min = c->parts[0].dt, dt_max = dt_min; float h, h_max = 0.0f, dt, dt_min = c->parts[0].dt, dt_max = dt_min;
double x[3]; double x[3];
struct cell *temp; struct cell *temp;
...@@ -1397,16 +1398,16 @@ void space_split ( struct space *s , struct cell *c ) { ...@@ -1397,16 +1398,16 @@ void space_split ( struct space *s , struct cell *c ) {
} }
else { else {
space_split( s , c->progeny[k] ); space_split( s , c->progeny[k] );
if ( c->progeny[k]->h_max > h_max ) h_max = fmaxf( h_max , c->progeny[k]->h_max );
h_max = c->progeny[k]->h_max; dt_min = fminf( dt_min , c->progeny[k]->dt_min );
if ( c->progeny[k]->dt_min < dt_min ) dt_max = fmaxf( dt_max , c->progeny[k]->dt_max );
dt_min = c->progeny[k]->dt_min; if ( c->progeny[k]->maxdepth > maxdepth )
if ( c->progeny[k]->dt_max > dt_max ) maxdepth = c->progeny[k]->maxdepth;
dt_max = c->progeny[k]->dt_max;
} }
c->h_max = h_max; c->h_max = h_max;
c->dt_min = dt_min; c->dt_min = dt_min;
c->dt_max = dt_max; c->dt_max = dt_max;
c->maxdepth = maxdepth;
} }
...@@ -1416,6 +1417,7 @@ void space_split ( struct space *s , struct cell *c ) { ...@@ -1416,6 +1417,7 @@ void space_split ( struct space *s , struct cell *c ) {
/* Clear the progeny. */ /* Clear the progeny. */
bzero( c->progeny , sizeof(struct cell *) * 8 ); bzero( c->progeny , sizeof(struct cell *) * 8 );
c->split = 0; c->split = 0;
c->maxdepth = c->depth;
/* Get dt_min/dt_max. */ /* Get dt_min/dt_max. */
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define space_splitratio 0.875f #define space_splitratio 0.875f
#define space_splitsize_default 400 #define space_splitsize_default 400
#define space_subsize_default 5000 #define space_subsize_default 5000
#define space_maxsubdepth 3
#define space_dosub 1 #define space_dosub 1
#define space_stretch 1.05f #define space_stretch 1.05f
#define space_maxtaskspercell 31 #define space_maxtaskspercell 31
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment