AutoDiffMatrix: use fastSparse{Add,Substract} when sparsisty patterns match.

This commit is contained in:
Robert Kloefkorn
2016-02-12 16:00:24 +01:00
parent 704603e2b2
commit d5b6566e06
2 changed files with 104 additions and 2 deletions

View File

@@ -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;
}