diff --git a/src/parallel/boundaries/BoundaryHandler.cpp b/src/parallel/boundaries/BoundaryHandler.cpp index 9d4619083..0db3ac74c 100644 --- a/src/parallel/boundaries/BoundaryHandler.cpp +++ b/src/parallel/boundaries/BoundaryHandler.cpp @@ -140,7 +140,8 @@ bool BoundaryHandler::isGlobalWall(int dimension) const { return isGlobalWall(BoundaryUtils::convertLS1DimsToDimensionPos(dimension)); } -void BoundaryHandler::processGlobalWallLeavingParticles(ParticleContainer* moleculeContainer, double timestepLength) { +void BoundaryHandler::processGlobalWallLeavingParticles( + ParticleContainer *moleculeContainer, double timestepLength) { double cutoff = moleculeContainer->getCutoff(); for (auto const ¤tWall : _isGlobalWall) { if (!currentWall.second) // not a global wall @@ -188,8 +189,9 @@ void BoundaryHandler::processGlobalWallLeavingParticles(ParticleContainer* molec BoundaryUtils::BoundaryType::REFLECTING) { double currentVel = it->v(currentDim); // reflect the velocity, such that when the leapfrog integrator adds - // nextStepVelAdjustment in the next integration step, the final result - // ends up being currentVel+nextStepVelAdjustment in the negative direction of travel + // nextStepVelAdjustment in the next integration step, the final + // result ends up being currentVel+nextStepVelAdjustment in the + // negative direction of travel it->setv(currentDim, -currentVel - nextStepVelAdjustment - nextStepVelAdjustment); } else { // outflow, delete the particle if it would leave @@ -207,7 +209,8 @@ void BoundaryHandler::processGlobalWallLeavingParticles(ParticleContainer* molec } } -void BoundaryHandler::removeNonPeriodicHalos(ParticleContainer* moleculeContainer) { +void BoundaryHandler::removeNonPeriodicHalos( + ParticleContainer *moleculeContainer) { // get halo lengths in each dimension double buffers[] = { moleculeContainer->get_halo_L(0) + moleculeContainer->getSkin(), diff --git a/src/parallel/boundaries/BoundaryHandler.h b/src/parallel/boundaries/BoundaryHandler.h index 5d8766870..ddd8a14b9 100644 --- a/src/parallel/boundaries/BoundaryHandler.h +++ b/src/parallel/boundaries/BoundaryHandler.h @@ -17,14 +17,17 @@ /** * Class to handle boundary conditions, namely leaving and halo particles. - * - * The objects of this class store the local and global bounds of the subdomain in every process, - * and provide functions to deal with leaving particles, and delete halo particles. - * - * The internal walls of the subdomain, touching other subdomains are 'local' walls - * while the walls that are also the limits of the global domain are 'global' walls. - * - * Since the behaviour of 'local' walls are unchanged, they are assigned to 'PERIODIC'. + * + * The objects of this class store the local and global bounds of the subdomain + * in every process, and provide functions to deal with leaving particles, and + * delete halo particles. + * + * The internal walls of the subdomain, touching other subdomains are 'local' + * walls while the walls that are also the limits of the global domain are + * 'global' walls. + * + * Since the behaviour of 'local' walls are unchanged, they are assigned to + * 'PERIODIC'. */ class BoundaryHandler { @@ -51,8 +54,9 @@ class BoundaryHandler { /** * Check if any of the global boundaries are non-periodic. - * - * This check helps bypass all boundary-related code if default behaviour (all periodic boundaries) is expected. + * + * This check helps bypass all boundary-related code if default behaviour + * (all periodic boundaries) is expected. */ bool hasNonPeriodicBoundary() const; @@ -70,46 +74,51 @@ class BoundaryHandler { /** * Determine which walls in the local region are actually global walls. - * - * Should be called after changing global and local regions (typically after a rebalance). + * + * Should be called after changing global and local regions (typically after a + * rebalance). */ void findGlobalWallsInLocalRegion(); - /* Check if the local wall in a particular dimension is actually a global wall. */ + /* Check if the local wall in a particular dimension is actually a global + * wall. */ bool isGlobalWall(BoundaryUtils::DimensionType dimension) const; - /* Check if the local wall in a particular dimension is actually a global wall. */ + /* Check if the local wall in a particular dimension is actually a global + * wall. */ bool isGlobalWall(int dimension) const; /** * Processes all particles that would leave the global domain. - * + * * If a subdomain has no global walls, this function does nothing. - * For every global wall, the fucktion iterates through all particles that are one cutoff distance away - * from the wall. If these particles would leave the global box in the next simulation, the following is done: - * + * For every global wall, the fucktion iterates through all particles that are + * one cutoff distance away from the wall. If these particles would leave the + * global box in the next simulation, the following is done: + * * PERIODIC - nop (default behaviour). - * REFLECTING - The particle's velocity is reversed normal to the wall it's leaving. - * OUTFLOW - The particle is deleted. + * REFLECTING - The particle's velocity is reversed normal to the wall it's + * leaving. OUTFLOW - The particle is deleted. */ - void processGlobalWallLeavingParticles(ParticleContainer* moleculeContainer, double timestepLength); + void processGlobalWallLeavingParticles(ParticleContainer *moleculeContainer, + double timestepLength); /** * Processes all halo particles outside the global domain. - * + * * If a subdomain has no global walls, this function does nothing. - * For every global wall, the fucktion iterates through all halo particles that are one cutoff distance away - * from the wall. The following is done for each particle: - * + * For every global wall, the fucktion iterates through all halo particles + * that are one cutoff distance away from the wall. The following is done for + * each particle: + * * PERIODIC - nop (default behaviour). * REFLECTING - The halo particle is deleted. * OUTFLOW - The halo particle is deleted. */ - void removeNonPeriodicHalos(ParticleContainer* moleculeContainer); + void removeNonPeriodicHalos(ParticleContainer *moleculeContainer); private: - -/* List of global boundary type per dimension. */ + /* List of global boundary type per dimension. */ std::map _boundaries; diff --git a/src/parallel/boundaries/BoundaryUtils.h b/src/parallel/boundaries/BoundaryUtils.h index f6fd27909..e6bdbdd88 100644 --- a/src/parallel/boundaries/BoundaryUtils.h +++ b/src/parallel/boundaries/BoundaryUtils.h @@ -38,7 +38,7 @@ enum class BoundaryType { PERIODIC, OUTFLOW, REFLECTING, ERROR }; /** * enum storing the axes and direction. - * + * * The dimensions are POSX, NEGX, POSY, NEGY, POSZ and NEGZ. * * This is hardcoded for 3D, and ERROR is included for sanity checks. @@ -124,10 +124,12 @@ getOuterBuffer(const std::array givenRegionBegin, const std::array givenRegionEnd, DimensionType dimension, double *regionWidth); -/* Returns the sign of a number, used for determining direction from a dimension. */ +/* Returns the sign of a number, used for determining direction from a + * dimension. */ inline int findSign(int n) { return n < 0 ? -1 : 1; } -/* Returns the sign of a number, used for determining direction from a dimension. */ +/* Returns the sign of a number, used for determining direction from a + * dimension. */ inline int findSign(DimensionType dimension) { return findSign(convertDimensionToNumeric(dimension)); }