replace std::copy with std::copy_n where appropriate

more expressive
This commit is contained in:
Arne Morten Kvarving
2026-02-23 08:41:31 +01:00
parent 961cf4a616
commit f0a67a1fa2
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ class MortarUtils {
static void extractBlock(Vector& x, const Vector& y, int len, int start = 0)
{
x.resize(len);
std::copy(y.begin() + start, y.begin() + len + start, x.begin());
std::copy_n(y.begin() + start, len, x.begin());
}
//! \brief Inject a range of indices into a vector
@@ -37,7 +37,7 @@ class MortarUtils {
//! \param[in] start The first index in the range
static void injectBlock(Vector& x, const Vector& y, int len, int start = 0)
{
std::copy(y.begin(), y.begin() + len, x.begin() + start);
std::copy_n(y.begin(), len, x.begin() + start);
}
};
+1 -1
View File
@@ -155,7 +155,7 @@ namespace Opm
int pos = (dims_[0] + 1)*j + i;
int new_pos = (new_dims_[0] + 1)*(j-jmin) + (i-imin);
// Copy all 6 coordinates for a pillar.
std::copy(COORD.begin() + 6*pos, COORD.begin() + 6*(pos + 1), new_COORD_.begin() + 6*new_pos);
std::copy_n(COORD.begin() + 6*pos, 6, new_COORD_.begin() + 6*new_pos);
if (resettoorigin) {
// Substract lowest x value from all X-coords, similarly for y, and truncate in z-direction
new_COORD_[6*new_pos] -= x_correction;