mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-24 18:20:22 -06:00
Re-add copying overload of AutoDiffBlock::function().
This commit is contained in:
parent
0a76af1b14
commit
ad3da1d946
@ -188,6 +188,8 @@ namespace Opm
|
||||
}
|
||||
|
||||
/// Create an AutoDiffBlock by directly specifying values and jacobians.
|
||||
/// This version of function() moves its arguments and is therefore
|
||||
/// quite efficient, but leaves the argument variables empty (but valid).
|
||||
/// \param[in] val values
|
||||
/// \param[in] jac vector of jacobians
|
||||
static AutoDiffBlock function(V&& val, std::vector<M>&& jac)
|
||||
@ -195,6 +197,18 @@ namespace Opm
|
||||
return AutoDiffBlock(std::move(val), std::move(jac));
|
||||
}
|
||||
|
||||
/// Create an AutoDiffBlock by directly specifying values and jacobians.
|
||||
/// This version of function() copies its arguments and is therefore
|
||||
/// less efficient than the other (moving) overload.
|
||||
/// \param[in] val values
|
||||
/// \param[in] jac vector of jacobians
|
||||
static AutoDiffBlock function(const V& val, const std::vector<M>& jac)
|
||||
{
|
||||
V val_copy(val);
|
||||
std::vector<M> jac_copy(jac);
|
||||
return AutoDiffBlock(std::move(val_copy), std::move(jac_copy));
|
||||
}
|
||||
|
||||
/// Construct a set of primary variables, each initialized to
|
||||
/// a given vector.
|
||||
static std::vector<AutoDiffBlock> variables(const std::vector<V>& initial_values)
|
||||
|
Loading…
Reference in New Issue
Block a user