Skip to content
Snippets Groups Projects
Commit f364d10d authored by Christoph Rettinger's avatar Christoph Rettinger
Browse files

Added functor wrappers for refinement

parent 50412516
Branches
Tags
No related merge requests found
//======================================================================================================================
//
// 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 RefinementFunctorWrapper.h
//! \ingroup lbm
//! \author Christoph Rettinger <christoph.rettinger@fau.de>
//
//======================================================================================================================
#pragma once
#include "domain_decomposition/BlockStorage.h"
#include <boost/function.hpp>
namespace walberla {
namespace lbm {
namespace refinement {
class FunctorWrapper {
public:
FunctorWrapper(boost::function<void()> fct)
: fct_(fct) {
}
void operator()(const uint_t /*level*/, const uint_t /*executionCounter*/) {
fct_();
}
private:
boost::function<void(void)> fct_;
};
class SweepAsFunctorWrapper {
public:
SweepAsFunctorWrapper( boost::function<void(IBlock * )> fct, const shared_ptr <StructuredBlockStorage> &blockStorage )
: fct_(fct), blockStorage_(blockStorage) {
}
void operator()(const uint_t level, const uint_t /*executionCounter*/) {
for (auto blockIt = blockStorage_->begin(); blockIt != blockStorage_->end(); ++blockIt) {
if (blockStorage_->getLevel(*blockIt) != level) continue;
fct_(blockIt.get());
}
}
private:
boost::function<void(IBlock * )> fct_;
shared_ptr <StructuredBlockStorage> blockStorage_;
};
} // namespace refinement
} // namespace lbm
} // namespace walberla
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "BoundarySetup.h" #include "BoundarySetup.h"
#include "PdfFieldPackInfo.h" #include "PdfFieldPackInfo.h"
#include "PdfFieldSyncPackInfo.h" #include "PdfFieldSyncPackInfo.h"
#include "RefinementFunctorWrapper.h"
#include "TimeStep.h" #include "TimeStep.h"
#include "TimeStepPdfPackInfo.h" #include "TimeStepPdfPackInfo.h"
#include "TimeTracker.h" #include "TimeTracker.h"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment