From 03131f2102f846581e14bb7b0721ebf457a513ee Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 28 Jul 2015 14:26:00 -0400 Subject: [PATCH] fix stl errors and rework MPI recv/send this addresses the two TODOs in the code --- source/lac/sparsity_tools.cc | 38 +++++++++++++++--------------------- 1 file changed, 16 insertions(+), 22 deletions(-) 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