From efc332a868a80faff5a1e42213ac9aa8727ad9c0 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Fri, 8 Dec 2017 17:10:38 +0100 Subject: [PATCH] in correspondence to NoPhantomData added PODPhantomData --- .../loadbalancing/PODPhantomData.h | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/blockforest/loadbalancing/PODPhantomData.h diff --git a/src/blockforest/loadbalancing/PODPhantomData.h b/src/blockforest/loadbalancing/PODPhantomData.h new file mode 100644 index 000000000..ccf514a1f --- /dev/null +++ b/src/blockforest/loadbalancing/PODPhantomData.h @@ -0,0 +1,66 @@ +//====================================================================================================================== +// +// 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 PODPhantomData.h +//! \ingroup blockforest +//! \author Sebastian Eibl <sebastian.eibl@fau.de> +// +//====================================================================================================================== + +#pragma once + +#include "blockforest/PhantomBlock.h" +#include "core/DataTypes.h" +#include "core/mpi/RecvBuffer.h" +#include "core/mpi/SendBuffer.h" + + +namespace walberla { +namespace blockforest { + +template <typename T> +class PODPhantomWeight +{ +public: + + typedef T weight_t; + + PODPhantomWeight( const T _weight ) : weight_( _weight ) {} + + T weight() const { return weight_; } + +private: + T weight_; +}; + +template <typename T> +struct PODPhantomWeightPackUnpack +{ + void operator()( mpi::SendBuffer & buffer, const PhantomBlock & block ) + { + buffer << block.getData< PODPhantomWeight<T> >().weight(); + } + + void operator()( mpi::RecvBuffer & buffer, const PhantomBlock &, boost::any & data ) + { + typename PODPhantomWeight<T>::weight_t w; + buffer >> w; + data = PODPhantomWeight<T>( w ); + } +}; + + +} // namespace blockforest +} // namespace walberla -- GitLab