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

[MaL] Rename getValues to copyValues.

parent 19322af1
No related branches found
No related tags found
No related merge requests found
...@@ -75,8 +75,8 @@ public: ...@@ -75,8 +75,8 @@ public:
} }
} }
/// get entry values to an array /// Copy vector values.
void getValues(std::vector<double>& u) void copyValues(std::vector<double>& u)
{ {
assert(u.size() == this->size()); assert(u.size() == this->size());
std::copy(this->cbegin(), this->cend(), u.begin()); std::copy(this->cbegin(), this->cend(), u.begin());
......
...@@ -86,8 +86,8 @@ public: ...@@ -86,8 +86,8 @@ public:
} }
} }
/// get entry values to an array /// Copy vector values.
void getValues(std::vector<double>& u) void copyValues(std::vector<double>& u)
{ {
assert(u.size() == _vec.size()); assert(u.size() == _vec.size());
copy_n(_vec.data(), _vec.size(), u.begin()); copy_n(_vec.data(), _vec.size(), u.begin());
......
...@@ -107,8 +107,8 @@ public: ...@@ -107,8 +107,8 @@ public:
} }
} }
/// get entry values to an array /// Copy vector values.
void getValues(std::vector<double>& u) void copyValues(std::vector<double>& u)
{ {
assert(u.size() == size()); assert(u.size() == size());
lis_vector_get_values(_vec, 0, size(), u.data()); lis_vector_get_values(_vec, 0, size(), u.data());
......
...@@ -153,7 +153,7 @@ void PETScVector::getGlobalVector(PetscScalar u[]) ...@@ -153,7 +153,7 @@ void PETScVector::getGlobalVector(PetscScalar u[])
#endif #endif
} }
void PETScVector::getValues(std::vector<double>& u) void PETScVector::copyValues(std::vector<double>& u)
{ {
assert(u.size() == getLocalSize() + getGhostSize()); assert(u.size() == getLocalSize() + getGhostSize());
......
...@@ -177,11 +177,11 @@ class PETScVector ...@@ -177,11 +177,11 @@ class PETScVector
*/ */
void getGlobalVector(PetscScalar u[]); void getGlobalVector(PetscScalar u[]);
/*! /*!
Get local entries including ghost ones to an array Copy local entries including ghost ones to an array
\param u Array for the values of local entries. \param u Preallocated vector for the values of local entries.
*/ */
void getValues(std::vector<double>& u); void copyValues(std::vector<double>& u);
/// Get an entry value. This is an expensive operation, /// Get an entry value. This is an expensive operation,
/// and it only get local value. Use it for only test purpose /// and it only get local value. Use it for only test purpose
......
...@@ -278,7 +278,7 @@ private: ...@@ -278,7 +278,7 @@ private:
assert(result && result->size() == _x->size()); assert(result && result->size() == _x->size());
// Copy result // Copy result
_x->getValues(*result); _x->copyValues(*result);
// Write output file // Write output file
DBUG("Writing output to \'%s\'.", file_name.c_str()); DBUG("Writing output to \'%s\'.", file_name.c_str());
......
...@@ -179,7 +179,7 @@ void checkGlobalVectorInterfacePETSc() ...@@ -179,7 +179,7 @@ void checkGlobalVectorInterfacePETSc()
// check local array // check local array
std::vector<double> loc_v( x_fixed_p.getLocalSize() std::vector<double> loc_v( x_fixed_p.getLocalSize()
+ x_fixed_p.getGhostSize() ); + x_fixed_p.getGhostSize() );
x_fixed_p.getValues(loc_v); x_fixed_p.copyValues(loc_v);
z[0] = 1.0; z[0] = 1.0;
z[1] = 2.0; z[1] = 2.0;
...@@ -253,7 +253,7 @@ void checkGlobalVectorInterfacePETSc() ...@@ -253,7 +253,7 @@ void checkGlobalVectorInterfacePETSc()
std::vector<double> loc_v1( x_with_ghosts.getLocalSize() std::vector<double> loc_v1( x_with_ghosts.getLocalSize()
+ x_with_ghosts.getGhostSize() ); + x_with_ghosts.getGhostSize() );
x_with_ghosts.getValues(loc_v1); x_with_ghosts.copyValues(loc_v1);
for (std::size_t i=0; i<expected.size(); i++) for (std::size_t i=0; i<expected.size(); i++)
{ {
ASSERT_EQ(expected[i], loc_v1[i]); ASSERT_EQ(expected[i], loc_v1[i]);
......
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