Make more use of move semantics in AD code.

This makes some API changes to AutoDiffBlock.
 - Add overload for the constant() constructor taking rvalue ref.
 - Add overload for the variable() constructor taking rvalue ref.
 - Make the function() constructor *require* rvalue refs.
 - Add a swap() function.

The remaining changes in this commit are follow-ups especially
to the third change (adding std::move in many places), and
some removal of unnecessary block pattern arguments from calls to
the constant() static method.
This commit is contained in:
Atgeirr Flø Rasmussen
2015-03-10 12:36:14 +01:00
parent 635f3db814
commit 04b255a03f
9 changed files with 100 additions and 64 deletions

View File

@@ -90,8 +90,8 @@ phaseMobility(const Opm::IncompPropertiesInterface& props,
std::vector<M> dmw = { krwjac/mu[0] };
std::vector<M> dmo = { krojac/mu[1] };
std::vector<ADB> pmobc = { ADB::function(krw / mu[0], dmw) ,
ADB::function(kro / mu[1], dmo) };
std::vector<ADB> pmobc = { ADB::function(krw / mu[0], std::move(dmw)) ,
ADB::function(kro / mu[1], std::move(dmo)) };
return pmobc;
}