Skip to content
Snippets Groups Projects
Commit 2c3153e5 authored by wenqing's avatar wenqing Committed by Dmitri Naumov
Browse files

[MathLib] Refactored PETScVector::setLocalAccessibleVector()

parent 76dd54de
No related branches found
No related tags found
No related merge requests found
...@@ -176,22 +176,7 @@ void PETScVector::getGlobalVector(std::vector<PetscScalar>& u) const ...@@ -176,22 +176,7 @@ void PETScVector::getGlobalVector(std::vector<PetscScalar>& u) const
void PETScVector::setLocalAccessibleVector() const void PETScVector::setLocalAccessibleVector() const
{ {
if (entry_array_.empty()) copyValues(entry_array_);
{
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_);
} }
void PETScVector::copyValues(std::vector<PetscScalar>& u) const void PETScVector::copyValues(std::vector<PetscScalar>& u) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment