void cells_resort_particles(int global_flag) { CELL_TRACE(fprintf(stderr, "%d: entering cells_resort_particles %d\n", this_node, global_flag)); invalidate_ghosts(); particle_invalidate_part_node(); n_verlet_updates++; switch (cell_structure.type) { case CELL_STRUCTURE_LAYERED: layered_exchange_and_sort_particles(global_flag); break; case CELL_STRUCTURE_NSQUARE: nsq_balance_particles(global_flag); break; case CELL_STRUCTURE_DOMDEC: dd_exchange_and_sort_particles(global_flag); break; } #ifdef ADDITIONAL_CHECKS /* at the end of the day, everything should be consistent again */ check_particle_consistency(); #endif ghost_communicator(&cell_structure.ghost_cells_comm); ghost_communicator(&cell_structure.exchange_ghosts_comm); resort_particles = 0; rebuild_verletlist = 1; on_resort_particles(); CELL_TRACE(dump_particle_ordering()); CELL_TRACE(fprintf(stderr, "%d: leaving cells_resort_particles\n", this_node)); }
void cells_re_init(int new_cs) { CellPList tmp_local; Cell *tmp_cells; int tmp_n_cells,i; CELL_TRACE(fprintf(stderr, "%d: cells_re_init: convert type (%d->%d)\n", this_node, cell_structure.type, new_cs)); invalidate_ghosts(); /* CELL_TRACE({ int p; for (p = 0; p < n_part; p++) if (local_particles[p]) fprintf(stderr, "%d: cells_re_init: got particle %d\n", this_node, p); } ); */ topology_release(cell_structure.type); /* MOVE old local_cell list to temporary buffer */ memcpy(&tmp_local,&local_cells,sizeof(CellPList)); init_cellplist(&local_cells); /* MOVE old cells to temporary buffer */ tmp_cells = cells; tmp_n_cells = n_cells; cells = NULL; n_cells = 0; topology_init(new_cs, &tmp_local); particle_invalidate_part_node(); /* finally deallocate the old cells */ realloc_cellplist(&tmp_local,0); for(i=0;i<tmp_n_cells;i++) realloc_particlelist(&tmp_cells[i],0); free(tmp_cells); CELL_TRACE(fprintf(stderr, "%d: old cells deallocated\n",this_node)); /* CELL_TRACE({ int p; for (p = 0; p < n_part; p++) if (local_particles[p]) fprintf(stderr, "%d: cells_re_init: now got particle %d\n", this_node, p); } ); */ /* to enforce initialization of the ghost cells */ resort_particles = 1; #ifdef ADDITIONAL_CHECKS check_cells_consistency(); #endif on_cell_structure_change(); }