mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use swap() and move() to reduce copying in formEllipticSystem().
This commit is contained in:
parent
5ff65b40e1
commit
f0ba4a5797
@ -396,7 +396,7 @@ namespace Opm
|
|||||||
// A concession to MRST, to obtain more similar behaviour:
|
// A concession to MRST, to obtain more similar behaviour:
|
||||||
// swap the first two equations, so that oil is first, then water.
|
// swap the first two equations, so that oil is first, then water.
|
||||||
auto eqs = eqs_in;
|
auto eqs = eqs_in;
|
||||||
std::swap(eqs[0], eqs[1]);
|
eqs[0].swap(eqs[1]);
|
||||||
|
|
||||||
// Characterize the material balance equations.
|
// Characterize the material balance equations.
|
||||||
const int n = eqs[0].size();
|
const int n = eqs[0].size();
|
||||||
@ -463,7 +463,7 @@ namespace Opm
|
|||||||
L.setFromTriplets(t.begin(), t.end());
|
L.setFromTriplets(t.begin(), t.end());
|
||||||
|
|
||||||
// Combine in single block.
|
// Combine in single block.
|
||||||
ADB total_residual = eqs[0];
|
ADB total_residual = std::move(eqs[0]);
|
||||||
for (int phase = 1; phase < num_phases; ++phase) {
|
for (int phase = 1; phase < num_phases; ++phase) {
|
||||||
total_residual = vertcat(total_residual, eqs[phase]);
|
total_residual = vertcat(total_residual, eqs[phase]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user