mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -403,7 +403,8 @@ collapseJacs(const AutoDiffBlock<double>& x)
|
||||
// Build final jacobian.
|
||||
std::vector<ADB::M> jacs(1);
|
||||
collapseJacs( x, jacs[ 0 ] );
|
||||
return ADB::function(x.value(), jacs);
|
||||
ADB::V val = x.value();
|
||||
return ADB::function(std::move(val), std::move(jacs));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user