Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / nbnxm / gridset.cpp
index f5241a5905eb536e25a36117417651a2020d63a8..f171317019f93533ec40d4605343cbb9d38f7931 100644 (file)
@@ -56,7 +56,7 @@ namespace Nbnxm
 {
 
 //! Returns the number of search grids
-static int numGrids(const GridSet::DomainSetup &domainSetup)
+static int numGrids(const GridSet::DomainSetupdomainSetup)
 {
     int numGrids;
     if (domainSetup.doTestParticleInsertion)
@@ -80,8 +80,8 @@ static int numGrids(const GridSet::DomainSetup &domainSetup)
 
 GridSet::DomainSetup::DomainSetup(const int                 ePBC,
                                   const bool                doTestParticleInsertion,
-                                  const ivec               *numDDCells,
-                                  const gmx_domdec_zones_t *ddZones) :
+                                  const ivec*               numDDCells,
+                                  const gmx_domdec_zones_tddZones) :
     ePBC(ePBC),
     doTestParticleInsertion(doTestParticleInsertion),
     haveMultipleDomains(numDDCells != nullptr),
@@ -95,8 +95,8 @@ GridSet::DomainSetup::DomainSetup(const int                 ePBC,
 
 GridSet::GridSet(const int                 ePBC,
                  const bool                doTestParticleInsertion,
-                 const ivec               *numDDCells,
-                 const gmx_domdec_zones_t *ddZones,
+                 const ivec*               numDDCells,
+                 const gmx_domdec_zones_tddZones,
                  const PairlistType        pairlistType,
                  const bool                haveFep,
                  const int                 numThreads,
@@ -116,13 +116,13 @@ GridSet::GridSet(const int                 ePBC,
 void GridSet::setLocalAtomOrder()
 {
     /* Set the atom order for the home cell (index 0) */
-    const Nbnxm::Grid &grid = grids_[0];
+    const Nbnxm::Gridgrid = grids_[0];
 
-    int                atomIndex = 0;
+    int atomIndex = 0;
     for (int cxy = 0; cxy < grid.numColumns(); cxy++)
     {
         const int numAtoms  = grid.numAtomsInColumn(cxy);
-        int       cellIndex = grid.firstCellInColumn(cxy)*grid.geometry().numAtomsPerCell;
+        int       cellIndex = grid.firstCellInColumn(cxy) * grid.geometry().numAtomsPerCell;
         for (int i = 0; i < numAtoms; i++)
         {
             gridSetData_.atomIndices[cellIndex] = atomIndex;
@@ -133,35 +133,35 @@ void GridSet::setLocalAtomOrder()
     }
 }
 
-void GridSet::putOnGrid(const matrix                    box,
-                        const int                       gridIndex,
-                        const rvec                      lowerCorner,
-                        const rvec                      upperCorner,
-                        const gmx::UpdateGroupsCog     *updateGroupsCog,
-                        const gmx::Range<int>           atomRange,
-                        real                            atomDensity,
-                        gmx::ArrayRef<const int>        atomInfo,
-                        gmx::ArrayRef<const gmx::RVec>  x,
-                        const int                       numAtomsMoved,
-                        const int                      *move,
-                        nbnxn_atomdata_t               *nbat)
+void GridSet::putOnGrid(const matrix                   box,
+                        const int                      gridIndex,
+                        const rvec                     lowerCorner,
+                        const rvec                     upperCorner,
+                        const gmx::UpdateGroupsCog*    updateGroupsCog,
+                        const gmx::Range<int>          atomRange,
+                        real                           atomDensity,
+                        gmx::ArrayRef<const int>       atomInfo,
+                        gmx::ArrayRef<const gmx::RVec> x,
+                        const int                      numAtomsMoved,
+                        const int*                     move,
+                        nbnxn_atomdata_t*              nbat)
 {
-    Nbnxm::Grid  &grid = grids_[gridIndex];
+    Nbnxm::Gridgrid = grids_[gridIndex];
 
-    int           cellOffset;
+    int cellOffset;
     if (gridIndex == 0)
     {
         cellOffset = 0;
     }
     else
     {
-        const Nbnxm::Grid &previousGrid = grids_[gridIndex - 1];
-        cellOffset = previousGrid.atomIndexEnd()/previousGrid.geometry().numAtomsPerCell;
+        const Nbnxm::GridpreviousGrid = grids_[gridIndex - 1];
+        cellOffset = previousGrid.atomIndexEnd() / previousGrid.geometry().numAtomsPerCell;
     }
 
     const int n = atomRange.size();
 
-    real      maxAtomGroupRadius;
+    real maxAtomGroupRadius;
     if (gridIndex == 0)
     {
         copy_mat(box, box_);
@@ -176,15 +176,14 @@ void GridSet::putOnGrid(const matrix                    box,
 
         if (debug)
         {
-            fprintf(debug, "natoms_local = %5d atom_density = %5.1f\n",
-                    numRealAtomsLocal_, atomDensity);
+            fprintf(debug, "natoms_local = %5d atom_density = %5.1f\n", numRealAtomsLocal_, atomDensity);
         }
     }
     else
     {
-        const Nbnxm::Grid::Dimensions &dimsGrid0 = grids_[0].dimensions();
-        atomDensity        = dimsGrid0.atomDensity;
-        maxAtomGroupRadius = dimsGrid0.maxAtomGroupRadius;
+        const Nbnxm::Grid::DimensionsdimsGrid0 = grids_[0].dimensions();
+        atomDensity                              = dimsGrid0.atomDensity;
+        maxAtomGroupRadius                       = dimsGrid0.maxAtomGroupRadius;
 
         numRealAtomsTotal_ = std::max(numRealAtomsTotal_, *atomRange.end());
     }
@@ -194,15 +193,11 @@ void GridSet::putOnGrid(const matrix                    box,
      */
     const int ddZone = (domainSetup_.doTestParticleInsertion ? 0 : gridIndex);
     // grid data used in GPU transfers inherits the gridset pinning policy
-    auto      pinPolicy = gridSetData_.cells.get_allocator().pinningPolicy();
-    grid.setDimensions(ddZone, n - numAtomsMoved,
-                       lowerCorner, upperCorner,
-                       atomDensity,
-                       maxAtomGroupRadius,
-                       haveFep_,
-                       pinPolicy);
-
-    for (GridWork &work : gridWork_)
+    auto pinPolicy = gridSetData_.cells.get_allocator().pinningPolicy();
+    grid.setDimensions(ddZone, n - numAtomsMoved, lowerCorner, upperCorner, atomDensity,
+                       maxAtomGroupRadius, haveFep_, pinPolicy);
+
+    for (GridWork& work : gridWork_)
     {
         work.numAtomsPerColumn.resize(grid.numColumns() + 1);
     }
@@ -218,19 +213,15 @@ void GridSet::putOnGrid(const matrix                    box,
     {
         try
         {
-            Grid::calcColumnIndices(grid.dimensions(),
-                                    updateGroupsCog,
-                                    atomRange, x,
-                                    ddZone, move, thread, nthread,
-                                    gridSetData_.cells,
-                                    gridWork_[thread].numAtomsPerColumn);
+            Grid::calcColumnIndices(grid.dimensions(), updateGroupsCog, atomRange, x, ddZone, move, thread,
+                                    nthread, gridSetData_.cells, gridWork_[thread].numAtomsPerColumn);
         }
-        GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+        GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
     }
 
     /* Copy the already computed cell indices to the grid and sort, when needed */
-    grid.setCellIndices(ddZone, cellOffset, &gridSetData_, gridWork_,
-                        atomRange, atomInfo.data(), x, numAtomsMoved, nbat);
+    grid.setCellIndices(ddZone, cellOffset, &gridSetData_, gridWork_, atomRange, atomInfo.data(), x,
+                        numAtomsMoved, nbat);
 
     if (gridIndex == 0)
     {