mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Re-add copying overload of AutoDiffBlock::function().
This commit is contained in:
@@ -188,6 +188,8 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create an AutoDiffBlock by directly specifying values and jacobians.
|
/// 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] val values
|
||||||
/// \param[in] jac vector of jacobians
|
/// \param[in] jac vector of jacobians
|
||||||
static AutoDiffBlock function(V&& val, std::vector<M>&& jac)
|
static AutoDiffBlock function(V&& val, std::vector<M>&& jac)
|
||||||
@@ -195,6 +197,18 @@ namespace Opm
|
|||||||
return AutoDiffBlock(std::move(val), std::move(jac));
|
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
|
/// Construct a set of primary variables, each initialized to
|
||||||
/// a given vector.
|
/// a given vector.
|
||||||
static std::vector<AutoDiffBlock> variables(const std::vector<V>& initial_values)
|
static std::vector<AutoDiffBlock> variables(const std::vector<V>& initial_values)
|
||||||
|
|||||||
Reference in New Issue
Block a user