mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
AutoDiffMatrix: use fastSparse{Add,Substract} when sparsisty patterns match.
This commit is contained in:
@@ -264,7 +264,12 @@ namespace Opm
|
||||
|
||||
AutoDiffMatrix& operator+=(const AutoDiffMatrix& rhs)
|
||||
{
|
||||
*this = *this + rhs;
|
||||
if( type_ == Sparse && rhs.type_ == Sparse )
|
||||
{
|
||||
fastSparseAdd( sparse_, rhs.sparse_ );
|
||||
}
|
||||
else
|
||||
*this = *this + rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -275,7 +280,12 @@ namespace Opm
|
||||
|
||||
AutoDiffMatrix& operator-=(const AutoDiffMatrix& rhs)
|
||||
{
|
||||
*this = *this + (rhs * -1.0);
|
||||
if( type_ == Sparse && rhs.type_ == Sparse )
|
||||
{
|
||||
fastSparseSubstract( sparse_, rhs.sparse_ );
|
||||
}
|
||||
else
|
||||
*this = *this + (rhs * -1.0);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user