Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Houman Mirzaalian Dastjerdi
waLBerla
Commits
26ac8bb5
Commit
26ac8bb5
authored
May 30, 2018
by
Christian Godenschwager
Browse files
Replace boost::bind with std::bind
Part of issue #48
parent
9e36486b
Changes
67
Hide whitespace changes
Inline
Side-by-side
apps/benchmarks/CouetteFlow/CouetteFlow.cpp
View file @
26ac8bb5
...
...
@@ -91,7 +91,6 @@
#include
"vtk/Initialization.h"
#include
"vtk/VTKOutput.h"
#include
<boost/bind.hpp>
#include
<boost/mpl/or.hpp>
#include
<boost/type_traits/is_same.hpp>
...
...
@@ -99,6 +98,7 @@
#include
<cmath>
#include
<cstdlib>
#include
<cstring>
#include
<functional>
#include
<iostream>
#include
<utility>
#include
<vector>
...
...
@@ -294,7 +294,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest:
(
setup
.
zCells
+
uint_t
(
2
)
*
FieldGhostLayers
)
)
*
memoryPerCell
;
forest
->
addRefinementSelectionFunction
(
refinementSelectionFunctions
);
forest
->
addWorkloadMemorySUIDAssignmentFunction
(
boo
st
::
bind
(
workloadAndMemoryAssignment
,
_1
,
memoryPerBlock
)
);
forest
->
addWorkloadMemorySUIDAssignmentFunction
(
st
d
::
bind
(
workloadAndMemoryAssignment
,
std
::
placeholders
::
_1
,
memoryPerBlock
)
);
forest
->
init
(
AABB
(
real_c
(
0
),
real_c
(
0
),
real_c
(
0
),
real_c
(
setup
.
xBlocks
*
setup
.
xCells
),
real_c
(
setup
.
yBlocks
*
setup
.
yCells
),
...
...
@@ -736,11 +736,11 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// evaluation
const
auto
exactSolutionFunction
=
boo
st
::
bind
(
exactVelocity
,
_1
,
blocks
->
getDomain
(),
setup
.
maxVelocity_L
);
const
auto
exactSolutionFunction
=
st
d
::
bind
(
exactVelocity
,
std
::
placeholders
::
_1
,
blocks
->
getDomain
(),
setup
.
maxVelocity_L
);
auto
volumetricFlowRate
=
field
::
makeVolumetricFlowRateEvaluation
<
VelocityAdaptor_T
,
FlagField_T
>
(
configBlock
,
blocks
,
velocityAdaptorId
,
flagFieldId
,
Fluid_Flag
,
boo
st
::
bind
(
exactFlowRate
,
setup
.
flowRate_L
),
st
d
::
bind
(
exactFlowRate
,
setup
.
flowRate_L
),
exactSolutionFunction
);
volumetricFlowRate
->
setNormalizationFactor
(
real_t
(
1
)
/
setup
.
maxVelocity_L
);
volumetricFlowRate
->
setDomainNormalization
(
Vector3
<
real_t
>
(
real_t
(
1
)
)
);
...
...
apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp
View file @
26ac8bb5
...
...
@@ -62,6 +62,8 @@
#include
"field/vtk/all.h"
#include
"lbm/vtk/all.h"
#include
<functional>
namespace
forces_on_sphere_near_plane_in_shear_flow
{
...
...
@@ -177,7 +179,7 @@ static shared_ptr< StructuredBlockForest > createBlockStructure( const AABB & do
WALBERLA_LOG_INFO_ON_ROOT
(
" - refinement box: "
<<
refinementBox
);
sforest
.
addRefinementSelectionFunction
(
boo
st
::
bind
(
refinementSelection
,
_1
,
numberOfLevels
,
refinementBox
)
);
sforest
.
addRefinementSelectionFunction
(
st
d
::
bind
(
refinementSelection
,
std
::
placeholders
::
_1
,
numberOfLevels
,
refinementBox
)
);
sforest
.
addWorkloadMemorySUIDAssignmentFunction
(
workloadAndMemoryAssignment
);
sforest
.
init
(
domainAABB
,
numberOfCoarseBlocksPerDirection
[
0
],
numberOfCoarseBlocksPerDirection
[
1
],
numberOfCoarseBlocksPerDirection
[
2
],
true
,
true
,
false
);
...
...
@@ -576,7 +578,7 @@ int main( int argc, char **argv )
// set up synchronization procedure
const
real_t
overlap
=
real_t
(
1.5
)
*
dx
;
std
::
function
<
void
(
void
)
>
syncCall
=
boo
st
::
bind
(
pe
::
syncShadowOwners
<
BodyTypeTuple
>
,
boo
st
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
std
::
function
<
void
(
void
)
>
syncCall
=
st
d
::
bind
(
pe
::
syncShadowOwners
<
BodyTypeTuple
>
,
st
d
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
// create pe bodies
...
...
apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp
View file @
26ac8bb5
...
...
@@ -58,6 +58,7 @@
#include
"vtk/Initialization.h"
#include
"vtk/VTKOutput.h"
#include
<functional>
#include
<memory>
...
...
@@ -811,9 +812,9 @@ int main( int argc, char **argv )
const
real_t
overlap
=
real_t
(
1.5
)
*
dx
;
std
::
function
<
void
(
void
)
>
syncCall
;
if
(
XBlocks
<=
uint_t
(
4
)
)
syncCall
=
boo
st
::
bind
(
pe
::
syncNextNeighbors
<
BodyTypeTuple
>
,
boo
st
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
syncCall
=
st
d
::
bind
(
pe
::
syncNextNeighbors
<
BodyTypeTuple
>
,
st
d
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
else
syncCall
=
boo
st
::
bind
(
pe
::
syncShadowOwners
<
BodyTypeTuple
>
,
boo
st
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
syncCall
=
st
d
::
bind
(
pe
::
syncShadowOwners
<
BodyTypeTuple
>
,
st
d
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
real_t
xParticle
=
real_t
(
0
);
...
...
apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp
View file @
26ac8bb5
...
...
@@ -76,6 +76,7 @@
#include
"vtk/VTKOutput.h"
#include
<cstdlib>
#include
<functional>
#include
<iostream>
...
...
@@ -279,7 +280,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf
uint_c
(
19
*
sizeof
(
real_t
)
)
)
/
numeric_cast
<
memory_t
>
(
1024
*
1024
);
sforest
.
addRefinementSelectionFunction
(
refinementSelection
);
sforest
.
addWorkloadMemorySUIDAssignmentFunction
(
boo
st
::
bind
(
workloadAndMemoryAssignment
,
_1
,
memoryPerBlock
)
);
sforest
.
addWorkloadMemorySUIDAssignmentFunction
(
st
d
::
bind
(
workloadAndMemoryAssignment
,
std
::
placeholders
::
_1
,
memoryPerBlock
)
);
sforest
.
init
(
AABB
(
real_t
(
0
),
real_t
(
0
),
real_t
(
0
),
real_c
(
numberOfXBlocks
*
numberOfXCellsPerBlock
),
real_c
(
numberOfYBlocks
*
numberOfYCellsPerBlock
),
...
...
apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp
View file @
26ac8bb5
...
...
@@ -88,12 +88,11 @@
#include
"vtk/Initialization.h"
#include
"vtk/VTKOutput.h"
#include
<boost/bind.hpp>
#include
<algorithm>
#include
<cmath>
#include
<cstdlib>
#include
<cstring>
#include
<functional>
#include
<iostream>
#include
<utility>
#include
<vector>
...
...
@@ -303,7 +302,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest:
(
setup
.
zCells
+
uint_t
(
2
)
*
FieldGhostLayers
)
)
*
memoryPerCell
;
forest
->
addRefinementSelectionFunction
(
refinementSelectionFunctions
);
forest
->
addWorkloadMemorySUIDAssignmentFunction
(
boo
st
::
bind
(
workloadAndMemoryAssignment
,
_1
,
memoryPerBlock
)
);
forest
->
addWorkloadMemorySUIDAssignmentFunction
(
st
d
::
bind
(
workloadAndMemoryAssignment
,
std
::
placeholders
::
_1
,
memoryPerBlock
)
);
forest
->
init
(
AABB
(
real_c
(
0
),
real_c
(
0
),
real_c
(
0
),
real_c
(
setup
.
xBlocks
*
setup
.
xCells
),
real_c
(
setup
.
yBlocks
*
setup
.
yCells
),
...
...
@@ -847,12 +846,12 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
// evaluation
const
auto
exactSolutionFunction
=
setup
.
circularProfile
?
boo
st
::
bind
(
exactPipeVelocity
,
_1
,
blocks
,
setup
)
:
boo
st
::
bind
(
exactPlatesVelocity
,
_1
,
blocks
,
setup
);
const
auto
exactSolutionFunction
=
setup
.
circularProfile
?
st
d
::
bind
(
exactPipeVelocity
,
std
::
placeholders
::
_1
,
blocks
,
setup
)
:
st
d
::
bind
(
exactPlatesVelocity
,
std
::
placeholders
::
_1
,
blocks
,
setup
);
auto
volumetricFlowRate
=
field
::
makeVolumetricFlowRateEvaluation
<
VelocityAdaptor_T
,
FlagField_T
>
(
configBlock
,
blocks
,
velocityAdaptorId
,
flagFieldId
,
Fluid_Flag
,
boo
st
::
bind
(
exactFlowRate
,
setup
.
flowRate_L
),
st
d
::
bind
(
exactFlowRate
,
setup
.
flowRate_L
),
exactSolutionFunction
);
volumetricFlowRate
->
setNormalizationFactor
(
real_t
(
1
)
/
setup
.
maxVelocity_L
);
volumetricFlowRate
->
setDomainNormalization
(
Vector3
<
real_t
>
(
real_t
(
1
)
)
);
...
...
apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp
View file @
26ac8bb5
...
...
@@ -106,12 +106,12 @@
#include
<boost/mpl/equal_to.hpp>
#include
<boost/mpl/int.hpp>
#include
<boost/mpl/or.hpp>
#include
<boost/bind.hpp>
#include
<algorithm>
#include
<cmath>
#include
<cstdlib>
#include
<cstring>
#include
<functional>
#include
<iostream>
#include
<utility>
#include
<vector>
...
...
@@ -656,7 +656,7 @@ static shared_ptr< SetupBlockForest > createSetupBlockForest( const blockforest:
(
setup
.
xCells
+
uint_t
(
2
)
*
FieldGhostLayers
)
)
*
memoryPerCell
;
forest
->
addRefinementSelectionFunction
(
refinementSelectionFunctions
);
forest
->
addWorkloadMemorySUIDAssignmentFunction
(
boo
st
::
bind
(
workloadMemoryAndSUIDAssignment
,
_1
,
memoryPerBlock
,
boo
st
::
cref
(
setup
)
)
);
forest
->
addWorkloadMemorySUIDAssignmentFunction
(
st
d
::
bind
(
workloadMemoryAndSUIDAssignment
,
std
::
placeholders
::
_1
,
memoryPerBlock
,
st
d
::
cref
(
setup
)
)
);
forest
->
init
(
AABB
(
real_c
(
0
),
real_c
(
0
),
real_c
(
0
),
setup
.
H
*
(
real_c
(
setup
.
xBlocks
)
*
real_c
(
setup
.
xCells
)
)
/
(
real_c
(
setup
.
yzBlocks
)
*
real_c
(
setup
.
yzCells
)
),
setup
.
H
,
setup
.
H
),
...
...
@@ -2602,7 +2602,8 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod
adaptiveRefinementLog
=
oss
.
str
();
}
minTargetLevelDeterminationFunctions
.
add
(
boost
::
bind
(
keepInflowOutflowAtTheSameLevel
,
_1
,
_2
,
_3
,
boost
::
cref
(
setup
)
)
);
minTargetLevelDeterminationFunctions
.
add
(
std
::
bind
(
keepInflowOutflowAtTheSameLevel
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
,
std
::
placeholders
::
_3
,
std
::
cref
(
setup
)
)
);
if
(
Is2D
<
LatticeModel_T
>::
value
)
minTargetLevelDeterminationFunctions
.
add
(
pseudo2DTargetLevelCorrection
);
...
...
@@ -3171,7 +3172,7 @@ int main( int argc, char **argv )
refinementSelectionFunctions
.
add
(
cylinderRefinementSelection
);
}
refinementSelectionFunctions
.
add
(
boo
st
::
bind
(
setInflowOutflowToSameLevel
,
_1
,
setup
)
);
refinementSelectionFunctions
.
add
(
st
d
::
bind
(
setInflowOutflowToSameLevel
,
std
::
placeholders
::
_1
,
setup
)
);
if
(
setup
.
pseudo2D
)
refinementSelectionFunctions
.
add
(
Pseudo2DRefinementSelectionCorrection
);
...
...
apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp
View file @
26ac8bb5
...
...
@@ -889,7 +889,7 @@ int main( int argc, char **argv ) {
// connect to pe
const
real_t
overlap
=
real_t
(
1.5
)
*
dx
;
auto
syncCall
=
boo
st
::
bind
(
pe
::
syncNextNeighbors
<
BodyTypeTuple
>
,
boo
st
::
ref
(
blocks
->
getBlockForest
()),
auto
syncCall
=
st
d
::
bind
(
pe
::
syncNextNeighbors
<
BodyTypeTuple
>
,
st
d
::
ref
(
blocks
->
getBlockForest
()),
bodyStorageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
overlap
,
false
);
shared_ptr
<
CollisionPropertiesEvaluator
>
collisionPropertiesEvaluator
=
walberla
::
make_shared
<
CollisionPropertiesEvaluator
>
(
*
cr
);
...
...
@@ -1196,7 +1196,7 @@ int main( int argc, char **argv ) {
velocityFieldID
,
svfFieldID
,
pressureGradientFieldID
,
dragCorrelationFunction
,
viscosity
);
dragAndPressureForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
dragAndPressureForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
typedef
pe_coupling
::
discrete_particle_methods
::
InteractionForceEvaluator
<
FlagField_T
,
field
::
NearestNeighborFieldInterpolator
,
field
::
KernelDistributor
>
IFE_T
;
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
dragForceFieldID
,
bodyStorageID
,
...
...
@@ -1204,7 +1204,7 @@ int main( int argc, char **argv ) {
velocityFieldID
,
svfFieldID
,
pressureGradientFieldID
,
dragCorrelationFunction
,
viscosity
);
dragAndPressureForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
dragAndPressureForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
else
if
(
interpol
==
Interpolation
::
IKernel
)
{
if
(
dist
==
Distribution
::
DNearestNeighbor
)
{
...
...
@@ -1214,7 +1214,7 @@ int main( int argc, char **argv ) {
velocityFieldID
,
svfFieldID
,
pressureGradientFieldID
,
dragCorrelationFunction
,
viscosity
);
dragAndPressureForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
dragAndPressureForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
typedef
pe_coupling
::
discrete_particle_methods
::
InteractionForceEvaluator
<
FlagField_T
,
field
::
KernelFieldInterpolator
,
field
::
KernelDistributor
>
IFE_T
;
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
dragForceFieldID
,
bodyStorageID
,
...
...
@@ -1222,7 +1222,7 @@ int main( int argc, char **argv ) {
velocityFieldID
,
svfFieldID
,
pressureGradientFieldID
,
dragCorrelationFunction
,
viscosity
);
dragAndPressureForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
dragAndPressureForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
else
if
(
interpol
==
Interpolation
::
ITrilinear
)
{
if
(
dist
==
Distribution
::
DNearestNeighbor
)
{
...
...
@@ -1232,7 +1232,7 @@ int main( int argc, char **argv ) {
velocityFieldID
,
svfFieldID
,
pressureGradientFieldID
,
dragCorrelationFunction
,
viscosity
);
dragAndPressureForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
dragAndPressureForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
typedef
pe_coupling
::
discrete_particle_methods
::
InteractionForceEvaluator
<
FlagField_T
,
field
::
TrilinearFieldInterpolator
,
field
::
KernelDistributor
>
IFE_T
;
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
dragForceFieldID
,
bodyStorageID
,
...
...
@@ -1240,7 +1240,7 @@ int main( int argc, char **argv ) {
velocityFieldID
,
svfFieldID
,
pressureGradientFieldID
,
dragCorrelationFunction
,
viscosity
);
dragAndPressureForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
dragAndPressureForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
}
...
...
@@ -1260,7 +1260,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
liftForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
velocityFieldID
,
velocityCurlFieldID
,
liftCorrelationFunction
,
viscosity
);
liftForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
liftForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
...
...
@@ -1268,7 +1268,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
liftForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
velocityFieldID
,
velocityCurlFieldID
,
liftCorrelationFunction
,
viscosity
);
liftForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
liftForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
else
if
(
interpol
==
Interpolation
::
IKernel
)
...
...
@@ -1279,7 +1279,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
liftForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
velocityFieldID
,
velocityCurlFieldID
,
liftCorrelationFunction
,
viscosity
);
liftForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
liftForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
...
...
@@ -1287,7 +1287,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
liftForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
velocityFieldID
,
velocityCurlFieldID
,
liftCorrelationFunction
,
viscosity
);
liftForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
liftForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
else
if
(
interpol
==
Interpolation
::
ITrilinear
)
...
...
@@ -1298,7 +1298,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
liftForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
velocityFieldID
,
velocityCurlFieldID
,
liftCorrelationFunction
,
viscosity
);
liftForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
liftForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
...
...
@@ -1306,7 +1306,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
liftForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
velocityFieldID
,
velocityCurlFieldID
,
liftCorrelationFunction
,
viscosity
);
liftForceEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
liftForceEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
...
...
@@ -1320,7 +1320,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
amForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
timeDerivativeVelocityFieldID
,
addedMassCorrelationFunction
,
bodyVelocityTimeDerivativeEvaluator
);
addedMassEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
addedMassEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
...
...
@@ -1328,7 +1328,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
amForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
timeDerivativeVelocityFieldID
,
addedMassCorrelationFunction
,
bodyVelocityTimeDerivativeEvaluator
);
addedMassEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
addedMassEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
else
if
(
interpol
==
Interpolation
::
IKernel
)
...
...
@@ -1339,7 +1339,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
amForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
timeDerivativeVelocityFieldID
,
addedMassCorrelationFunction
,
bodyVelocityTimeDerivativeEvaluator
);
addedMassEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
addedMassEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
...
...
@@ -1347,7 +1347,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
amForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
timeDerivativeVelocityFieldID
,
addedMassCorrelationFunction
,
bodyVelocityTimeDerivativeEvaluator
);
addedMassEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
addedMassEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
else
if
(
interpol
==
Interpolation
::
ITrilinear
)
...
...
@@ -1358,7 +1358,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
amForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
timeDerivativeVelocityFieldID
,
addedMassCorrelationFunction
,
bodyVelocityTimeDerivativeEvaluator
);
addedMassEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
addedMassEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
else
if
(
dist
==
Distribution
::
DKernel
)
{
...
...
@@ -1366,7 +1366,7 @@ int main( int argc, char **argv ) {
shared_ptr
<
IFE_T
>
forceEvaluatorPtr
=
make_shared
<
IFE_T
>
(
blocks
,
amForceFieldID
,
bodyStorageID
,
flagFieldID
,
Fluid_Flag
,
timeDerivativeVelocityFieldID
,
addedMassCorrelationFunction
,
bodyVelocityTimeDerivativeEvaluator
);
addedMassEvaluationFunction
=
boo
st
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
addedMassEvaluationFunction
=
st
d
::
bind
(
&
IFE_T
::
operator
(),
forceEvaluatorPtr
);
}
}
...
...
@@ -1376,7 +1376,7 @@ int main( int argc, char **argv ) {
{
typedef
pe_coupling
::
discrete_particle_methods
::
LubricationForceEvaluator
LE_T
;
shared_ptr
<
LE_T
>
lubEval
=
make_shared
<
LE_T
>
(
blocks
,
globalBodyStorage
,
bodyStorageID
,
viscosity
,
lubricationCutOffDistance
);
lubricationEvaluationFunction
=
boo
st
::
bind
(
&
LE_T
::
operator
(),
lubEval
);
lubricationEvaluationFunction
=
st
d
::
bind
(
&
LE_T
::
operator
(),
lubEval
);
}
else
{
...
...
apps/tutorials/basics/02_Sweeps.cpp
View file @
26ac8bb5
...
...
@@ -24,7 +24,7 @@
#include
"gui/Gui.h"
#include
"timeloop/SweepTimeloop.h"
#include
<
boost/bind.hpp
>
#include
<
functional
>
using
namespace
walberla
;
...
...
@@ -125,7 +125,7 @@ int main( int argc, char ** argv )
// registering the function sweep
auto
pointerToTwoArgFunction
=
&
simpleSweep
;
auto
pointerToOneArgFunction
=
boo
st
::
bind
(
pointerToTwoArgFunction
,
_1
,
fieldID
);
auto
pointerToOneArgFunction
=
st
d
::
bind
(
pointerToTwoArgFunction
,
std
::
placeholders
::
_1
,
fieldID
);
timeloop
.
add
()
<<
Sweep
(
pointerToOneArgFunction
,
"BogusAlgorithm"
);
// registering the class sweep
...
...
apps/tutorials/pe/02_ConfinedGasExtended.cpp
View file @
26ac8bb5
...
...
@@ -32,6 +32,8 @@
#include
<postprocessing/sqlite/SQLite.h>
#include
<vtk/VTKOutput.h>
#include
<functional>
using
namespace
walberla
;
using
namespace
walberla
::
pe
;
using
namespace
walberla
::
timing
;
...
...
@@ -150,20 +152,20 @@ int main( int argc, char ** argv )
std
::
function
<
void
(
void
)
>
syncCall
;
if
(
!
syncShadowOwners
)
{
syncCall
=
boo
st
::
bind
(
pe
::
syncNextNeighbors
<
BodyTuple
>
,
boo
st
::
ref
(
*
forest
),
storageID
,
&
tt
,
real_c
(
0.0
),
false
);
syncCall
=
st
d
::
bind
(
pe
::
syncNextNeighbors
<
BodyTuple
>
,
st
d
::
ref
(
*
forest
),
storageID
,
&
tt
,
real_c
(
0.0
),
false
);
}
else
{
syncCall
=
boo
st
::
bind
(
pe
::
syncShadowOwners
<
BodyTuple
>
,
boo
st
::
ref
(
*
forest
),
storageID
,
&
tt
,
real_c
(
0.0
),
false
);
syncCall
=
st
d
::
bind
(
pe
::
syncShadowOwners
<
BodyTuple
>
,
st
d
::
ref
(
*
forest
),
storageID
,
&
tt
,
real_c
(
0.0
),
false
);
}
//! [Bind Sync Call]
std
::
function
<
void
(
void
)
>
syncCallWithoutTT
;
if
(
!
syncShadowOwners
)
{
syncCallWithoutTT
=
boo
st
::
bind
(
pe
::
syncNextNeighbors
<
BodyTuple
>
,
boo
st
::
ref
(
*
forest
),
storageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
real_c
(
0.0
),
false
);
syncCallWithoutTT
=
st
d
::
bind
(
pe
::
syncNextNeighbors
<
BodyTuple
>
,
st
d
::
ref
(
*
forest
),
storageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
real_c
(
0.0
),
false
);
}
else
{
syncCallWithoutTT
=
boo
st
::
bind
(
pe
::
syncShadowOwners
<
BodyTuple
>
,
boo
st
::
ref
(
*
forest
),
storageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
real_c
(
0.0
),
false
);
syncCallWithoutTT
=
st
d
::
bind
(
pe
::
syncShadowOwners
<
BodyTuple
>
,
st
d
::
ref
(
*
forest
),
storageID
,
static_cast
<
WcTimingTree
*>
(
NULL
),
real_c
(
0.0
),
false
);
}
//! [Bind Sync Call]
...
...
src/blockforest/Initialization.cpp
View file @
26ac8bb5
...
...
@@ -31,6 +31,8 @@
#include
"stencil/D3Q19.h"
#include
<functional>
namespace
walberla
{
namespace
blockforest
{
...
...
@@ -500,7 +502,7 @@ createUniformBlockGrid( const AABB& domainAABB,
numeric_cast
<
memory_t
>
(
maxBlocksPerProcess
);
GlobalLoadBalancing
::
MetisConfiguration
<
SetupBlock
>
metisConfig
(
includeMetis
,
forceMetis
,
boo
st
::
bind
(
cellWeightedCommunicationCost
,
_1
,
_2
,
st
d
::
bind
(
cellWeightedCommunicationCost
,
std
::
placeholders
::
_1
,
std
::
placeholders
::
_2
,
numberOfXCellsPerBlock
,
numberOfYCellsPerBlock
,
numberOfZCellsPerBlock
)
);
...
...
src/blockforest/StructuredBlockForest.h
View file @
26ac8bb5
...
...
@@ -24,6 +24,7 @@
#include
"BlockForest.h"
#include
"domain_decomposition/StructuredBlockStorage.h"
#include
<functional>
namespace
walberla
{
namespace
blockforest
{
...
...
@@ -205,7 +206,7 @@ inline StructuredBlockForest::StructuredBlockForest( const shared_ptr< BlockFore
blockForest_
(
blockForest
)
{
blockForest_
->
addRefreshCallbackFunctionBeforeBlockDataIsUnpacked
(
BlockForest
::
RefreshCallbackWrappper
(
boo
st
::
bind
(
resetCellDecompositionInStorage
,
boo
st
::
ref
(
*
this
)
)
)
);
BlockForest
::
RefreshCallbackWrappper
(
st
d
::
bind
(
resetCellDecompositionInStorage
,
st
d
::
ref
(
*
this
)
)
)
);
blockCells_
[
0
]
=
blockXCells
;
blockCells_
[
1
]
=
blockYCells
;
...
...
src/blockforest/communication/NonUniformBufferedScheme.h
View file @
26ac8bb5
...
...
@@ -36,10 +36,9 @@
#include
"core/selectable/IsSetSelected.h"
#include
"core/uid/SUID.h"
#include
<boost/bind.hpp>
#include
<functional>
#include
<map>
#include
<functional>
#include
<set>
#include
<vector>
...
...
@@ -110,7 +109,7 @@ public:
//@{
void
startCommunication
()
{
startCommunicateEqualLevel
();
startCommunicateCoarseToFine
();
startCommunicateFineToCoarse
();
}
std
::
function
<
void
()
>
getStartCommunicateFunctor
()
{
return
boo
st
::
bind
(
&
NonUniformBufferedScheme
::
startCommunication
,
this
);
}
std
::
function
<
void
()
>
getStartCommunicateFunctor
()
{
return
st
d
::
bind
(
&
NonUniformBufferedScheme
::
startCommunication
,
this
);
}
inline
void
startCommunicateEqualLevel
();
inline
void
startCommunicateCoarseToFine
();
...
...
@@ -121,7 +120,7 @@ public:
inline
void
startCommunicateFineToCoarse
(
const
uint_t
fineLevel
);
void
wait
()
{
waitCommunicateEqualLevel
();
waitCommunicateCoarseToFine
();
waitCommunicateFineToCoarse
();
}
std
::
function
<
void
()
>
getWaitFunctor
()
{
return
boo
st
::
bind
(
&
NonUniformBufferedScheme
::
wait
,
this
);
}
std
::
function
<
void
()
>
getWaitFunctor
()
{
return
st
d
::
bind
(
&
NonUniformBufferedScheme
::
wait
,
this
);
}
inline
void
waitCommunicateEqualLevel
();
inline
void
waitCommunicateCoarseToFine
();
...
...
@@ -659,13 +658,13 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationEqualLevel( const uint
localBuffers
.
push_back
(
buffer
);
const
uint_t
bufferIndex
=
uint_c
(
localBuffers
.
size
()
)
-
uint_t
(
1
);
VoidFunction
pack
=
boo
st
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferPacking
,
this
,
EQUAL_LEVEL
,
index
,
bufferIndex
,
boo
st
::
cref
(
*
packInfo
),
block
,
neighbor
,
*
dir
);
VoidFunction
pack
=
st
d
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferPacking
,
this
,
EQUAL_LEVEL
,
index
,
bufferIndex
,
st
d
::
cref
(
*
packInfo
),
block
,
neighbor
,
*
dir
);
threadsafeLocalCommunication
.
push_back
(
pack
);
VoidFunction
unpack
=
boo
st
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferUnpacking
,
this
,
EQUAL_LEVEL
,
index
,
bufferIndex
,
boo
st
::
cref
(
*
packInfo
),
neighbor
,
block
,
*
dir
);
VoidFunction
unpack
=
st
d
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferUnpacking
,
this
,
EQUAL_LEVEL
,
index
,
bufferIndex
,
st
d
::
cref
(
*
packInfo
),
neighbor
,
block
,
*
dir
);
if
(
(
*
packInfo
)
->
threadsafeReceiving
()
)
threadsafeLocalCommunicationUnpack
.
push_back
(
unpack
);
...
...
@@ -674,7 +673,7 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationEqualLevel( const uint
}
else
{
VoidFunction
localCommunicationFunction
=
boo
st
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
communicateLocalEqualLevel
,
VoidFunction
localCommunicationFunction
=
st
d
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
communicateLocalEqualLevel
,
*
packInfo
,
block
,
neighbor
,
*
dir
);
if
(
(
*
packInfo
)
->
threadsafeReceiving
()
)
threadsafeLocalCommunication
.
push_back
(
localCommunicationFunction
);
...
...
@@ -688,10 +687,10 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationEqualLevel( const uint
auto
nProcess
=
block
->
getNeighborProcess
(
neighborIdx
,
uint_t
(
0
)
);
if
(
!
packInfos_
.
empty
()
)
sendFunctions
[
nProcess
].
push_back
(
boo
st
::
bind
(
NonUniformBufferedScheme
<
Stencil
>::
writeHeader
,
_1
,
block
->
getId
(),
receiverId
,
*
dir
)
);
sendFunctions
[
nProcess
].
push_back
(
st
d
::
bind
(
NonUniformBufferedScheme
<
Stencil
>::
writeHeader
,
std
::
placeholders
::
_1
,
block
->
getId
(),
receiverId
,
*
dir
)
);
for
(
auto
packInfo
=
packInfos_
.
begin
();
packInfo
!=
packInfos_
.
end
();
++
packInfo
)
sendFunctions
[
nProcess
].
push_back
(
boo
st
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
packDataEqualLevel
,
*
packInfo
,
block
,
*
dir
,
_1
)
);
sendFunctions
[
nProcess
].
push_back
(
st
d
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
packDataEqualLevel
,
*
packInfo
,
block
,
*
dir
,
std
::
placeholders
::
_1
)
);
}
}
}
...
...
@@ -700,8 +699,8 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationEqualLevel( const uint
for
(
auto
sender
=
sendFunctions
.
begin
();
sender
!=
sendFunctions
.
end
();
++
sender
)
{
bufferSystem
->
addSendingFunction
(
int_c
(
sender
->
first
),
boo
st
::
bind
(
NonUniformBufferedScheme
<
Stencil
>::
send
,
_1
,
sender
->
second
)
);
bufferSystem
->
addReceivingFunction
(
int_c
(
sender
->
first
),
boo
st
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
receive
,
this
,
_1
)
);
bufferSystem
->
addSendingFunction
(
int_c
(
sender
->
first
),
st
d
::
bind
(
NonUniformBufferedScheme
<
Stencil
>::
send
,
std
::
placeholders
::
_1
,
sender
->
second
)
);
bufferSystem
->
addReceivingFunction
(
int_c
(
sender
->
first
),
st
d
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
receive
,
this
,
std
::
placeholders
::
_1
)
);
}
setupBeforeNextCommunication
=
char
(
0
);
...
...
@@ -785,13 +784,13 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationCoarseToFine( const ui
localBuffers
.
push_back
(
buffer
);
const
uint_t
bufferIndex
=
uint_c
(
localBuffers
.
size
()
)
-
uint_t
(
1
);
VoidFunction
pack
=
boo
st
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferPacking
,
this
,
COARSE_TO_FINE
,
index
,
bufferIndex
,
boo
st
::
cref
(
*
packInfo
),
block
,
neighbor
,
*
dir
);
VoidFunction
pack
=
st
d
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferPacking
,
this
,
COARSE_TO_FINE
,
index
,
bufferIndex
,
st
d
::
cref
(
*
packInfo
),
block
,
neighbor
,
*
dir
);
threadsafeLocalCommunication
.
push_back
(
pack
);
VoidFunction
unpack
=
boo
st
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferUnpacking
,
this
,
COARSE_TO_FINE
,
index
,
bufferIndex
,
boo
st
::
cref
(
*
packInfo
),
neighbor
,
block
,
*
dir
);
VoidFunction
unpack
=
st
d
::
bind
(
&
NonUniformBufferedScheme
<
Stencil
>::
localBufferUnpacking
,
this
,
COARSE_TO_FINE
,
index
,
bufferIndex
,
st
d
::
cref
(
*
packInfo
),
neighbor
,
block
,
*
dir
);
if
(
(
*
packInfo
)
->
threadsafeReceiving
()
)
threadsafeLocalCommunicationUnpack
.
push_back
(
unpack
);
...
...
@@ -800,7 +799,7 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationCoarseToFine( const ui
}
else
{
VoidFunction
localCommunicationFunction
=
boo
st
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
communicateLocalCoarseToFine
,
VoidFunction
localCommunicationFunction
=
st
d
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
communicateLocalCoarseToFine
,
*
packInfo
,
block
,
neighbor
,
*
dir
);
if
(
(
*
packInfo
)
->
threadsafeReceiving
()
)
threadsafeLocalCommunication
.
push_back
(
localCommunicationFunction
);
...
...
@@ -814,10 +813,10 @@ void NonUniformBufferedScheme<Stencil>::startCommunicationCoarseToFine( const ui
auto
nProcess
=
block
->
getNeighborProcess
(
neighborIdx
,
n
);
if
(
!
packInfos_
.
empty
()
)
sendFunctions
[
nProcess
].
push_back
(
boo
st
::
bind
(
NonUniformBufferedScheme
<
Stencil
>::
writeHeader
,
_1
,
block
->
getId
(),
receiverId
,
*
dir
)
);
sendFunctions
[
nProcess
].
push_back
(
st
d
::
bind
(
NonUniformBufferedScheme
<
Stencil
>::
writeHeader
,
std
::
placeholders
::
_1
,
block
->
getId
(),
receiverId
,
*
dir
)
);
for
(
auto
packInfo
=
packInfos_
.
begin
();
packInfo
!=
packInfos_
.
end
();
++
packInfo
)
sendFunctions
[
nProcess
].
push_back
(
boo
st
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
packDataCoarseToFine
,
*
packInfo
,
block
,
receiverId
,
*
dir
,
_1
)
);
sendFunctions
[
nProcess
].
push_back
(
st
d
::
bind
(
&
blockforest
::
communication
::
NonUniformPackInfo
::
packDataCoarseToFine
,
*
packInfo
,
block
,
receiverId
,
*
dir
,
std
::
placeholders
::
_1
)
);
}