From: Peter Munch Date: Fri, 6 Nov 2020 09:29:27 +0000 (+0100) Subject: Fix SolverCG for sm-mode L:d:V X-Git-Tag: v9.3.0-rc1~924^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11151%2Fhead;p=dealii.git Fix SolverCG for sm-mode L:d:V --- diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 24a1864fa7..235e2d9821 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -134,27 +134,15 @@ namespace LinearAlgebra { if (comm_shared == MPI_COMM_SELF) { - if (new_alloc_size > allocated_size) - { - Assert(((allocated_size > 0 && data.values != nullptr) || - data.values == nullptr), - ExcInternalError()); + Number *new_val; + Utilities::System::posix_memalign( + reinterpret_cast(&new_val), + 64, + sizeof(Number) * new_alloc_size); + data.values = {new_val, [](Number *data) { std::free(data); }}; - Number *new_val; - Utilities::System::posix_memalign( - reinterpret_cast(&new_val), - 64, - sizeof(Number) * new_alloc_size); - data.values = {new_val, - [](Number *data) { std::free(data); }}; + allocated_size = new_alloc_size; - allocated_size = new_alloc_size; - } - else if (new_alloc_size == 0) - { - data.values.reset(); - allocated_size = 0; - } data.values_sm = { ArrayView(data.values.get(), new_alloc_size)}; }