aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-03-14 15:46:02 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:33 +0000
commit0991987bb774ba23f3eba967f64c2890c40bea88 (patch)
tree4faf4981c52ad27d638fdec20dca2ec37450bb87 /Carpet
parent6331a668feb46209e86fcbf6b1b33879d4fc6208 (diff)
CarpetLib: Check input sizes for Allgatherv communications
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetLib/src/mpi_string.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/mpi_string.cc b/Carpet/CarpetLib/src/mpi_string.cc
index 063ed0bdf..bf794881a 100644
--- a/Carpet/CarpetLib/src/mpi_string.cc
+++ b/Carpet/CarpetLib/src/mpi_string.cc
@@ -195,6 +195,7 @@ namespace CarpetLib
// Exchange the sizes of the data vectors
int const size_in = data.size();
+ assert (size_in >= 0);
vector <int> sizes_out (num_procs);
// cerr << "QQQ: allgatherv[1] size_in=" << size_in << endl;
MPI_Allgather (const_cast <int *> (& size_in), 1, MPI_INT,
@@ -207,7 +208,9 @@ namespace CarpetLib
offsets_out.AT(0) = 0;
for (int n = 0; n < num_procs; ++ n)
{
+ assert (sizes_out.AT(n) >= 0);
offsets_out.AT(n + 1) = offsets_out.AT(n) + sizes_out.AT(n);
+ assert (offsets_out.AT(n + 1) >= 0);
}
int const total_length_out = offsets_out.AT(num_procs);
vector <T> alldata_buffer_out (total_length_out);