From: Denis Davydov Date: Wed, 29 Nov 2017 12:58:09 +0000 (+0100) Subject: cleanup public interface X-Git-Tag: v9.0.0-rc1~701^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c3f78443caaea7a354a66ee052178e1b7f95856;p=dealii.git cleanup public interface --- diff --git a/include/deal.II/lac/scalapack.h b/include/deal.II/lac/scalapack.h index 9d93b05d80..2a1002e944 100644 --- a/include/deal.II/lac/scalapack.h +++ b/include/deal.II/lac/scalapack.h @@ -230,32 +230,32 @@ public: /** * Number of local rows on this MPI processes. */ - int local_m() const; + unsigned int local_m() const; /** * Number of local columns on this MPI process. */ - int local_n() const; + unsigned int local_n() const; /** * Return the global row number for the given local row @p loc_row . */ - int global_row(const int loc_row) const; + unsigned int global_row(const unsigned int loc_row) const; /** * Return the global column number for the given local column @p loc_column. */ - int global_column(const int loc_column) const; + unsigned int global_column(const unsigned int loc_column) const; /** * Read access to local element. */ - NumberType local_el(const int loc_row, const int loc_column) const; + NumberType local_el(const unsigned int loc_row, const unsigned int loc_column) const; /** * Write access to local element. */ - NumberType &local_el(const int loc_row, const int loc_column); + NumberType &local_el(const unsigned int loc_row, const unsigned int loc_column); private: @@ -371,7 +371,7 @@ private: template inline NumberType -ScaLAPACKMatrix::local_el(const int loc_row, const int loc_column) const +ScaLAPACKMatrix::local_el(const unsigned int loc_row, const unsigned int loc_column) const { return (*this)(loc_row,loc_column); } @@ -381,11 +381,49 @@ ScaLAPACKMatrix::local_el(const int loc_row, const int loc_column) c template inline NumberType & -ScaLAPACKMatrix::local_el(const int loc_row, const int loc_column) +ScaLAPACKMatrix::local_el(const unsigned int loc_row, const unsigned int loc_column) { return (*this)(loc_row,loc_column); } + +template +inline +unsigned int +ScaLAPACKMatrix::m() const +{ + return n_rows; +} + + + +template +inline +unsigned int +ScaLAPACKMatrix::n() const +{ + return n_columns; +} + + + +template +unsigned int +ScaLAPACKMatrix::local_m() const +{ + return n_local_rows; +} + + + +template +unsigned int +ScaLAPACKMatrix::local_n() const +{ + return n_local_columns; +} + + #endif // DOXYGEN DEAL_II_NAMESPACE_CLOSE diff --git a/source/base/process_grid.cc b/source/base/process_grid.cc index 5b391b8786..4727265fd0 100644 --- a/source/base/process_grid.cc +++ b/source/base/process_grid.cc @@ -122,8 +122,8 @@ namespace Utilities // Initialize Cblas context from the provided communicator blacs_context = Csys2blacs_handle(mpi_communicator); const char *order = ( column_major ? "Col" : "Row" ); - // FIXME: blacs_context can be modified below. Thus Cblacs2sys_handle - // may not return the same MPI communicator + // Note that blacs_context can be modified below. Thus Cblacs2sys_handle + // may not return the same MPI communicator. Cblacs_gridinit(&blacs_context, order, n_process_rows, n_process_columns); // Blacs may modify the grid size on processes which are not used @@ -134,14 +134,14 @@ namespace Utilities // If this MPI core is not on the grid, flag it as inactive and // skip all jobs - // FIXME: different condition is used here + // Note that a different condition is used in FORTRAN code here // https://stackoverflow.com/questions/18516915/calling-blacs-with-more-processes-than-used if (this_process_row < 0 || this_process_column < 0) mpi_process_is_active = false; else mpi_process_is_active = true; - // Create an auxiliary communicator which has root and all inactive cores + // Create an auxiliary communicator which has root and all inactive cores. // Assume that inactive cores start with id=n_process_rows*n_process_columns Assert (mpi_process_is_active || this_mpi_process >= n_process_rows*n_process_columns, ExcInternalError()); @@ -166,7 +166,7 @@ namespace Utilities AssertThrowMPI(ierr); // Create the communicator based on the group - // Note that, on most cores the communicator will be MPI_COMM_NULL + // Note that on most cores the communicator will be MPI_COMM_NULL. // FIXME: switch to MPI_Comm_create_group for MPI-3 so that only processes within the to-be subgroup call this ierr = MPI_Comm_create(mpi_communicator, inactive_with_root_group, &mpi_communicator_inactive_with_root); diff --git a/source/lac/scalapack.cc b/source/lac/scalapack.cc index 4d55ec7188..4c30617394 100644 --- a/source/lac/scalapack.cc +++ b/source/lac/scalapack.cc @@ -142,43 +142,7 @@ ScaLAPACKMatrix::operator = (const FullMatrix &matrix) template unsigned int -ScaLAPACKMatrix::m() const -{ - return n_rows; -} - - - -template -unsigned int -ScaLAPACKMatrix::n() const -{ - return n_columns; -} - - - -template -int -ScaLAPACKMatrix::local_m() const -{ - return n_local_rows; -} - - - -template -int -ScaLAPACKMatrix::local_n() const -{ - return n_local_columns; -} - - - -template -int -ScaLAPACKMatrix::global_row(const int loc_row) const +ScaLAPACKMatrix::global_row(const unsigned int loc_row) const { Assert (loc_row >= 0 && loc_row < n_local_rows, ExcIndexRange(loc_row,0,n_local_rows)); @@ -189,8 +153,8 @@ ScaLAPACKMatrix::global_row(const int loc_row) const template -int -ScaLAPACKMatrix::global_column(const int loc_column) const +unsigned int +ScaLAPACKMatrix::global_column(const unsigned int loc_column) const { Assert (loc_column >= 0 && loc_column < n_local_columns, ExcIndexRange(loc_column,0,n_local_columns));