Apply re-formatting to C++ in src/ tree.
[alexxy/gromacs.git] / src / gromacs / domdec / distribute.cpp
index 062acc6b570c712254536c922220ad6dcb1a1adc..9485b08d13325b28ee737b8f119339309a915369 100644 (file)
@@ -87,8 +87,7 @@ static void distributeVecSendrecv(gmx_domdec_t*                  dd,
                                    "The index count and number of indices should match");
 
 #if GMX_MPI
-                MPI_Send(buffer.data(), domainGroups.numAtoms * sizeof(gmx::RVec), MPI_BYTE, rank,
-                         rank, dd->mpi_comm_all);
+                MPI_Send(buffer.data(), domainGroups.numAtoms * sizeof(gmx::RVec), MPI_BYTE, rank, rank, dd->mpi_comm_all);
 #endif
             }
         }
@@ -104,8 +103,13 @@ static void distributeVecSendrecv(gmx_domdec_t*                  dd,
     {
 #if GMX_MPI
         int numHomeAtoms = dd->comm->atomRanges.numHomeAtoms();
-        MPI_Recv(localVec.data(), numHomeAtoms * sizeof(gmx::RVec), MPI_BYTE, dd->masterrank,
-                 MPI_ANY_TAG, dd->mpi_comm_all, MPI_STATUS_IGNORE);
+        MPI_Recv(localVec.data(),
+                 numHomeAtoms * sizeof(gmx::RVec),
+                 MPI_BYTE,
+                 dd->masterrank,
+                 MPI_ANY_TAG,
+                 dd->mpi_comm_all,
+                 MPI_STATUS_IGNORE);
 #endif
     }
 }
@@ -136,8 +140,12 @@ static void distributeVecScatterv(gmx_domdec_t*                  dd,
     }
 
     int numHomeAtoms = dd->comm->atomRanges.numHomeAtoms();
-    dd_scatterv(dd, sendCounts, displacements, DDMASTER(dd) ? dd->ma->rvecBuffer.data() : nullptr,
-                numHomeAtoms * sizeof(gmx::RVec), localVec.data());
+    dd_scatterv(dd,
+                sendCounts,
+                displacements,
+                DDMASTER(dd) ? dd->ma->rvecBuffer.data() : nullptr,
+                numHomeAtoms * sizeof(gmx::RVec),
+                localVec.data());
 }
 
 static void distributeVec(gmx_domdec_t*                  dd,
@@ -401,12 +409,11 @@ static std::vector<std::vector<int>> getAtomGroupDistribution(const gmx::MDLogge
             {
                 for (int g = 0; g < updateGrouping.numBlocks(); g++)
                 {
-                    const auto& block     = updateGrouping.block(g);
-                    const int   atomBegin = atomOffset + block.begin();
-                    const int   atomEnd   = atomOffset + block.end();
-                    const int   domainIndex =
-                            computeAtomGroupDomainIndex(*dd, ddbox, triclinicCorrectionMatrix,
-                                                        cellBoundaries, atomBegin, atomEnd, box, pos);
+                    const auto& block       = updateGrouping.block(g);
+                    const int   atomBegin   = atomOffset + block.begin();
+                    const int   atomEnd     = atomOffset + block.end();
+                    const int   domainIndex = computeAtomGroupDomainIndex(
+                            *dd, ddbox, triclinicCorrectionMatrix, cellBoundaries, atomBegin, atomEnd, box, pos);
 
                     for (int atomIndex : block)
                     {
@@ -426,8 +433,8 @@ static std::vector<std::vector<int>> getAtomGroupDistribution(const gmx::MDLogge
         /* Compute the center of geometry for all atoms */
         for (int atom = 0; atom < mtop.natoms; atom++)
         {
-            int domainIndex = computeAtomGroupDomainIndex(*dd, ddbox, triclinicCorrectionMatrix,
-                                                          cellBoundaries, atom, atom + 1, box, pos);
+            int domainIndex = computeAtomGroupDomainIndex(
+                    *dd, ddbox, triclinicCorrectionMatrix, cellBoundaries, atom, atom + 1, box, pos);
 
             indices[domainIndex].push_back(atom);
             ma.domainGroups[domainIndex].numAtoms += 1;
@@ -459,9 +466,11 @@ static std::vector<std::vector<int>> getAtomGroupDistribution(const gmx::MDLogge
         GMX_LOG(mdlog.info)
                 .appendTextFormatted(
                         "Atom distribution over %d domains: av %d stddev %d min %d max %d",
-                        dd->nnodes, nat_sum,
+                        dd->nnodes,
+                        nat_sum,
                         gmx::roundToInt(std::sqrt(nat2_sum - gmx::square(static_cast<double>(nat_sum)))),
-                        nat_min, nat_max);
+                        nat_min,
+                        nat_max);
     }
 
     return indices;
@@ -519,8 +528,8 @@ static void distributeAtomGroups(const gmx::MDLogger& mdlog,
             ma->intBuffer[rank]              = groupIndices[rank].size() * sizeof(int);
             ma->intBuffer[dd->nnodes + rank] = groupOffset * sizeof(int);
 
-            ma->atomGroups.insert(ma->atomGroups.end(), groupIndices[rank].begin(),
-                                  groupIndices[rank].end());
+            ma->atomGroups.insert(
+                    ma->atomGroups.end(), groupIndices[rank].begin(), groupIndices[rank].end());
 
             ma->domainGroups[rank].atomGroups = gmx::constArrayRefFromArray(
                     ma->atomGroups.data() + groupOffset, groupIndices[rank].size());
@@ -529,9 +538,11 @@ static void distributeAtomGroups(const gmx::MDLogger& mdlog,
         }
     }
 
-    dd_scatterv(dd, bMaster ? ma->intBuffer.data() : nullptr,
+    dd_scatterv(dd,
+                bMaster ? ma->intBuffer.data() : nullptr,
                 bMaster ? ma->intBuffer.data() + dd->nnodes : nullptr,
-                bMaster ? ma->atomGroups.data() : nullptr, dd->ncg_home * sizeof(int),
+                bMaster ? ma->atomGroups.data() : nullptr,
+                dd->ncg_home * sizeof(int),
                 dd->globalAtomGroupIndices.data());
 
     if (debug)