mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-14 09:52:01 -05:00
Faster copying to jacMatrix
This commit is contained in:
1 parent
3797b7297d
commit
550ce92902
1 file changed
+8
-3
@@ -574,13 +574,18 @@ namespace Opm
|
||||
blockJacobiForGPUILU0_->endindices();
|
||||
}
|
||||
|
||||
void copyMatToBlockJac(Matrix& mat, Matrix& blockJac)
|
||||
void copyMatToBlockJac(const Matrix& mat, Matrix& blockJac)
|
||||
{
|
||||
auto rbegin = blockJac.begin();
|
||||
auto rend = blockJac.end();
|
||||
for (auto row = rbegin; row != rend; ++row) {
|
||||
auto outerRow = mat.begin();
|
||||
for (auto row = rbegin; row != rend; ++row, ++outerRow) {
|
||||
auto outerCol = (*outerRow).begin();
|
||||
for (auto col = (*row).begin(); col != (*row).end(); ++col) {
|
||||
blockJac[row.index()][col.index()] = mat[row.index()][col.index()];
|
||||
// outerRow is guaranteed to have all column entries that row has!
|
||||
while(outerCol.index() < col.index()) ++outerCol;
|
||||
assert(outerCol.index() == col.index());
|
||||
*col = *outerCol; // copy nonzero block
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user