Changeset 9fc7e1


Ignore:
Timestamp:
Feb 10, 2012, 3:19:51 PM (14 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
322469
Parents:
32ff22
Message:

Bugfix for trac ticket #61.

Removed all variable-length arrays, even those of POD datatypes. Throws no warnings/errors when compiled with GCC 4.6.1 and -pedantic.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1339 5161e1c8-67bf-11de-9fd5-51895aff932f

Location:
src/comm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/comm/comm_mpi.cpp

    r32ff22 r9fc7e1  
    400400
    401401  Index index;
    402   int global_extent[6*size], send_sizes[size], recv_sizes[size];
    403   Index begin_remote[size], end_remote[size];
    404   std::vector<int> pos_indices[size], charge_indices[size];
    405   MPI_Datatype dt_temp;
     402  std::vector<int> global_extent, send_sizes, recv_sizes;
     403  std::vector<Index> begin_remote, end_remote;
     404  std::vector< std::vector<int> > pos_indices, charge_indices;
    406405  std::vector<vmg_float> buffer_x, buffer_q;
    407406  std::vector<vmg_int> buffer_ind;
     407  MPI_Datatype dt_temp;
     408
     409  global_extent.resize(6*size);
     410  send_sizes.resize(size);
     411  recv_sizes.resize(size);
     412  begin_remote.resize(size);
     413  end_remote.resize(size);
     414  pos_indices.resize(size);
     415  charge_indices.resize(size);
    408416
    409417  std::memcpy(&global_extent[6*rank], grid.Global().BeginLocal().vec(), 3*sizeof(int));
    410418  std::memcpy(&global_extent[6*rank+3], grid.Global().EndLocal().vec(), 3*sizeof(int));
    411419
    412   MPI_Allgather(MPI_IN_PLACE, 6, MPI_INT, global_extent, 6, MPI_INT, MPI_COMM_WORLD);
     420  MPI_Allgather(MPI_IN_PLACE, 6, MPI_INT, &global_extent.front(), 6, MPI_INT, MPI_COMM_WORLD);
    413421
    414422  for (int i=0; i<size; ++i) {
     
    433441    send_sizes[i] = charge_indices[i].size();
    434442
    435   MPI_Alltoall(send_sizes, 1, MPI_INT, recv_sizes, 1, MPI_INT, comm_global);
     443  MPI_Alltoall(&send_sizes.front(), 1, MPI_INT, &recv_sizes.front(), 1, MPI_INT, comm_global);
    436444
    437445  /*
  • src/comm/mpi/settings.cpp

    r32ff22 r9fc7e1  
    287287    MPI_Comm_size(comm, &size);
    288288
    289     int buffer[6*size];
     289    std::vector<int> buffer;
     290    buffer.resize(6*size);
    290291
    291292    // Compute local offset for ghost cells
     
    306307    }
    307308
    308     MPI_Allgather(MPI_IN_PLACE, 6, MPI_INT, buffer, 6, MPI_INT, comm);
     309    MPI_Allgather(MPI_IN_PLACE, 6, MPI_INT, &buffer.front(), 6, MPI_INT, comm);
    309310
    310311    if (insert_result.second) {
     
    341342    }
    342343
    343     MPI_Allgather(MPI_IN_PLACE, 6, MPI_INT, buffer, 6, MPI_INT, comm);
     344    MPI_Allgather(MPI_IN_PLACE, 6, MPI_INT, &buffer.front(), 6, MPI_INT, comm);
    344345
    345346    if (insert_result.second) {
Note: See TracChangeset for help on using the changeset viewer.