36 #ifndef _PETSCMATTOOLS_HPP_
37 #define _PETSCMATTOOLS_HPP_
236 template<
size_t MATRIX_SIZE>
237 static void AddMultipleValues(
Mat matrix,
unsigned* matrixRowAndColIndices, c_matrix<double, MATRIX_SIZE, MATRIX_SIZE>& rSmallMatrix)
239 PetscInt matrix_row_indices[MATRIX_SIZE];
245 for (
unsigned row = 0; row<MATRIX_SIZE; row++)
247 global_row = matrixRowAndColIndices[row];
248 if (global_row >= lo && global_row < hi)
250 matrix_row_indices[num_rows_owned++] = global_row;
254 if ( num_rows_owned == MATRIX_SIZE)
268 double values[MATRIX_SIZE*MATRIX_SIZE];
269 unsigned num_values_owned = 0;
270 for (
unsigned row = 0; row < MATRIX_SIZE; row++)
272 global_row = matrixRowAndColIndices[row];
273 if (global_row >= lo && global_row < hi)
275 for (
unsigned col = 0; col < MATRIX_SIZE; col++)
277 values[num_values_owned++] = rSmallMatrix(row, col);
293 #endif //_PETSCMATTOOLS_HPP_