Skip to content

Commit a40bef4

Browse files
committed
Fix local column index conversion in replaceValues for TrilinosSpaceExperimental
1 parent 586880f commit a40bef4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

applications/TrilinosApplication/trilinos_space_experimental.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,8 +2091,10 @@ class TrilinosSpaceExperimental
20912091

20922092
// If diagonal empty assign scale factor
20932093
if (empty) {
2094-
const int row_gid_int = static_cast<int>(row_gid); // Casting to int
2095-
localMatrix.replaceValues(i, &row_gid_int, 1, &scale_factor, false, true);
2094+
// replaceValues expects LOCAL column indices, not global IDs.
2095+
// Convert the global diagonal column ID to a local column index.
2096+
const LO local_diag_col = static_cast<LO>(colMap->getLocalElement(row_gid));
2097+
localMatrix.replaceValues(i, &local_diag_col, 1, &scale_factor, false, true);
20962098
localRhs(i, 0) = 0.0;
20972099
}
20982100
}

0 commit comments

Comments
 (0)