diff --git a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.cpp b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.cpp deleted file mode 100644 index 806c3538ae46599c61a713eae9b60ac010035ad6..0000000000000000000000000000000000000000 --- a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//====================================================================================================================== -// -// 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 WeightAssignmentFunctor.cpp -//! \author Sebastian Eibl <sebastian.eibl@fau.de> -// -//====================================================================================================================== - -#include "WeightAssignmentFunctor.h" - -namespace walberla { -namespace pe { -namespace amr { - -const double WeightAssignmentFunctor::baseWeight = real_t(10.0); - -} -} -} diff --git a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h index 3a6b5d9b2ad34969bbdcfcd0e021ff42bcd33f60..24b4d7e969597281ca2005c00f568afacd9b8bfd 100644 --- a/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h +++ b/src/pe/amr/weight_assignment/WeightAssignmentFunctor.h @@ -35,10 +35,7 @@ public: typedef walberla::blockforest::PODPhantomWeight<double> PhantomBlockWeight; typedef walberla::blockforest::PODPhantomWeightPackUnpack<double> PhantomBlockWeightPackUnpackFunctor; - ///Base weight due to allocated data structures. A weight of zero for blocks is dangerous as empty blocks might accumulate on one process! - static const double baseWeight; - - WeightAssignmentFunctor( shared_ptr<InfoCollection>& ic ) : ic_(ic) {} + WeightAssignmentFunctor( shared_ptr<InfoCollection>& ic, const real_t baseWeight = real_t(10.0) ) : ic_(ic), baseWeight_(baseWeight) {} void operator()( std::vector< std::pair< const PhantomBlock *, boost::any > > & blockData, const PhantomBlockForest & ) { @@ -52,7 +49,7 @@ public: { auto infoIt = ic_->find( block->getId()/*.getFatherId()*/ ); WALBERLA_ASSERT_UNEQUAL( infoIt, ic_->end() ); - it->second = PhantomBlockWeight( double_c(infoIt->second.numberOfLocalBodies) + baseWeight ); + it->second = PhantomBlockWeight( double_c(infoIt->second.numberOfLocalBodies) + baseWeight_ ); continue; } @@ -60,7 +57,7 @@ public: { auto infoIt = ic_->find( block->getId() ); WALBERLA_ASSERT_UNEQUAL( infoIt, ic_->end() ); - it->second = PhantomBlockWeight( double_c(infoIt->second.numberOfLocalBodies) + baseWeight ); + it->second = PhantomBlockWeight( double_c(infoIt->second.numberOfLocalBodies) + baseWeight_ ); continue; } @@ -74,14 +71,20 @@ public: WALBERLA_ASSERT_UNEQUAL( childIt, ic_->end() ); weight += double_c(childIt->second.numberOfLocalBodies); } - it->second = PhantomBlockWeight( weight + baseWeight ); + it->second = PhantomBlockWeight( weight + baseWeight_ ); continue; } } } + inline void setBaseWeight( const real_t weight) { baseWeight_ = weight;} + inline real_t getBaseWeight() const { return baseWeight_; } + private: shared_ptr<InfoCollection> ic_; + + ///Base weight due to allocated data structures. A weight of zero for blocks is dangerous as empty blocks might accumulate on one process! + double baseWeight_ = real_t(10.0); }; }