Commit aa0e4e04 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

fixed missing initialisation.


Former-commit-id: d346b8abf9c248fddca6c49fb8a6864cd5368c9e
parent efd2eda8
......@@ -744,7 +744,7 @@ void space_map_parts ( struct space *s , void (*fun)( struct part *p , struct ce
void space_map_cells_post ( struct space *s , int full , void (*fun)( struct cell *c , void *data ) , void *data ) {
int i, cid;
int i, cid = 0;
void rec_map ( struct cell *c ) {
......@@ -763,7 +763,7 @@ void space_map_cells_post ( struct space *s , int full , void (*fun)( struct cel
}
/* Call the recursive function on all higher-level cells. */
#pragma omp parallel shared(cid)
#pragma omp parallel shared(s,cid)
{
int mycid;
while ( 1 ) {
......@@ -781,7 +781,7 @@ void space_map_cells_post ( struct space *s , int full , void (*fun)( struct cel
void space_map_cells_pre ( struct space *s , int full , void (*fun)( struct cell *c , void *data ) , void *data ) {
int i;
int i, cid = 0;
void rec_map ( struct cell *c ) {
......@@ -800,9 +800,18 @@ void space_map_cells_pre ( struct space *s , int full , void (*fun)( struct cell
}
/* Call the recursive function on all higher-level cells. */
#pragma omp parallel for schedule(dynamic,1)
for ( i = 0 ; i < s->nr_cells ; i++ )
rec_map( &s->cells[i] );
#pragma omp parallel shared(s,cid)
{
int mycid;
while ( 1 ) {
#pragma omp critical
mycid = cid++;
if ( mycid < s->nr_cells )
rec_map( &s->cells[i] );
else
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