Commit eaf49972 authored by Michael Kuron's avatar Michael Kuron
Browse files

Remove boost::function

parent c0ac624e
......@@ -576,7 +576,7 @@ int main( int argc, char **argv )
// set up synchronization procedure
const real_t overlap = real_t( 1.5 ) * dx;
boost::function<void(void)> syncCall = boost::bind( pe::syncShadowOwners<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false );
std::function<void(void)> syncCall = boost::bind( pe::syncShadowOwners<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false );
// create pe bodies
......@@ -635,7 +635,7 @@ int main( int argc, char **argv )
///////////////
// setup of the LBM communication for synchronizing the pdf field between neighboring blocks
boost::function< void () > commFunction;
std::function< void () > commFunction;
blockforest::communication::UniformBufferedScheme< Stencil_T > scheme( blocks );
scheme.addPackInfo( make_shared< lbm::PdfFieldPackInfo< LatticeModel_T > >( pdfFieldID ) );
commFunction = scheme;
......
......@@ -809,7 +809,7 @@ int main( int argc, char **argv )
// set up synchronization procedure
const real_t overlap = real_t( 1.5 ) * dx;
boost::function<void(void)> syncCall;
std::function<void(void)> syncCall;
if( XBlocks <= uint_t(4) )
syncCall = boost::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false );
else
......@@ -949,7 +949,7 @@ int main( int argc, char **argv )
boost::filesystem::create_directory( tpath );
// setup of the LBM communication for synchronizing the pdf field between neighboring blocks
boost::function< void () > commFunction;
std::function< void () > commFunction;
blockforest::communication::UniformBufferedScheme< Stencil_T > scheme( blocks );
scheme.addPackInfo( make_shared< lbm::PdfFieldPackInfo< LatticeModel_T > >( pdfFieldID ) );
......
......@@ -495,7 +495,7 @@ struct AddLB
{
// setup of the LB communication for synchronizing the pdf field between neighboring blocks
boost::function< void () > commFunction;
std::function< void () > commFunction;
if( directComm )
{
if( fullComm )
......@@ -599,7 +599,7 @@ struct AddLB< LatticeModel_T, typename boost::enable_if_c< boost::mpl::or_<
{
// setup of the LB communication for synchronizing the pdf field between neighboring blocks
boost::function< void () > commFunction;
std::function< void () > commFunction;
if( directComm )
{
......
......@@ -1093,7 +1093,7 @@ int main( int argc, char **argv ) {
/////////////////////////////////
// drag correlation function
boost::function<Vector3<real_t> ( const Vector3<real_t>&, const Vector3<real_t> &, real_t, real_t, real_t, real_t)> dragCorrelationFunction;
std::function<Vector3<real_t> ( const Vector3<real_t>&, const Vector3<real_t> &, real_t, real_t, real_t, real_t)> dragCorrelationFunction;
if( dragCorr == DragCorrelation::ErgunWenYu )
{
dragCorrelationFunction = pe_coupling::discrete_particle_methods::dragForceErgunWenYu;
......@@ -1124,7 +1124,7 @@ int main( int argc, char **argv ) {
}
// lift correlation function
boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> liftCorrelationFunction;
std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> liftCorrelationFunction;
if( liftCorr == LiftCorrelation::NoLift )
{
liftCorrelationFunction = pe_coupling::discrete_particle_methods::noLiftForce;
......@@ -1139,7 +1139,7 @@ int main( int argc, char **argv ) {
}
// added mass correlation function
boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> addedMassCorrelationFunction;
std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> addedMassCorrelationFunction;
if( addedMassCorr == AddedMassCorrelation::NoAM )
{
addedMassCorrelationFunction = pe_coupling::discrete_particle_methods::noAddedMassForce;
......@@ -1154,7 +1154,7 @@ int main( int argc, char **argv ) {
}
// set up effective viscosity calculation
boost::function<real_t ( real_t, real_t)> effectiveViscosityFunction;
std::function<real_t ( real_t, real_t)> effectiveViscosityFunction;
if( effVisc == EffectiveViscosity::None )
{
effectiveViscosityFunction = pe_coupling::discrete_particle_methods::calculateUnchangedEffectiveViscosity;
......@@ -1186,7 +1186,7 @@ int main( int argc, char **argv ) {
(*bodyVelocityTimeDerivativeEvaluator)();
// function used to evaluate the interaction force between fluid and particles
boost::function<void(void)> dragAndPressureForceEvaluationFunction;
std::function<void(void)> dragAndPressureForceEvaluationFunction;
if( dpm == DPMethod::GNS ) {
if (interpol == Interpolation::INearestNeighbor) {
if (dist == Distribution::DNearestNeighbor) {
......@@ -1251,7 +1251,7 @@ int main( int argc, char **argv ) {
// function to evaluate the lift force contribution
boost::function<void(void)> liftForceEvaluationFunction;
std::function<void(void)> liftForceEvaluationFunction;
if( interpol == Interpolation::INearestNeighbor )
{
if( dist == Distribution::DNearestNeighbor )
......@@ -1311,7 +1311,7 @@ int main( int argc, char **argv ) {
}
// function to evaluate the added mass contribution
boost::function<void(void)> addedMassEvaluationFunction;
std::function<void(void)> addedMassEvaluationFunction;
if( interpol == Interpolation::INearestNeighbor )
{
if( dist == Distribution::DNearestNeighbor )
......@@ -1371,7 +1371,7 @@ int main( int argc, char **argv ) {
}
// function to evaluate lubrication forces
boost::function<void(void)> lubricationEvaluationFunction;
std::function<void(void)> lubricationEvaluationFunction;
if( lubricationCutOffDistance > real_t(0) )
{
typedef pe_coupling::discrete_particle_methods::LubricationForceEvaluator LE_T;
......
......@@ -147,7 +147,7 @@ int main( int argc, char ** argv )
cr.setGlobalLinearAcceleration( Vec3(0,0,0) );
WALBERLA_LOG_INFO_ON_ROOT("*** SYNCCALL ***");
boost::function<void(void)> syncCall;
std::function<void(void)> syncCall;
if (!syncShadowOwners)
{
syncCall = boost::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(*forest), storageID, &tt, real_c(0.0), false );
......@@ -157,7 +157,7 @@ int main( int argc, char ** argv )
}
//! [Bind Sync Call]
boost::function<void(void)> syncCallWithoutTT;
std::function<void(void)> syncCallWithoutTT;
if (!syncShadowOwners)
{
syncCallWithoutTT = boost::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false );
......
......@@ -97,7 +97,7 @@ Block::Block( BlockForest & forest, const PhantomBlock & phantom ) :
Block::Block( BlockForest & forest, const BlockID & id, const AABB & aabb, const uint_t level, mpi::RecvBuffer & buffer,
const boost::function< uint_t ( const uint_t ) > & processMapping ) :
const std::function< uint_t ( const uint_t ) > & processMapping ) :
IBlock( forest, aabb, id.getID() ),
......
......@@ -77,7 +77,7 @@ public:
const std::vector< BlockReconstruction::NeighborhoodReconstructionBlock > & neighbors );
Block( BlockForest & forest, const PhantomBlock & phantom );
Block( BlockForest & forest, const BlockID & id, const AABB & aabb, const uint_t level, mpi::RecvBuffer & buffer,
const boost::function< uint_t ( const uint_t ) > & processMapping = boost::function< uint_t ( const uint_t ) >() );
const std::function< uint_t ( const uint_t ) > & processMapping = std::function< uint_t ( const uint_t ) >() );
virtual ~Block() {}
......
......@@ -49,16 +49,16 @@ class BlockForest : public BlockStorage
{
public:
typedef boost::function< void ( std::vector< std::pair< const Block *, uint_t > > & minTargetLevels,
typedef std::function< void ( std::vector< std::pair< const Block *, uint_t > > & minTargetLevels,
std::vector< const Block * > & blocksAlreadyMarkedForRefinement,
const BlockForest & forest ) >
RefreshMinTargetLevelDeterminationFunction;
typedef boost::function< void ( BlockForest & forest, const PhantomBlockForest & phantomForest ) > RefreshCallbackFunction;
typedef std::function< void ( BlockForest & forest, const PhantomBlockForest & phantomForest ) > RefreshCallbackFunction;
typedef boost::function< void ( std::vector<uint_t> & sendTo, std::vector<uint_t> & recvFrom ) > SnapshotCreationFunction;
typedef boost::function< uint_t ( const uint_t ) > SnapshotRestorenFunction;
typedef boost::function< void () > SnapshotRestoreCallbackFunction;
typedef std::function< void ( std::vector<uint_t> & sendTo, std::vector<uint_t> & recvFrom ) > SnapshotCreationFunction;
typedef std::function< uint_t ( const uint_t ) > SnapshotRestorenFunction;
typedef std::function< void () > SnapshotRestoreCallbackFunction;
enum FileIOMode { MPI_PARALLEL, MASTER_SLAVE, SERIALIZED_DISTRIBUTED };
......@@ -87,7 +87,7 @@ public:
class RefreshCallbackWrappper
{
public:
typedef boost::function< void () > Functor_T;
typedef std::function< void () > Functor_T;
RefreshCallbackWrappper( const Functor_T & functor ) : functor_( functor ) {}
void operator()( BlockForest &, const PhantomBlockForest & ) { functor_(); }
private:
......@@ -354,7 +354,7 @@ public:
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() );
template< typename T >
inline BlockDataID addBlockData( boost::function< T* ( IBlock* const block ) > function,
inline BlockDataID addBlockData( std::function< T* ( IBlock* const block ) > function,
const std::string & identifier = std::string(),
const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() )
......@@ -452,7 +452,7 @@ public:
void setRefreshPhantomBlockDataPackFunction( const PhantomBlockForest::PhantomBlockDataPackFunction & f ) { refreshPhantomBlockDataPackFunction_ = f; }
void setRefreshPhantomBlockDataUnpackFunction( const PhantomBlockForest::PhantomBlockDataUnpackFunction & f ) { refreshPhantomBlockDataUnpackFunction_ = f; }
inline bool loadBalancingFunctionRegistered() const { return !refreshPhantomBlockMigrationPreparationFunction_.empty(); }
inline bool loadBalancingFunctionRegistered() const { return static_cast<bool>(refreshPhantomBlockMigrationPreparationFunction_); }
/// get number of "setRefreshPhantomBlockMigrationPreparationFunction" calls
inline uint_t phantomBlockMigrationIterations() const { return phantomBlockMigrationIterations_; }
......
......@@ -32,7 +32,7 @@
#include "core/load_balancing/MetisWrapper.h"
#include "core/math/KahanSummation.h"
#include <boost/function.hpp>
#include <functional>
#include <algorithm>
#include <list>
......@@ -55,7 +55,7 @@ public:
class MetisConfiguration {
public:
typedef boost::function< memory_t ( const BLOCK* const, const BLOCK* const ) > CommunicationFunction;
typedef std::function< memory_t ( const BLOCK* const, const BLOCK* const ) > CommunicationFunction;
MetisConfiguration( const bool _includeMetis = false, const bool _forceMetis = false, CommunicationFunction _communicationFunction = 0,
const real_t _maxUbvec = real_c(1.5), const uint_t _iterations = uint_c(10) ) :
......
......@@ -405,7 +405,7 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock
if( packBlockData )
{
WALBERLA_ASSERT( unpackBlockData );
WALBERLA_ASSERT( static_cast<bool>(unpackBlockData) );
packBlockData( buffer, *pBlock );
}
......@@ -483,7 +483,7 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock
if( unpackBlockData )
{
WALBERLA_ASSERT( packBlockData );
WALBERLA_ASSERT( static_cast<bool>(packBlockData) );
boost::any data;
unpackBlockData( buffer, *phantom, data );
phantom->addData( data );
......
......@@ -42,23 +42,23 @@ class PhantomBlockForest
{
public:
typedef boost::function< Set<SUID> ( const std::vector< std::pair< BlockID, Set<SUID> > > & source, const BlockID & destintation ) >
typedef std::function< Set<SUID> ( const std::vector< std::pair< BlockID, Set<SUID> > > & source, const BlockID & destintation ) >
BlockStateDeterminationFunction;
typedef boost::function< void ( std::vector< std::pair< const PhantomBlock *, boost::any > > & blockData,
typedef std::function< void ( std::vector< std::pair< const PhantomBlock *, boost::any > > & blockData,
const PhantomBlockForest & phantomForest ) >
PhantomBlockDataAssignmentFunction;
/// \param iteration execution counter of this callback
/// \return should the callback rerun after phantom block migration?
typedef boost::function< bool ( std::vector< std::pair< const PhantomBlock *, uint_t > > & targetProcess,
typedef std::function< bool ( std::vector< std::pair< const PhantomBlock *, uint_t > > & targetProcess,
std::set< uint_t > & processesToRecvFrom,
const PhantomBlockForest & phantomForest,
const uint_t iteration ) >
MigrationPreparationFunction; // = load balancing
typedef boost::function< void ( mpi::SendBuffer & buffer, const PhantomBlock & block ) > PhantomBlockDataPackFunction;
typedef boost::function< void ( mpi::RecvBuffer & buffer, const PhantomBlock & block, boost::any & data ) > PhantomBlockDataUnpackFunction;
typedef std::function< void ( mpi::SendBuffer & buffer, const PhantomBlock & block ) > PhantomBlockDataPackFunction;
typedef std::function< void ( mpi::RecvBuffer & buffer, const PhantomBlock & block, boost::any & data ) > PhantomBlockDataUnpackFunction;
......
......@@ -31,7 +31,7 @@
#include "core/math/AABB.h"
#include "core/uid/SUID.h"
#include <boost/function.hpp>
#include <functional>
#include <set>
#include <string>
#include <vector>
......@@ -45,7 +45,7 @@ class SetupBlockForest : private NonCopyable {
public:
typedef boost::function< uint_t ( SetupBlockForest & forest, const uint_t numberOfProcesses, const memory_t perProcessMemoryLimit ) >
typedef std::function< uint_t ( SetupBlockForest & forest, const uint_t numberOfProcesses, const memory_t perProcessMemoryLimit ) >
TargetProcessAssignmentFunction; // returns number of processes (may be lower than numberOfProcesses)
......@@ -72,14 +72,14 @@ public:
// Do not use a vector of bool's! Due to the implementation of this vector in the standard library, parallel access to a
// vector of bool's - even on different elements - is not thread-safe!
typedef boost::function< void ( std::vector<uint8_t>& excludeBlock, const RootBlockAABB& aabb ) > RootBlockExclusionFunction;
typedef std::function< void ( std::vector<uint8_t>& excludeBlock, const RootBlockAABB& aabb ) > RootBlockExclusionFunction;
typedef boost::function< void ( SetupBlockForest& forest ) > RefinementSelectionFunction;
typedef boost::function< void ( SetupBlockForest& forest ) > WorkloadMemorySUIDAssignmentFunction;
typedef std::function< void ( SetupBlockForest& forest ) > RefinementSelectionFunction;
typedef std::function< void ( SetupBlockForest& forest ) > WorkloadMemorySUIDAssignmentFunction;
typedef std::vector< std::pair< const SetupBlock*, const SetupBlock* > > CommunicationPairs;
typedef std::vector< real_t > CommunicationWeights;
typedef boost::function< void ( const CommunicationPairs &, CommunicationWeights & ) > CommunicationWeightFunction;
typedef std::function< void ( const CommunicationPairs &, CommunicationWeights & ) > CommunicationWeightFunction;
inline static void NullCommunicationWeightFunction( const CommunicationPairs &, CommunicationWeights & )
{
......
......@@ -138,7 +138,7 @@ public:
{ return blockForest_->addBlockData( dataHandling, identifier, requiredSelectors, incompatibleSelectors ); }
template< typename T >
inline BlockDataID addBlockData( boost::function< T* ( IBlock* const block ) > function,
inline BlockDataID addBlockData( std::function< T* ( IBlock* const block ) > function,
const std::string& identifier = std::string(),
const Set<SUID>& requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID>& incompatibleSelectors = Set<SUID>::emptySet() )
......
......@@ -37,7 +37,7 @@
#include "core/uid/SUID.h"
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <functional>
#include <map>
#include <set>
......@@ -60,8 +60,8 @@ public:
typedef mpi::RecvBuffer RecvBuffer;
typedef shared_ptr< blockforest::communication::NonUniformPackInfo > PackInfo;
typedef boost::function<void ()> VoidFunction;
typedef boost::function<void ( SendBuffer & buffer )> SendBufferFunction;
typedef std::function<void ()> VoidFunction;
typedef std::function<void ( SendBuffer & buffer )> SendBufferFunction;
//**Construction & Destruction***************************************************************************************
/*! \name Construction & Destruction */
......@@ -110,7 +110,7 @@ public:
//@{
void startCommunication() { startCommunicateEqualLevel(); startCommunicateCoarseToFine(); startCommunicateFineToCoarse(); }
boost::function<void()> getStartCommunicateFunctor() { return boost::bind( &NonUniformBufferedScheme::startCommunication, this ); }
std::function<void()> getStartCommunicateFunctor() { return boost::bind( &NonUniformBufferedScheme::startCommunication, this ); }
inline void startCommunicateEqualLevel();
inline void startCommunicateCoarseToFine();
......@@ -121,7 +121,7 @@ public:
inline void startCommunicateFineToCoarse( const uint_t fineLevel );
void wait() { waitCommunicateEqualLevel(); waitCommunicateCoarseToFine(); waitCommunicateFineToCoarse(); }
boost::function<void() > getWaitFunctor() { return boost::bind( &NonUniformBufferedScheme::wait, this ); }
std::function<void() > getWaitFunctor() { return boost::bind( &NonUniformBufferedScheme::wait, this ); }
inline void waitCommunicateEqualLevel();
inline void waitCommunicateCoarseToFine();
......
......@@ -39,7 +39,7 @@
#include "core/uid/SUID.h"
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <functional>
#include <map>
#include <vector>
......@@ -89,8 +89,8 @@ public:
typedef shared_ptr< walberla::communication::UniformPackInfo > PackInfo;
typedef boost::function<void ()> VoidFunction;
typedef boost::function<void ( SendBuffer & buffer )> SendBufferFunction;
typedef std::function<void ()> VoidFunction;
typedef std::function<void ( SendBuffer & buffer )> SendBufferFunction;
typedef walberla::communication::UniformPackInfo CommunicationItemInfo;
......@@ -161,8 +161,8 @@ public:
void startCommunication();
void wait();
boost::function<void()> getStartCommunicateFunctor();
boost::function<void()> getWaitFunctor();
std::function<void()> getStartCommunicateFunctor();
std::function<void()> getWaitFunctor();
//@}
//*******************************************************************************************************************
......@@ -537,13 +537,13 @@ void UniformBufferedScheme<Stencil>::localBufferUnpacking( const uint_t index, c
}
template< typename Stencil >
boost::function<void()> UniformBufferedScheme<Stencil>::getStartCommunicateFunctor()
std::function<void()> UniformBufferedScheme<Stencil>::getStartCommunicateFunctor()
{
return boost::bind( &UniformBufferedScheme::startCommunication, this );
}
template< typename Stencil >
boost::function<void()> UniformBufferedScheme<Stencil>::getWaitFunctor()
std::function<void()> UniformBufferedScheme<Stencil>::getWaitFunctor()
{
return boost::bind( &UniformBufferedScheme::wait, this );
}
......
......@@ -112,8 +112,8 @@ public:
void startCommunication();
void wait();
boost::function<void()> getStartCommunicateFunctor() { return boost::bind( &UniformDirectScheme::startCommunication, this ); }
boost::function<void()> getWaitFunctor() { return boost::bind( &UniformDirectScheme::wait, this ); }
std::function<void()> getStartCommunicateFunctor() { return boost::bind( &UniformDirectScheme::startCommunication, this ); }
std::function<void()> getWaitFunctor() { return boost::bind( &UniformDirectScheme::wait, this ); }
//@}
//*******************************************************************************************************************
......
......@@ -41,7 +41,7 @@ public:
enum WeightsToUse { PARMETIS_NO_WEIGHTS = 0, PARMETIS_EDGE_WEIGHTS = 1, PARMETIS_VERTEX_WEIGHTS = 2, PARMETIS_BOTH_WEIGHTS = 3 };
typedef std::pair< const SetupBlock *, const SetupBlock * > BlockPair;
typedef boost::function<void (const std::vector< BlockPair > & edges, std::vector< int64_t > & weights ) > CommWeightFunction;
typedef std::function<void (const std::vector< BlockPair > & edges, std::vector< int64_t > & weights ) > CommWeightFunction;
StaticLevelwiseParMetis( const Algorithm algorithm = PARMETIS_PART_GEOM_KWAY )
: algorithm_( algorithm ), weightsToUse_( PARMETIS_VERTEX_WEIGHTS ) {}
......
......@@ -23,7 +23,7 @@
#include "core/singleton/Singleton.h"
#include <boost/function.hpp>
#include <functional>
#include <cstdlib>
#include <sstream>
#include <stdexcept>
......@@ -40,7 +40,7 @@ class Abort : public singleton::Singleton<Abort>
public:
typedef boost::function<void ( const std::string & message, const std::string & callerPath, const int line, bool withDebugInfo )> AbortFunction;
typedef std::function<void ( const std::string & message, const std::string & callerPath, const int line, bool withDebugInfo )> AbortFunction;
void resetAbortFunction( const AbortFunction & function = AbortFunction() ) { abortFunction_ = function; }
......
......@@ -25,7 +25,7 @@
#ifndef NDEBUG
# include "CheckFunctions.h"
# include <boost/function.hpp>
# include <functional>
# include <boost/bind.hpp>
# include <string>
#endif
......@@ -255,12 +255,12 @@ void myAssert(const char * const file, const int line);
class ConditionalExec
{
public:
ConditionalExec( bool cond, const boost::function<void (void)> & function ) : cond_(cond), function_(function) { }
ConditionalExec( bool cond, const std::function<void (void)> & function ) : cond_(cond), function_(function) { }
~ConditionalExec() { if(cond_) function_(); }
operator bool() const { return cond_; }
private:
bool cond_;
boost::function<void (void)> function_;
std::function<void (void)> function_;
};
/// \endcond
......
......@@ -31,7 +31,7 @@
#include "core/Regex.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/function.hpp>
#include <functional>
#include <cmath>
#include <fstream>
......
Markdown is supported
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