From 2c3153e57a06752680619690eacfd1b873af736c Mon Sep 17 00:00:00 2001 From: Wenqing Wang <wenqing.wang@ufz.de> Date: Mon, 2 May 2022 16:53:49 +0200 Subject: [PATCH] [MathLib] Refactored PETScVector::setLocalAccessibleVector() --- MathLib/LinAlg/PETSc/PETScVector.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/MathLib/LinAlg/PETSc/PETScVector.cpp b/MathLib/LinAlg/PETSc/PETScVector.cpp index ac7a6394ea7..7a17f2ed485 100644 --- a/MathLib/LinAlg/PETSc/PETScVector.cpp +++ b/MathLib/LinAlg/PETSc/PETScVector.cpp @@ -176,22 +176,7 @@ void PETScVector::getGlobalVector(std::vector<PetscScalar>& u) const void PETScVector::setLocalAccessibleVector() const { - if (entry_array_.empty()) - { - const PetscInt array_size = global_ids2local_ids_ghost_.empty() - ? size_ - : size_loc_ + size_ghosts_; - entry_array_.resize(array_size); - } - - if (!global_ids2local_ids_ghost_.empty()) - { - PetscScalar* loc_x = getLocalVector(); - std::copy_n(loc_x, size_loc_ + size_ghosts_, entry_array_.begin()); - restoreArray(loc_x); - } - else - getGlobalVector(entry_array_); + copyValues(entry_array_); } void PETScVector::copyValues(std::vector<PetscScalar>& u) const -- GitLab