mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-16 20:24:48 -06:00
Don't return values from update operators.
Statements like a = b += c make no sense
This commit is contained in:
parent
0ff3b721ee
commit
6319c428a3
32
AutoDiff.hpp
32
AutoDiff.hpp
@ -50,74 +50,58 @@ namespace AutoDiff {
|
||||
: val_(x), der_(dx)
|
||||
{}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator +=(const Scalar& rhs)
|
||||
{
|
||||
val_ += rhs;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator +=(const Forward& rhs)
|
||||
{
|
||||
val_ += rhs.val_;
|
||||
der_ += rhs.der_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator -=(const Scalar& rhs)
|
||||
{
|
||||
val_ -= rhs;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator -=(const Forward& rhs)
|
||||
{
|
||||
val_ -= rhs.val_;
|
||||
der_ -= rhs.der_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator *=(const Scalar& rhs)
|
||||
{
|
||||
val_ *= rhs;
|
||||
der_ *= rhs;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator *=(const Forward& rhs)
|
||||
{
|
||||
der_ = der_*rhs.val_ + val_*rhs.der_;
|
||||
val_ *= rhs.val_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator /=(const Scalar& rhs)
|
||||
{
|
||||
val_ /= rhs;
|
||||
der_ /= rhs;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Forward&
|
||||
void
|
||||
operator /=(const Forward& rhs)
|
||||
{
|
||||
der_ = (der_*rhs.val_ - val_*rhs.der_) / (rhs.val_ * rhs.val_);
|
||||
val_ /= rhs.val_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class Ostream>
|
||||
|
Loading…
Reference in New Issue
Block a user