void cells_pre_init()
{
  CellPList tmp_local;
  CELL_TRACE(fprintf(stderr, "%d: cells_pre_init\n",this_node));
  /* her local_cells has to be a NULL pointer */
  if(local_cells.cell != NULL) {
    fprintf(stderr,"INTERNAL ERROR: wrong usage of cells_pre_init!\n");
    errexit();
  }
  memcpy(&tmp_local,&local_cells,sizeof(CellPList));
  dd_topology_init(&tmp_local);
}
/** Switch for choosing the topology init function of a certain
    cell system. */
static void topology_init(int cs, CellPList *local) {
  switch (cs) {
  case CELL_STRUCTURE_CURRENT:
    topology_init(cell_structure.type, local);
    break;
  case CELL_STRUCTURE_DOMDEC:
    dd_topology_init(local);
    break;
  case CELL_STRUCTURE_NSQUARE:
    nsq_topology_init(local);
    break;
  case CELL_STRUCTURE_LAYERED:
    layered_topology_init(local);
    break;
  default:
    fprintf(stderr, "INTERNAL ERROR: attempting to sort the particles in an unknown way\n");
    errexit();
  }
}
示例#3
0
void on_program_start()
{
    EVENT_TRACE(fprintf(stderr, "%d: on_program_start\n", this_node));

    /* tell Electric fence that we do realloc(0) on purpose. */
#ifdef EFENCE
    extern int EF_ALLOW_MALLOC_0;
    EF_ALLOW_MALLOC_0 = 1;
#endif

    register_sigint_handler();

    if (this_node == 0) {
        /* master node */
#ifdef FORCE_CORE
        /* core should be the last exit handler (process dies) */
        atexit(core);
#endif
        atexit(mpi_stop);
    }

    /*
      call the initialization of the modules here
    */
    init_random();
    init_bit_random();

    setup_node_grid();
    /* calculate initial minimimal number of cells (see tclcallback_min_num_cells) */
    min_num_cells = calc_processor_min_num_cells();

    /* initially go for domain decomposition */
    dd_topology_init(&local_cells);

    ghost_init();
    /* Initialise force and energy tables */
    force_and_energy_tables_init();
#ifdef ADRESS
#ifdef INTERFACE_CORRECTION
    adress_force_and_energy_tables_init();
#endif
    /* #ifdef THERMODYNAMIC_FORCE */
    tf_tables_init();
    /* #endif */
#endif
#ifdef P3M
    p3m_pre_init();
#endif
#ifdef DP3M
    dp3m_pre_init();
#endif

#ifdef LB_GPU
    if(this_node == 0) {
        //lb_pre_init_gpu();
    }
#endif
#ifdef LB
    lb_pre_init();
#endif

#ifdef REACTIONS
    reaction.back_rate=-1.0;
#endif

    /*
      call all initializations to do only on the master node here.
    */
    if (this_node == 0) {
        /* interaction_data.c: make sure 0<->0 ia always exists */
        make_particle_type_exist(0);
    }
}