From: Pengfei Jia Date: Fri, 4 Mar 2022 00:19:29 +0000 (-0500) Subject: Removing DEAL_II_MPI_CONST_CAST X-Git-Tag: v9.4.0-rc1~407^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b05dc256f055327a45d3a1bf613c68af312e1436;p=dealii.git Removing DEAL_II_MPI_CONST_CAST Fix based on #13474 forgot about indent more indent suggested changes --- diff --git a/include/deal.II/base/mpi.templates.h b/include/deal.II/base/mpi.templates.h index ab5b455752..679817ae5c 100644 --- a/include/deal.II/base/mpi.templates.h +++ b/include/deal.II/base/mpi.templates.h @@ -80,9 +80,7 @@ namespace Utilities } # endif const int ierr = - MPI_Allreduce(values != output ? - DEAL_II_MPI_CONST_CAST(values.data()) : - MPI_IN_PLACE, + MPI_Allreduce(values != output ? values.data() : MPI_IN_PLACE, static_cast(output.data()), static_cast(values.size()), mpi_type_id(values.data()), diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index 8831df89ba..34c6bad845 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -7694,11 +7694,8 @@ DataOutInterface::write_vtu_in_parallel( int ierr = MPI_Info_create(&info); AssertThrowMPI(ierr); MPI_File fh; - ierr = MPI_File_open(comm, - DEAL_II_MPI_CONST_CAST(filename.c_str()), - MPI_MODE_CREATE | MPI_MODE_WRONLY, - info, - &fh); + ierr = MPI_File_open( + comm, filename.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh); AssertThrow(ierr == MPI_SUCCESS, ExcFileNotOpen(filename)); ierr = MPI_File_set_size(fh, 0); // delete the file contents @@ -7720,11 +7717,8 @@ DataOutInterface::write_vtu_in_parallel( header_size = ss.str().size(); // Write the header on rank 0 and automatically move the // shared file pointer to the location after header; - ierr = MPI_File_write_shared(fh, - DEAL_II_MPI_CONST_CAST(ss.str().c_str()), - header_size, - MPI_CHAR, - MPI_STATUS_IGNORE); + ierr = MPI_File_write_shared( + fh, ss.str().c_str(), header_size, MPI_CHAR, MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } @@ -7747,11 +7741,8 @@ DataOutInterface::write_vtu_in_parallel( vtk_flags, ss); - ierr = MPI_File_write_ordered(fh, - DEAL_II_MPI_CONST_CAST(ss.str().c_str()), - ss.str().size(), - MPI_CHAR, - MPI_STATUS_IGNORE); + ierr = MPI_File_write_ordered( + fh, ss.str().c_str(), ss.str().size(), MPI_CHAR, MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } @@ -7761,11 +7752,8 @@ DataOutInterface::write_vtu_in_parallel( std::stringstream ss; DataOutBase::write_vtu_footer(ss); unsigned int footer_size = ss.str().size(); - ierr = MPI_File_write_shared(fh, - DEAL_II_MPI_CONST_CAST(ss.str().c_str()), - footer_size, - MPI_CHAR, - MPI_STATUS_IGNORE); + ierr = MPI_File_write_shared( + fh, ss.str().c_str(), footer_size, MPI_CHAR, MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } ierr = MPI_File_close(&fh); diff --git a/source/distributed/fully_distributed_tria.cc b/source/distributed/fully_distributed_tria.cc index f958273f9e..9838561c8f 100644 --- a/source/distributed/fully_distributed_tria.cc +++ b/source/distributed/fully_distributed_tria.cc @@ -527,7 +527,7 @@ namespace parallel // Open file. MPI_File fh; ierr = MPI_File_open(this->mpi_communicator, - DEAL_II_MPI_CONST_CAST(fname_tria.c_str()), + fname_tria.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh); @@ -569,7 +569,7 @@ namespace parallel // Write offsets to file. ierr = MPI_File_write_at(fh, myrank * sizeof(unsigned int), - DEAL_II_MPI_CONST_CAST(&buffer_size), + &buffer_size, 1, MPI_UNSIGNED, MPI_STATUS_IGNORE); @@ -579,7 +579,7 @@ namespace parallel ierr = MPI_File_write_at(fh, mpisize * sizeof(unsigned int) + offset, // global position in file - DEAL_II_MPI_CONST_CAST(buffer.data()), + buffer.data(), buffer.size(), // local buffer MPI_CHAR, MPI_STATUS_IGNORE); @@ -656,7 +656,7 @@ namespace parallel MPI_File fh; ierr = MPI_File_open(this->mpi_communicator, - DEAL_II_MPI_CONST_CAST(fname_tria.c_str()), + fname_tria.c_str(), MPI_MODE_RDONLY, info, &fh); @@ -670,7 +670,7 @@ namespace parallel ierr = MPI_File_read_at(fh, myrank * sizeof(unsigned int), - DEAL_II_MPI_CONST_CAST(&buffer_size), + &buffer_size, 1, MPI_UNSIGNED, MPI_STATUS_IGNORE); @@ -691,7 +691,7 @@ namespace parallel ierr = MPI_File_read_at(fh, mpisize * sizeof(unsigned int) + offset, // global position in file - DEAL_II_MPI_CONST_CAST(buffer.data()), + buffer.data(), buffer.size(), // local buffer MPI_CHAR, MPI_STATUS_IGNORE); diff --git a/source/distributed/tria_base.cc b/source/distributed/tria_base.cc index 18736bd4f2..c919a0b1d8 100644 --- a/source/distributed/tria_base.cc +++ b/source/distributed/tria_base.cc @@ -1416,7 +1416,7 @@ namespace parallel MPI_File fh; ierr = MPI_File_open(mpi_communicator, - DEAL_II_MPI_CONST_CAST(fname_fixed.c_str()), + fname_fixed.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh); @@ -1440,8 +1440,7 @@ namespace parallel { ierr = MPI_File_write_at(fh, 0, - DEAL_II_MPI_CONST_CAST( - sizes_fixed_cumulative.data()), + sizes_fixed_cumulative.data(), sizes_fixed_cumulative.size(), MPI_UNSIGNED, MPI_STATUS_IGNORE); @@ -1461,13 +1460,12 @@ namespace parallel if (src_data_fixed.size() <= static_cast(std::numeric_limits::max())) { - ierr = - MPI_File_write_at(fh, - my_global_file_position, - DEAL_II_MPI_CONST_CAST(src_data_fixed.data()), - src_data_fixed.size(), - MPI_BYTE, - MPI_STATUS_IGNORE); + ierr = MPI_File_write_at(fh, + my_global_file_position, + src_data_fixed.data(), + src_data_fixed.size(), + MPI_BYTE, + MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } else @@ -1476,7 +1474,7 @@ namespace parallel ierr = MPI_File_write_at(fh, my_global_file_position, - DEAL_II_MPI_CONST_CAST(src_data_fixed.data()), + src_data_fixed.data(), 1, *Utilities::MPI::create_mpi_data_type_n_bytes( src_data_fixed.size()), @@ -1504,7 +1502,7 @@ namespace parallel MPI_File fh; ierr = MPI_File_open(mpi_communicator, - DEAL_II_MPI_CONST_CAST(fname_variable.c_str()), + fname_variable.c_str(), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh); @@ -1531,13 +1529,12 @@ namespace parallel std::numeric_limits::max()), ExcNotImplemented()); - ierr = - MPI_File_write_at(fh, - my_global_file_position, - DEAL_II_MPI_CONST_CAST(src_sizes_variable.data()), - src_sizes_variable.size(), - MPI_INT, - MPI_STATUS_IGNORE); + ierr = MPI_File_write_at(fh, + my_global_file_position, + src_sizes_variable.data(), + src_sizes_variable.size(), + MPI_INT, + MPI_STATUS_IGNORE); AssertThrowMPI(ierr); } @@ -1546,7 +1543,7 @@ namespace parallel // to avoid overflow for files larger than 4GB: const std::uint64_t size_on_proc = src_data_variable.size(); std::uint64_t prefix_sum = 0; - ierr = MPI_Exscan(DEAL_II_MPI_CONST_CAST(&size_on_proc), + ierr = MPI_Exscan(&size_on_proc, &prefix_sum, 1, MPI_UINT64_T, @@ -1564,8 +1561,7 @@ namespace parallel { ierr = MPI_File_write_at(fh, my_global_file_position, - DEAL_II_MPI_CONST_CAST( - src_data_variable.data()), + src_data_variable.data(), src_data_variable.size(), MPI_BYTE, MPI_STATUS_IGNORE); @@ -1577,8 +1573,7 @@ namespace parallel ierr = MPI_File_write_at(fh, my_global_file_position, - DEAL_II_MPI_CONST_CAST( - src_data_variable.data()), + src_data_variable.data(), 1, *Utilities::MPI::create_mpi_data_type_n_bytes( src_data_variable.size()), @@ -1632,11 +1627,8 @@ namespace parallel AssertThrowMPI(ierr); MPI_File fh; - ierr = MPI_File_open(mpi_communicator, - DEAL_II_MPI_CONST_CAST(fname_fixed.c_str()), - MPI_MODE_RDONLY, - info, - &fh); + ierr = MPI_File_open( + mpi_communicator, fname_fixed.c_str(), MPI_MODE_RDONLY, info, &fh); AssertThrowMPI(ierr); ierr = MPI_Info_free(&info); @@ -1712,11 +1704,8 @@ namespace parallel AssertThrowMPI(ierr); MPI_File fh; - ierr = MPI_File_open(mpi_communicator, - DEAL_II_MPI_CONST_CAST(fname_variable.c_str()), - MPI_MODE_RDONLY, - info, - &fh); + ierr = MPI_File_open( + mpi_communicator, fname_variable.c_str(), MPI_MODE_RDONLY, info, &fh); AssertThrowMPI(ierr); ierr = MPI_Info_free(&info); @@ -1745,7 +1734,7 @@ namespace parallel 0ULL); std::uint64_t prefix_sum = 0; - ierr = MPI_Exscan(DEAL_II_MPI_CONST_CAST(&size_on_proc), + ierr = MPI_Exscan(&size_on_proc, &prefix_sum, 1, MPI_UINT64_T, diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index a399320691..f86e09bb06 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -3913,13 +3913,12 @@ namespace internal // --------- Phase 4: shift indices so that each processor has a unique // range of indices dealii::types::global_dof_index my_shift = 0; - const int ierr = - MPI_Exscan(DEAL_II_MPI_CONST_CAST(&n_locally_owned_dofs), - &my_shift, - 1, - DEAL_II_DOF_INDEX_MPI_TYPE, - MPI_SUM, - triangulation->get_communicator()); + const int ierr = MPI_Exscan(&n_locally_owned_dofs, + &my_shift, + 1, + DEAL_II_DOF_INDEX_MPI_TYPE, + MPI_SUM, + triangulation->get_communicator()); AssertThrowMPI(ierr); // make dof indices globally consecutive @@ -4130,8 +4129,7 @@ namespace internal //* 3. communicate local dofcount and shift ids to make // them unique dealii::types::global_dof_index my_shift = 0; - int ierr = MPI_Exscan(DEAL_II_MPI_CONST_CAST( - &level_number_cache.n_locally_owned_dofs), + int ierr = MPI_Exscan(&level_number_cache.n_locally_owned_dofs, &my_shift, 1, DEAL_II_DOF_INDEX_MPI_TYPE, diff --git a/source/lac/scalapack.cc b/source/lac/scalapack.cc index f0b53bc05b..a57410bc4a 100644 --- a/source/lac/scalapack.cc +++ b/source/lac/scalapack.cc @@ -391,7 +391,7 @@ ScaLAPACKMatrix::copy_from(const LAPACKFullMatrix &B, const int n = 1; const std::vector ranks(n, rank); MPI_Group group_B; - MPI_Group_incl(group_A, n, DEAL_II_MPI_CONST_CAST(ranks.data()), &group_B); + MPI_Group_incl(group_A, n, ranks.data(), &group_B); MPI_Comm communicator_B; const int mpi_tag = Utilities::MPI::internal::Tags::scalapack_copy_from; @@ -562,7 +562,7 @@ ScaLAPACKMatrix::copy_to(LAPACKFullMatrix &B, const int n = 1; const std::vector ranks(n, rank); MPI_Group group_B; - MPI_Group_incl(group_A, n, DEAL_II_MPI_CONST_CAST(ranks.data()), &group_B); + MPI_Group_incl(group_A, n, ranks.data(), &group_B); MPI_Comm communicator_B; const int mpi_tag = Utilities::MPI::internal::Tags::scalapack_copy_to; diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 58ea43f2ff..783b6dea3b 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -1182,14 +1182,13 @@ namespace SparsityTools unsigned int idx = 0; for (const auto &sparsity_line : send_data) { - const int ierr = - MPI_Isend(DEAL_II_MPI_CONST_CAST(sparsity_line.second.data()), - sparsity_line.second.size(), - DEAL_II_DOF_INDEX_MPI_TYPE, - sparsity_line.first, - mpi_tag, - mpi_comm, - &requests[idx++]); + const int ierr = MPI_Isend(sparsity_line.second.data(), + sparsity_line.second.size(), + DEAL_II_DOF_INDEX_MPI_TYPE, + sparsity_line.first, + mpi_tag, + mpi_comm, + &requests[idx++]); AssertThrowMPI(ierr); } }