]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Removing DEAL_II_MPI_CONST_CAST 13488/head
authorPengfei Jia <pengfej@clemson.edu>
Fri, 4 Mar 2022 00:19:29 +0000 (19:19 -0500)
committerPengfei Jia <pengfej@clemson.edu>
Sun, 6 Mar 2022 17:31:23 +0000 (12:31 -0500)
Fix based on #13474

forgot about indent

more indent

suggested changes

include/deal.II/base/mpi.templates.h
source/base/data_out_base.cc
source/distributed/fully_distributed_tria.cc
source/distributed/tria_base.cc
source/dofs/dof_handler_policy.cc
source/lac/scalapack.cc
source/lac/sparsity_tools.cc

index ab5b455752810b1b9573f00e25c8913c487fb56c..679817ae5c3538e6bb2e33dc18b687a312bab2d4 100644 (file)
@@ -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<void *>(output.data()),
                             static_cast<int>(values.size()),
                             mpi_type_id(values.data()),
index 8831df89ba601db03f619571c02bcf0e654102c2..34c6bad845599495c0b223ff0a25854850f6b5fb 100644 (file)
@@ -7694,11 +7694,8 @@ DataOutInterface<dim, spacedim>::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<dim, spacedim>::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<dim, spacedim>::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<dim, spacedim>::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);
index f958273f9efa04338be1850ace9b6de0ac9687a2..9838561c8fd1d1193d551fc90823971536663e6a 100644 (file)
@@ -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);
index 18736bd4f28dd70bcf3e8c139035de03a4a3f2e5..c919a0b1d8104aa8daa0bf4cf4d2fee1d562930f 100644 (file)
@@ -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::size_t>(std::numeric_limits<int>::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<int>::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,
index a399320691aa93d46fd4d127da0cb7f0c63bb515..f86e09bb067a16beda55c508dc58cf0fa7623b87 100644 (file)
@@ -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,
index f0b53bc05b0a5330d200e0f19fb65e7aeb7b318f..a57410bc4a60a6586175d8b502fe80097974910c 100644 (file)
@@ -391,7 +391,7 @@ ScaLAPACKMatrix<NumberType>::copy_from(const LAPACKFullMatrix<NumberType> &B,
   const int              n = 1;
   const std::vector<int> 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<NumberType>::copy_to(LAPACKFullMatrix<NumberType> &B,
   const int              n = 1;
   const std::vector<int> 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;
index 58ea43f2ff36f04c34210abe573065babf116f45..783b6dea3b4f1e0fa2a3531a6f7ba0f10b17f34a 100644 (file)
@@ -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);
         }
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.