mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
equalSparsityPattern: address nitpicks.
This commit is contained in:
parent
bc71458d44
commit
d001cac5b7
@ -194,51 +194,27 @@ equalSparsityPattern(const Lhs& lhs, const Rhs& rhs)
|
||||
return false;
|
||||
}
|
||||
|
||||
const Index nnz = lhs.nonZeros();
|
||||
|
||||
// outer indices
|
||||
const Index* rhsOuter = rhs.outerIndexPtr();
|
||||
const Index* lhsOuter = lhs.outerIndexPtr();
|
||||
for(Index i=0; i<=outerSize; ++i )
|
||||
{
|
||||
if( lhsOuter[ i ] != rhsOuter[ i ] ) {
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
||||
// inner indices
|
||||
const Index* rhsInner = rhs.innerIndexPtr();
|
||||
const Index* lhsInner = lhs.innerIndexPtr();
|
||||
|
||||
bool equalOuter = true;
|
||||
bool equalInner = true;
|
||||
const Index size = std::min( outerSize+1, nnz );
|
||||
for( Index i=0; i<size; ++i)
|
||||
const Index nnz = lhs.nonZeros();
|
||||
for( Index i=0; i<nnz; ++i)
|
||||
{
|
||||
equalOuter &= (lhsOuter[ i ] == rhsOuter[ i ]);
|
||||
equalInner &= (lhsInner[ i ] == rhsInner[ i ]);
|
||||
}
|
||||
|
||||
if( ! equalOuter || ! equalInner ) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
if( outerSize+1 < nnz )
|
||||
{
|
||||
for(Index i=outerSize+1; i<nnz; ++i)
|
||||
{
|
||||
if( lhsInner[ i ] != rhsInner[ i ] ) {
|
||||
return false;
|
||||
}
|
||||
if( lhsInner[ i ] != rhsInner[ i ] ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if( outerSize+1 > nnz )
|
||||
{
|
||||
for(Index o=nnz; o<=outerSize; ++o )
|
||||
{
|
||||
if( lhsOuter[ o ] != rhsOuter[ o ] ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return equalOuter && equalInner;
|
||||
}
|
||||
}
|
||||
|
||||
return equal;
|
||||
|
Loading…
Reference in New Issue
Block a user