From: Timo Heister Date: Tue, 28 Jul 2015 18:26:00 +0000 (-0400) Subject: fix stl errors and rework MPI recv/send X-Git-Tag: v8.4.0-rc2~706^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1205%2Fhead;p=dealii.git fix stl errors and rework MPI recv/send this addresses the two TODOs in the code --- diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 266f226afc..952856975e 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -606,9 +606,6 @@ namespace SparsityTools &requests[idx]); } -//TODO: In the following, we read individual bytes and then reinterpret them -// as typename DSP_t::size_type objects. this is error prone. use properly typed reads that -// match the write above { //receive std::vector recv_buf; @@ -619,22 +616,21 @@ namespace SparsityTools MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &status); Assert (status.MPI_TAG==124, ExcInternalError()); - MPI_Get_count(&status, MPI_BYTE, &len); - Assert( len%sizeof(typename DSP_t::size_type)==0, ExcInternalError()); - - recv_buf.resize(len/sizeof(typename DSP_t::size_type)); - - MPI_Recv(&recv_buf[0], len, MPI_BYTE, status.MPI_SOURCE, + MPI_Get_count(&status, DEAL_II_DOF_INDEX_MPI_TYPE, &len); + recv_buf.resize(len); + MPI_Recv(&recv_buf[0], len, DEAL_II_DOF_INDEX_MPI_TYPE, status.MPI_SOURCE, status.MPI_TAG, mpi_comm, &status); typename std::vector::const_iterator ptr = recv_buf.begin(); typename std::vector::const_iterator end = recv_buf.end(); - while (ptr+1 recv_buf; @@ -743,22 +737,21 @@ namespace SparsityTools MPI_Probe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &status); Assert (status.MPI_TAG==124, ExcInternalError()); - MPI_Get_count(&status, MPI_BYTE, &len); - Assert( len%sizeof(typename DSP_t::size_type)==0, ExcInternalError()); - - recv_buf.resize(len/sizeof(typename DSP_t::size_type)); - - MPI_Recv(&recv_buf[0], len, MPI_BYTE, status.MPI_SOURCE, + MPI_Get_count(&status, DEAL_II_DOF_INDEX_MPI_TYPE, &len); + recv_buf.resize(len); + MPI_Recv(&recv_buf[0], len, DEAL_II_DOF_INDEX_MPI_TYPE, status.MPI_SOURCE, status.MPI_TAG, mpi_comm, &status); typename std::vector::const_iterator ptr = recv_buf.begin(); typename std::vector::const_iterator end = recv_buf.end(); - while (ptr+1