const std::vector<unsigned int> &row_lengths,
const bool is_symmetric = false);
+ /**
+ * Exception
+ */
+ DeclException2 (ExcLocalRowsTooLarge,
+ int, int,
+ << "The number of local rows " << arg1
+ << " must be larger than the total number of rows " << arg2);
+
private:
+ /**
+ * Copy of the communicator object to
+ * be used for this parallel vector.
+ */
+ MPI_Comm communicator;
+
/**
* Do the actual work for the
* respective reinit() function and the
const unsigned int local_rows,
const std::vector<unsigned int> &row_lengths,
const bool is_symmetric = false);
-
- private:
- /**
- * Copy of the communicator object to
- * be used for this parallel vector.
- */
- MPI_Comm communicator;
};
}
const unsigned int n_nonzero_per_row,
const bool is_symmetric)
{
+ Assert (local_rows < m, ExcLocalRowsTooLarge (local_rows, m));
+
// use the call sequence indicating only
// a maximal number of elements per row
// for all rows globally
// local_rows as they do for local_size
// on parallel vectors
const int ierr
- = MatCreateMPIAIJ(communicator, local_rows, local_rows, m, n,
+ = MatCreateMPIAIJ(communicator,
+ local_rows, std::min(local_rows, n),
+ m, n,
n_nonzero_per_row, 0, 0, 0,
&matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));
const std::vector<unsigned int> &row_lengths,
const bool is_symmetric)
{
+ Assert (local_rows < m, ExcLocalRowsTooLarge (local_rows, m));
+
Assert (row_lengths.size() == m,
ExcDimensionMismatch (row_lengths.size(), m));
// local_rows as they do for local_size
// on parallel vectors
const int ierr
- = MatCreateMPIAIJ(communicator, local_rows, local_rows, m, n,
+ = MatCreateMPIAIJ(communicator,
+ local_rows, local_rows,
+ m, std::min(local_rows, n),
0, &int_row_lengths[0], 0, 0,
&matrix);
AssertThrow (ierr == 0, ExcPETScError(ierr));