diff --git a/MathLib/LinAlg/PETSc/PETScVector.cpp b/MathLib/LinAlg/PETSc/PETScVector.cpp index 587a53d1135f0e4bc988b3c67a3bd42b8b596051..053ea73274a14618b06353a9a2c31c8c14752a8e 100644 --- a/MathLib/LinAlg/PETSc/PETScVector.cpp +++ b/MathLib/LinAlg/PETSc/PETScVector.cpp @@ -170,9 +170,9 @@ void PETScVector::setLocalAccessibleVector() const { if (_entry_array.empty()) { - const PetscInt array_size = _global_ids2local_ids_ghost.size() > 0 - ? _size_loc + _size_ghosts - : _size; + const PetscInt array_size = _global_ids2local_ids_ghost.empty() + ? _size + : _size_loc + _size_ghosts; _entry_array.resize(array_size); } @@ -197,7 +197,7 @@ void PETScVector::copyValues(std::vector<PetscScalar>& u) const PetscScalar PETScVector::get(const PetscInt idx) const { - if (_global_ids2local_ids_ghost.size() > 0) + if (!_global_ids2local_ids_ghost.empty()) { return _entry_array[getLocalIndex(idx)]; } @@ -215,7 +215,7 @@ std::vector<PetscScalar> PETScVector::get( // use VecGetValues(_v, indices.size(), indices.data(), // local_x.data()); - if (_global_ids2local_ids_ghost.size() > 0) + if (!_global_ids2local_ids_ghost.empty()) { for (std::size_t i = 0; i < indices.size(); i++) {