Skip to content

Commit

Permalink
[MaL] Rename getValues to copyValues.
Browse files Browse the repository at this point in the history
  • Loading branch information
endJunction authored and wenqing committed Feb 10, 2016
1 parent 19322af commit e6ea275
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions MathLib/LinAlg/Dense/DenseVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class DenseVector : public std::valarray<T>
}
}

/// get entry values to an array
void getValues(std::vector<double>& u)
/// Copy vector values.
void copyValues(std::vector<double>& u)
{
assert(u.size() == this->size());
std::copy(this->cbegin(), this->cend(), u.begin());
Expand Down
4 changes: 2 additions & 2 deletions MathLib/LinAlg/Eigen/EigenVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class EigenVector final
}
}

/// get entry values to an array
void getValues(std::vector<double>& u)
/// Copy vector values.
void copyValues(std::vector<double>& u)
{
assert(u.size() == _vec.size());
copy_n(_vec.data(), _vec.size(), u.begin());
Expand Down
4 changes: 2 additions & 2 deletions MathLib/LinAlg/Lis/LisVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ class LisVector
}
}

/// get entry values to an array
void getValues(std::vector<double>& u)
/// Copy vector values.
void copyValues(std::vector<double>& u)
{
assert(u.size() == size());
lis_vector_get_values(_vec, 0, size(), u.data());
Expand Down
2 changes: 1 addition & 1 deletion MathLib/LinAlg/PETSc/PETScVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void PETScVector::getGlobalVector(PetscScalar u[])
#endif
}

void PETScVector::getValues(std::vector<double>& u)
void PETScVector::copyValues(std::vector<double>& u)
{
assert(u.size() == getLocalSize() + getGhostSize());

Expand Down
8 changes: 4 additions & 4 deletions MathLib/LinAlg/PETSc/PETScVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ class PETScVector
*/
void getGlobalVector(PetscScalar u[]);

/*!
Get local entries including ghost ones to an array
\param u Array for the values of local entries.
/*!
Copy local entries including ghost ones to an array
\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,
/// and it only get local value. Use it for only test purpose
Expand Down
2 changes: 1 addition & 1 deletion ProcessLib/Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class Process
assert(result && result->size() == _x->size());

// Copy result
_x->getValues(*result);
_x->copyValues(*result);

// Write output file
DBUG("Writing output to \'%s\'.", file_name.c_str());
Expand Down
4 changes: 2 additions & 2 deletions Tests/MathLib/TestGlobalVectorInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void checkGlobalVectorInterfacePETSc()
// check local array
std::vector<double> loc_v( x_fixed_p.getLocalSize()
+ x_fixed_p.getGhostSize() );
x_fixed_p.getValues(loc_v);
x_fixed_p.copyValues(loc_v);
z[0] = 1.0;
z[1] = 2.0;

Expand Down Expand Up @@ -253,7 +253,7 @@ void checkGlobalVectorInterfacePETSc()

std::vector<double> loc_v1( x_with_ghosts.getLocalSize()
+ 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++)
{
ASSERT_EQ(expected[i], loc_v1[i]);
Expand Down

0 comments on commit e6ea275

Please sign in to comment.