From 423006926489eacb1d79c0f4776dab7764b256de Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Wed, 1 Nov 2006 16:00:47 +0000 Subject: [PATCH] fixed warn again. fixed error when no doubles sent in message. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@1422 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- Exchange.cxx | 2 +- StorageBin.cxx | 11 ++++++++--- Surface.cxx | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Exchange.cxx b/Exchange.cxx index cfdb3c45..92328c34 100644 --- a/Exchange.cxx +++ b/Exchange.cxx @@ -247,7 +247,7 @@ void cxxExchange::mpi_unpack(int *ints, int *ii, double *doubles, int *dd) this->description = " "; - this->pitzer_exchange_gammas = (bool) ints[i++]; + this->pitzer_exchange_gammas = (ints[i++] == TRUE); int count = ints[i++]; this->exchComps.clear(); for (int n = 0; n < count; n++) { diff --git a/StorageBin.cxx b/StorageBin.cxx index 3a60d7a3..36c5d794 100644 --- a/StorageBin.cxx +++ b/StorageBin.cxx @@ -672,7 +672,7 @@ void cxxStorageBin::mpi_send(int n, int task_number) // Pack data int max_size = 0; int member_size = 0; - MPI_Pack_size((int) ints.size(), MPI_INT, MPI_COMM_WORLD, &member_size); + MPI_Pack_size((int) ints.size() + 10, MPI_INT, MPI_COMM_WORLD, &member_size); max_size += member_size; MPI_Pack_size((int) doubles.size(), MPI_DOUBLE, MPI_COMM_WORLD, &member_size); max_size += member_size + 10; @@ -704,7 +704,10 @@ void cxxStorageBin::mpi_send(int n, int task_number) MPI_Pack(&(ints.front()), i, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD); MPI_Pack(&d, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD); //MPI_Pack(&double_array, d, MPI_DOUBLE, buffer, max_size, &position, MPI_COMM_WORLD); - MPI_Pack(&(doubles.front()), d, MPI_DOUBLE, buffer, max_size, &position, MPI_COMM_WORLD); + if (d > 0) { + MPI_Pack(&(doubles.front()), d, MPI_DOUBLE, buffer, max_size, &position, MPI_COMM_WORLD); + } + std::cerr << "Packed 4" << std::endl; MPI_Send(buffer, position, MPI_PACKED, task_number, 0, MPI_COMM_WORLD); buffer = (void *) free_check_null(buffer); @@ -741,7 +744,9 @@ void cxxStorageBin::mpi_recv(int task_number) int count_doubles; MPI_Unpack(buffer, msg_size, &position, &count_doubles, 1, MPI_INT, MPI_COMM_WORLD); double *doubles = new double[count_doubles]; - MPI_Unpack(buffer, msg_size, &position, doubles, count_doubles, MPI_DOUBLE, MPI_COMM_WORLD); + if (count_doubles > 0) { + MPI_Unpack(buffer, msg_size, &position, doubles, count_doubles, MPI_DOUBLE, MPI_COMM_WORLD); + } buffer = free_check_null(buffer); #ifdef SKIP for (int j = 0; j < count_ints; j++) { diff --git a/Surface.cxx b/Surface.cxx index dee0636b..4cc8fab7 100644 --- a/Surface.cxx +++ b/Surface.cxx @@ -621,13 +621,13 @@ void cxxSurface::mpi_unpack(int *ints, int *ii, double *doubles, int *dd) this->type = (SURFACE_TYPE) ints[i++]; this->dl_type = (DIFFUSE_LAYER_TYPE) ints[i++]; this->sites_units = (SITES_UNITS) ints[i++]; - this->only_counter_ions = (bool) ints[i++]; + this->only_counter_ions = (ints[i++] == TRUE); //this->donnan = (bool) ints[i++]; this->thickness = doubles[d++]; this->debye_lengths = doubles[d++]; this->DDL_viscosity = doubles[d++]; this->DDL_limit = doubles[d++]; - this->transport = (bool) ints[i++]; + this->transport = (ints[i++] == TRUE); *ii = i; *dd = d; }