From 4ab5f55ad54feb2bde2ef0a01137775a34854ed2 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Tue, 23 May 2017 13:32:17 +0200 Subject: [PATCH] added clear synchronization function --- src/pe/synchronization/ClearSynchronization.h | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/pe/synchronization/ClearSynchronization.h diff --git a/src/pe/synchronization/ClearSynchronization.h b/src/pe/synchronization/ClearSynchronization.h new file mode 100644 index 000000000..2d14c3249 --- /dev/null +++ b/src/pe/synchronization/ClearSynchronization.h @@ -0,0 +1,62 @@ +//====================================================================================================================== +// +// This file is part of waLBerla. waLBerla is free software: you can +// redistribute it and/or modify it under the terms of the GNU General Public +// License as published by the Free Software Foundation, either version 3 of +// the License, or (at your option) any later version. +// +// waLBerla is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. +// +//! \file ClearSynchronization.h +//! \author Sebastian Eibl <sebastian.eibl@fau.de> +// +//====================================================================================================================== + +#pragma once + +//************************************************************************************************* +// Includes +//************************************************************************************************* + +#include "pe/rigidbody/BodyStorage.h" + +#include "domain_decomposition/BlockStorage.h" + +namespace walberla { +namespace pe { + +//************************************************************************************************* +/*!\brief Removes all synchronization information. + * + * \param blocks BlockStorage of the simulation. + * \param BlockDataID BlockDataID of the pe storage. + */ +inline +void clearSynchronization( BlockStorage& blocks, BlockDataID storageID ) +{ + for (auto it = blocks.begin(); it != blocks.end(); ++it) + { + IBlock & currentBlock = *it; + Storage * storage = currentBlock.getData< Storage >( storageID ); + BodyStorage& localStorage = (*storage)[0]; + BodyStorage& shadowStorage = (*storage)[1]; + + for( auto bodyIt = localStorage.begin(); bodyIt != localStorage.end(); ++bodyIt ) + { + bodyIt->MPITrait.clearShadowOwners(); + bodyIt->MPITrait.clearBlockStates(); + } + + shadowStorage.clear(); + } +} +//************************************************************************************************* + +} // namespace pe +} // namespace walberla -- GitLab