diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3927d881288d90034c0fd9fc0d548cf677d6f260..f26726ef4b8afdd3f7981d3d317830d9446026b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,67 +125,6 @@ stages: -intel_15_serial: - <<: *build_serial_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - only: - - triggers - tags: - - docker - - intel - -intel_15_mpionly: - <<: *build_mpionly_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - only: - - triggers - tags: - - docker - - intel - -intel_15_hybrid: - <<: *build_hybrid_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - only: - - triggers - tags: - - docker - - intel - -intel_15_serial_dbg: - <<: *build_serial_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - only: - - triggers - tags: - - docker - - intel - -intel_15_mpionly_dbg: - <<: *build_mpionly_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - only: - - triggers - tags: - - docker - - intel - -intel_15_hybrid_dbg: - <<: *build_hybrid_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - tags: - - docker - - intel - -intel_15_hybrid_dbg_sp: - <<: *build_hybrid_dbg_sp_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:15 - only: - - triggers - tags: - - docker - - intel - intel_16_serial: <<: *build_serial_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:16 @@ -239,8 +178,6 @@ intel_16_mpionly_dbg: intel_16_hybrid_dbg: <<: *build_hybrid_dbg_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/intel:16 - only: - - triggers tags: - cuda - docker @@ -309,172 +246,6 @@ intel_17_hybrid_dbg_sp: - docker - intel -gcc_4.7_serial: - <<: *build_serial_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - only: - - triggers - tags: - - docker - -gcc_4.7_mpionly: - <<: *build_mpionly_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - only: - - triggers - tags: - - docker - -gcc_4.7_hybrid: - <<: *build_hybrid_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - only: - - triggers - tags: - - docker - -gcc_4.7_serial_dbg: - <<: *build_serial_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - only: - - triggers - tags: - - docker - -gcc_4.7_mpionly_dbg: - <<: *build_mpionly_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - only: - - triggers - tags: - - docker - -gcc_4.7_hybrid_dbg: - <<: *build_hybrid_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - tags: - - docker - -gcc_4.7_hybrid_dbg_sp: - <<: *build_hybrid_dbg_sp_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.7 - only: - - triggers - tags: - - docker - -gcc_4.8_serial: - <<: *build_serial_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.8_mpionly: - <<: *build_mpionly_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.8_hybrid: - <<: *build_hybrid_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.8_serial_dbg: - <<: *build_serial_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.8_mpionly_dbg: - <<: *build_mpionly_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.8_hybrid_dbg: - <<: *build_hybrid_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.8_hybrid_dbg_sp: - <<: *build_hybrid_dbg_sp_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.8 - only: - - triggers - tags: - - docker - -gcc_4.9_serial: - <<: *build_serial_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - -gcc_4.9_mpionly: - <<: *build_mpionly_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - -gcc_4.9_hybrid: - <<: *build_hybrid_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - -gcc_4.9_serial_dbg: - <<: *build_serial_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - -gcc_4.9_mpionly_dbg: - <<: *build_mpionly_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - -gcc_4.9_hybrid_dbg: - <<: *build_hybrid_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - -gcc_4.9_hybrid_dbg_sp: - <<: *build_hybrid_dbg_sp_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:4.9 - only: - - triggers - tags: - - docker - gcc_5_serial: <<: *build_serial_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:5 @@ -519,8 +290,6 @@ gcc_5_mpionly_dbg: gcc_5_hybrid_dbg: <<: *build_hybrid_dbg_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:5 - only: - - triggers tags: - cuda - docker @@ -636,72 +405,6 @@ gcc_7_hybrid_dbg_sp: tags: - docker -clang_3.4_serial: - <<: *build_serial_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.4 - only: - - triggers - tags: - - docker - -clang_3.4_mpionly: - <<: *build_mpionly_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.4 - only: - - triggers - tags: - - docker - -clang_3.4_serial_dbg: - <<: *build_serial_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.4 - only: - - triggers - tags: - - docker - -clang_3.4_mpionly_dbg: - <<: *build_mpionly_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.4 - tags: - - docker - -clang_3.5_serial: - <<: *build_serial_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.5 - only: - - triggers - tags: - - cuda - - docker - -clang_3.5_mpionly: - <<: *build_mpionly_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.5 - only: - - triggers - tags: - - cuda - - docker - -clang_3.5_serial_dbg: - <<: *build_serial_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.5 - only: - - triggers - tags: - - cuda - - docker - -clang_3.5_mpionly_dbg: - <<: *build_mpionly_dbg_definition - image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.5 - only: - - triggers - tags: - - cuda - - docker - clang_3.6_serial: <<: *build_serial_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.6 @@ -732,8 +435,6 @@ clang_3.6_serial_dbg: clang_3.6_mpionly_dbg: <<: *build_mpionly_dbg_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:3.6 - only: - - triggers tags: - cuda - docker @@ -1097,88 +798,6 @@ coverage: - ctest -LE $CTEST_EXCLUDE_LABELS -C $BUILD_CONFIGURATION --output-on-failure -j 4 -msvc-12_Hybrid_Dbg: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "DebugOptimized" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "ON" - WALBERLA_BUILD_WITH_OPENMP: "ON" - WALBERLA_DOUBLE_ACCURACY: "ON" - -msvc-12_Hybrid_SP_Dbg: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "DebugOptimized" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "ON" - WALBERLA_BUILD_WITH_OPENMP: "ON" - WALBERLA_DOUBLE_ACCURACY: "OFF" - only: - - triggers - -msvc-12_Hybrid: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "Release" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "ON" - WALBERLA_BUILD_WITH_OPENMP: "ON" - WALBERLA_DOUBLE_ACCURACY: "ON" - only: - - triggers - -msvc-12_Serial_Dbg: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "DebugOptimized" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "OFF" - WALBERLA_BUILD_WITH_OPENMP: "OFF" - WALBERLA_DOUBLE_ACCURACY: "ON" - only: - - triggers - -msvc-12_Serial: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "Release" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "OFF" - WALBERLA_BUILD_WITH_OPENMP: "OFF" - WALBERLA_DOUBLE_ACCURACY: "ON" - only: - - triggers - -msvc-12_MpiOnly_Dbg: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "DebugOptimized" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "ON" - WALBERLA_BUILD_WITH_OPENMP: "OFF" - WALBERLA_DOUBLE_ACCURACY: "ON" - only: - - triggers - -msvc-12_MpiOnly: - <<: *win_build_definition - variables: - CMAKE_GENERATOR: "Visual Studio 12 2013 Win64" - BUILD_CONFIGURATION: "Release" - CTEST_EXCLUDE_LABELS: "longrun" - WALBERLA_BUILD_WITH_MPI: "ON" - WALBERLA_BUILD_WITH_OPENMP: "OFF" - WALBERLA_DOUBLE_ACCURACY: "ON" - only: - - triggers - msvc-14_Hybrid_Dbg: <<: *win_build_definition variables: @@ -1188,8 +807,6 @@ msvc-14_Hybrid_Dbg: WALBERLA_BUILD_WITH_MPI: "ON" WALBERLA_BUILD_WITH_OPENMP: "ON" WALBERLA_DOUBLE_ACCURACY: "ON" - only: - - triggers msvc-14_Hybrid_SP_Dbg: <<: *win_build_definition @@ -1348,14 +965,10 @@ msvc-14.1_MpiOnly: .conda-deploy: &conda_deploy_definition stage: deploy before_script: - - conda update -y conda - - conda update -y python - conda install -y conda-build anaconda-client - anaconda login --username $CONDA_DEPLOY_USER --password $CONDA_DEPLOY_PASSWORD --hostname $CI_JOB_ID - conda config --set anaconda_upload yes - conda config --add channels lssfau - - conda -V - - conda build -V after_script: - anaconda logout dependencies: [] @@ -1364,41 +977,21 @@ msvc-14.1_MpiOnly: - master@walberla/walberla - tags@walberla/walberla -conda-py36-win-withoutLbm: +conda-py36-win: <<: *conda_deploy_definition tags: - win script: - - conda build --python=3.6 --user=lssfau utilities\\conda\\withoutLbm + - conda build --python=3.6 --user=lssfau utilities\\conda\\walberla -conda-py35-win-withoutLbm: +conda-py35-win: <<: *conda_deploy_definition tags: - win script: - - conda build --python=3.5 --user=lssfau utilities\\conda\\withoutLbm + - conda build --python=3.5 --user=lssfau utilities\\conda\\walberla -conda-py36-linux-withoutLbm: - <<: *conda_deploy_definition - tags: - - docker - image: continuumio/miniconda3 - script: - - apt-get update - - apt-get install -y build-essential - - conda build --python=3.6 --user=lssfau utilities/conda/withoutLbm - -conda-py35-linux-withoutLbm: - <<: *conda_deploy_definition - tags: - - docker - image: continuumio/miniconda3 - script: - - apt-get update - - apt-get install -y build-essential - - conda build --python=3.5 --user=lssfau utilities/conda/withoutLbm - -conda-py36-linux-withLbm: +conda-py36-linux: <<: *conda_deploy_definition tags: - docker @@ -1406,9 +999,9 @@ conda-py36-linux-withLbm: script: - apt-get update - apt-get install -y build-essential - - conda build --python=3.6 --user=lssfau utilities/conda/withLbm + - conda build --python=3.6 --user=lssfau utilities/conda/walberla -conda-py35-linux-withLbm: +conda-py35-linux: <<: *conda_deploy_definition tags: - docker @@ -1416,4 +1009,4 @@ conda-py35-linux-withLbm: script: - apt-get update - apt-get install -y build-essential - - conda build --python=3.5 --user=lssfau utilities/conda/withLbm + - conda build --python=3.5 --user=lssfau utilities/conda/walberla diff --git a/CMakeLists.txt b/CMakeLists.txt index 583c5bb4edf29cddf5dccf17645c7b5f729fc54b..013862580918abfcf4418dc924b4c9153d11c789 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ ## ############################################################################################################################ -CMAKE_MINIMUM_REQUIRED (VERSION 2.8) +CMAKE_MINIMUM_REQUIRED (VERSION 3.1) PROJECT ( walberla ) @@ -36,11 +36,7 @@ include ( waLBerlaFunctions ) set_version( 4 0 ) -if( CMAKE_VERSION VERSION_LESS 2.8.3 ) - include( CMakeParseArgumentsCompat ) -else() - include( CMakeParseArguments ) -endif() +include( CMakeParseArguments ) # Enable CTest enable_testing() @@ -166,6 +162,9 @@ if( CMAKE_CXX_COMPILER MATCHES "icpc" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "icpc" SET(CMAKE_LINKER "${XILD}") ENDIF(XILD) MARK_AS_ADVANCED(XILD) + if( CMAKE_VERSION VERSION_LESS 3.6.0 ) + add_flag ( CMAKE_CXX_FLAGS "-std=c++14" ) + endif() else() option ( WALBERLA_CXX_COMPILER_IS_INTEL "Use Intel compiler" OFF ) endif() @@ -204,7 +203,7 @@ endif() mark_as_advanced ( WALBERLA_CXX_COMPILER_IS_NEC ) # Check for Clang compiler -if( CMAKE_CXX_COMPILER MATCHES "clang" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) +if( CMAKE_CXX_COMPILER MATCHES "clang" OR CMAKE_CXX_COMPILER_ARG1 MATCHES "clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" ) option ( WALBERLA_CXX_COMPILER_IS_CLANG "Use clang compiler" ON ) else() option ( WALBERLA_CXX_COMPILER_IS_CLANG "Use clang compiler" OFF ) @@ -270,30 +269,18 @@ if ( WALBERLA_PROFILE_USE ) endif() endif() +set( CMAKE_CXX_STANDARD 14 ) +set( CMAKE_CXX_STANDARD_REQUIRED ON ) +set( CMAKE_CXX_EXTENSIONS OFF ) + # common flags for intel and g++ if( WALBERLA_CXX_COMPILER_IS_GNU OR WALBERLA_CXX_COMPILER_IS_INTEL ) - if( CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7 ) - add_flag ( CMAKE_CXX_FLAGS "-std=c++0x" ) - else() - add_flag ( CMAKE_CXX_FLAGS "-std=c++11" ) - endif() - #add_flag ( CMAKE_C_FLAGS "-std=c99" ) add_flag ( CMAKE_CXX_FLAGS "-Wall -Wconversion -Wshadow" ) endif() -# C++11 language features for IBM compiler -if( WALBERLA_CXX_COMPILER_IS_IBM ) - add_flag ( CMAKE_CXX_FLAGS "-qlanglvl=autotypededuction -qlanglvl=decltype -qlanglvl=static_assert -qlanglvl=rightanglebracket -qlanglvl=c99longlong" ) -endif() - -# C++11 language features for Cray compiler -if( WALBERLA_CXX_COMPILER_IS_CRAY ) - add_flag ( CMAKE_CXX_FLAGS "-hstd=c++11" ) -endif() - # C++11 language features for NEC compiler if( WALBERLA_CXX_COMPILER_IS_NEC ) - add_flag ( CMAKE_CXX_FLAGS "-Kcpp11 -Krtti -Kexceptions -size_t64 -Kgcc" ) + add_flag ( CMAKE_CXX_FLAGS "-Kcpp14 -Krtti -Kexceptions -size_t64 -Kgcc" ) add_flag ( CMAKE_CXX_FLAGS "-D__BIG_ENDIAN -D__BYTE_ORDER=__BIG_ENDIAN" ) add_flag ( CMAKE_CXX_FLAGS "-Tnoauto,used" ) add_flag ( CMAKE_EXE_LINKER_FLAGS "-Wl,-h,muldefs" ) @@ -384,7 +371,7 @@ endif ( ) if ( WALBERLA_CXX_COMPILER_IS_CLANG ) - add_flag ( CMAKE_CXX_FLAGS "-Wall -Wconversion -Wshadow -Wno-c++11-extensions -std=c++11 -Qunused-arguments" ) + add_flag ( CMAKE_CXX_FLAGS "-Wall -Wconversion -Wshadow -Wno-c++11-extensions -Qunused-arguments" ) add_flag ( CMAKE_CXX_FLAGS "-D'_LIBCPP_EXTERN_TEMPLATE(...)='") endif ( ) @@ -587,23 +574,7 @@ endif() ############################################################################################################################# set ( waLBerla_REQUIRED_MIN_BOOST_VERSION "1.48") -option ( WALBERLA_BUILD_WITH_BOOST_THREAD "Build with boost thread library support" ON ) -# There have been problems with the IBM compiler and boost thread, so WALBERLA_BUILD_WITH_BOOST_THREAD is disabled by default for this compiler -if( WALBERLA_CXX_COMPILER_IS_IBM ) - set ( WALBERLA_BUILD_WITH_BOOST_THREAD OFF CACHE BOOL "Build with boost thread library support" FORCE ) -endif() - -if ( WALBERLA_BUILD_WITH_BOOST_THREAD ) - list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS chrono filesystem system thread ) -else () - list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS chrono filesystem system ) -endif () - -if (( WALBERLA_CXX_COMPILER_IS_IBM ) OR - ( WALBERLA_CXX_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9 ) OR - ( WALBERLA_CXX_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5 ) ) - list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS regex) - endif() +list ( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS filesystem system ) if ( WALBERLA_BUILD_WITH_PYTHON AND WALBERLA_CXX_COMPILER_IS_MSVC ) list( APPEND waLBerla_REQUIRED_BOOST_COMPONENTS python3 ) @@ -712,11 +683,11 @@ endif() ############################################################################################################################ ## -## PThread is required in Linux environments by boost::thread +## PThread is required in Linux environments by std::thread ## ############################################################################################################################ -if ( NOT WIN32 AND WALBERLA_BUILD_WITH_BOOST_THREAD ) +if ( NOT WIN32 ) add_flag( CMAKE_CXX_FLAGS "-pthread" ) endif() diff --git a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp index e10ef4cb98df3a2f6995966817ac09755f718833..62cd5258d085e029eedce2f53940177244d7d187 100644 --- a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp +++ b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp @@ -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; diff --git a/apps/benchmarks/MeshDistance/MeshDistanceBenchmark.cpp b/apps/benchmarks/MeshDistance/MeshDistanceBenchmark.cpp index 64e9001fc18fec9d08296c9136015eeb9ad29568..0e95853463bb92a51bff94e4606427416dc7d994 100644 --- a/apps/benchmarks/MeshDistance/MeshDistanceBenchmark.cpp +++ b/apps/benchmarks/MeshDistance/MeshDistanceBenchmark.cpp @@ -34,7 +34,7 @@ #include "mesh/distance_octree/DistanceOctree.h" #include "mesh/MeshIO.h" -#include <boost/random.hpp> +#include <random> #include <algorithm> #include <vector> @@ -64,7 +64,7 @@ void runBenchmark( const std::string & meshFile, const uint_t numPoints, const u timer.end(); WALBERLA_LOG_INFO( "Mesh preparation took " << timer.last() << "s" ); - boost::random::mt19937 rng; + std::mt19937 rng; std::vector< typename MeshType::Point > points( numPoints ); for(auto it = points.begin(); it != points.end(); ++it) diff --git a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp index 90e2b3479e6147974feccb5fda9ffa55e997ab4d..c54228f176723996ef2af2d457265dcc714429ac 100644 --- a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp +++ b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp @@ -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 @@ -831,7 +831,7 @@ int main( int argc, char **argv ) else if( int(Galileo) == 250 ) { // add random perturbance for chaotic regime - walberla::math::seedRandomGenerator( boost::mt19937::result_type(std::time(0)) ); + walberla::math::seedRandomGenerator( std::mt19937::result_type(std::time(0)) ); xParticle = real_c( xlength ) * real_t(0.5) + walberla::math::realRandom( real_t(-0.5), real_t(0.5) ); yParticle = real_c( ylength ) * real_t(0.5) + walberla::math::realRandom( real_t(-0.5), real_t(0.5) ); @@ -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 ) ); diff --git a/apps/benchmarks/UniformGrid/UniformGrid.cpp b/apps/benchmarks/UniformGrid/UniformGrid.cpp index 15c75b3f84f5524b1b61cc32e5d913de9073721f..396faa8300a9e4a54b47c7f909bf40a929e6a7f6 100644 --- a/apps/benchmarks/UniformGrid/UniformGrid.cpp +++ b/apps/benchmarks/UniformGrid/UniformGrid.cpp @@ -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 ) { diff --git a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp index 1d65e398765707869220e565cd283dde393a8dc5..7e5cab12994f667faf9e42ddcfdf5383b2aabd54 100644 --- a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp +++ b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp @@ -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; diff --git a/apps/tutorials/pe/02_ConfinedGasExtended.cpp b/apps/tutorials/pe/02_ConfinedGasExtended.cpp index c58d14c2f13d7ce22f84bd83386ae5791ffc26b8..b1ac3e4a380c915c1883213706edead118920b9a 100644 --- a/apps/tutorials/pe/02_ConfinedGasExtended.cpp +++ b/apps/tutorials/pe/02_ConfinedGasExtended.cpp @@ -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 ); diff --git a/cmake/CMakeParseArgumentsCompat.cmake b/cmake/CMakeParseArgumentsCompat.cmake deleted file mode 100644 index 2f54a2336b81558ce7803a4ec6e6d78a94f6dc1c..0000000000000000000000000000000000000000 --- a/cmake/CMakeParseArgumentsCompat.cmake +++ /dev/null @@ -1,138 +0,0 @@ -# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) -# -# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for -# parsing the arguments given to that macro or function. -# It processes the arguments and defines a set of variables which hold the -# values of the respective options. -# -# The <options> argument contains all options for the respective macro, -# i.e. keywords which can be used when calling the macro without any value -# following, like e.g. the OPTIONAL keyword of the install() command. -# -# The <one_value_keywords> argument contains all keywords for this macro -# which are followed by one value, like e.g. DESTINATION keyword of the -# install() command. -# -# The <multi_value_keywords> argument contains all keywords for this macro -# which can be followed by more than one value, like e.g. the TARGETS or -# FILES keywords of the install() command. -# -# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the -# keywords listed in <options>, <one_value_keywords> and -# <multi_value_keywords> a variable composed of the given <prefix> -# followed by "_" and the name of the respective keyword. -# These variables will then hold the respective value from the argument list. -# For the <options> keywords this will be TRUE or FALSE. -# -# All remaining arguments are collected in a variable -# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether -# your macro was called with unrecognized parameters. -# -# As an example here a my_install() macro, which takes similar arguments as the -# real install() command: -# -# function(MY_INSTALL) -# set(options OPTIONAL FAST) -# set(oneValueArgs DESTINATION RENAME) -# set(multiValueArgs TARGETS CONFIGURATIONS) -# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) -# ... -# -# Assume my_install() has been called like this: -# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) -# -# After the cmake_parse_arguments() call the macro will have set the following -# variables: -# MY_INSTALL_OPTIONAL = TRUE -# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() -# MY_INSTALL_DESTINATION = "bin" -# MY_INSTALL_RENAME = "" (was not used) -# MY_INSTALL_TARGETS = "foo;bar" -# MY_INSTALL_CONFIGURATIONS = "" (was not used) -# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" -# -# You can the continue and process these variables. -# -# Keywords terminate lists of values, e.g. if directly after a one_value_keyword -# another recognized keyword follows, this is interpreted as the beginning of -# the new option. -# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in -# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would -# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. - -#============================================================================= -# Copyright 2010 Alexander Neundorf <neundorf@kde.org> -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - - -if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) - return() -endif() -set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) - - -function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) - # first set all result variables to empty/FALSE - foreach(arg_name ${_singleArgNames} ${_multiArgNames}) - set(${prefix}_${arg_name}) - endforeach(arg_name) - - foreach(option ${_optionNames}) - set(${prefix}_${option} FALSE) - endforeach(option) - - set(${prefix}_UNPARSED_ARGUMENTS) - - set(insideValues FALSE) - set(currentArgName) - - # now iterate over all arguments and fill the result variables - foreach(currentArg ${ARGN}) - list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword - list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword - - if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) - if(insideValues) - if(insideValues STREQUAL "SINGLE") - set(${prefix}_${currentArgName} ${currentArg}) - set(insideValues FALSE) - elseif(insideValues STREQUAL "MULTI") - list(APPEND ${prefix}_${currentArgName} ${currentArg}) - endif() - else(insideValues) - list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) - endif(insideValues) - else() - if(NOT ${optionIndex} EQUAL -1) - set(${prefix}_${currentArg} TRUE) - set(insideValues FALSE) - elseif(NOT ${singleArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "SINGLE") - elseif(NOT ${multiArgIndex} EQUAL -1) - set(currentArgName ${currentArg}) - set(${prefix}_${currentArgName}) - set(insideValues "MULTI") - endif() - endif() - - endforeach(currentArg) - - # propagate the result variables to the caller: - foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) - set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) - endforeach(arg_name) - set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) - -endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/src/blockforest/Block.cpp b/src/blockforest/Block.cpp index d4d081c33fc20c485e5ae817c65ccfceaffbfc47..d13ba9de7b7057dda04927ad9bb9240d98637f2b 100644 --- a/src/blockforest/Block.cpp +++ b/src/blockforest/Block.cpp @@ -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() ), diff --git a/src/blockforest/Block.h b/src/blockforest/Block.h index 5f1a089ffa34149547d9da5105f4305c78328eff..39d958b7e8ecad45bd56d7113f1eebb8412fb41f 100644 --- a/src/blockforest/Block.h +++ b/src/blockforest/Block.h @@ -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() {} diff --git a/src/blockforest/BlockDataHandling.h b/src/blockforest/BlockDataHandling.h index a9e612e84560bdf5593ef00d979c13d8af5bf5b0..c947b3e032de0a01bf727a30e86d81ff23c035f5 100644 --- a/src/blockforest/BlockDataHandling.h +++ b/src/blockforest/BlockDataHandling.h @@ -214,7 +214,7 @@ public: template< typename T > BlockDataHandlingAdder & operator<<( const domain_decomposition::BlockDataCreator<T> & bdc ) { - auto downcast = boost::dynamic_pointer_cast< blockforest::BlockDataHandling<T> >( bdc.dataHandling_ ); + auto downcast = dynamic_pointer_cast< blockforest::BlockDataHandling<T> >( bdc.dataHandling_ ); if( downcast ) { dataHandling_.add( make_shared< blockforest::internal::BlockDataHandlingHelper<T> >( downcast ), bdc.requiredSelectors_, diff --git a/src/blockforest/BlockForest.cpp b/src/blockforest/BlockForest.cpp index 8d99f0abe7b0c015b35e0d855221979471619b64..e6c19cbc1fe9341bc297f73606a926549659355a 100644 --- a/src/blockforest/BlockForest.cpp +++ b/src/blockforest/BlockForest.cpp @@ -2277,7 +2277,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) auto blockDataHandlingWrapper = dataItem->getDataHandling( block, targetState[0] ); if( blockDataHandlingWrapper ) { - auto downcastBlockDataHandlingWrapper = boost::dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); + auto downcastBlockDataHandlingWrapper = dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); if( !downcastBlockDataHandlingWrapper ) { WALBERLA_ABORT( "Dynamic data structure refresh failed!\n" @@ -2305,7 +2305,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) auto blockDataHandlingWrapper = dataItem->getDataHandling( block, targetState[c] ); if( blockDataHandlingWrapper ) { - auto downcastBlockDataHandlingWrapper = boost::dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); + auto downcastBlockDataHandlingWrapper = dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); if( !downcastBlockDataHandlingWrapper ) { WALBERLA_ABORT( "Dynamic data structure refresh failed!\n" @@ -2651,7 +2651,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) auto blockDataHandlingWrapper = dataItem->getDataHandling( block ); if( blockDataHandlingWrapper ) { - auto downcastBlockDataHandlingWrapper = boost::dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); + auto downcastBlockDataHandlingWrapper = dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); if( !downcastBlockDataHandlingWrapper ) { WALBERLA_ABORT( "Dynamic data structure refresh failed!\n" @@ -2671,7 +2671,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) auto blockDataHandlingWrapper = dataItem->getDataHandling( block, buffers[0].first ); if( blockDataHandlingWrapper ) { - auto downcastBlockDataHandlingWrapper = boost::dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); + auto downcastBlockDataHandlingWrapper = dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); if( !downcastBlockDataHandlingWrapper ) { WALBERLA_ABORT( "Dynamic data structure refresh failed!\n" @@ -2699,7 +2699,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) auto blockDataHandlingWrapper = dataItem->getDataHandling( block ); if( blockDataHandlingWrapper ) { - auto downcastBlockDataHandlingWrapper = boost::dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); + auto downcastBlockDataHandlingWrapper = dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); if( !downcastBlockDataHandlingWrapper ) { WALBERLA_ABORT( "Dynamic data structure refresh failed!\n" @@ -2720,7 +2720,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) auto blockDataHandlingWrapper = dataItem->getDataHandling( block, buffers[c].first ); if( blockDataHandlingWrapper ) { - auto downcastBlockDataHandlingWrapper = boost::dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); + auto downcastBlockDataHandlingWrapper = dynamic_pointer_cast< blockforest::internal::BlockDataHandlingWrapper >( blockDataHandlingWrapper ); if( !downcastBlockDataHandlingWrapper ) { WALBERLA_ABORT( "Dynamic data structure refresh failed!\n" diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h index 011dbf371076aaa42d6aa49f7acf83acbcad2546..42d1081e1feb7d6af47aba14e398966cdf055066 100644 --- a/src/blockforest/BlockForest.h +++ b/src/blockforest/BlockForest.h @@ -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_; } @@ -856,7 +856,7 @@ inline BlockDataID BlockForest::addBlockData( const shared_ptr< T > & dataHandli { //static_assert( boost::is_base_of< BlockDataHandling<typename T::value_type>, T >::value ); - auto downcast = boost::dynamic_pointer_cast< blockforest::BlockDataHandling<typename T::value_type> >( dataHandling ); + auto downcast = dynamic_pointer_cast< blockforest::BlockDataHandling<typename T::value_type> >( dataHandling ); if( downcast ) { @@ -880,7 +880,7 @@ template< typename T > inline BlockDataID BlockForest::loadBlockData( const std::string & file, const shared_ptr< T > & dataHandling, const std::string & identifier, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) { - auto downcast = boost::dynamic_pointer_cast< blockforest::BlockDataHandling<typename T::value_type> >( dataHandling ); + auto downcast = dynamic_pointer_cast< blockforest::BlockDataHandling<typename T::value_type> >( dataHandling ); if( downcast ) { diff --git a/src/blockforest/BlockID.h b/src/blockforest/BlockID.h index b9691c74490ac52663b07f65816002fc2c48354d..dddb36d96c9659d9e7e8d6460c5bfd939726fe78 100644 --- a/src/blockforest/BlockID.h +++ b/src/blockforest/BlockID.h @@ -93,8 +93,8 @@ private: static const uint_t SHIFT = UINT_BITS - 3; - BOOST_STATIC_ASSERT( UINT_BITS > 31 ); - BOOST_STATIC_ASSERT( !(UINT_BITS & (UINT_BITS - 1)) ); // power of two + WALBERLA_STATIC_ASSERT( UINT_BITS > 31 ); + WALBERLA_STATIC_ASSERT( !(UINT_BITS & (UINT_BITS - 1)) ); // power of two }; // class BlockID diff --git a/src/blockforest/GlobalLoadBalancing.h b/src/blockforest/GlobalLoadBalancing.h index 23f79d7b5d3618d50e9d8d9e0cf2f4a4d1c2e137..d14e98291fa555a6da3d47e63a563517b6d56e87 100644 --- a/src/blockforest/GlobalLoadBalancing.h +++ b/src/blockforest/GlobalLoadBalancing.h @@ -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) ) : diff --git a/src/blockforest/PhantomBlockForest.cpp b/src/blockforest/PhantomBlockForest.cpp index 4dce58b48c010129ca81ea30e0b5724e607c9c25..691cfe744bffa45cf7c790c86699f7a5e84dcba5 100644 --- a/src/blockforest/PhantomBlockForest.cpp +++ b/src/blockforest/PhantomBlockForest.cpp @@ -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 ); diff --git a/src/blockforest/PhantomBlockForest.h b/src/blockforest/PhantomBlockForest.h index 5e263158d666d839302d33beda6fcdcf90d1f2b1..797a29cbe28ee0a0463d69a9cd5417e90347a8b6 100644 --- a/src/blockforest/PhantomBlockForest.h +++ b/src/blockforest/PhantomBlockForest.h @@ -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; diff --git a/src/blockforest/SetupBlockForest.h b/src/blockforest/SetupBlockForest.h index 01a1379a319bc3c948708eb8481fa0aaab56d794..dbea75a0058945ccb631e6b9689a9ec4324338ac 100644 --- a/src/blockforest/SetupBlockForest.h +++ b/src/blockforest/SetupBlockForest.h @@ -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 & ) { diff --git a/src/blockforest/StructuredBlockForest.h b/src/blockforest/StructuredBlockForest.h index 19de504b62ee54e2aa91bdd9c739cbe0899b362f..82f4e810d1444d18ebbb1f47e9cd19a42d2ab2c2 100644 --- a/src/blockforest/StructuredBlockForest.h +++ b/src/blockforest/StructuredBlockForest.h @@ -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() ) diff --git a/src/blockforest/Types.h b/src/blockforest/Types.h index 0624414b23b529e47b23e6c56a941afa0b816eb7..76ab3911327cb28608cb6c89b2a8e964a6791803 100644 --- a/src/blockforest/Types.h +++ b/src/blockforest/Types.h @@ -23,7 +23,6 @@ #include "core/DataTypes.h" -#include <boost/static_assert.hpp> #include <limits> @@ -37,8 +36,8 @@ namespace blockforest { typedef real_t workload_t; typedef real_t memory_t; -BOOST_STATIC_ASSERT( sizeof( workload_t ) == 4 || sizeof( workload_t ) == 8 ); -BOOST_STATIC_ASSERT( sizeof( memory_t ) == 4 || sizeof( memory_t ) == 8 ); +WALBERLA_STATIC_ASSERT( sizeof( workload_t ) == 4 || sizeof( workload_t ) == 8 ); +WALBERLA_STATIC_ASSERT( sizeof( memory_t ) == 4 || sizeof( memory_t ) == 8 ); template< typename T > inline workload_t workload_c( T t ) { return numeric_cast< workload_t >(t); } ///< cast to type workload_t using "workload_c(x)" template< typename T > inline memory_t memory_c ( T t ) { return numeric_cast< memory_t >(t); } ///< cast to type memory_t using "memory_c(x)" diff --git a/src/blockforest/communication/NonUniformBufferedScheme.h b/src/blockforest/communication/NonUniformBufferedScheme.h index 12d059fc6b2914f4e57c3399a8fe79007731f405..e2eca543d736d543748d115ee645f91b12323e01 100644 --- a/src/blockforest/communication/NonUniformBufferedScheme.h +++ b/src/blockforest/communication/NonUniformBufferedScheme.h @@ -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(); diff --git a/src/blockforest/communication/UniformBufferedScheme.h b/src/blockforest/communication/UniformBufferedScheme.h index 5fc500e20c7fb6aa710b2dd87d047c4777762a05..393301f6c78039790a97c6f752798e344c1c07a0 100644 --- a/src/blockforest/communication/UniformBufferedScheme.h +++ b/src/blockforest/communication/UniformBufferedScheme.h @@ -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 ); } diff --git a/src/blockforest/communication/UniformDirectScheme.h b/src/blockforest/communication/UniformDirectScheme.h index 4c2e0a4de906279f784d1dd2144d9c3deb17f65d..16d6e9fdda939275ba60ce3ef22aa98b5db9f143 100644 --- a/src/blockforest/communication/UniformDirectScheme.h +++ b/src/blockforest/communication/UniformDirectScheme.h @@ -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 ); } //@} //******************************************************************************************************************* diff --git a/src/blockforest/loadbalancing/StaticParMetis.h b/src/blockforest/loadbalancing/StaticParMetis.h index 85012654d1d170899034d09a50e529e2d78218e9..0e77baf45b72be5a6f6991fed3c8cc49891f94f9 100644 --- a/src/blockforest/loadbalancing/StaticParMetis.h +++ b/src/blockforest/loadbalancing/StaticParMetis.h @@ -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 ) {} diff --git a/src/core/Abort.h b/src/core/Abort.h index 3fa01308bd24c40baa1283691cee7bdb3c380afd..8c52f6783d8539613492498be0bd66ae7858b1a6 100644 --- a/src/core/Abort.h +++ b/src/core/Abort.h @@ -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; } diff --git a/src/core/DataTypes.h b/src/core/DataTypes.h index 765636c0626c6bd62bde1a57d94f86c0ed8f0bba..b0442f52466f8fcbe13ef68656a9b99ad449cbb2 100644 --- a/src/core/DataTypes.h +++ b/src/core/DataTypes.h @@ -23,13 +23,10 @@ #include "waLBerlaDefinitions.h" -#include <boost/cstdint.hpp> -#include <boost/make_shared.hpp> +#include <cstdint> #include <boost/numeric/conversion/cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> -#include <boost/static_assert.hpp> -#include "boost/type_traits/integral_constant.hpp" +#include <memory> +#include <type_traits> #include <boost/units/detail/utility.hpp> #include <cmath> @@ -39,17 +36,19 @@ namespace walberla { +#define WALBERLA_STATIC_ASSERT(x) static_assert(x, "Assertion failed") -template <typename> struct never_true : boost::false_type {}; + +template <typename> struct never_true : std::false_type {}; // shared ptr -using boost::shared_ptr; -using boost::weak_ptr; -using boost::make_shared; -using boost::dynamic_pointer_cast; +using std::shared_ptr; +using std::weak_ptr; +using std::make_shared; +using std::dynamic_pointer_cast; // functions, use this when "function" namespace is no longer needed //using std::function; @@ -69,10 +68,10 @@ inline S numeric_cast( T t ) { // fixed size signed integral types -typedef boost::int8_t int8_t; ///< 8 bit signed integer -typedef boost::int16_t int16_t; ///< 16 bit signed integer -typedef boost::int32_t int32_t; ///< 32 bit signed integer -typedef boost::int64_t int64_t; ///< 64 bit signed integer +typedef std::int8_t int8_t; ///< 8 bit signed integer +typedef std::int16_t int16_t; ///< 16 bit signed integer +typedef std::int32_t int32_t; ///< 32 bit signed integer +typedef std::int64_t int64_t; ///< 64 bit signed integer template< typename T > inline int8_t int8_c( T t ) { return numeric_cast< int8_t >(t); } ///< cast to type int8_t using "int8_c(x)" template< typename T > inline int16_t int16_c( T t ) { return numeric_cast< int16_t >(t); } ///< cast to type int16_t using "int16_c(x)" @@ -83,10 +82,10 @@ template< typename T > inline int64_t int64_c( T t ) { return numeric_cast< int6 // fixed size unsigned integral types -typedef boost::uint8_t uint8_t; ///< 8 bit unsigned integer -typedef boost::uint16_t uint16_t; ///< 16 bit unsigned integer -typedef boost::uint32_t uint32_t; ///< 32 bit unsigned integer -typedef boost::uint64_t uint64_t; ///< 64 bit unsigned integer +typedef std::uint8_t uint8_t; ///< 8 bit unsigned integer +typedef std::uint16_t uint16_t; ///< 16 bit unsigned integer +typedef std::uint32_t uint32_t; ///< 32 bit unsigned integer +typedef std::uint64_t uint64_t; ///< 64 bit unsigned integer typedef uint8_t byte_t; typedef uint64_t id_t; //sid datatype for pe @@ -156,7 +155,7 @@ static const uint_t UINT_BITS_LD = int_ld< std::numeric_limits< uint_t >::digits typedef int cell_idx_t; //typedef int64_t cell_idx_t; -BOOST_STATIC_ASSERT( std::numeric_limits<cell_idx_t>::is_specialized && +WALBERLA_STATIC_ASSERT( std::numeric_limits<cell_idx_t>::is_specialized && std::numeric_limits<cell_idx_t>::is_integer && std::numeric_limits<cell_idx_t>::is_signed ); diff --git a/src/core/Regex.h b/src/core/Regex.h index 85eeba2be889b3e4d7968d9a62acfff4f67ea2d3..03d45ba7812fb44b5e6e2cf97666c1f4c313df9e 100644 --- a/src/core/Regex.h +++ b/src/core/Regex.h @@ -22,43 +22,15 @@ #pragma once -#if ( defined WALBERLA_CXX_COMPILER_IS_IBM ) -#include <boost/regex.hpp> -#elif ( defined WALBERLA_CXX_COMPILER_IS_CLANG ) && ( ( __clang_major__ == 3 ) && ( __clang_minor__ <= 4 ) ) -#include <boost/regex.hpp> -#elif ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ <= 8 ) ) -#include <boost/regex.hpp> -#else #include <regex> -#endif namespace walberla { -#if ( defined WALBERLA_CXX_COMPILER_IS_IBM ) -using boost::regex; -using boost::regex_match; -using boost::regex_error; -using boost::regex_search; -using boost::regex_replace; -#elif ( defined WALBERLA_CXX_COMPILER_IS_CLANG ) && ( ( __clang_major__ == 3 ) && ( __clang_minor__ <= 4 ) ) -using boost::regex; -using boost::regex_match; -using boost::regex_error; -using boost::regex_search; -using boost::regex_replace; -#elif ( defined WALBERLA_CXX_COMPILER_IS_GNU ) && ( ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ <= 8 ) ) -using boost::regex; -using boost::regex_match; -using boost::regex_error; -using boost::regex_search; -using boost::regex_replace; -#else using std::regex; using std::regex_match; using std::regex_error; using std::regex_search; using std::regex_replace; -#endif } \ No newline at end of file diff --git a/src/core/cell/CellInterval.h b/src/core/cell/CellInterval.h index 1f4737337e942f340001c4363e613485624cf2e8..10dfb0d9b1bbc375aeac80e08118b61af8c8cfd4 100644 --- a/src/core/cell/CellInterval.h +++ b/src/core/cell/CellInterval.h @@ -29,7 +29,6 @@ #include "core/mpi/RecvBuffer.h" #include "core/mpi/SendBuffer.h" -#include <boost/static_assert.hpp> #include <algorithm> #include <iterator> diff --git a/src/core/debug/CheckFunctions.h b/src/core/debug/CheckFunctions.h index 54efea20b30ba2abc04105df96729d00d900eb53..4e64bbf358954947fd4fdcd01cf9808d93ed77c4 100644 --- a/src/core/debug/CheckFunctions.h +++ b/src/core/debug/CheckFunctions.h @@ -28,8 +28,6 @@ #include "core/math/Utility.h" #include "core/VectorTrait.h" -//#include <boost/math/special_functions/next.hpp> -#include <boost/static_assert.hpp> #include <boost/type_traits/is_arithmetic.hpp> #include <boost/type_traits/is_floating_point.hpp> #include <boost/type_traits/has_left_shift.hpp> diff --git a/src/core/debug/CheckFunctions.impl.h b/src/core/debug/CheckFunctions.impl.h index fb67dd269fcd357eb986bd7e32b283e23c82ccae..fac44221d516a0a8be73690787eecff21a672e88 100644 --- a/src/core/debug/CheckFunctions.impl.h +++ b/src/core/debug/CheckFunctions.impl.h @@ -20,6 +20,7 @@ //====================================================================================================================== +#include <boost/type_traits/integral_constant.hpp> /// \cond internal diff --git a/src/core/debug/Debug.h b/src/core/debug/Debug.h index 8bca728a3a9af53e395ec413a069095409bd56e3..3ea4bcd054c16039fb2adedfaf4e8043ed38ff5c 100644 --- a/src/core/debug/Debug.h +++ b/src/core/debug/Debug.h @@ -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 diff --git a/src/core/logging/Logging.h b/src/core/logging/Logging.h index 0f7a88319dfa29625b18ee6faa59a3179538a7bf..603b944142e3dd564bd57ffaa7b2e03b5dc1e84a 100644 --- a/src/core/logging/Logging.h +++ b/src/core/logging/Logging.h @@ -31,7 +31,7 @@ #include "core/Regex.h" #include <boost/algorithm/string/replace.hpp> -#include <boost/function.hpp> +#include <functional> #include <cmath> #include <fstream> diff --git a/src/core/math/DistributedSample.cpp b/src/core/math/DistributedSample.cpp index 8d7a531b55545d059b600e25ceb9c8f10704cf93..509af72af40ccd817e29f183e0d1b8925574a414 100644 --- a/src/core/math/DistributedSample.cpp +++ b/src/core/math/DistributedSample.cpp @@ -26,7 +26,6 @@ #include <boost/algorithm/string/replace.hpp> #include <boost/lexical_cast.hpp> -#include <boost/math/special_functions/pow.hpp> @@ -64,7 +63,10 @@ void DistributedSample::mpiAllGather() variance_ = real_t(0); for( auto it = data_.begin(); it != data_.end(); ++it ) - variance_ += boost::math::pow<2>( *it - mean_ ); + { + real_t val = *it - mean_; + variance_ += val*val; + } WALBERLA_MPI_SECTION() { @@ -120,7 +122,10 @@ void DistributedSample::mpiGather( int rank ) variance_ = real_t(0); for( auto it = data_.begin(); it != data_.end(); ++it ) - variance_ += boost::math::pow<2>( *it - mean_ ); + { + real_t val = *it - mean_; + variance_ += val*val; + } WALBERLA_MPI_SECTION() { diff --git a/src/core/math/FPClassify.h b/src/core/math/FPClassify.h index 2c87b8e2b37597f02c5e824f8ac650d6b16e70da..abd8aee27c2d15ea1b13558fda974c5866d46eb8 100644 --- a/src/core/math/FPClassify.h +++ b/src/core/math/FPClassify.h @@ -22,7 +22,7 @@ #pragma once -#include <boost/math/special_functions/fpclassify.hpp> +#include <cmath> namespace walberla { @@ -39,7 +39,7 @@ namespace math { template<typename T> inline bool isnan(T x) { - return (boost::math::isnan)(x); + return (std::isnan)(x); } @@ -53,7 +53,7 @@ inline bool isnan(T x) template<typename T> inline bool isinf(T x) { - return (boost::math::isinf)(x); + return (std::isinf)(x); } @@ -67,7 +67,7 @@ inline bool isinf(T x) template<typename T> bool finite(T x) { - return (boost::math::isfinite)(x); + return (std::isfinite)(x); } diff --git a/src/core/math/GenericAABB.h b/src/core/math/GenericAABB.h index 99e1ac6478d2fef22a3cafc4e9d29eaaa68c5d60..aa8e15ac57be558db072a0aef155bde677c97d52 100644 --- a/src/core/math/GenericAABB.h +++ b/src/core/math/GenericAABB.h @@ -30,7 +30,7 @@ #include <boost/array.hpp> #include <boost/type_traits/is_floating_point.hpp> -#include <boost/random/uniform_real_distribution.hpp> +#include <random> namespace walberla { diff --git a/src/core/math/GenericAABB.impl.h b/src/core/math/GenericAABB.impl.h index e5db1a23cd68e35012b3720c76213e118697963f..5709d770e51cf1f03ff81f3c9e322032b35325d6 100644 --- a/src/core/math/GenericAABB.impl.h +++ b/src/core/math/GenericAABB.impl.h @@ -1717,7 +1717,7 @@ void GenericAABB< T >::intersect( const GenericAABB & other ) * The point is in ( [ xMin(), xMax() ), [ yMin(), yMax() ), [ zMin(), zMax() ) ) * * \pre !empty() - * \param engine An Uniform Random Number Generator (e.g. boost::random::mt19937) + * \param engine An Uniform Random Number Generator (e.g. std::mt19937) * \returns Random point within *this */ template< typename T > @@ -1725,9 +1725,9 @@ template< typename Engine > typename GenericAABB< T >::vector_type GenericAABB< T >::randomPoint( Engine & engine ) const { WALBERLA_ASSERT( !empty() ); - boost::random::uniform_real_distribution< T > randX( xMin(), xMax() ); - boost::random::uniform_real_distribution< T > randY( yMin(), yMax() ); - boost::random::uniform_real_distribution< T > randZ( zMin(), zMax() ); + std::uniform_real_distribution< T > randX( xMin(), xMax() ); + std::uniform_real_distribution< T > randY( yMin(), yMax() ); + std::uniform_real_distribution< T > randZ( zMin(), zMax() ); return vector_type( randX( engine ), randY( engine ), randZ( engine ) ); } diff --git a/src/core/math/Matrix2.h b/src/core/math/Matrix2.h index db66c6e2cc45be63c6798537dd8e1d6f6db04d56..87b41821e01dc77efd2e2daffc82382ada132980 100644 --- a/src/core/math/Matrix2.h +++ b/src/core/math/Matrix2.h @@ -28,7 +28,6 @@ #include "core/mpi/RecvBuffer.h" #include "core/mpi/SendBuffer.h" -#include <boost/static_assert.hpp> #include <algorithm> #include <cmath> #include <iostream> @@ -725,9 +724,9 @@ inline const Matrix2<Type> Matrix2<Type>::getTranspose() const template< typename Type > inline Matrix2<Type>& Matrix2<Type>::invert() { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); Type det = getDeterminant(); @@ -754,9 +753,9 @@ inline Matrix2<Type>& Matrix2<Type>::invert() template< typename Type > inline const Matrix2<Type> Matrix2<Type>::getInverse() const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); Type det = getDeterminant(); @@ -898,7 +897,7 @@ inline bool isnan( const Matrix2<Type>& m ) template< typename Type > inline const Matrix2<Type> abs( const Matrix2<Type>& m ) { - BOOST_STATIC_ASSERT( std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( std::numeric_limits<Type>::is_integer ); return Matrix2<Type>( std::abs(m[0]), std::abs(m[1]), std::abs(m[2]), std::abs(m[3]) ); } @@ -919,7 +918,7 @@ inline const Matrix2<Type> abs( const Matrix2<Type>& m ) template< typename Type > inline const Matrix2<Type> fabs( const Matrix2<Type>& m ) { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); return Matrix2<Type>( std::fabs(m[0]), std::fabs(m[1]), std::fabs(m[2]), std::fabs(m[3]) ); } diff --git a/src/core/math/Matrix3.h b/src/core/math/Matrix3.h index 8706833ae539070102d9258ece6c8faecf1016e1..42a36dc9e2e95727dc0bb66117124c33162c31f8 100644 --- a/src/core/math/Matrix3.h +++ b/src/core/math/Matrix3.h @@ -32,7 +32,6 @@ #include "core/mpi/RecvBuffer.h" #include "core/mpi/SendBuffer.h" -#include <boost/static_assert.hpp> #include <boost/type_traits/is_arithmetic.hpp> #include <boost/utility/enable_if.hpp> @@ -370,9 +369,9 @@ template< typename Type > template< typename Axis, typename Angle > Matrix3<Type>::Matrix3( Vector3<Axis> axis, Angle angle ) { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Axis>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Angle>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Axis>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Angle>::is_integer ); const Angle sina( std::sin(angle) ); const Angle cosa( std::cos(angle) ); @@ -1007,9 +1006,9 @@ inline const Matrix3<Type> Matrix3<Type>::getTranspose() const template< typename Type > inline Matrix3<Type>& Matrix3<Type>::invert() { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); Type det = v_[0] * ( ( v_[4] * v_[8] ) - ( v_[7] * v_[5] ) ) + v_[1] * ( ( v_[5] * v_[6] ) - ( v_[8] * v_[3] ) ) + @@ -1046,7 +1045,7 @@ inline Matrix3<Type>& Matrix3<Type>::invert() template< typename Type > inline const Matrix3<Type> Matrix3<Type>::getInverse() const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); Type det = v_[0] * ( ( v_[4] * v_[8] ) - ( v_[7] * v_[5] ) ) + v_[1] * ( ( v_[5] * v_[6] ) - ( v_[8] * v_[3] ) ) + @@ -1101,8 +1100,8 @@ template< typename Type > template< typename Other > inline const Matrix3<HIGH> Matrix3<Type>::rotate( const Matrix3<Other>& m ) const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Other>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Other>::is_integer ); //--Multiplication in two steps (number of FLOP = 90, 1 additional temporary matrix)------------ @@ -1160,8 +1159,8 @@ template< typename Type > template< typename Other > inline const Matrix3<HIGH> Matrix3<Type>::diagRotate( const Matrix3<Other>& m ) const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Other>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Other>::is_integer ); // Precalculating tmp = m * R(-1) const Matrix3<HIGH> tmp( m.v_[0]*v_[0], m.v_[0]*v_[3], m.v_[0]*v_[6], @@ -1249,7 +1248,7 @@ inline bool Matrix3<Type>::isZero() const template< typename Type > inline const Matrix3<Type> Matrix3<Type>::getCholesky() const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); Matrix3 tmp( Type(0) ); @@ -1292,8 +1291,8 @@ template< typename Type > template< typename Other > inline const Vector3<HIGH> Matrix3<Type>::solve( const Vector3<Other> &rhs ) const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); - BOOST_STATIC_ASSERT( !std::numeric_limits<Other>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Other>::is_integer ); Vector3<HIGH> tmp1, tmp2; HIGH sum; @@ -1355,7 +1354,7 @@ inline Type Matrix3<Type>::trace() const template< typename Type > inline const Vector3<Type> Matrix3<Type>::getEulerAnglesXYZ() const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); const Type cy( std::sqrt( v_[0]*v_[0] + v_[3]*v_[3] ) ); @@ -1382,7 +1381,7 @@ inline const Vector3<Type> Matrix3<Type>::getEulerAnglesXYZ() const template< typename Type > const Vector3<Type> Matrix3<Type>::getEulerAngles( EulerRotation order ) const { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); static const uint_t eulSafe[4] = { 0, 1, 2, 0 }; static const uint_t eulNext[4] = { 1, 2, 0, 1 }; @@ -1663,7 +1662,7 @@ inline bool isnan( const Matrix3<Type>& m ) template< typename Type > inline const Matrix3<Type> abs( const Matrix3<Type>& m ) { - BOOST_STATIC_ASSERT( std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( std::numeric_limits<Type>::is_integer ); return Matrix3<Type>( std::abs(m[0]), std::abs(m[1]), std::abs(m[2]), std::abs(m[3]), std::abs(m[4]), std::abs(m[5]), std::abs(m[6]), std::abs(m[7]), std::abs(m[8]) ); @@ -1685,7 +1684,7 @@ inline const Matrix3<Type> abs( const Matrix3<Type>& m ) template< typename Type > inline const Matrix3<Type> fabs( const Matrix3<Type>& m ) { - BOOST_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); + WALBERLA_STATIC_ASSERT( !std::numeric_limits<Type>::is_integer ); return Matrix3<Type>( std::fabs(m[0]), std::fabs(m[1]), std::fabs(m[2]), std::fabs(m[3]), std::fabs(m[4]), std::fabs(m[5]), std::fabs(m[6]), std::fabs(m[7]), std::fabs(m[8]) ); diff --git a/src/core/math/PhysicalCheck.cpp b/src/core/math/PhysicalCheck.cpp index 43c8e5030a5e0266f12701acab71fd9d11fd7255..321890603a9e7d0306858a94e489dad95b02cf4d 100644 --- a/src/core/math/PhysicalCheck.cpp +++ b/src/core/math/PhysicalCheck.cpp @@ -231,7 +231,7 @@ namespace math { constraints_.push_back( *i ); } - void PhysicalCheck::completeConfig( const boost::shared_ptr<Config>& config ) + void PhysicalCheck::completeConfig( const shared_ptr<Config>& config ) { auto globalBlock = config->getWritableGlobalBlock(); diff --git a/src/core/math/PhysicalCheck.h b/src/core/math/PhysicalCheck.h index d3ae91ee9848425fef6ecc063e3a3c254ebcf897..857b292f404f96b2bec8fed07ed036963afefea4 100644 --- a/src/core/math/PhysicalCheck.h +++ b/src/core/math/PhysicalCheck.h @@ -94,7 +94,7 @@ namespace math { void addEquations ( const std::vector<std::string>& equations ); void addUnitParameterRelations ( const std::map< std::string, std::string >& unitParameterRelations ); void addConstraints ( const std::vector<std::string>& constraints ); - void completeConfig ( const boost::shared_ptr<Config>& config ); + void completeConfig ( const shared_ptr<Config>& config ); //@} //**************************************************************************************************************** diff --git a/src/core/math/Quaternion.h b/src/core/math/Quaternion.h index a20309bfd857aa85a8739bf834e9de7b7a424040..ccf6836d1f16a204b3ba179d1acfefdf1a0d1878 100644 --- a/src/core/math/Quaternion.h +++ b/src/core/math/Quaternion.h @@ -661,7 +661,7 @@ inline void Quaternion<Type>::swap( Quaternion& q ) /* throw() */ template< typename Type > inline const Vector3<Type> Quaternion<Type>::getEulerAnglesXYZ() const { - BOOST_STATIC_ASSERT(!std::numeric_limits<Type>::is_integer); + WALBERLA_STATIC_ASSERT(!std::numeric_limits<Type>::is_integer); Vector3<Type> eulerAngles; diff --git a/src/core/math/Random.cpp b/src/core/math/Random.cpp index 0236e1012abe4745d3527bc4542d5581476331ae..72707f208e5053cba44daed005e2685f86333e8b 100644 --- a/src/core/math/Random.cpp +++ b/src/core/math/Random.cpp @@ -29,9 +29,9 @@ namespace math { namespace internal { -static boost::mt19937 generator; // static boost::random::mt19937_64 generator; +static std::mt19937 generator; // static std::mt19937_64 generator; -boost::mt19937 & getGenerator() // boost::random::mt19937_64 +std::mt19937 & getGenerator() // std::mt19937_64 { return generator; } @@ -40,7 +40,7 @@ boost::mt19937 & getGenerator() // boost::random::mt19937_64 -void seedRandomGenerator( const boost::mt19937::result_type & seed ) +void seedRandomGenerator( const std::mt19937::result_type & seed ) { #ifdef _OPENMP #pragma omp critical (random) diff --git a/src/core/math/Random.h b/src/core/math/Random.h index 77476461533158952bdb8d5c328cd9a07b1f3854..ec61aa51d65b76f3a10c243086d08a48eb166590 100644 --- a/src/core/math/Random.h +++ b/src/core/math/Random.h @@ -24,9 +24,7 @@ #include "core/DataTypes.h" #include "core/debug/Debug.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> // #include <boost/random/uniform_int_distribution.hpp> -#include <boost/random/uniform_real.hpp> // #include <boost/random/uniform_real_distribution.hpp> +#include <random> #include <limits> @@ -36,12 +34,12 @@ namespace math { namespace internal { -boost::mt19937 & getGenerator(); // boost::random::mt19937_64 +std::mt19937 & getGenerator(); // std::mt19937_64 } -void seedRandomGenerator( const boost::mt19937::result_type & seed ); // boost::random::mt19937_64 +void seedRandomGenerator( const std::mt19937::result_type & seed ); // std::mt19937_64 @@ -51,13 +49,13 @@ void seedRandomGenerator( const boost::mt19937::result_type & seed ); // boost:: */ //********************************************************************************************************************** template< typename INT > -INT intRandom( const INT min = std::numeric_limits<INT>::min(), const INT max = std::numeric_limits<INT>::max(), - boost::mt19937 & generator = internal::getGenerator() ) +INT intRandom( const INT min, const INT max, std::mt19937 & generator ) { static_assert_int_t< INT >(); + static_assert(sizeof(INT) > sizeof(char), "cannot use char"); WALBERLA_ASSERT_LESS_EQUAL( min, max ); - boost::uniform_int< INT > distribution( min, max ); // boost::random::uniform_int_distribution< INT > distribution; + std::uniform_int_distribution< INT > distribution( min, max ); INT value; #ifdef _OPENMP @@ -68,19 +66,89 @@ INT intRandom( const INT min = std::numeric_limits<INT>::min(), const INT max = return value; } +template<> +inline char intRandom<char>( const char min, const char max, std::mt19937 & generator ) +{ + static_assert_int_t< char >(); + WALBERLA_ASSERT_LESS_EQUAL( min, max ); + + std::uniform_int_distribution< int16_t > distribution( min, max ); + + char value; +#ifdef _OPENMP + #pragma omp critical (random) +#endif + { value = static_cast<char>( distribution( generator ) ); } + + return value; +} + +template<> +inline unsigned char intRandom<unsigned char>( const unsigned char min, const unsigned char max, std::mt19937 & generator ) +{ + static_assert_int_t< unsigned char >(); + WALBERLA_ASSERT_LESS_EQUAL( min, max ); + + std::uniform_int_distribution< int16_t > distribution( min, max ); + + unsigned char value; +#ifdef _OPENMP + #pragma omp critical (random) +#endif + { value = static_cast<unsigned char>( distribution( generator ) ); } + + return value; +} + +template<> +inline signed char intRandom<signed char>( const signed char min, const signed char max, std::mt19937 & generator ) +{ + static_assert_int_t< signed char >(); + WALBERLA_ASSERT_LESS_EQUAL( min, max ); + + std::uniform_int_distribution< int16_t > distribution( min, max ); + + signed char value; +#ifdef _OPENMP + #pragma omp critical (random) +#endif + { value = static_cast<signed char>( distribution( generator ) ); } + + return value; +} + + +template< typename INT > +INT intRandom( const INT min ) +{ + return intRandom( min, std::numeric_limits<INT>::max(), internal::getGenerator() ); +} + +template< typename INT > +INT intRandom( const INT min, const INT max ) +{ + return intRandom( min, max, internal::getGenerator() ); +} + +template< typename INT > +INT intRandom() +{ + return intRandom( std::numeric_limits<INT>::min(), std::numeric_limits<INT>::max() ); +} + template< typename INT > class IntRandom { public: - IntRandom( const boost::mt19937::result_type & seed = boost::mt19937::result_type() ) { generator_.seed( seed ); } + IntRandom( const std::mt19937::result_type & seed = std::mt19937::result_type() ) { generator_.seed( seed ); } INT operator()( const INT min = std::numeric_limits<INT>::min(), const INT max = std::numeric_limits<INT>::max() ) { return intRandom( min, max, generator_ ); } private: - boost::mt19937 generator_; + std::mt19937 generator_; }; @@ -91,12 +159,12 @@ private: */ //********************************************************************************************************************** template< typename REAL > -REAL realRandom( const REAL min = REAL(0), const REAL max = REAL(1), boost::mt19937 & generator = internal::getGenerator() ) +REAL realRandom( const REAL min = REAL(0), const REAL max = REAL(1), std::mt19937 & generator = internal::getGenerator() ) { static_assert( std::numeric_limits<REAL>::is_specialized && !std::numeric_limits<REAL>::is_integer, "Floating point type required/expected!" ); WALBERLA_ASSERT_LESS( min, max ); - boost::uniform_real< REAL > distribution( min, max ); // boost::uniform_real_distribution< REAL > distribution( min, max ); + std::uniform_real_distribution< REAL > distribution( min, max ); REAL value; #ifdef _OPENMP @@ -113,13 +181,13 @@ template< typename REAL > class RealRandom { public: - RealRandom( const boost::mt19937::result_type & seed = boost::mt19937::result_type() ) { generator_.seed( seed ); } + RealRandom( const std::mt19937::result_type & seed = std::mt19937::result_type() ) { generator_.seed( seed ); } REAL operator()( const REAL min = REAL(0), const REAL max = REAL(1) ) { return realRandom( min, max, generator_ ); } private: - boost::mt19937 generator_; + std::mt19937 generator_; }; @@ -133,10 +201,10 @@ inline bool boolRandom() { ///< Randomly returns 'true' or 'false' class BoolRandom { public: - BoolRandom( const boost::mt19937::result_type & seed = boost::mt19937::result_type() ) { generator_.seed( seed ); } + BoolRandom( const std::mt19937::result_type & seed = std::mt19937::result_type() ) { generator_.seed( seed ); } bool operator()() { return boolRandom(); } private: - boost::mt19937 generator_; + std::mt19937 generator_; }; diff --git a/src/core/math/Sample.cpp b/src/core/math/Sample.cpp index 6db1ad17abb7600aeec1bcf9fbd6fb792712bcea..eabe897cd81c45ba07445f168e87841eecea99fa 100644 --- a/src/core/math/Sample.cpp +++ b/src/core/math/Sample.cpp @@ -26,7 +26,6 @@ #include <boost/algorithm/string/replace.hpp> #include <boost/lexical_cast.hpp> -#include <boost/math/special_functions/pow.hpp> #include <functional> #include <iterator> @@ -128,7 +127,10 @@ real_t Sample::variance( real_t theMean ) const KahanAccumulator< real_t > acc; for(auto it = begin(); it != end(); ++it) - acc += boost::math::pow<2>(*it - theMean); + { + real_t val = *it - theMean; + acc += val*val; + } return acc.get() / real_c(size()); } diff --git a/src/core/math/Utility.h b/src/core/math/Utility.h index f53d2c47c86d94b38592513bc6083e3eef5e14bb..198cd4c73dd9e311e3f8fa2766d2a827f9eb0dd2 100644 --- a/src/core/math/Utility.h +++ b/src/core/math/Utility.h @@ -26,7 +26,6 @@ #include "core/DataTypes.h" #include <boost/math/constants/constants.hpp> -#include <boost/static_assert.hpp> #include <cmath> #include <cstddef> #include <limits> @@ -100,7 +99,7 @@ inline real_t round( real_t a ); template< typename T > inline const T sign( T a ) { - BOOST_STATIC_ASSERT( std::numeric_limits<T>::is_signed ); + WALBERLA_STATIC_ASSERT( std::numeric_limits<T>::is_signed ); return ( a < T(0) )?( T(-1) ):( T(1) ); } //********************************************************************************************************************** diff --git a/src/core/math/Vector2.h b/src/core/math/Vector2.h index 247f2a026a83e68365ff58be1864b0713b30c59d..1ad6f9cab05d9eda80a0684d736e5921ba26b5d0 100644 --- a/src/core/math/Vector2.h +++ b/src/core/math/Vector2.h @@ -38,7 +38,6 @@ #include "core/mpi/SendBuffer.h" #include <boost/functional/hash.hpp> -#include <boost/static_assert.hpp> #include <boost/type_traits/is_floating_point.hpp> #include <boost/type_traits/is_fundamental.hpp> #include <boost/type_traits/is_same.hpp> diff --git a/src/core/math/Vector3.h b/src/core/math/Vector3.h index 38fbf7ef0c40e0d3111bc7214bf21d6d8f05b826..f5b1ea819cff09f5813a162574ee318ab8bd7fa7 100644 --- a/src/core/math/Vector3.h +++ b/src/core/math/Vector3.h @@ -39,7 +39,6 @@ #include "core/debug/CheckFunctions.h" #include <boost/functional/hash.hpp> -#include <boost/static_assert.hpp> #include <boost/type_traits.hpp> #include <boost/type_traits/is_floating_point.hpp> #include <boost/type_traits/is_fundamental.hpp> diff --git a/src/core/math/equation_system/Equation.cpp b/src/core/math/equation_system/Equation.cpp index 6c355b86fdc800e2d1513979fc2be8280a602258..53bef41aa50ae3e29425ab947390380e891cf372 100644 --- a/src/core/math/equation_system/Equation.cpp +++ b/src/core/math/equation_system/Equation.cpp @@ -23,7 +23,8 @@ #include "Operator.h" #include "Variable.h" -#include <boost/math/special_functions/fpclassify.hpp> +#include <cmath> +#include <algorithm> namespace walberla { @@ -128,10 +129,10 @@ namespace math { double left = root_->left_->compute(); double right = root_->right_->compute(); - if ( boost::math::isnan(left) && boost::math::isnan(right) ){ + if ( std::isnan(left) && std::isnan(right) ){ //WALBERLA_LOG_WARNING( "WARNING: Both values are NAN -> return true" ); return true; - } else if ( boost::math::isinf(left) && boost::math::isinf(right) ){ + } else if ( std::isinf(left) && std::isinf(right) ){ //WALBERLA_LOG_WARNING( "WARNING: Both values are INF -> return true" ); return true; } diff --git a/src/core/math/equation_system/EquationSystem.h b/src/core/math/equation_system/EquationSystem.h index 5ba6d2db2f24c0c7c0fe09aae48fe8236d071025..56a15bf8096b58fbd26dc007d7fb6522c4232166 100644 --- a/src/core/math/equation_system/EquationSystem.h +++ b/src/core/math/equation_system/EquationSystem.h @@ -121,7 +121,7 @@ namespace math { }; - typedef boost::shared_ptr< EquationSystem > EquationSystemPtr; + typedef shared_ptr< EquationSystem > EquationSystemPtr; } // namespace math } // namespace walberla diff --git a/src/core/math/equation_system/FwdEquation.h b/src/core/math/equation_system/FwdEquation.h index 587eceb7960558b5d69f4e300c74edbbb363c5a9..37787456b7eb1daa3ab131cb30112bd9804e483e 100644 --- a/src/core/math/equation_system/FwdEquation.h +++ b/src/core/math/equation_system/FwdEquation.h @@ -21,7 +21,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> namespace walberla { @@ -41,13 +41,13 @@ namespace math { }; class Node; - typedef boost::shared_ptr<Node> NodePtr; + typedef std::shared_ptr<Node> NodePtr; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // EQUATION ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class Equation; - typedef boost::shared_ptr< Equation > EquationPtr; + typedef std::shared_ptr< Equation > EquationPtr; } // namespace math } // namespace walberla diff --git a/src/core/math/equation_system/FwdOperator.h b/src/core/math/equation_system/FwdOperator.h index 1b54a2dbeddc74a879d102edd7787626842a4e82..2df1ae9abda4bed416e52223400111758ea4e4fa 100644 --- a/src/core/math/equation_system/FwdOperator.h +++ b/src/core/math/equation_system/FwdOperator.h @@ -21,7 +21,6 @@ #pragma once -#include <boost/shared_ptr.hpp> #include <map> diff --git a/src/core/math/equation_system/FwdVariable.h b/src/core/math/equation_system/FwdVariable.h index cbd8c86f709fa590016071e4cad036558d947af8..76715f973efe5b97d47fe7762abc8747f14e760b 100644 --- a/src/core/math/equation_system/FwdVariable.h +++ b/src/core/math/equation_system/FwdVariable.h @@ -21,7 +21,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <map> #include <string> @@ -33,7 +33,7 @@ namespace math { class Var; - typedef boost::shared_ptr<Var> VarPtr; + typedef std::shared_ptr<Var> VarPtr; typedef std::map<std::string, VarPtr> VarMap; typedef std::map<std::string, VarPtr>::const_iterator VarMapIt; diff --git a/src/core/math/equation_system/Variable.cpp b/src/core/math/equation_system/Variable.cpp index 12295cb9c6e909735b6c8207ec61b4d83ad6f930..04d9b7517c75fc3428aad650d4963dd872f2c92b 100644 --- a/src/core/math/equation_system/Variable.cpp +++ b/src/core/math/equation_system/Variable.cpp @@ -21,7 +21,7 @@ #include "Variable.h" -#include <boost/math/special_functions/fpclassify.hpp> +#include <cmath> #include <sstream> @@ -36,7 +36,7 @@ namespace math { void Var::setValue( const double value ){ value_ = value; - valid_ = !boost::math::isnan( value ); + valid_ = !std::isnan( value ); } bool Var::operator==( const Var& var) const { diff --git a/src/core/mpi/OpenMPBufferSystem.cpp b/src/core/mpi/OpenMPBufferSystem.cpp index afdc66b1af087e43b9195f59d47e571cee161a0d..54471ccf415c82cd2403d0a4db3c122de9ced943 100644 --- a/src/core/mpi/OpenMPBufferSystem.cpp +++ b/src/core/mpi/OpenMPBufferSystem.cpp @@ -47,14 +47,14 @@ OpenMPBufferSystem::OpenMPBufferSystem( const MPI_Comm & communicator, int tag, } -void OpenMPBufferSystem::addReceivingFunction( MPIRank rank, boost::function<void ( RecvBuffer & buf ) > recvFunction ) +void OpenMPBufferSystem::addReceivingFunction( MPIRank rank, std::function<void ( RecvBuffer & buf ) > recvFunction ) { dirty_ = true; recvFunctions_[rank] = recvFunction; } -void OpenMPBufferSystem::addSendingFunction ( MPIRank rank, boost::function<void ( SendBuffer & buf ) > sendFunction ) +void OpenMPBufferSystem::addSendingFunction ( MPIRank rank, std::function<void ( SendBuffer & buf ) > sendFunction ) { dirty_ = true; sendRanks_.push_back( rank ); diff --git a/src/core/mpi/OpenMPBufferSystem.h b/src/core/mpi/OpenMPBufferSystem.h index f38f471608cdf00f36a3c7d062149c14500b7eee..9fd31e2b2146b23fef31a8b1ae768621cadeb738 100644 --- a/src/core/mpi/OpenMPBufferSystem.h +++ b/src/core/mpi/OpenMPBufferSystem.h @@ -23,7 +23,7 @@ #include "BufferSystem.h" -#include <boost/function.hpp> +#include <functional> #include <map> @@ -60,8 +60,8 @@ public: bool isSizeCommunicatedInNextStep() const { return bs_.isSizeCommunicatedInNextStep(); } - void addReceivingFunction( MPIRank rank, boost::function<void ( RecvBuffer & buf ) > recvFunction ); - void addSendingFunction ( MPIRank rank, boost::function<void ( SendBuffer & buf ) > sendFunction ); + void addReceivingFunction( MPIRank rank, std::function<void ( RecvBuffer & buf ) > recvFunction ); + void addSendingFunction ( MPIRank rank, std::function<void ( SendBuffer & buf ) > sendFunction ); void clearReceivingFunctions() { dirty_ = true; recvFunctions_.clear(); } void clearSendingFunctions() { dirty_ = true; sendFunctions_.clear(); sendRanks_.clear(); } @@ -86,11 +86,11 @@ private: bool sizeChangesEverytime_; - std::map<MPIRank, boost::function<void ( RecvBuffer & )> > recvFunctions_; + std::map<MPIRank, std::function<void ( RecvBuffer & )> > recvFunctions_; std::vector<MPIRank> sendRanks_; - std::vector< boost::function<void ( SendBuffer & )> > sendFunctions_; + std::vector< std::function<void ( SendBuffer & )> > sendFunctions_; void startCommunicationOpenMP(); void startCommunicationSerial(); diff --git a/src/core/mpi/RecvBuffer.h b/src/core/mpi/RecvBuffer.h index 5015f9bf52c8373cf70c0eb72286027cd5498971..3caa764b7bfc9a2559d78204cc10bc2e8c33c6fb 100644 --- a/src/core/mpi/RecvBuffer.h +++ b/src/core/mpi/RecvBuffer.h @@ -554,10 +554,10 @@ template< typename T > // Element type template< typename V > // Type of the built-in data value inline void GenericRecvBuffer<T>::peek( V& value ) const { - BOOST_STATIC_ASSERT( boost::is_arithmetic<V>::value ); + WALBERLA_STATIC_ASSERT( boost::is_arithmetic<V>::value ); - BOOST_STATIC_ASSERT( sizeof(V) > sizeof(T) ); - BOOST_STATIC_ASSERT( sizeof(V) % sizeof(T) == 0); + WALBERLA_STATIC_ASSERT( sizeof(V) > sizeof(T) ); + WALBERLA_STATIC_ASSERT( sizeof(V) % sizeof(T) == 0); // Checking the validity of the read operation WALBERLA_ASSERT_LESS_EQUAL( cur_ + BUFFER_DEBUG_OVERHEAD + sizeof(V)/sizeof(T), end_); diff --git a/src/core/singleton/Singleton.h b/src/core/singleton/Singleton.h index bb3e6ba8eb691e84df4a3334a2696f25e67a70ef..441a730c7e8dfae097317fda450101a71d1f1401 100644 --- a/src/core/singleton/Singleton.h +++ b/src/core/singleton/Singleton.h @@ -27,9 +27,7 @@ #include "core/DataTypes.h" #include "core/NonCopyable.h" -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD -#include <boost/thread/mutex.hpp> -#endif +#include <mutex> /// \cond internal @@ -41,14 +39,11 @@ namespace singleton { #ifdef WALBERLA_CXX_COMPILER_IS_GNU #pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wunused-local-typedefs" #endif #ifdef WALBERLA_CXX_COMPILER_IS_CLANG #pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunknown-pragmas" #pragma clang diagnostic ignored "-Wunused-local-typedefs" #endif @@ -495,9 +490,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -520,9 +513,7 @@ private: shared_ptr<D7> dependency7_; //!< Handle to the seventh lifetime dependency. shared_ptr<D8> dependency8_; //!< Handle to the eighth lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -592,9 +583,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -616,9 +605,7 @@ private: shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency. shared_ptr<D7> dependency7_; //!< Handle to the seventh lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -686,9 +673,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -709,9 +694,7 @@ private: shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency. shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -776,9 +759,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -798,9 +779,7 @@ private: shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -862,9 +841,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -883,9 +860,7 @@ private: shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -944,9 +919,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -964,9 +937,7 @@ private: shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -1022,9 +993,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -1041,9 +1010,7 @@ private: shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -1096,9 +1063,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -1114,9 +1079,7 @@ private: //@{ shared_ptr<D1> dependency1_; //!< Handle to the lifetime dependency. -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -1165,9 +1128,7 @@ public: //@{ static const shared_ptr<T>& instance() { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::mutex::scoped_lock lock( instanceMutex_ ); -#endif + std::lock_guard<std::mutex> lock( instanceMutex_ ); static shared_ptr<T> object( new T() ); isInstantiated_ = true; return object; @@ -1181,9 +1142,7 @@ private: //**Member variables**************************************************************************** /*!\name Member variables */ //@{ -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. -#endif + static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. static bool isInstantiated_; //@} @@ -1199,82 +1158,56 @@ private: // //====================================================================================================================== -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -boost::mutex Singleton<T,A,B,C,D,E,F,G,H>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,C,D,E,F,G,H>::instanceMutex_; template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > bool Singleton<T,A,B,C,D,E,F,G,H>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -boost::mutex Singleton<T,A,B,C,D,E,F,G,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,C,D,E,F,G,NullType>::instanceMutex_; template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G > bool Singleton<T,A,B,C,D,E,F,G,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B, typename C, typename D, typename E, typename F > -boost::mutex Singleton<T,A,B,C,D,E,F,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,C,D,E,F,NullType,NullType>::instanceMutex_; template< typename T, typename A, typename B, typename C, typename D, typename E, typename F > bool Singleton<T,A,B,C,D,E,F,NullType,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B, typename C, typename D, typename E > -boost::mutex Singleton<T,A,B,C,D,E,NullType,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,C,D,E,NullType,NullType,NullType>::instanceMutex_; template< typename T, typename A, typename B, typename C, typename D, typename E > bool Singleton<T,A,B,C,D,E,NullType,NullType,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B, typename C, typename D > -boost::mutex Singleton<T,A,B,C,D,NullType,NullType,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,C,D,NullType,NullType,NullType,NullType>::instanceMutex_; template< typename T, typename A, typename B, typename C, typename D > bool Singleton<T,A,B,C,D,NullType,NullType,NullType,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B, typename C > -boost::mutex Singleton<T,A,B,C,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,C,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; template< typename T, typename A, typename B, typename C > bool Singleton<T,A,B,C,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A, typename B > -boost::mutex Singleton<T,A,B,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,B,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; template< typename T, typename A, typename B > bool Singleton<T,A,B,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T, typename A > -boost::mutex Singleton<T,A,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,A,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; template< typename T, typename A > bool Singleton<T,A,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false; - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD template< typename T > -boost::mutex Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; -#endif +std::mutex Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; template< typename T > bool Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false; diff --git a/src/core/timing/Time.h b/src/core/timing/Time.h index 87a962f0ed6e85dabf2eb8dbb12dd49e16c7e6e6..f6112885951e14185e2bdddd3215bde85c495b67 100644 --- a/src/core/timing/Time.h +++ b/src/core/timing/Time.h @@ -31,7 +31,7 @@ #include <sstream> #include <string> -#include <boost/chrono/chrono.hpp> +#include <chrono> #if defined(_MSC_VER) # ifndef NOMINMAX @@ -75,18 +75,7 @@ inline double getCpuTime(); */ inline double getWcTime() { -#ifdef WIN32 - LARGE_INTEGER perfCounter, perfFrequency; - QueryPerformanceCounter( &perfCounter ); - QueryPerformanceFrequency( &perfFrequency ); - return static_cast<double>(perfCounter.QuadPart) / static_cast<double>(perfFrequency.QuadPart); -#elif defined __bg__ // boost::chrono seems broken on BG/Q - struct timeval tp; - gettimeofday( &tp, NULL ); - return ( static_cast<double>( tp.tv_sec ) + static_cast<double>( tp.tv_usec )/1E6 ); -#else - return static_cast<double>(boost::chrono::duration_cast<boost::chrono::nanoseconds>(boost::chrono::high_resolution_clock::now().time_since_epoch()).count()) * 1e-9; -#endif + return static_cast<double>(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count()) * 1e-9; } //********************************************************************************************************************** diff --git a/src/core/uid/UID.h b/src/core/uid/UID.h index 3f4cb7f975be744d46917625d0a92c6286eba924..7739f7a39fe5139d27f9dd6614111d98d3e2c731 100644 --- a/src/core/uid/UID.h +++ b/src/core/uid/UID.h @@ -34,9 +34,8 @@ #include <sstream> #include <string> -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD -#include <boost/thread.hpp> -#endif +#include <mutex> +#include <shared_mutex> namespace walberla { @@ -69,8 +68,7 @@ namespace uid { * translates the numerical UID representations into a bit mask. For further information see the documentation of the * two member functions "toIndex()" and "toBitMask()" of this class. * -* If 'WALBERLA_BUILD_WITH_BOOST_THREAD' is defined, the class UID is thread safe and follows -* a multiple-readers / single-writer pattern. +* The class UID is thread safe and follows a multiple-readers / single-writer pattern. */ //********************************************************************************************************************** @@ -129,10 +127,8 @@ private: static std::map< uint_type, std::string >& uidToString() { static std::map< uint_type, std::string > map; return map; } static std::map< std::string, uint_type >& stringToUid() { static std::map< std::string, uint_type > map; return map; } -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - static boost::shared_mutex& uidToStringMutex() { static boost::shared_mutex mutex; return mutex; } - static boost::shared_mutex& stringToUidMutex() { static boost::shared_mutex mutex; return mutex; } -#endif + static std::shared_timed_mutex& uidToStringMutex() { static std::shared_timed_mutex mutex; return mutex; } + static std::shared_timed_mutex& stringToUidMutex() { static std::shared_timed_mutex mutex; return mutex; } uint_type uid_; @@ -197,9 +193,7 @@ inline UID<T>::UID( const std::string& identifier, const bool newUid, const bool template< typename T > void UID<T>::init( const std::string& identifier, const bool newUid, const bool appendUIDtoIdentifier ) { -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > stringToUid_lock( stringToUidMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > stringToUid_lock( stringToUidMutex() ); WALBERLA_ASSERT( !identifier.empty() ); @@ -211,9 +205,7 @@ void UID<T>::init( const std::string& identifier, const bool newUid, const bool WALBERLA_ASSERT( stringToUid().find( idString ) == stringToUid().end() ); // 'idString' must not exist -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() ); uidToString()[ uid_ ] = idString; stringToUid()[ idString ] = uid_; @@ -226,9 +218,7 @@ void UID<T>::init( const std::string& identifier, const bool newUid, const bool uid_ = T::generateUID(); -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() ); uidToString()[ uid_ ] = identifier; stringToUid()[ identifier ] = uid_; } @@ -256,10 +246,7 @@ UID<T>::UID( const bool createAnonymousUID ) : uid_( 0 ) { #endif } else { - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > stringToUid_lock( stringToUidMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > stringToUid_lock( stringToUidMutex() ); uid_ = T::generateUID(); @@ -267,9 +254,7 @@ UID<T>::UID( const bool createAnonymousUID ) : uid_( 0 ) { WALBERLA_ASSERT( stringToUid().find( identifier ) == stringToUid().end() ); // 'identifier' must not exist -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() ); uidToString()[ uid_ ] = identifier; stringToUid()[ identifier ] = uid_; @@ -304,10 +289,7 @@ inline UID<T>::UID( const uint_type uid ) : uid_( uid ) //********************************************************************************************************************** template< typename T > UID<T> UID<T>::getOrConstruct( const std::string& identifier ) { - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > stringToUid_lock( stringToUidMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > stringToUid_lock( stringToUidMutex() ); WALBERLA_ASSERT( !identifier.empty() ); @@ -317,9 +299,7 @@ UID<T> UID<T>::getOrConstruct( const std::string& identifier ) { uint_type uid = T::generateUID(); -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::unique_lock< boost::shared_mutex > uidToString_lock( uidToStringMutex() ); -#endif + std::unique_lock< std::shared_timed_mutex > uidToString_lock( uidToStringMutex() ); uidToString()[ uid ] = identifier; stringToUid()[ identifier ] = uid; @@ -340,10 +320,7 @@ UID<T> UID<T>::getOrConstruct( const std::string& identifier ) { //********************************************************************************************************************** template< typename T > inline UID<T> UID<T>::get( const std::string& identifier ) { - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::shared_lock< boost::shared_mutex > lock( stringToUidMutex() ); -#endif + std::shared_lock< std::shared_timed_mutex > lock( stringToUidMutex() ); WALBERLA_ASSERT( stringToUid().find( identifier ) != stringToUid().end() ); // 'identifier' must exist @@ -354,10 +331,7 @@ inline UID<T> UID<T>::get( const std::string& identifier ) { template< typename T > inline const std::string& UID<T>::getIdentifier() const { - -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - boost::shared_lock< boost::shared_mutex > lock( uidToStringMutex() ); -#endif + std::shared_lock< std::shared_timed_mutex > lock( uidToStringMutex() ); WALBERLA_ASSERT( valid_ ); WALBERLA_ASSERT( uidToString().find( uid_ ) != uidToString().end() ); diff --git a/src/core/uid/UIDGenerators.h b/src/core/uid/UIDGenerators.h index 96dc6443eba50168b2acba8adf9b1c613cc03101..d9c254d93986340ed079761a2951119e1d7d29c4 100644 --- a/src/core/uid/UIDGenerators.h +++ b/src/core/uid/UIDGenerators.h @@ -24,8 +24,7 @@ #include "core/debug/Debug.h" -#include <boost/cstdint.hpp> -#include <boost/static_assert.hpp> +#include <cstdint> #include <limits> @@ -106,7 +105,7 @@ public: static const char* getType() { static const char* const type = "index generator"; return type; } - BOOST_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && + WALBERLA_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && !std::numeric_limits<UINT>::is_signed ); }; @@ -142,7 +141,7 @@ public: static const char* getType() { static const char* const type = "standard generator"; return type; } - BOOST_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && + WALBERLA_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && !std::numeric_limits<UINT>::is_signed ); }; @@ -242,7 +241,7 @@ public: static const char* getType() { static const char* const type = "bit generator"; return type; } - BOOST_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && + WALBERLA_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && !std::numeric_limits<UINT>::is_signed ); }; @@ -281,7 +280,7 @@ public: static const char* getType() { static const char* const type = "singleton generator"; return type; } - BOOST_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && + WALBERLA_STATIC_ASSERT( std::numeric_limits<UINT>::is_specialized && std::numeric_limits<UINT>::is_integer && !std::numeric_limits<UINT>::is_signed ); }; diff --git a/src/cuda/FieldCopy.h b/src/cuda/FieldCopy.h index 87af5060d139cefd2ef529ab4c51878bc5f72816..07fd04c808032fccd21c3f00f98600294b124a9b 100644 --- a/src/cuda/FieldCopy.h +++ b/src/cuda/FieldCopy.h @@ -49,7 +49,7 @@ namespace cuda { } template<typename DstType, typename SrcType> - boost::function<void()> fieldCpyFunctor( const shared_ptr< StructuredBlockStorage > & blocks, + std::function<void()> fieldCpyFunctor( const shared_ptr< StructuredBlockStorage > & blocks, BlockDataID dstID, ConstBlockDataID srcID ) { return boost::bind( fieldCpy<DstType,SrcType>, blocks, dstID, srcID ); @@ -66,7 +66,7 @@ namespace cuda { } template<typename DstType, typename SrcType> - boost::function<void(IBlock*)> fieldCpyFunctor( BlockDataID dstID, ConstBlockDataID srcID ) + std::function<void(IBlock*)> fieldCpyFunctor( BlockDataID dstID, ConstBlockDataID srcID ) { return boost::bind( fieldCpySweepFunction<DstType,SrcType>, dstID, srcID, _1 ); } diff --git a/src/cuda/GPUCopy.cpp b/src/cuda/GPUCopy.cpp index 3c1c8f12649ab4f2de483e4b6a3ebf6877790910..834150fdcb921064392fb99d6690752b6eaaee3c 100644 --- a/src/cuda/GPUCopy.cpp +++ b/src/cuda/GPUCopy.cpp @@ -26,6 +26,8 @@ #include "GPUCopy.h" #include "ErrorChecking.h" +#include <cstring> + namespace walberla { namespace cuda { @@ -56,7 +58,7 @@ void copyDevToDevFZYX( const cudaPitchedPtr& dst, const cudaPitchedPtr& src, WALBERLA_ASSERT( fIntervalSize == 1 || ( Nz == dstAllocSizeZ && Nz == srcAllocSizeZ ) ); cudaMemcpy3DParms p; - memset( &p, 0, sizeof(p) ); + std::memset( &p, 0, sizeof(p) ); p.srcPos = make_cudaPos( srcX * typeSize, srcY, srcCoordF * srcAllocSizeZ + srcZ ); p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize ); @@ -115,7 +117,7 @@ void copyDevToDevZYXF( const cudaPitchedPtr& dst, const cudaPitchedPtr& src, auto copyFunctor = [&](uint_t dstCoordZ, uint_t srcCoordZ, uint_t zIntervalSize) { cudaMemcpy3DParms p; - memset( &p, 0, sizeof(p) ); + std::memset( &p, 0, sizeof(p) ); p.srcPos = make_cudaPos( srcF * typeSize, srcX, srcCoordZ * srcAllocSizeY + srcY ); p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize ); @@ -174,7 +176,7 @@ void copyHostToDevFZYX( const cudaPitchedPtr& dst, unsigned char* src, auto copyFunctor = [&](uint_t dstCoordF, uint_t srcCoordF, uint_t fIntervalSize) { cudaMemcpy3DParms p; - memset( &p, 0, sizeof(p) ); + std::memset( &p, 0, sizeof(p) ); p.srcPos = make_cudaPos( srcX * typeSize, srcY, srcCoordF * srcAllocSizeZ + srcZ ); p.srcPtr = make_cudaPitchedPtr( src, Nx * typeSize, Nx * typeSize, Ny ); @@ -233,7 +235,7 @@ void copyHostToDevZYXF( const cudaPitchedPtr& dst, unsigned char* src, auto copyFunctor = [&](uint_t dstCoordZ, uint_t srcCoordZ, uint_t zIntervalSize) { cudaMemcpy3DParms p; - memset( &p, 0, sizeof(p) ); + std::memset( &p, 0, sizeof(p) ); p.srcPos = make_cudaPos( srcF * typeSize, srcX, srcCoordZ * srcAllocSizeY + srcY ); p.srcPtr = make_cudaPitchedPtr( src, Nf * typeSize, Nf * typeSize, Nx ); @@ -293,7 +295,7 @@ void copyDevToHostFZYX( unsigned char* dst, const cudaPitchedPtr& src, auto copyFunctor = [&](uint_t dstCoordF, uint_t srcCoordF, uint_t fIntervalSize) { cudaMemcpy3DParms p; - memset( &p, 0, sizeof(p) ); + std::memset( &p, 0, sizeof(p) ); p.srcPos = make_cudaPos( srcX * typeSize, srcY, srcCoordF * srcAllocSizeZ + srcZ ); p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize ); @@ -353,7 +355,7 @@ void copyDevToHostZYXF( unsigned char* dst, const cudaPitchedPtr& src, auto copyFunctor = [&](uint_t dstCoordZ, uint_t srcCoordZ, uint_t zIntervalSize) { cudaMemcpy3DParms p; - memset( &p, 0, sizeof(p) ); + std::memset( &p, 0, sizeof(p) ); p.srcPos = make_cudaPos( srcF * typeSize, srcX, srcCoordZ * srcAllocSizeY + srcY ); p.srcPtr = make_cudaPitchedPtr( src.ptr, src.pitch, src.xsize, src.ysize ); diff --git a/src/domain_decomposition/BlockDataHandling.h b/src/domain_decomposition/BlockDataHandling.h index c9e74212e1132d8f6f1f1546ba93e4102d23b7cb..4bd96dae090d6c09d5c43498d61343600803312b 100644 --- a/src/domain_decomposition/BlockDataHandling.h +++ b/src/domain_decomposition/BlockDataHandling.h @@ -82,7 +82,7 @@ class BlockDataHandlingFunctionAdaptor : public BlockDataHandling<T> { public: - typedef boost::function< T* ( IBlock * const block ) > Function; + typedef std::function< T* ( IBlock * const block ) > Function; BlockDataHandlingFunctionAdaptor( const Function & function ) : function_( function ) {} @@ -130,7 +130,7 @@ struct BlockDataCreator requiredSelectors_( requiredSelectors ), incompatibleSelectors_( incompatibleSelectors ) {} - BlockDataCreator( const boost::function< T* ( IBlock * const block ) > & function, + BlockDataCreator( const 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() ) : diff --git a/src/domain_decomposition/BlockStorage.h b/src/domain_decomposition/BlockStorage.h index 4d3292e21e0d6a8e7f87ae2c42c3271ade5fed79..fb778309aae9853272eef2c8402d3d553d6a2e7a 100644 --- a/src/domain_decomposition/BlockStorage.h +++ b/src/domain_decomposition/BlockStorage.h @@ -34,7 +34,7 @@ #include "core/uid/GlobalState.h" #include "core/uid/SUID.h" -#include <boost/function.hpp> +#include <functional> //#include <boost/type_traits/is_base_of.hpp> #include <string> #include <vector> @@ -472,7 +472,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() ); @@ -676,7 +676,7 @@ inline BlockDataID BlockStorage::addBlockData( const shared_ptr< T > & dataHandl */ //********************************************************************************************************************** template< typename T > -inline BlockDataID BlockStorage::addBlockData( boost::function< T* ( IBlock* const block ) > function, const std::string & identifier, +inline BlockDataID BlockStorage::addBlockData( std::function< T* ( IBlock* const block ) > function, const std::string & identifier, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) { internal::SelectableBlockDataHandlingWrapper dataHandling( diff --git a/src/domain_decomposition/IBlock.h b/src/domain_decomposition/IBlock.h index e9b4ec6fb0dcf070e469cee35b52a223423ca627..215f8a51d27d714b41192ecaec0d273e721f560d 100644 --- a/src/domain_decomposition/IBlock.h +++ b/src/domain_decomposition/IBlock.h @@ -30,7 +30,6 @@ #include "core/math/AABB.h" #include "core/uid/SUID.h" -#include <boost/cast.hpp> #include <typeinfo> #include <vector> diff --git a/src/domain_decomposition/MakeBlockDataInitFunction.h b/src/domain_decomposition/MakeBlockDataInitFunction.h index 2f82ea473cba060f1994e3df0520e6496cc08b3f..466f944c110341acdde00a786e45fa39d3764e05 100644 --- a/src/domain_decomposition/MakeBlockDataInitFunction.h +++ b/src/domain_decomposition/MakeBlockDataInitFunction.h @@ -24,7 +24,7 @@ #include "IBlock.h" #include <boost/bind.hpp> -#include <boost/function.hpp> +#include <functional> namespace walberla { @@ -91,61 +91,61 @@ namespace internal template<class T> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction() { return boost::bind( internal::newFunc<T>, _1); } template<class T, class P1> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1) { return boost::bind( internal::newFunc<T,P1>, _1,p1); } template<class T, class P1, class P2> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2) { return boost::bind( internal::newFunc<T,P1,P2>, _1,p1,p2); } template<class T, class P1, class P2, class P3> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3) { return boost::bind( internal::newFunc<T,P1,P2,P3>, _1,p1,p2,p3); } template<class T, class P1, class P2, class P3, class P4> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3, const P4 & p4) { return boost::bind( internal::newFunc<T,P1,P2,P3,P4>, _1,p1,p2,p3,p4); } template<class T, class P1, class P2, class P3, class P4, class P5> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3, const P4 & p4, const P5 & p5) { return boost::bind( internal::newFunc<T,P1,P2,P3,P4,P5>, _1,p1,p2,p3,p4,p5); } template<class T, class P1, class P2, class P3, class P4, class P5, class P6> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3, const P4 & p4, const P5 & p5, const P6 & p6) { return boost::bind( internal::newFunc<T,P1,P2,P3,P4,P5,P6>, _1,p1,p2,p3,p4,p5,p6); } template<class T, class P1, class P2, class P3, class P4, class P5, class P6, class P7> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3, const P4 & p4, const P5 & p5, const P6 & p6, const P7 & p7) { return boost::bind( internal::newFunc<T,P1,P2,P3,P4,P5,P6,P7>, _1,p1,p2,p3,p4,p5,p6,p7); } template<class T, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3, const P4 & p4, const P5 & p5, const P6 & p6, const P7 & p7, const P8 & p8) { return boost::bind( internal::newFunc<T,P1,P2,P3,P4,P5,P6,P7,P8>, _1,p1,p2,p3,p4,p5,p6,p7,p8); } template<class T, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9> -boost::function< T* ( const IBlock* const block ) > +std::function< T* ( const IBlock* const block ) > makeBlockDataInitFunction(const P1 & p1, const P2 & p2, const P3 & p3, const P4 & p4, const P5 & p5, const P6 & p6, const P7 & p7, const P8 & p8, const P9 & p9) { return boost::bind( internal::newFunc<T,P1,P2,P3,P4,P5,P6,P7,P8,P9>, _1,p1,p2,p3,p4,p5,p6,p7,p8,p9); } diff --git a/src/domain_decomposition/StructuredBlockStorage.h b/src/domain_decomposition/StructuredBlockStorage.h index 8fbd4fb04abfcd0c1aba0dea8229abafea802635..4315429d285f3189e82d367f75d0a2f48bd895c8 100644 --- a/src/domain_decomposition/StructuredBlockStorage.h +++ b/src/domain_decomposition/StructuredBlockStorage.h @@ -43,14 +43,14 @@ template< typename T > struct StructuredBlockDataCreator { StructuredBlockDataCreator( - const boost::function< T * ( IBlock * const block, StructuredBlockStorage * const storage ) > & function, + const std::function< T * ( IBlock * const block, StructuredBlockStorage * const storage ) > & function, const std::string & identifier = std::string(), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : function_( function ), identifier_( identifier ), requiredSelectors_( requiredSelectors ), incompatibleSelectors_( incompatibleSelectors ) {} - boost::function< T * ( IBlock * const block, StructuredBlockStorage * const storage ) > function_; + std::function< T * ( IBlock * const block, StructuredBlockStorage * const storage ) > function_; std::string identifier_; Set<SUID> requiredSelectors_; @@ -243,7 +243,7 @@ public: { return blockStorage_->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() ) @@ -413,7 +413,7 @@ public: { return StructuredBlockDataAdder( *this, identifier ); } template< typename T > - inline BlockDataID addStructuredBlockData( boost::function< T* ( IBlock* const block, StructuredBlockStorage* const storage ) > function, + inline BlockDataID addStructuredBlockData( std::function< T* ( IBlock* const block, StructuredBlockStorage* const storage ) > function, const std::string& identifier = std::string(), const Set<SUID>& requiredSelectors = Set<SUID>::emptySet(), const Set<SUID>& incompatibleSelectors = Set<SUID>::emptySet() ); @@ -1072,7 +1072,7 @@ inline void StructuredBlockStorage::transformBlockLocalToGlobalCellInterval( Cel //********************************************************************************************************************** template< typename T > inline BlockDataID StructuredBlockStorage::addStructuredBlockData( - boost::function< T* ( IBlock* const block, StructuredBlockStorage* const storage ) > function, + std::function< T* ( IBlock* const block, StructuredBlockStorage* const storage ) > function, const std::string& identifier, const Set<SUID>& requiredSelectors, const Set<SUID>& incompatibleSelectors ) { internal::SelectableBlockDataHandlingWrapper dataHandling( diff --git a/src/fft/Fft.cpp b/src/fft/Fft.cpp index f54423ee7044b8f6b668c31bee2e7816646719fd..bbae269ea245a124fe5ca0b8208d5bd408db6bb4 100644 --- a/src/fft/Fft.cpp +++ b/src/fft/Fft.cpp @@ -7,7 +7,7 @@ namespace fft { template <typename Field_T> FourierTransform<Field_T>::FourierTransform( shared_ptr< StructuredBlockForest > & blocks, BlockDataID fieldId, - boost::function<real_t(uint_t,uint_t,uint_t)> greens ) + std::function<real_t(uint_t,uint_t,uint_t)> greens ) : blocks_(blocks), fieldId_(fieldId), greens_() { #ifdef WALBERLA_USE_PFFT diff --git a/src/fft/Fft.h b/src/fft/Fft.h index 0f4c29f469d95e6a464af99b9925caa0194bb861..481c96bb86843ef632034bd4e301dfb6596a9d92 100644 --- a/src/fft/Fft.h +++ b/src/fft/Fft.h @@ -22,7 +22,7 @@ class FourierTransform { public: FourierTransform( shared_ptr< StructuredBlockForest > & blocks, BlockDataID fieldId, - boost::function<real_t(uint_t,uint_t,uint_t)> greens = boost::function<real_t(uint_t,uint_t,uint_t)>() ); + std::function<real_t(uint_t,uint_t,uint_t)> greens = std::function<real_t(uint_t,uint_t,uint_t)>() ); void operator() (); private: diff --git a/src/field/AccuracyEvaluation.h b/src/field/AccuracyEvaluation.h index a043dc0958f1664ff4cc35bab891152107dadd7f..4f6e40176bd85bf9db91aba8318ac6311f37bdf7 100644 --- a/src/field/AccuracyEvaluation.h +++ b/src/field/AccuracyEvaluation.h @@ -133,7 +133,7 @@ inline real_t accuracyEvaluationAbsError( const Vector3<real_t> & error ) { retu //********************************************************************************************************************** template< typename Field_T, - typename SolutionFunction_T = boost::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, + typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter > class AccuracyEvaluation { diff --git a/src/field/AccuracyEvaluationLinePlot.h b/src/field/AccuracyEvaluationLinePlot.h index 217a2c55a4e77044913ba85b2889d97593fb4f32..d2c1fcbe66019004261c61fa9d9ffc06d33376ea 100644 --- a/src/field/AccuracyEvaluationLinePlot.h +++ b/src/field/AccuracyEvaluationLinePlot.h @@ -191,7 +191,7 @@ inline void accuracyEvaluationLinePlotIO( std::ofstream & file, const std::vecto //********************************************************************************************************************** template< typename Field_T, - typename SolutionFunction_T = boost::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, + typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter > class AccuracyEvaluationLinePlot { diff --git a/src/field/AddToStorage.h b/src/field/AddToStorage.h index 5136dab5ab7a4261ff381ad2eb660f77fd91f0c8..7895d3b555663386540c135f755af734eca76435 100644 --- a/src/field/AddToStorage.h +++ b/src/field/AddToStorage.h @@ -64,8 +64,8 @@ BlockDataID addFlagFieldToStorage( const shared_ptr< BlockStorage_T > & blocks, const std::string & identifier, const uint_t nrOfGhostLayers = uint_t(1), const bool alwaysInitialize = false, - const boost::function< void ( FlagField_T * field, IBlock * const block ) > & initFunction = - boost::function< void ( FlagField_T * field, IBlock * const block ) >(), + const std::function< void ( FlagField_T * field, IBlock * const block ) > & initFunction = + std::function< void ( FlagField_T * field, IBlock * const block ) >(), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { @@ -91,7 +91,7 @@ BlockDataID addFlagFieldToStorage( const shared_ptr< BlockStorage_T > & blocks, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { return addFlagFieldToStorage< FlagField_T >( blocks, identifier, nrOfGhostLayers, alwaysInitialize, - boost::function< void ( FlagField_T * field, IBlock * const block ) >(), + std::function< void ( FlagField_T * field, IBlock * const block ) >(), requiredSelectors, incompatibleSelectors ); } @@ -108,9 +108,9 @@ struct AddToStorage { static BlockDataID add( const shared_ptr< BlockStorage_T > & blocks, const std::string & identifier, const typename GhostLayerField_T::value_type & initValue, const Layout layout, const uint_t nrOfGhostLayers, - const bool /*alwaysInitialize*/, const boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction, + const bool /*alwaysInitialize*/, const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = defaultSize ) + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = defaultSize ) { auto dataHandling = walberla::make_shared< field::AlwaysInitializeBlockDataHandling< GhostLayerField_T > >( blocks, nrOfGhostLayers, initValue, layout, calculateSize ); dataHandling->addInitializationFunction( initFunction ); @@ -125,9 +125,9 @@ struct AddToStorage< GhostLayerField_T, BlockStorage_T, { static BlockDataID add( const shared_ptr< BlockStorage_T > & blocks, const std::string & identifier, const typename GhostLayerField_T::value_type & initValue, const Layout layout, const uint_t nrOfGhostLayers, - const bool alwaysInitialize, const boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction, + const bool alwaysInitialize, const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = defaultSize ) + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = defaultSize ) { if( alwaysInitialize ) { @@ -153,8 +153,8 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, const Layout layout = zyxf, const uint_t nrOfGhostLayers = uint_t(1), const bool alwaysInitialize = false, - const boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = - boost::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), + const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = + std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { @@ -174,7 +174,7 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { return addToStorage< GhostLayerField_T >( blocks, identifier, initValue, layout, nrOfGhostLayers, alwaysInitialize, - boost::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), + std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), requiredSelectors, incompatibleSelectors ); } @@ -183,13 +183,13 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, template< typename GhostLayerField_T, typename BlockStorage_T > BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, const std::string & identifier, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize, + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize, const typename GhostLayerField_T::value_type & initValue = typename GhostLayerField_T::value_type(), const Layout layout = zyxf, const uint_t nrOfGhostLayers = uint_t(1), const bool alwaysInitialize = false, - const boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = - boost::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), + const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = + std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { @@ -203,7 +203,7 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, template< typename GhostLayerField_T, typename BlockStorage_T > BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, const std::string & identifier, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize, + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize, const typename GhostLayerField_T::value_type & initValue, const Layout layout, const uint_t nrOfGhostLayers, @@ -211,7 +211,7 @@ BlockDataID addToStorage( const shared_ptr< BlockStorage_T > & blocks, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) { return addToStorage< GhostLayerField_T >( blocks, identifier, initValue, layout, nrOfGhostLayers, alwaysInitialize, - boost::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), + std::function< void ( GhostLayerField_T * field, IBlock * const block ) >(), requiredSelectors, incompatibleSelectors, calculateSize ); } @@ -274,8 +274,8 @@ struct Creator : public domain_decomposition::BlockDataCreator< GhostLayerField_ const Layout layout = zyxf, const uint_t nrOfGhostLayers = uint_t(1), const bool /*alwaysInitialize*/ = false, - const boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = - boost::function< void ( GhostLayerField_T * field, IBlock * const block ) >() ) : + const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = + std::function< void ( GhostLayerField_T * field, IBlock * const block ) >() ) : domain_decomposition::BlockDataCreator< GhostLayerField_T >( shared_ptr< field::DefaultBlockDataHandling< GhostLayerField_T > >(), identifier, requiredSelectors, incompatibleSelectors ) { @@ -313,8 +313,8 @@ struct Creator< GhostLayerField_T, const Layout layout = zyxf, const uint_t nrOfGhostLayers = uint_t(1), const bool alwaysInitialize = false, - const boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = - boost::function< void ( GhostLayerField_T * field, IBlock * const block ) >() ) : + const std::function< void ( GhostLayerField_T * field, IBlock * const block ) > & initFunction = + std::function< void ( GhostLayerField_T * field, IBlock * const block ) >() ) : domain_decomposition::BlockDataCreator< GhostLayerField_T >( shared_ptr< field::DefaultBlockDataHandling< GhostLayerField_T > >(), identifier, requiredSelectors, incompatibleSelectors ) { @@ -358,8 +358,8 @@ struct Creator< FlagField<T> > : public domain_decomposition::BlockDataCreator< const Set<SUID> & incompatibleSelectors, const uint_t nrOfGhostLayers = uint_t(1), const bool alwaysInitialize = false, - const boost::function< void ( FlagField<T> * field, IBlock * const block ) > & initFunction = - boost::function< void ( FlagField<T> * field, IBlock * const block ) >() ) : + const std::function< void ( FlagField<T> * field, IBlock * const block ) > & initFunction = + std::function< void ( FlagField<T> * field, IBlock * const block ) >() ) : domain_decomposition::BlockDataCreator< FlagField<T> >( shared_ptr< field::DefaultBlockDataHandling< FlagField<T> > >(), identifier, requiredSelectors, incompatibleSelectors ) { diff --git a/src/field/Field.h b/src/field/Field.h index b6e517ec3d1f774c2c372757a2423ced83e84ec5..913655771e2eec0c8937b3e96ce3511093ec3f34 100644 --- a/src/field/Field.h +++ b/src/field/Field.h @@ -36,8 +36,7 @@ #include "iterators/FieldIterator.h" #include "iterators/FieldPointer.h" -#include <boost/function.hpp> -#include <boost/static_assert.hpp> +#include <functional> #include <memory> #include <vector> @@ -278,7 +277,7 @@ namespace field { //** Monitoring ************************************************************************************************* /*! \name Monitoring */ //@{ - typedef boost::function< void ( cell_idx_t x, cell_idx_t y, + typedef std::function< void ( cell_idx_t x, cell_idx_t y, cell_idx_t z, cell_idx_t f, const T & value) > MonitorFunction; void addMonitoringFunction( const MonitorFunction & func ); diff --git a/src/field/FlagField.h b/src/field/FlagField.h index 4472323ae4e149c11bf3537a603f7b3a35804817..2785dd199fac3964a2ae835c3bf7c15299ff213a 100644 --- a/src/field/FlagField.h +++ b/src/field/FlagField.h @@ -32,7 +32,6 @@ #include "core/math/Uint.h" #include <boost/array.hpp> -#include <boost/static_assert.hpp> #include <boost/type_traits/is_same.hpp> #include <iostream> diff --git a/src/field/VolumetricFlowRateEvaluation.h b/src/field/VolumetricFlowRateEvaluation.h index 26bf6ec8134993a24d14ef16a97b0af2b603c9f3..1763ea0eb78585bb8588cb581869d027488f5680 100644 --- a/src/field/VolumetricFlowRateEvaluation.h +++ b/src/field/VolumetricFlowRateEvaluation.h @@ -47,8 +47,8 @@ namespace field { namespace internal { -typedef boost::function< real_t () > FlowRateSolution_T; -typedef boost::function< Vector3< real_t > ( const Vector3< real_t > & ) > FlowRateVelocitySolution_T; +typedef std::function< real_t () > FlowRateSolution_T; +typedef std::function< Vector3< real_t > ( const Vector3< real_t > & ) > FlowRateVelocitySolution_T; const std::string volumetricFlowRateEvaluationFilename("flowrate.dat"); const real_t volumetricFlowRateEvaluationNormalization( real_t(1) ); @@ -205,7 +205,7 @@ public: real_t solution() const { - if( solution_.empty() ) + if( !solution_ ) return real_t(0); auto blocks = blocks_.lock(); @@ -305,7 +305,7 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() if( axis_[0] ) { const auto factor = normalizationFactor_ * normalizedDy * normalizedDz; - if( velocitySolution_.empty() ) + if( !velocitySolution_ ) { WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp parallel for schedule(static) reduction(+:_flowRate), @@ -338,7 +338,7 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() else if( axis_[1] ) { const auto factor = normalizationFactor_ * normalizedDx * normalizedDz; - if( velocitySolution_.empty() ) + if( !velocitySolution_ ) { WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp parallel for schedule(static) reduction(+:_flowRate), @@ -371,7 +371,7 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() else { const auto factor = normalizationFactor_ * normalizedDx * normalizedDy; - if( velocitySolution_.empty() ) + if( !velocitySolution_ ) { WALBERLA_FOR_ALL_CELLS_XYZ_OMP( field, omp parallel for schedule(static) reduction(+:_flowRate), @@ -420,16 +420,16 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() file << "# volumetric flow rate evaluation of data '" << id << "'\n" << "# step [1], flow rate (simulation) [2], flow rate (\"discrete\" solution) [3], flow rate (exact solution) [4]" ", rel. error (base = \"discrete\" solution) [5], rel. error (base = exact solution) [6]" << std::endl; - if( velocitySolution_.empty() ) + if( !velocitySolution_ ) file << "ATTENTION: \"discrete\" solution values not available and thus not valid!" << std::endl; - if( solution_.empty() ) + if( !solution_ ) file << "ATTENTION: exact solution values not available and thus not valid!" << std::endl; file.close(); } if( log ) { - if( !velocitySolution_.empty() && !solution_.empty() ) + if( velocitySolution_ && solution_ ) { WALBERLA_LOG_INFO( "Evaluation of the volumetric flow rate [data = '" << id << "']:" << "\n- exact solution: " << _solution << @@ -439,18 +439,18 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() "\n + " << ( std::abs( ( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ) << " (base = \"discrete\" solution)" << "\n + " << ( std::abs( ( flowRate_ - _solution ) / _solution ) ) << " (base = exact solution)" ); } - else if( !velocitySolution_.empty() ) + else if( velocitySolution_ ) { - WALBERLA_ASSERT( solution_.empty() ); + WALBERLA_ASSERT( !solution_ ); WALBERLA_LOG_INFO( "Evaluation of the volumetric flow rate [data = '" << id << "']:" << "\n- \"discrete\" solution: " << velocitySolutionFlowRate_ << " (using reference velocities evaluated at cell centers)" << "\n- simulation: " << flowRate_ << " (using computed velocities evaluated at cell centers)" << "\n- rel. error (of the simulation): " << ( std::abs( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ); } - else if( !solution_.empty() ) + else if( solution_ ) { - WALBERLA_ASSERT( velocitySolution_.empty() ); + WALBERLA_ASSERT( !velocitySolution_ ); WALBERLA_LOG_INFO( "Evaluation of the volumetric flow rate [data = '" << id << "']:" << "\n- exact solution: " << _solution << "\n- simulation: " << flowRate_ << @@ -459,7 +459,7 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() } else { - WALBERLA_ASSERT( solution_.empty() && velocitySolution_.empty() ); + WALBERLA_ASSERT( !solution_ && !velocitySolution_ ); WALBERLA_LOG_INFO( "Evaluation of the volumetric flow rate [data = '" << id << "']: " << flowRate_ ); } } @@ -467,7 +467,7 @@ void VolumetricFlowRateEvaluation< VelocityField_T, Filter_T >::operator()() if( plot ) { std::ofstream file( filename_.c_str(), std::ofstream::out | std::ofstream::app ); - file << ( executionCounter_ - uint_t(1) ) << " " << flowRate_ << " " << velocitySolutionFlowRate_ << " " << solution_ << " " + file << ( executionCounter_ - uint_t(1) ) << " " << flowRate_ << " " << velocitySolutionFlowRate_ << " " << _solution << " " << ( isIdentical( velocitySolutionFlowRate_, real_t(0) ) ? real_t(0) : std::abs( ( flowRate_ - velocitySolutionFlowRate_ ) / velocitySolutionFlowRate_ ) ) << " " << ( isIdentical( _solution, real_t(0) ) ? real_t(0) : std::abs( ( flowRate_ - _solution ) / _solution ) ) << std::endl; file.close(); diff --git a/src/field/allocation/FieldAllocator.h b/src/field/allocation/FieldAllocator.h index 78d149fc3ade6b3c26dcb8c08edbf8c100b27d3e..5be0ecf4b0dbd2b5e292d446dd13d62aae9aca23 100644 --- a/src/field/allocation/FieldAllocator.h +++ b/src/field/allocation/FieldAllocator.h @@ -26,7 +26,6 @@ #include "core/debug/Debug.h" #include "field/CMakeDefs.h" -#include <boost/static_assert.hpp> #include <map> #include <new> @@ -289,8 +288,8 @@ namespace field { aligned_free(values); } - BOOST_STATIC_ASSERT_MSG(alignment > 0, "Use StdFieldAlloc"); - BOOST_STATIC_ASSERT_MSG(!(alignment & (alignment - 1)) , "Alignment has to be power of 2"); + static_assert(alignment > 0, "Use StdFieldAlloc"); + static_assert(!(alignment & (alignment - 1)) , "Alignment has to be power of 2"); private: /// Nr of elements per allocated pointer has to be stored to call the destructor on each element diff --git a/src/field/blockforest/BlockDataHandling.h b/src/field/blockforest/BlockDataHandling.h index 3e73314c69633274a2647fecb2f5a848bfffa638..3d6d92a622287bd11d341e14d1e62a707aec464f 100644 --- a/src/field/blockforest/BlockDataHandling.h +++ b/src/field/blockforest/BlockDataHandling.h @@ -40,7 +40,7 @@ class BlockDataHandling : public blockforest::BlockDataHandling< Field_T > public: typedef typename Field_T::value_type Value_T; - typedef boost::function< void ( Field_T * field, IBlock * const block ) > InitializationFunction_T; + typedef std::function< void ( Field_T * field, IBlock * const block ) > InitializationFunction_T; virtual ~BlockDataHandling() {} @@ -395,18 +395,18 @@ public: typedef typename GhostLayerField_T::value_type Value_T; DefaultBlockDataHandling( const weak_ptr< StructuredBlockStorage > & blocks, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : blocks_( blocks ), nrOfGhostLayers_( uint_t(1) ), initValue_(), layout_( zyxf ), calculateSize_( calculateSize ) {} DefaultBlockDataHandling( const weak_ptr< StructuredBlockStorage > & blocks, const uint_t nrOfGhostLayers, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : blocks_( blocks ), nrOfGhostLayers_( nrOfGhostLayers ), initValue_(), layout_( zyxf ), calculateSize_( calculateSize ) {} DefaultBlockDataHandling( const weak_ptr< StructuredBlockStorage > & blocks, const uint_t nrOfGhostLayers, const Value_T & initValue, const Layout layout = zyxf, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : blocks_( blocks ), nrOfGhostLayers_( nrOfGhostLayers ), initValue_( initValue ), layout_( layout ), calculateSize_( calculateSize ) { static_assert( !boost::is_same< GhostLayerField_T, FlagField< Value_T > >::value, @@ -440,7 +440,7 @@ private: uint_t nrOfGhostLayers_; Value_T initValue_; Layout layout_; - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize_; + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize_; }; // class DefaultBlockDataHandling @@ -455,21 +455,21 @@ class AlwaysInitializeBlockDataHandling : public blockforest::AlwaysInitializeBl public: typedef typename GhostLayerField_T::value_type Value_T; - typedef boost::function< void ( GhostLayerField_T * field, IBlock * const block ) > InitializationFunction_T; + typedef std::function< void ( GhostLayerField_T * field, IBlock * const block ) > InitializationFunction_T; AlwaysInitializeBlockDataHandling( const weak_ptr< StructuredBlockStorage > & blocks, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : blocks_( blocks ), nrOfGhostLayers_( uint_t(1) ), initValue_(), layout_( zyxf ), calculateSize_( calculateSize ) {} AlwaysInitializeBlockDataHandling( const weak_ptr< StructuredBlockStorage > & blocks, const uint_t nrOfGhostLayers, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : blocks_( blocks ), nrOfGhostLayers_( nrOfGhostLayers ), initValue_(), layout_( zyxf ), calculateSize_( calculateSize ) {} AlwaysInitializeBlockDataHandling( const weak_ptr< StructuredBlockStorage > & blocks, const uint_t nrOfGhostLayers, const Value_T & initValue, const Layout layout, - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize = internal::defaultSize ) : blocks_( blocks ), nrOfGhostLayers_( nrOfGhostLayers ), initValue_( initValue ), layout_( layout ), calculateSize_( calculateSize ) { static_assert( !boost::is_same< GhostLayerField_T, FlagField< Value_T > >::value, @@ -498,7 +498,7 @@ private: uint_t nrOfGhostLayers_; Value_T initValue_; Layout layout_; - const boost::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize_; + const std::function< Vector3< uint_t > ( const shared_ptr< StructuredBlockStorage > &, IBlock * const ) > calculateSize_; InitializationFunction_T initFunction_; diff --git a/src/field/python/GatherExport.impl.h b/src/field/python/GatherExport.impl.h index d297d8a63c2e8d84f1a2aa6dbce933b6d4d92c17..42f66565c21de0d708f2f00f3f916cf770e84ce1 100644 --- a/src/field/python/GatherExport.impl.h +++ b/src/field/python/GatherExport.impl.h @@ -76,7 +76,7 @@ namespace internal { IBlock * firstBlock = & ( * blocks->begin() ); python_coupling::Dispatcher<FieldTypes, Exporter_gatherToObject > dispatcher( firstBlock ); auto func = dispatcher( fieldID ); - if ( func.empty() ) + if ( !func ) { PyErr_SetString( PyExc_RuntimeError, "This function cannot handle this type of block data."); throw error_already_set(); diff --git a/src/field/vtk/VTKWriter.h b/src/field/vtk/VTKWriter.h index fabb4d71454356a3ec213b64a3f30f19e93c33c7..c83033fe81a06a54c7a0874ceb8581fc07b6f353 100644 --- a/src/field/vtk/VTKWriter.h +++ b/src/field/vtk/VTKWriter.h @@ -169,7 +169,7 @@ inline vtk::VTKOutput::Write createVTKOutput ( const ConstBlockDataID & fieldId auto vtkOutput = vtk::createVTKOutput_BlockData( blocks, identifier, writeFrequency, ghostLayers, forcePVTU, baseFolder, executionFolder, continuousNumbering, binary, littleEndian, useMPIIO, initialExecutionCount ); - vtkOutput->addCellDataWriter( boost::make_shared< VTKWriter< Field_T,OutputType > >( fieldId, identifier ) ); + vtkOutput->addCellDataWriter( make_shared< VTKWriter< Field_T,OutputType > >( fieldId, identifier ) ); return writeFiles( vtkOutput, true, simultaneousIOOperations, requiredStates, incompatibleStates ); } @@ -222,7 +222,7 @@ inline vtk::VTKOutput::Write createScalingVTKOutput( const ConstBlockDataID & fi auto vtkOutput = vtk::createVTKOutput_BlockData( blocks, identifier, writeFrequency, ghostLayers, forcePVTU, baseFolder, executionFolder, continuousNumbering, binary, littleEndian, useMPIIO, initialExecutionCount ); - auto writer = boost::make_shared< VTKWriter< Field_T,OutputType > >( fieldId, identifier ); + auto writer = make_shared< VTKWriter< Field_T,OutputType > >( fieldId, identifier ); vtkOutput->addCellDataWriter( vtk::makeBlockCellDataWriterScalingAdapter(identifier, writer, factor) ); return writeFiles( vtkOutput, true, simultaneousIOOperations, requiredStates, incompatibleStates ); diff --git a/src/gather/CurveGatherPackInfo.h b/src/gather/CurveGatherPackInfo.h index ff545e15f54e24101f61401a230f66c4a83342a3..f23b18ae6abc04845bedef1fb39e748250fd5243 100644 --- a/src/gather/CurveGatherPackInfo.h +++ b/src/gather/CurveGatherPackInfo.h @@ -28,7 +28,7 @@ #include "domain_decomposition/StructuredBlockStorage.h" #include "field/interpolators/TrilinearInterpolatorFwd.h" -#include <boost/function.hpp> +#include <functional> #include <functional> #include <map> #include <vector> @@ -52,7 +52,7 @@ class CurveGatherPackInfo : public GatherPackInfo { public: typedef Vector3<real_t> RealVec3; - typedef boost::function<RealVec3 (real_t t) > CurveCallback; + typedef std::function<RealVec3 (real_t t) > CurveCallback; //**Construction & Destruction************************************************************************* diff --git a/src/gather/CurveGatherPackInfo.impl.h b/src/gather/CurveGatherPackInfo.impl.h index c18ff74d511b67b5dbd38c315d405388ab7c9b2f..0039b2a05cb1f3c16adb1ab427bb8ae925fc9923 100644 --- a/src/gather/CurveGatherPackInfo.impl.h +++ b/src/gather/CurveGatherPackInfo.impl.h @@ -20,7 +20,6 @@ // //====================================================================================================================== -#include "boost/lambda/bind.hpp" #include "core/debug/Debug.h" #include "core/logging/Logging.h" #include "core/math/Parser.h" diff --git a/src/gui/Gui.h b/src/gui/Gui.h index f2b520d76ca34410c8de3ea9ace617fa1680b18f..b66ddc3be5b4c722b3f5455f717e46955c5655b2 100644 --- a/src/gui/Gui.h +++ b/src/gui/Gui.h @@ -25,7 +25,7 @@ #include "blockforest/StructuredBlockForest.h" #include "timeloop/ITimeloop.h" -#include <boost/function.hpp> +#include <functional> #include <vector> @@ -52,7 +52,7 @@ namespace gui { void registerPropertyTree( const shared_ptr<PropertyTree> propertyTree ); - typedef boost::function< DisplayAdaptor * ( const IBlock &, ConstBlockDataID ) > DisplayAdaptorCreatorFunc; + typedef std::function< DisplayAdaptor * ( const IBlock &, ConstBlockDataID ) > DisplayAdaptorCreatorFunc; void registerDisplayAdaptorCreator( const DisplayAdaptorCreatorFunc & creatorFunc ); static void breakpoint( const std::string & comment, const std::string & file, int line ); diff --git a/src/lbm/boundary/VelocityBoundary.h b/src/lbm/boundary/VelocityBoundary.h index 383cd41bb2d4832dbd51276a56cadc1610ab7730..8b470021b3575e755894f49397ff9cc0ddb945c3 100644 --- a/src/lbm/boundary/VelocityBoundary.h +++ b/src/lbm/boundary/VelocityBoundary.h @@ -112,7 +112,7 @@ public: inline void treatDirection( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const stencil::Direction dir, const cell_idx_t nx, const cell_idx_t ny, const cell_idx_t nz, const flag_t mask ); - inline const std::vector<real_t> & getValue( const cell_idx_t x, cell_idx_t y, cell_idx_t z ) const { return vel_->get(x,y,z); } + inline const std::vector<real_t> & getValue( const cell_idx_t x, cell_idx_t y, cell_idx_t z ) const { return *(vel_->get(x,y,z)); } private: diff --git a/src/lbm/python/ExportBasic.impl.h b/src/lbm/python/ExportBasic.impl.h index 4727cb5f38cd106b094c849c7c384e7c82164f01..afae7a5a105fc0e4067d694eaa74e19b5817bb51 100644 --- a/src/lbm/python/ExportBasic.impl.h +++ b/src/lbm/python/ExportBasic.impl.h @@ -388,7 +388,7 @@ namespace internal SweepWrapper() {} - SweepWrapper( const boost::function<void(IBlock*) > & sweepToWrap ) + SweepWrapper( const std::function<void(IBlock*) > & sweepToWrap ) : sweepToWrap_( sweepToWrap ) {} void operator() ( IBlock * block ) @@ -397,7 +397,7 @@ namespace internal sweepToWrap_( block ); } protected: - boost::function<void(IBlock*) > sweepToWrap_; + std::function<void(IBlock*) > sweepToWrap_; }; diff --git a/src/lbm/refinement/BoundarySetup.h b/src/lbm/refinement/BoundarySetup.h index 07b963f0da2fcb36d12bf619924f85747bfd72fa..4271b9984e3e74476bae1e4b7ab0f20af61dcc24 100644 --- a/src/lbm/refinement/BoundarySetup.h +++ b/src/lbm/refinement/BoundarySetup.h @@ -74,16 +74,16 @@ inline shared_ptr< BoundaryConfiguration > defaultBoundaryConfiguration( const C //********************************************************************************************************************** template< typename BoundaryHandling_T, bool ForceBoundary > void consistentlySetBoundary( StructuredBlockStorage & blocks, Block & block, const BlockDataID & boundaryHandlingId, const FlagUID & flag, - const boost::function< bool ( const Vector3< real_t > & ) > & isBoundary, - const boost::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter = internal::defaultBoundaryConfiguration ); + const std::function< bool ( const Vector3< real_t > & ) > & isBoundary, + const std::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter = internal::defaultBoundaryConfiguration ); /// For documentation see function "template< typename BoundaryHandling_T, bool ForceBoundary > void consistentlySetBoundary(...)" template< typename BoundaryHandling_T > void consistentlySetBoundary( StructuredBlockStorage & blocks, Block & block, const BlockDataID & boundaryHandlingId, const FlagUID & flag, - const boost::function< bool ( const Vector3< real_t > & ) > & isBoundary, - const boost::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter = internal::defaultBoundaryConfiguration ) + const std::function< bool ( const Vector3< real_t > & ) > & isBoundary, + const std::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter = internal::defaultBoundaryConfiguration ) { consistentlySetBoundary< BoundaryHandling_T, false >( blocks, block, boundaryHandlingId, flag, isBoundary, parameter ); } @@ -93,8 +93,8 @@ void consistentlySetBoundary( StructuredBlockStorage & blocks, Block & block, co /// For documentation see function "template< typename BoundaryHandling_T, bool ForceBoundary > void consistentlySetBoundary(...)" template< typename BoundaryHandling_T > void consistentlyForceBoundary( StructuredBlockStorage & blocks, Block & block, const BlockDataID & boundaryHandlingId, const FlagUID & flag, - const boost::function< bool ( const Vector3< real_t > & ) > & isBoundary, - const boost::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter = internal::defaultBoundaryConfiguration ) + const std::function< bool ( const Vector3< real_t > & ) > & isBoundary, + const std::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter = internal::defaultBoundaryConfiguration ) { consistentlySetBoundary< BoundaryHandling_T, true >( blocks, block, boundaryHandlingId, flag, isBoundary, parameter ); } @@ -103,8 +103,8 @@ void consistentlyForceBoundary( StructuredBlockStorage & blocks, Block & block, template< typename BoundaryHandling_T, bool ForceBoundary > void consistentlySetBoundary( StructuredBlockStorage & blocks, Block & block, const BlockDataID & boundaryHandlingId, const FlagUID & flag, - const boost::function< bool ( const Vector3< real_t > & ) > & isBoundary, - const boost::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter ) + const std::function< bool ( const Vector3< real_t > & ) > & isBoundary, + const std::function< shared_ptr< BoundaryConfiguration > ( const Cell &, const Vector3< real_t > & ) > & parameter ) { const uint_t level = blocks.getLevel(block); diff --git a/src/lbm/refinement/RefinementFunctorWrapper.h b/src/lbm/refinement/RefinementFunctorWrapper.h index 92261857469ffe0297b4f9462daf978fe792cae9..9ea0b99e15baa1ebdd6653256cbaf6e6dfd3b87e 100644 --- a/src/lbm/refinement/RefinementFunctorWrapper.h +++ b/src/lbm/refinement/RefinementFunctorWrapper.h @@ -23,7 +23,7 @@ #include "domain_decomposition/BlockStorage.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace lbm { @@ -31,7 +31,7 @@ namespace refinement { class FunctorWrapper { public: - FunctorWrapper( const boost::function<void()> & fct) + FunctorWrapper( const std::function<void()> & fct) : fct_(fct) { } @@ -40,12 +40,12 @@ public: } private: - boost::function<void(void)> fct_; + std::function<void(void)> fct_; }; class SweepAsFunctorWrapper { public: - SweepAsFunctorWrapper( const boost::function<void(IBlock * )> & fct, + SweepAsFunctorWrapper( const std::function<void(IBlock * )> & fct, const shared_ptr <StructuredBlockStorage> & blockStorage ) : fct_(fct), blockStorage_(blockStorage) { } @@ -58,7 +58,7 @@ public: } private: - boost::function<void(IBlock * )> fct_; + std::function<void(IBlock * )> fct_; shared_ptr <StructuredBlockStorage> blockStorage_; }; diff --git a/src/lbm/refinement/TimeStep.h b/src/lbm/refinement/TimeStep.h index f006d0494aa0af888821c671c6491aa86cff49dc..1be6a470d5402e21600831870524e80c563f6716 100644 --- a/src/lbm/refinement/TimeStep.h +++ b/src/lbm/refinement/TimeStep.h @@ -55,8 +55,8 @@ public: typedef typename NeighborsStencil<LatticeModel_T>::type CommunicationStencil_T; - typedef boost::function< void ( const uint_t, const uint_t ) > VoidFunction; // parameters: level, execution count - typedef boost::function< void ( IBlock *, const uint_t, const uint_t ) > BlockFunction; // parameters: block, level, execution count + typedef std::function< void ( const uint_t, const uint_t ) > VoidFunction; // parameters: level, execution count + typedef std::function< void ( IBlock *, const uint_t, const uint_t ) > BlockFunction; // parameters: block, level, execution count private: diff --git a/src/lbm/srt/SplitPureSweep.impl.h b/src/lbm/srt/SplitPureSweep.impl.h index 975e06eb7ebc65af827fbb196d168bbd29381da9..d545a9d1269be9cbd48833d610a37f12b91f8e3c 100644 --- a/src/lbm/srt/SplitPureSweep.impl.h +++ b/src/lbm/srt/SplitPureSweep.impl.h @@ -133,11 +133,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -489,11 +489,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx ) { @@ -833,13 +833,13 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT rho = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT rho = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -1191,13 +1191,13 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT rho = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT rho = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx ) { diff --git a/src/lbm/srt/SplitSweep.impl.h b/src/lbm/srt/SplitSweep.impl.h index 30d16a68f9ba9fb765f4f908bb0f1ba36edb666e..fca8be64fe097069ea8f8892177e27d0cb0691e8 100644 --- a/src/lbm/srt/SplitSweep.impl.h +++ b/src/lbm/srt/SplitSweep.impl.h @@ -127,13 +127,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -553,13 +553,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { @@ -967,15 +967,15 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT rho = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT rho = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -1398,15 +1398,15 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT rho = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT rho = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT dir_indep_trm = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { diff --git a/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h b/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h index 501bf1ed06b070f68caaa8a2fd158e98a86d2e51..865e3dfa7dd579c1518094c9214b8139418841e9 100644 --- a/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h +++ b/src/lbm/srt/bluegeneq/SplitPureSweep.impl.h @@ -145,11 +145,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* dir_indep_trm = new real_t[ xSize ]; + real_t* dir_indep_trm = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -634,11 +634,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* dir_indep_trm = new real_t[ xSize ]; + real_t* dir_indep_trm = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { @@ -1038,13 +1038,13 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* rho = new real_t[ xSize ]; + real_t* rho = new real_t[ uint_c(xSize) ]; - real_t* dir_indep_trm = new real_t[ xSize ]; + real_t* dir_indep_trm = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -1529,13 +1529,13 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* rho = new real_t[ xSize ]; + real_t* rho = new real_t[ uint_c(xSize) ]; - real_t* dir_indep_trm = new real_t[ xSize ]; + real_t* dir_indep_trm = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { diff --git a/src/lbm/trt/SplitPureSweep.impl.h b/src/lbm/trt/SplitPureSweep.impl.h index 90f742b7b0c916194aae6e0358daabe93c59ac41..0c60f11b440c230bff7c211b24e51e59700bdbda 100644 --- a/src/lbm/trt/SplitPureSweep.impl.h +++ b/src/lbm/trt/SplitPureSweep.impl.h @@ -140,11 +140,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -543,11 +543,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx ) { @@ -936,16 +936,16 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT t1x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT t2x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac1 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac2 = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT t1x2 = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT t2x2 = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT fac1 = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT fac2 = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -1358,16 +1358,16 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if< boost::mpl::and_ #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT t1x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT t2x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac1 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac2 = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT t1x2 = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT t2x2 = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT fac1 = new real_t[ uint_c( xSize ) ]; + real_t * WALBERLA_RESTRICT fac2 = new real_t[ uint_c( xSize ) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c( xSize ) ]; if( src->layout() == field::fzyx ) { diff --git a/src/lbm/trt/SplitSweep.impl.h b/src/lbm/trt/SplitSweep.impl.h index f33ef64ab34d7110ddb12b648b1c02c897cfbe25..fed687b167e9f1f89e20d7e64d63ce3941732cf4 100644 --- a/src/lbm/trt/SplitSweep.impl.h +++ b/src/lbm/trt/SplitSweep.impl.h @@ -134,13 +134,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -611,13 +611,13 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { @@ -1074,18 +1074,18 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT t1x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT t2x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac1 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac2 = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT t1x2 = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT t2x2 = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT fac1 = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT fac2 = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -1570,18 +1570,18 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename boost::enable_if< boost:: #endif // temporaries, calculated by the first innermost loop - real_t * WALBERLA_RESTRICT velX = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velY = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT velZ = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT velX = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velY = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT velZ = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT t1x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT t2x2 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac1 = new real_t[ xSize ]; - real_t * WALBERLA_RESTRICT fac2 = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT t1x2 = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT t2x2 = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT fac1 = new real_t[ uint_c(xSize) ]; + real_t * WALBERLA_RESTRICT fac2 = new real_t[ uint_c(xSize) ]; - real_t * WALBERLA_RESTRICT feq_common = new real_t[ xSize ]; + real_t * WALBERLA_RESTRICT feq_common = new real_t[ uint_c(xSize) ]; - bool * WALBERLA_RESTRICT perform_lbm = new bool[ xSize ]; + bool * WALBERLA_RESTRICT perform_lbm = new bool[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { diff --git a/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h b/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h index 985667314552ca883d1115df4e4a45526c06f921..ca3821096a692da7bc61322f53e4b68a910e825a 100644 --- a/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h +++ b/src/lbm/trt/bluegeneq/SplitPureSweep.impl.h @@ -151,11 +151,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* feq_common = new real_t[ xSize ]; + real_t* feq_common = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -687,11 +687,11 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* feq_common = new real_t[ xSize ]; + real_t* feq_common = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { @@ -1140,16 +1140,16 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* t1x2 = new real_t[ xSize ]; - real_t* t2x2 = new real_t[ xSize ]; - real_t* fac1 = new real_t[ xSize ]; - real_t* fac2 = new real_t[ xSize ]; + real_t* t1x2 = new real_t[ uint_c(xSize) ]; + real_t* t2x2 = new real_t[ uint_c(xSize) ]; + real_t* fac1 = new real_t[ uint_c(xSize) ]; + real_t* fac2 = new real_t[ uint_c(xSize) ]; - real_t* feq_common = new real_t[ xSize ]; + real_t* feq_common = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx && dst->layout() == field::fzyx ) { @@ -1699,16 +1699,16 @@ void SplitPureSweep< LatticeModel_T, typename boost::enable_if_c< ice_and< boost #endif // temporaries, calculated by the first innermost loop - real_t* velX = new real_t[ xSize ]; - real_t* velY = new real_t[ xSize ]; - real_t* velZ = new real_t[ xSize ]; + real_t* velX = new real_t[ uint_c(xSize) ]; + real_t* velY = new real_t[ uint_c(xSize) ]; + real_t* velZ = new real_t[ uint_c(xSize) ]; - real_t* t1x2 = new real_t[ xSize ]; - real_t* t2x2 = new real_t[ xSize ]; - real_t* fac1 = new real_t[ xSize ]; - real_t* fac2 = new real_t[ xSize ]; + real_t* t1x2 = new real_t[ uint_c(xSize) ]; + real_t* t2x2 = new real_t[ uint_c(xSize) ]; + real_t* fac1 = new real_t[ uint_c(xSize) ]; + real_t* fac2 = new real_t[ uint_c(xSize) ]; - real_t* feq_common = new real_t[ xSize ]; + real_t* feq_common = new real_t[ uint_c(xSize) ]; if( src->layout() == field::fzyx ) { diff --git a/src/mesh/boundary/BoundarySetup.h b/src/mesh/boundary/BoundarySetup.h index 26254df4ec3cfeaa65a7f9c1937f777854960f98..08840ed0ae24502e7248d9831351b955d15f0d30 100644 --- a/src/mesh/boundary/BoundarySetup.h +++ b/src/mesh/boundary/BoundarySetup.h @@ -34,7 +34,7 @@ #include "stencil/D3Q27.h" -#include <boost/function.hpp> +#include <functional> #include <queue> @@ -46,7 +46,7 @@ class BoundarySetup public: typedef field::GhostLayerField< uint8_t, uint_t(1) > VoxelizationField; - typedef boost::function< real_t ( const Vector3< real_t > &) > DistanceFunction; + typedef std::function< real_t ( const Vector3< real_t > &) > DistanceFunction; enum Location { INSIDE, OUTSIDE }; diff --git a/src/mesh/vtk/VTKMeshWriter.h b/src/mesh/vtk/VTKMeshWriter.h index f01a65bebfe5bf0fa30df0e15ae1a4fc788aa243..025779e4f785fed80866a5f72bde633d3d9c3c1a 100644 --- a/src/mesh/vtk/VTKMeshWriter.h +++ b/src/mesh/vtk/VTKMeshWriter.h @@ -42,7 +42,7 @@ namespace mesh { template< typename MeshType > class VTKMeshWriter { public: - typedef boost::function<bool ( const MeshType &, const typename MeshType::FaceHandle & )> FaceFilterFunction; + typedef std::function<bool ( const MeshType &, const typename MeshType::FaceHandle & )> FaceFilterFunction; typedef std::vector< typename MeshType::FaceHandle > Faces; typedef std::vector< typename MeshType::VertexHandle > Vertices; @@ -98,7 +98,7 @@ public: inline void setFaceFilter ( const FaceFilterFunction & f ) { faceFilter_ = f; } inline void clearFaceFilter() { faceFilter_ = FaceFilterFunction(); } - inline bool isFaceFilterSet() const { return !faceFilter_.empty(); } + inline bool isFaceFilterSet() const { return static_cast<bool>(faceFilter_); } void incrementTimeStep() { ++timestep_; } bool isWriteScheduled() const { return timestep_ % writeFrequency_ == 0; } diff --git a/src/pde/iterations/CGFixedStencilIteration.h b/src/pde/iterations/CGFixedStencilIteration.h index b7c5ac85fbfa17ec775841822f5d8fcf14fc7531..145fa37c80515a9745265d9b12a652abbf733d19 100644 --- a/src/pde/iterations/CGFixedStencilIteration.h +++ b/src/pde/iterations/CGFixedStencilIteration.h @@ -31,7 +31,7 @@ #include "field/GhostLayerField.h" #include "field/iterators/IteratorMacros.h" -#include <boost/function.hpp> +#include <functional> @@ -50,7 +50,7 @@ public: CGFixedStencilIteration( BlockStorage & blocks, const BlockDataID & uId, const BlockDataID & rId, const BlockDataID & dId, const BlockDataID & zId, const BlockDataID & fId, const std::vector< real_t > & weights, - const uint_t iterations, const boost::function< void () > & synchronizeD, + const uint_t iterations, const std::function< void () > & synchronizeD, const real_t residualNormThreshold = real_t(0), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -88,7 +88,7 @@ protected: uint_t iterations_; real_t residualNormThreshold_; - boost::function< void () > synchronizeD_; + std::function< void () > synchronizeD_; Set<SUID> requiredSelectors_; Set<SUID> incompatibleSelectors_; @@ -100,7 +100,7 @@ template< typename Stencil_T > CGFixedStencilIteration< Stencil_T >::CGFixedStencilIteration( BlockStorage & blocks, const BlockDataID & uId, const BlockDataID & rId, const BlockDataID & dId, const BlockDataID & zId, const BlockDataID & fId, const std::vector< real_t > & weights, - const uint_t iterations, const boost::function< void () > & synchronizeD, + const uint_t iterations, const std::function< void () > & synchronizeD, const real_t residualNormThreshold, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) : blocks_( blocks ), uId_( uId ), rId_( rId ), dId_( dId ), zId_( zId ), fId_( fId ), diff --git a/src/pde/iterations/CGIteration.h b/src/pde/iterations/CGIteration.h index 2a0afaf23bb81526e8f4468fa3a7bbc6c015a387..d3339759bb7b2998a22eb6e281704ef583a98715 100644 --- a/src/pde/iterations/CGIteration.h +++ b/src/pde/iterations/CGIteration.h @@ -31,7 +31,7 @@ #include "field/GhostLayerField.h" #include "field/iterators/IteratorMacros.h" -#include <boost/function.hpp> +#include <functional> @@ -51,7 +51,7 @@ public: CGIteration( BlockStorage & blocks, const BlockDataID & uId, const BlockDataID & rId, const BlockDataID & dId, const BlockDataID & zId, const BlockDataID & fId, const BlockDataID & stencilId, - const uint_t iterations, const boost::function< void () > & synchronizeD, + const uint_t iterations, const std::function< void () > & synchronizeD, const real_t residualNormThreshold = real_t(0), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -88,7 +88,7 @@ protected: uint_t iterations_; real_t residualNormThreshold_; - boost::function< void () > synchronizeD_; + std::function< void () > synchronizeD_; Set<SUID> requiredSelectors_; Set<SUID> incompatibleSelectors_; @@ -100,7 +100,7 @@ template< typename Stencil_T > CGIteration< Stencil_T >::CGIteration( BlockStorage & blocks, const BlockDataID & uId, const BlockDataID & rId, const BlockDataID & dId, const BlockDataID & zId, const BlockDataID & fId, const BlockDataID & stencilId, - const uint_t iterations, const boost::function< void () > & synchronizeD, + const uint_t iterations, const std::function< void () > & synchronizeD, const real_t residualNormThreshold, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) : blocks_( blocks ), uId_( uId ), rId_( rId ), dId_( dId ), zId_( zId ), fId_( fId ), stencilId_( stencilId ), diff --git a/src/pde/iterations/JacobiIteration.cpp b/src/pde/iterations/JacobiIteration.cpp index f3044457e4c1672a3263c349db2de980b4c1a553..f088ebe3110c14891d7e6620e62319e117ebdf1d 100644 --- a/src/pde/iterations/JacobiIteration.cpp +++ b/src/pde/iterations/JacobiIteration.cpp @@ -37,7 +37,7 @@ void JacobiIteration::operator()() uint_t i( uint_t(0) ); while( i < iterations_ ) { - if( !boundary_.empty() ) + if( boundary_ ) boundary_(); communication_(); @@ -48,7 +48,7 @@ void JacobiIteration::operator()() { if( (i % residualCheckFrequency_) == uint_t(0) ) { - if( !boundary_.empty() ) + if( boundary_ ) boundary_(); const real_t residualNorm = residualNorm_(); WALBERLA_CHECK( math::finite(residualNorm), "Non-finite residual norm detected during the Jacobi iteration, " diff --git a/src/pde/iterations/JacobiIteration.h b/src/pde/iterations/JacobiIteration.h index 3f30bcd85b21039576eefa1e3660744b13de4845..3002e7ff33c13c7dfcd5da50238828809e74c45c 100644 --- a/src/pde/iterations/JacobiIteration.h +++ b/src/pde/iterations/JacobiIteration.h @@ -25,7 +25,7 @@ #include "core/uid/SUID.h" #include "domain_decomposition/BlockStorage.h" -#include <boost/function.hpp> +#include <functional> @@ -39,9 +39,9 @@ class JacobiIteration public: JacobiIteration( BlockStorage & blocks, const uint_t iterations, - const boost::function< void () > & communication, - const boost::function< void ( IBlock * ) > & jacobi, - const boost::function< real_t () > & residualNorm, + const std::function< void () > & communication, + const std::function< void ( IBlock * ) > & jacobi, + const std::function< real_t () > & residualNorm, const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : @@ -51,7 +51,7 @@ public: requiredSelectors_( requiredSelectors ), incompatibleSelectors_( incompatibleSelectors ) {} - void addBoundaryHandling( const boost::function< void () > & boundary ) { boundary_ = boundary; } + void addBoundaryHandling( const std::function< void () > & boundary ) { boundary_ = boundary; } void operator()(); @@ -63,10 +63,10 @@ protected: real_t residualNormThreshold_; uint_t residualCheckFrequency_; - boost::function< void () > boundary_; - boost::function< void () > communication_; - boost::function< void ( IBlock * ) > jacobi_; - boost::function< real_t () > residualNorm_; + std::function< void () > boundary_; + std::function< void () > communication_; + std::function< void ( IBlock * ) > jacobi_; + std::function< real_t () > residualNorm_; Set<SUID> requiredSelectors_; Set<SUID> incompatibleSelectors_; diff --git a/src/pde/iterations/RBGSIteration.cpp b/src/pde/iterations/RBGSIteration.cpp index 7994b633128a3eeec52ceea4abc12870db0f66bc..18c503db781cf4e73f21731c558dc052796c72ee 100644 --- a/src/pde/iterations/RBGSIteration.cpp +++ b/src/pde/iterations/RBGSIteration.cpp @@ -40,14 +40,14 @@ void RBGSIteration::operator()() uint_t i( uint_t(0) ); while( i < iterations_ ) { - if( !boundary_.empty() ) + if( boundary_ ) boundary_(); communication_(); for( auto block = blocks_.begin( requiredSelectors_, incompatibleSelectors_ ); block != blocks_.end(); ++block ) redUpdate_( block.get() ); - if( !boundary_.empty() ) + if( boundary_ ) boundary_(); communication_(); @@ -58,7 +58,7 @@ void RBGSIteration::operator()() { if( (i % residualCheckFrequency_) == uint_t(0) ) { - if( !boundary_.empty() ) + if( boundary_ ) boundary_(); const real_t residualNorm = residualNorm_(); WALBERLA_CHECK( math::finite(residualNorm), "Non-finite residual norm detected during the red-black Gauss-Seidel iteration, " diff --git a/src/pde/iterations/RBGSIteration.h b/src/pde/iterations/RBGSIteration.h index aaae718913b99ca1006d37b1ac0f224e5b7dcaac..9f4ee04e7e9f3aa7f4584263e6d6603716d14b32 100644 --- a/src/pde/iterations/RBGSIteration.h +++ b/src/pde/iterations/RBGSIteration.h @@ -25,7 +25,7 @@ #include "core/uid/SUID.h" #include "domain_decomposition/BlockStorage.h" -#include <boost/function.hpp> +#include <functional> @@ -39,10 +39,10 @@ class RBGSIteration public: RBGSIteration( BlockStorage & blocks, const uint_t iterations, - const boost::function< void () > & communication, - const boost::function< void ( IBlock * ) > & redUpdate, - const boost::function< void ( IBlock * ) > & blackUpdate, - const boost::function< real_t () > & residualNorm, + const std::function< void () > & communication, + const std::function< void ( IBlock * ) > & redUpdate, + const std::function< void ( IBlock * ) > & blackUpdate, + const std::function< real_t () > & residualNorm, const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ) : @@ -53,7 +53,7 @@ public: requiredSelectors_( requiredSelectors ), incompatibleSelectors_( incompatibleSelectors ) {} - void addBoundaryHandling( const boost::function< void () > & boundary ) { boundary_ = boundary; } + void addBoundaryHandling( const std::function< void () > & boundary ) { boundary_ = boundary; } void operator()(); @@ -71,11 +71,11 @@ protected: uint_t iterationsPerformed_; bool thresholdReached_; - boost::function< void () > boundary_; - boost::function< void () > communication_; - boost::function< void ( IBlock * ) > redUpdate_; - boost::function< void ( IBlock * ) > blackUpdate_; - boost::function< real_t () > residualNorm_; + std::function< void () > boundary_; + std::function< void () > communication_; + std::function< void ( IBlock * ) > redUpdate_; + std::function< void ( IBlock * ) > blackUpdate_; + std::function< real_t () > residualNorm_; Set<SUID> requiredSelectors_; Set<SUID> incompatibleSelectors_; diff --git a/src/pde/iterations/VCycles.h b/src/pde/iterations/VCycles.h index 161af67115994d5a5ea20275198e04de7e97491c..eca2b908fc5420cb24b1889e0bba71c2c2cbe86d 100644 --- a/src/pde/iterations/VCycles.h +++ b/src/pde/iterations/VCycles.h @@ -33,7 +33,7 @@ #include "pde/sweeps/RBGSFixedStencil.h" #include "pde/sweeps/RBGS.h" -#include <boost/function.hpp> +#include <functional> #include <vector> @@ -54,7 +54,7 @@ public: const Weight_T weights, const uint_t iterations, const uint_t numLvl, const uint_t preSmoothingIters, const uint_t postSmoothingIters, - const uint_t coarseIters, const boost::function< real_t () > & residualNorm, + const uint_t coarseIters, const std::function< real_t () > & residualNorm, const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -63,7 +63,7 @@ public: const BlockDataID & stencilFieldId, const uint_t iterations, const uint_t numLvl, const uint_t preSmoothingIters, const uint_t postSmoothingIters, - const uint_t coarseIters, const boost::function< real_t () > & residualNorm, + const uint_t coarseIters, const std::function< real_t () > & residualNorm, const real_t residualNormThreshold = real_t(0), const uint_t residualCheckFrequency = uint_t(1), const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(), const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() ); @@ -94,7 +94,7 @@ protected: uint_t iterationsPerformed_; bool thresholdReached_; - boost::function< real_t() > residualNorm_; + std::function< real_t() > residualNorm_; std::vector<real_t> convergenceRate_; std::vector<BlockDataID> uId_; @@ -105,9 +105,9 @@ protected: std::vector< shared_ptr<pde::RBGSFixedStencil< Stencil_T > > > RBGSFixedSweeps_; std::vector< shared_ptr<pde::RBGS< Stencil_T > > > RBGSSweeps_; - std::vector< boost::function< void() > > RBGSIteration_; - boost::function< void() > CGIteration_; - std::vector<boost::function< void(IBlock *) > > computeResidual_, restrict_, zeroize_, prolongateAndCorrect_; + std::vector< std::function< void() > > RBGSIteration_; + std::function< void() > CGIteration_; + std::vector<std::function< void(IBlock *) > > computeResidual_, restrict_, zeroize_, prolongateAndCorrect_; std::vector< blockforest::communication::UniformBufferedScheme< Stencil_T > > communication_; diff --git a/src/pde/iterations/VCycles.impl.h b/src/pde/iterations/VCycles.impl.h index 8ad0833d4f9c4f1173f32a9dd4a2d011b6c8fa07..a35cf35779f8dd3396a6792a4fedeaad7e7957e3 100644 --- a/src/pde/iterations/VCycles.impl.h +++ b/src/pde/iterations/VCycles.impl.h @@ -44,7 +44,7 @@ VCycles< Stencil_T >::VCycles( shared_ptr< StructuredBlockForest > blocks, const const Weight_T weights, const uint_t iterations, const uint_t numLvl, const uint_t preSmoothingIters, const uint_t postSmoothingIters, - const uint_t coarseIters, const boost::function< real_t () > & residualNorm, + const uint_t coarseIters, const std::function< real_t () > & residualNorm, const real_t residualNormThreshold, const uint_t residualCheckFrequency, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) : @@ -150,7 +150,7 @@ VCycles< Stencil_T >::VCycles( shared_ptr< StructuredBlockForest > blocks, const const BlockDataID & stencilFieldId, const uint_t iterations, const uint_t numLvl, const uint_t preSmoothingIters, const uint_t postSmoothingIters, - const uint_t coarseIters, const boost::function< real_t () > & residualNorm, + const uint_t coarseIters, const std::function< real_t () > & residualNorm, const real_t residualNormThreshold, const uint_t residualCheckFrequency, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) : diff --git a/src/pde/sweeps/RBGS.h b/src/pde/sweeps/RBGS.h index 98f9849190bb1f88d6fab4eb2e912c8be2cc2389..1f3404341379aea84ab26e4d514a8a5f9cc9ff58 100644 --- a/src/pde/sweeps/RBGS.h +++ b/src/pde/sweeps/RBGS.h @@ -51,12 +51,12 @@ public: void update( IBlock * const block, const bool rb ); - boost::function< void ( IBlock * const ) > getRedSweep() + std::function< void ( IBlock * const ) > getRedSweep() { return boost::bind( &RBGS::update, this, _1, true ); } - boost::function< void ( IBlock * const ) > getBlackSweep() + std::function< void ( IBlock * const ) > getBlackSweep() { return boost::bind( &RBGS::update, this, _1, false ); } diff --git a/src/pde/sweeps/RBGSFixedStencil.h b/src/pde/sweeps/RBGSFixedStencil.h index cd4715fda9efc16bffe66e9cd97b2b3c39840594..76df0005548e9df4126d30e017ce10bb1d75f750 100644 --- a/src/pde/sweeps/RBGSFixedStencil.h +++ b/src/pde/sweeps/RBGSFixedStencil.h @@ -50,12 +50,12 @@ public: void update( IBlock * const block, const bool rb ); - boost::function< void ( IBlock * const ) > getRedSweep() + std::function< void ( IBlock * const ) > getRedSweep() { return boost::bind( &RBGSFixedStencil::update, this, _1, true ); } - boost::function< void ( IBlock * const ) > getBlackSweep() + std::function< void ( IBlock * const ) > getBlackSweep() { return boost::bind( &RBGSFixedStencil::update, this, _1, false ); } diff --git a/src/pde/sweeps/SOR.h b/src/pde/sweeps/SOR.h index 9ce89069cef49c9ea003513a6cd311d0242dff18..90be98268340223cd6e22d750c7db6bee9d5105b 100644 --- a/src/pde/sweeps/SOR.h +++ b/src/pde/sweeps/SOR.h @@ -51,12 +51,12 @@ public: void update( IBlock * const block, const bool rb ); - boost::function< void ( IBlock * const ) > getRedSweep() + std::function< void ( IBlock * const ) > getRedSweep() { return boost::bind( &SOR::update, this, _1, true ); } - boost::function< void ( IBlock * const ) > getBlackSweep() + std::function< void ( IBlock * const ) > getBlackSweep() { return boost::bind( &SOR::update, this, _1, false ); } diff --git a/src/pde/sweeps/SORFixedStencil.h b/src/pde/sweeps/SORFixedStencil.h index 2e9a54a9128f7316a5ca228637a7ce4c399c7bf8..51535e0378b9ccaa5bcf1181442ed5ff7bdba5ec 100644 --- a/src/pde/sweeps/SORFixedStencil.h +++ b/src/pde/sweeps/SORFixedStencil.h @@ -50,12 +50,12 @@ public: void update( IBlock * const block, const bool rb ); - boost::function< void ( IBlock * const ) > getRedSweep() + std::function< void ( IBlock * const ) > getRedSweep() { return boost::bind( &SORFixedStencil::update, this, _1, true ); } - boost::function< void ( IBlock * const ) > getBlackSweep() + std::function< void ( IBlock * const ) > getBlackSweep() { return boost::bind( &SORFixedStencil::update, this, _1, false ); } diff --git a/src/pe/rigidbody/BodyStorage.h b/src/pe/rigidbody/BodyStorage.h index fb34a55908f6a721914f9fcde6fb8e4953f73589..6761fea4e1ed826cf5825b5c2ceb2e7d1bd21f5e 100644 --- a/src/pe/rigidbody/BodyStorage.h +++ b/src/pe/rigidbody/BodyStorage.h @@ -37,7 +37,7 @@ #include <pe/rigidbody/RigidBody.h> #include <pe/Types.h> -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe { @@ -133,11 +133,11 @@ public: //**Callbacks************************************************************************ /*!\name Callbacks */ //@{ - inline void registerAddCallback ( const std::string name, const boost::function<void (BodyID)>& func ); + inline void registerAddCallback ( const std::string name, const std::function<void (BodyID)>& func ); inline void deregisterAddCallback ( const std::string name ); inline void clearAddCallbacks ( ); - inline void registerRemoveCallback ( const std::string name, const boost::function<void (BodyID)>& func ); + inline void registerRemoveCallback ( const std::string name, const std::function<void (BodyID)>& func ); inline void deregisterRemoveCallback ( const std::string name ); inline void clearRemoveCallbacks ( ); //@} @@ -150,8 +150,8 @@ private: Bodies bodies_; //!< The rigid bodies contained in the simulation world. std::map<id_t, SizeType> bodyIDs_; //!< The association of system IDs to rigid bodies. - std::map< std::string, boost::function<void (BodyID)> > addCallbacks_; - std::map< std::string, boost::function<void (BodyID)> > removeCallbacks_; + std::map< std::string, std::function<void (BodyID)> > addCallbacks_; + std::map< std::string, std::function<void (BodyID)> > removeCallbacks_; //@} //********************************************************************************************** }; @@ -713,7 +713,7 @@ inline void BodyStorage::clear() } //************************************************************************************************* -inline void BodyStorage::registerAddCallback ( const std::string name, const boost::function<void (BodyID)>& func ) +inline void BodyStorage::registerAddCallback ( const std::string name, const std::function<void (BodyID)>& func ) { WALBERLA_ASSERT_EQUAL(addCallbacks_.find(name), addCallbacks_.end(), "Callback '" << name << "' already exists!"); addCallbacks_.insert( std::make_pair(name, func) ); @@ -733,7 +733,7 @@ inline void BodyStorage::clearAddCallbacks ( ) addCallbacks_.clear(); } -inline void BodyStorage::registerRemoveCallback ( const std::string name, const boost::function<void (BodyID)>& func ) +inline void BodyStorage::registerRemoveCallback ( const std::string name, const std::function<void (BodyID)>& func ) { WALBERLA_ASSERT_EQUAL(removeCallbacks_.find(name), removeCallbacks_.end(), "Callback '" << name << "' already exists!"); removeCallbacks_.insert( std::make_pair(name, func) ); diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h index 5950cfc3fc1f8dc59119ad24072f8609f218d762..a318686d8865509b3597d3361852c51c42c1ffcc 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/AddedMassForceEvaluator.h @@ -45,7 +45,7 @@ #include "stencil/Directions.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe_coupling { @@ -78,9 +78,9 @@ public: const BlockDataID & forceFieldID, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & velocityTimeDerivativeFieldID, - const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> & addedMassForceCorrelationFunction, + const std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> & addedMassForceCorrelationFunction, const shared_ptr< BodyVelocityTimeDerivativeEvaluator > & bodyVelocityTimeDerivativeEvaluator, - const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), addedMassForceCorrelationFunction_( addedMassForceCorrelationFunction ), bodyVelocityTimeDerivativeEvaluator_( bodyVelocityTimeDerivativeEvaluator ), @@ -97,11 +97,11 @@ private: shared_ptr<StructuredBlockStorage> blockStorage_; const BlockDataID bodyStorageID_; - boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> addedMassForceCorrelationFunction_; + std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t )> addedMassForceCorrelationFunction_; shared_ptr< BodyVelocityTimeDerivativeEvaluator > bodyVelocityTimeDerivativeEvaluator_; - boost::function<bool(pe::BodyID)> dpmBodySelectorFct_; + std::function<bool(pe::BodyID)> dpmBodySelectorFct_; BlockDataID velocityTimeDerivativeFieldInterpolatorID_; BlockDataID forceDistributorID_; diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h index 95d64064089c8a89081774b59a7f0f90b3856ecc..229be174ef1951b0e2601a65717457683c8d1467 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/BodyVelocityTimeDerivativeEvaluator.h @@ -27,7 +27,7 @@ #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> #include <map> namespace walberla { @@ -50,7 +50,7 @@ public: BodyVelocityTimeDerivativeEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, const real_t & deltaT = real_t(1), - const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), deltaTinv_( real_t(1) / deltaT ), dpmBodySelectorFct_( dpmBodySelectorFct) { } @@ -88,7 +88,7 @@ private: const BlockDataID bodyStorageID_; std::map< walberla::id_t, Vector3< real_t > > bodyVelocityMap_; real_t deltaTinv_; - boost::function<bool(pe::BodyID)> dpmBodySelectorFct_; + std::function<bool(pe::BodyID)> dpmBodySelectorFct_; }; diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h index c052b6059bad2ac9a54ce5bee15a8f8ae6c10033..fc10c9b975cf8e5845432f62d439b354fefb6f3f 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h @@ -66,7 +66,7 @@ public: EffectiveViscosityFieldEvaluator( const BlockDataID & omegaFieldID, const ConstBlockDataID & solidVolumeFractionFieldID, const real_t & fluidViscosity, - const boost::function<real_t (real_t, real_t)> & effectiveViscosityFunc ) + const std::function<real_t (real_t, real_t)> & effectiveViscosityFunc ) : omegaFieldID_( omegaFieldID ), solidVolumeFractionFieldID_( solidVolumeFractionFieldID ), fluidViscosity_( fluidViscosity ), effectiveViscosityFunc_( effectiveViscosityFunc ) { @@ -97,7 +97,7 @@ private: const BlockDataID omegaFieldID_; const ConstBlockDataID solidVolumeFractionFieldID_; real_t fluidViscosity_; - boost::function<real_t (real_t, real_t)> effectiveViscosityFunc_; + std::function<real_t (real_t, real_t)> effectiveViscosityFunc_; }; diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h index d3a6dc098cb536ba85794543c69086095b074566..33a2e7d76fa567bd754214a4ccba52280c31299e 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/InteractionForceEvaluator.h @@ -45,7 +45,7 @@ #include "stencil/Directions.h" -#include <boost/function.hpp> +#include <functional> #include <vector> @@ -88,9 +88,9 @@ public: const BlockDataID & forceFieldID, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & velocityFieldID, const BlockDataID & solidVolumeFractionFieldID, const BlockDataID & pressureGradientFieldID, - const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> & dragForceCorrelationFunction, + const std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> & dragForceCorrelationFunction, real_t fluidDynamicViscosity, - const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), dragForceCorrelationFunction_( dragForceCorrelationFunction ), fluidDynamicViscosity_( fluidDynamicViscosity ), dpmBodySelectorFct_( dpmBodySelectorFct) @@ -109,11 +109,11 @@ private: const BlockDataID bodyStorageID_; const BlockDataID pdfFieldID_; - boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> dragForceCorrelationFunction_; + std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t, real_t )> dragForceCorrelationFunction_; real_t fluidDynamicViscosity_; - boost::function<bool(pe::BodyID)> dpmBodySelectorFct_; + std::function<bool(pe::BodyID)> dpmBodySelectorFct_; BlockDataID velocityFieldInterpolatorID_; BlockDataID solidVolumeFractionFieldInterpolatorID_; diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h index 97dee854dc7d68d66e165dd5849de0a8b04af2cd..d04ca701ca8788abc87b424b4b9b3a3328109819 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/LiftForceEvaluator.h @@ -38,7 +38,7 @@ #include "pe_coupling/geometry/SphereEquivalentDiameter.h" #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> #include <cmath> @@ -72,9 +72,9 @@ public: LiftForceEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & forceFieldID, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & velocityFieldID, const BlockDataID & velocityCurlFieldID, - const boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> & liftForceCorrelationFunction, + const std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> & liftForceCorrelationFunction, real_t fluidDynamicViscosity, - const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), liftForceCorrelationFunction_( liftForceCorrelationFunction ), fluidDynamicViscosity_( fluidDynamicViscosity ), dpmBodySelectorFct_( dpmBodySelectorFct) { @@ -90,11 +90,11 @@ private: shared_ptr<StructuredBlockStorage> blockStorage_; BlockDataID bodyStorageID_; - boost::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> liftForceCorrelationFunction_; + std::function<Vector3<real_t> ( const Vector3<real_t> &, const Vector3<real_t> &, const Vector3<real_t> &, real_t, real_t, real_t )> liftForceCorrelationFunction_; real_t fluidDynamicViscosity_; - boost::function<bool(pe::BodyID)> dpmBodySelectorFct_; + std::function<bool(pe::BodyID)> dpmBodySelectorFct_; BlockDataID velocityFieldInterpolatorID_; BlockDataID velocityCurlFieldInterpolatorID_; diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/SolidVolumeFractionFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/SolidVolumeFractionFieldEvaluator.h index eb0bbafb4b3b8ff7d74da6ea51661698a92a821d..1c83df74afc0eba7d192454f350932307f27bef4 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/SolidVolumeFractionFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/SolidVolumeFractionFieldEvaluator.h @@ -32,7 +32,7 @@ #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe_coupling { @@ -68,7 +68,7 @@ public: SolidVolumeFractionFieldEvaluator( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & solidVolumeFractionFieldID, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, - const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), solidVolumeFractionFieldID_( solidVolumeFractionFieldID ), bodyStorageID_( bodyStorageID ), dpmBodySelectorFct_( dpmBodySelectorFct) { @@ -104,7 +104,7 @@ private: BlockDataID solidVolumeFractionFieldID_; BlockDataID bodyStorageID_; - boost::function<bool(pe::BodyID)> dpmBodySelectorFct_; + std::function<bool(pe::BodyID)> dpmBodySelectorFct_; BlockDataID scalarDistributorID_; }; diff --git a/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h b/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h index 3ad78d1ad3f1929342c05c101b516dbe1a00b403..75ebeef5b370820e5f306b06c0f954c45b7dd16e 100644 --- a/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h +++ b/src/pe_coupling/discrete_particle_methods/utility/BodyVelocityInitializer.h @@ -36,7 +36,7 @@ #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> #include <cmath> @@ -66,7 +66,7 @@ public: BodyVelocityInitializer( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, const BlockDataID & flagFieldID, const Set< FlagUID > & domainFlags, const BlockDataID & velocityFieldID, - const boost::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & dpmBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), bodyStorageID_( bodyStorageID ), dpmBodySelectorFct_( dpmBodySelectorFct) { @@ -105,7 +105,7 @@ private: shared_ptr<StructuredBlockStorage> blockStorage_; BlockDataID bodyStorageID_; BlockDataID velocityFieldInterpolatorID_; - boost::function<bool(pe::BodyID)> dpmBodySelectorFct_; + std::function<bool(pe::BodyID)> dpmBodySelectorFct_; }; diff --git a/src/pe_coupling/discrete_particle_methods/utility/SubgridTimeStep.h b/src/pe_coupling/discrete_particle_methods/utility/SubgridTimeStep.h index 130a4829fa5a6bd87960c937f7fa12621cddc525..b337175e03fca3e4cd63158a5c24c31d7e4b28e0 100644 --- a/src/pe_coupling/discrete_particle_methods/utility/SubgridTimeStep.h +++ b/src/pe_coupling/discrete_particle_methods/utility/SubgridTimeStep.h @@ -32,7 +32,7 @@ #include "pe/rigidbody/BodyIterators.h" #include "pe/synchronization/SyncForces.h" -#include <boost/function.hpp> +#include <functional> #include <map> @@ -63,8 +63,8 @@ public: explicit SubgridTimeStep( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, pe::cr::ICR & collisionResponse, - const boost::function<void (void)> & synchronizeFunc, - const boost::function<void ()> & forceEvaluationFunc, + const std::function<void (void)> & synchronizeFunc, + const std::function<void ()> & forceEvaluationFunc, const real_t timeStepSize = real_t(1), const uint_t intermediateSteps = uint_t(1) ) : timeStepSize_( timeStepSize ) , intermediateSteps_( ( intermediateSteps == 0 ) ? uint_t(1) : intermediateSteps ) @@ -153,8 +153,8 @@ protected: const BlockDataID & bodyStorageID_; pe::cr::ICR & collisionResponse_; - boost::function<void (void)> synchronizeFunc_; - boost::function<void ()> forceEvaluationFunc_; + std::function<void (void)> synchronizeFunc_; + std::function<void ()> forceEvaluationFunc_; }; diff --git a/src/pe_coupling/mapping/BodyMapping.h b/src/pe_coupling/mapping/BodyMapping.h index 042c8dd23acc30d445dbba791fc68d86a5970d05..4af2e9d3195ebaddc0ce3a6a08108c2c4d28d10d 100644 --- a/src/pe_coupling/mapping/BodyMapping.h +++ b/src/pe_coupling/mapping/BodyMapping.h @@ -35,7 +35,7 @@ #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe_coupling { @@ -99,7 +99,7 @@ template< typename BoundaryHandling_T > void mapBodies( StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID, const BlockDataID & bodyStorageID, pe::BodyStorage & globalBodyStorage, const FlagUID & obstacle, - const boost::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectAllBodies ) + const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectAllBodies ) { for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt ) { diff --git a/src/pe_coupling/momentum_exchange_method/BodyMapping.h b/src/pe_coupling/momentum_exchange_method/BodyMapping.h index 3b4b7ff57736c629eaaa377086162d88a7e47f21..7651386b613b476a00d5070c1550884930a003f9 100644 --- a/src/pe_coupling/momentum_exchange_method/BodyMapping.h +++ b/src/pe_coupling/momentum_exchange_method/BodyMapping.h @@ -35,7 +35,7 @@ #include "pe_coupling/mapping/BodyBBMapping.h" #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe_coupling { @@ -70,7 +70,7 @@ public: const shared_ptr<pe::BodyStorage> & globalBodyStorage, const BlockDataID & bodyFieldID, const FlagUID & obstacle, const FlagUID & formerObstacle, - const boost::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies ) + const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies ) : blockStorage_( blockStorage ), boundaryHandlingID_( boundaryHandlingID ), bodyStorageID_(bodyStorageID), globalBodyStorage_( globalBodyStorage ), bodyFieldID_( bodyFieldID ), obstacle_( obstacle ), formerObstacle_( formerObstacle ), mappingBodySelectorFct_( mappingBodySelectorFct ) @@ -192,7 +192,7 @@ private: const FlagUID obstacle_; const FlagUID formerObstacle_; - boost::function<bool(pe::BodyID)> mappingBodySelectorFct_; + std::function<bool(pe::BodyID)> mappingBodySelectorFct_; }; // class BodyMapping @@ -267,7 +267,7 @@ template< typename BoundaryHandling_T > void mapMovingBodies( StructuredBlockStorage & blockStorage, const BlockDataID & boundaryHandlingID, const BlockDataID & bodyStorageID, pe::BodyStorage & globalBodyStorage, const BlockDataID & bodyFieldID, const FlagUID & obstacle, - const boost::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectAllBodies ) + const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectAllBodies ) { for( auto blockIt = blockStorage.begin(); blockIt != blockStorage.end(); ++blockIt ) { diff --git a/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h b/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h index ef8289da08ffc29712a8cb4ec7cfcfc559605a5c..d21808bb3cc8bae4084ea24bff84b6051dd30253 100644 --- a/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h +++ b/src/pe_coupling/momentum_exchange_method/restoration/PDFReconstruction.h @@ -33,7 +33,7 @@ #include "field/iterators/IteratorMacros.h" #include "Reconstructor.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe_coupling { @@ -71,7 +71,7 @@ public: const BlockDataID & bodyFieldID, const Reconstructer_T & reconstructor, const FlagUID & formerObstacle, const FlagUID & fluid, - const boost::function<bool(pe::BodyID)> & movingBodySelectorFct = selectRegularBodies, + const std::function<bool(pe::BodyID)> & movingBodySelectorFct = selectRegularBodies, const bool optimizeForSmallObstacleFraction = false ) : blockStorage_( blockStorage ), boundaryHandlingID_( boundaryHandlingID ), bodyStorageID_(bodyStorageID), globalBodyStorage_( globalBodyStorage ), bodyFieldID_( bodyFieldID ), @@ -127,7 +127,7 @@ private: const FlagUID formerObstacle_; const FlagUID fluid_; - boost::function<bool(pe::BodyID)> movingBodySelectorFct_; + std::function<bool(pe::BodyID)> movingBodySelectorFct_; const bool optimizeForSmallObstacleFraction_; diff --git a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h index 3a6ef85a07db100e4f487548c518a0f0d02d63d9..9f28d42e6bd41f2226766c3e6b88bb8ad0b350ec 100644 --- a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h +++ b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.h @@ -34,7 +34,7 @@ #include "pe_coupling/mapping/BodyBBMapping.h" #include "pe_coupling/utility/BodySelectorFunctions.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace pe_coupling { @@ -108,7 +108,7 @@ public: const shared_ptr<pe::BodyStorage> & globalBodyStorage, const BlockDataID & bodyStorageID, const BlockDataID & bodyAndVolumeFractionFieldID, - const boost::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies, + const std::function<bool(pe::BodyID)> & mappingBodySelectorFct = selectRegularBodies, const real_t velocityUpdatingEpsilon = real_t(0), const real_t positionUpdatingEpsilon = real_t(0), const uint_t superSamplingDepth = uint_t(4) ) @@ -141,7 +141,7 @@ private: const BlockDataID bodyStorageID_; const BlockDataID bodyAndVolumeFractionFieldID_; - boost::function<bool(pe::BodyID)> mappingBodySelectorFct_; + std::function<bool(pe::BodyID)> mappingBodySelectorFct_; shared_ptr<BodyAndVolumeFractionField_T> updatedBodyAndVolumeFractionField_; std::map< walberla::id_t, Vector3< real_t > > lastUpdatedPositionMap_; diff --git a/src/pe_coupling/utility/TimeStep.h b/src/pe_coupling/utility/TimeStep.h index 6faf07fa6620ca33fbec4d7e8073bf33effa7ad1..684fb6bf60a01d9869f3b9f8adc12723b155e7af 100644 --- a/src/pe_coupling/utility/TimeStep.h +++ b/src/pe_coupling/utility/TimeStep.h @@ -32,7 +32,7 @@ #include "pe/rigidbody/BodyIterators.h" #include "pe/synchronization/SyncForces.h" -#include <boost/function.hpp> +#include <functional> #include <map> @@ -47,7 +47,7 @@ public: explicit TimeStep( const shared_ptr<StructuredBlockStorage> & blockStorage, const BlockDataID & bodyStorageID, pe::cr::ICR & collisionResponse, - const boost::function<void (void)> & synchronizeFunc, + const std::function<void (void)> & synchronizeFunc, const real_t timeStep = real_t(1), const uint_t intermediateSteps = uint_c(1) ) : timeStep_( timeStep ) , intermediateSteps_( ( intermediateSteps == 0 ) ? uint_c(1) : intermediateSteps ) @@ -147,7 +147,7 @@ protected: const BlockDataID & bodyStorageID_; pe::cr::ICR & collisionResponse_; - boost::function<void (void)> synchronizeFunc_; + std::function<void (void)> synchronizeFunc_; }; // class TimeStep diff --git a/src/python_coupling/DictWrapper.impl.h b/src/python_coupling/DictWrapper.impl.h index 57e7f55348865367bb0ae12a550a76e8d1cbf0d2..400eb2e7f09e4855cd2d1ffdb630b2dfb6ac6448 100644 --- a/src/python_coupling/DictWrapper.impl.h +++ b/src/python_coupling/DictWrapper.impl.h @@ -102,7 +102,7 @@ inline bool DictWrapper::has<DictWrapper >( const std::string & name ) //=================================================================================================================== // -// Getting boost::functions +// Getting std::functions // //=================================================================================================================== @@ -111,13 +111,13 @@ inline void runPythonObject( boost::python::object obj ) { obj(); } template<> -inline boost::function<void()> DictWrapper::get( const std::string & name ) { +inline std::function<void()> DictWrapper::get( const std::string & name ) { boost::python::object obj ( d_[name] ); return boost::bind( &runPythonObject, obj ); } template<> -inline bool DictWrapper::has<boost::function<void()> >( const std::string & name ) +inline bool DictWrapper::has<std::function<void()> >( const std::string & name ) { if(! d_.has_key(name) ) return false; diff --git a/src/python_coupling/Manager.h b/src/python_coupling/Manager.h index 5acfb0daadcd7d5444cdf757bb62bc8cb6e94236..b6294b6fb0a6f218585b1e75bcc9d1bf5ba262ed 100644 --- a/src/python_coupling/Manager.h +++ b/src/python_coupling/Manager.h @@ -71,8 +71,8 @@ namespace python_coupling { public: WALBERLA_BEFRIEND_SINGLETON; - typedef boost::function<void()> ExporterFunction; - typedef boost::function< boost::python::object ( IBlock&, BlockDataID ) > BlockDataToObjectFunction; + typedef std::function<void()> ExporterFunction; + typedef std::function< boost::python::object ( IBlock&, BlockDataID ) > BlockDataToObjectFunction; ~Manager(); diff --git a/src/python_coupling/basic_exports/BasicExports.cpp b/src/python_coupling/basic_exports/BasicExports.cpp index 837122b5a4012502f8833584308557621bd11944..a3e4a8f31cbeb1715515319c2b6ff0e37bbe1e42 100644 --- a/src/python_coupling/basic_exports/BasicExports.cpp +++ b/src/python_coupling/basic_exports/BasicExports.cpp @@ -41,6 +41,7 @@ #include "python_coupling/helper/BlockStorageExportHelpers.h" #include "stencil/Directions.h" +#include <boost/version.hpp> using namespace boost::python; @@ -111,6 +112,47 @@ struct NumpyFloatConversion }; +#if BOOST_VERSION < 106300 +// taken from https://github.com/boostorg/python/commit/97e4b34a15978ca9d7c296da2de89b78bba4e0d5 +template <class T> +struct exportSharedPtr +{ + exportSharedPtr() + { + converter::registry::insert( &convertible, &construct, boost::python::type_id<std::shared_ptr<T> >() +#ifndef BOOST_PYTHON_NO_PY_SIGNATURES + , &converter::expected_from_python_type_direct<T>::get_pytype +#endif + ); + } + +private: + static void* convertible( PyObject* p ) + { + if ( p == Py_None ) + return p; + + return converter::get_lvalue_from_python( p, converter::registered<T>::converters ); + } + + static void construct( PyObject* source, converter::rvalue_from_python_stage1_data* data ) + { + void* const storage = ( (converter::rvalue_from_python_storage< std::shared_ptr<T> >*) data )->storage.bytes; + // Deal with the "None" case. + if ( data->convertible == source ) + new (storage) std::shared_ptr<T>(); + else + { + std::shared_ptr<void> hold_convertible_ref_count( (void*)0, converter::shared_ptr_deleter( handle<>( borrowed( source ) ) ) ); + // use aliasing constructor + new (storage) std::shared_ptr<T>( hold_convertible_ref_count, static_cast<T*>(data->convertible) ); + } + + data->convertible = storage; + } +}; +#endif + //====================================================================================================================== // // Helper Functions @@ -609,6 +651,10 @@ void exportTiming() .def( self_ns::str(self) ) ; +#if BOOST_VERSION < 106300 + exportSharedPtr<WcTimingTree>(); +#endif + } @@ -996,6 +1042,10 @@ void exportStructuredBlockStorage() .add_property( "periodic", &SbS_periodic ) ; + +#if BOOST_VERSION < 106300 + exportSharedPtr<StructuredBlockStorage>(); +#endif } //====================================================================================================================== @@ -1013,6 +1063,11 @@ void exportCommunication() using communication::UniformMPIDatatypeInfo; class_< UniformMPIDatatypeInfo, shared_ptr<UniformMPIDatatypeInfo>, boost::noncopyable> ( "UniformMPIDatatypeInfo", no_init ); + +#if BOOST_VERSION < 106300 + exportSharedPtr<UniformPackInfo>(); + exportSharedPtr<UniformMPIDatatypeInfo>(); +#endif } //====================================================================================================================== diff --git a/src/python_coupling/helper/MplHelpers.h b/src/python_coupling/helper/MplHelpers.h index ff5969f75dbc2ab7a7778749fed990be7f85432c..640f45637b09d10dc54904250749830dea43fbc8 100644 --- a/src/python_coupling/helper/MplHelpers.h +++ b/src/python_coupling/helper/MplHelpers.h @@ -61,7 +61,7 @@ struct NonCopyableWrap {}; #define FunctionExporterClass( functionName, functionSignature ) \ struct Exporter_##functionName \ { \ - typedef boost::function< functionSignature > FunctionType;\ + typedef std::function< functionSignature > FunctionType;\ Exporter_##functionName( const IBlock * block, ConstBlockDataID id )\ : block_( block ), blockDataID_( id )\ {}\ diff --git a/src/timeloop/PerformanceMeter.cpp b/src/timeloop/PerformanceMeter.cpp index 1f4f5c13dce935e034d3e34f69fc1d58b4cd489c..7af5f847d18ba2ae2bc51049fbe8706a3d30a0a7 100644 --- a/src/timeloop/PerformanceMeter.cpp +++ b/src/timeloop/PerformanceMeter.cpp @@ -51,7 +51,7 @@ namespace timeloop { timeloop.addFuncBeforeTimeStep( perfMeter.getBeforeFunction() ); \endcode *******************************************************************************************************************/ - boost::function<void () > PerformanceMeter::getBeforeFunction() + std::function<void () > PerformanceMeter::getBeforeFunction() { return boost::bind ( &PerformanceMeter::timingStart, this ); } @@ -64,7 +64,7 @@ namespace timeloop { timeloop.addFuncAfterTimeStep ( perfMeter.getAfterFunction() ); \endcode *******************************************************************************************************************/ - boost::function<void () > PerformanceMeter::getAfterFunction() + std::function<void () > PerformanceMeter::getAfterFunction() { return boost::bind ( &PerformanceMeter::timingEnd, this ); } diff --git a/src/timeloop/PerformanceMeter.h b/src/timeloop/PerformanceMeter.h index d08a3fb1b79fd79f5ade7ce5d78b489fa89db84d..732121789149a1553e927fe2eb5d24e8ffa07846 100644 --- a/src/timeloop/PerformanceMeter.h +++ b/src/timeloop/PerformanceMeter.h @@ -24,7 +24,7 @@ #include "domain_decomposition/StructuredBlockStorage.h" #include <boost/bind.hpp> -#include <boost/function.hpp> +#include <functional> #include <iostream> #include <map> @@ -72,7 +72,7 @@ namespace timeloop { class PerformanceMeter { public: - typedef boost::function< uint_t(const IBlock &) > CountFunction; + typedef std::function< uint_t(const IBlock &) > CountFunction; PerformanceMeter( StructuredBlockStorage & blockStorage ); @@ -86,8 +86,8 @@ namespace timeloop { void timingStart(); void timingEnd(); - boost::function<void () > getBeforeFunction(); - boost::function<void () > getAfterFunction(); + std::function<void () > getBeforeFunction(); + std::function<void () > getAfterFunction(); void clear(); //@} diff --git a/src/timeloop/SelectableFunctionCreators.h b/src/timeloop/SelectableFunctionCreators.h index f00d5a3a0f298c901665b05115335d0c5c562e26..b6762e469e37afc1f3c093c76af35c822731ec82 100644 --- a/src/timeloop/SelectableFunctionCreators.h +++ b/src/timeloop/SelectableFunctionCreators.h @@ -26,7 +26,7 @@ #include "domain_decomposition/BlockStorage.h" #include <boost/bind.hpp> -#include <boost/function.hpp> +#include <functional> #include <string> @@ -38,7 +38,7 @@ namespace timeloop { template < typename FuncType > struct FuncCreator { - FuncCreator( boost::function< FuncType > fct, + FuncCreator( std::function< FuncType > fct, const std::string& identifier = std::string(), const Set<SUID>& requiredSelectors = Set<SUID>::emptySet(), const Set<SUID>& incompatibleSelectors = Set<SUID>::emptySet() ) @@ -46,7 +46,7 @@ namespace timeloop { requiredSelectors_( requiredSelectors ), incompatibleSelectors_( incompatibleSelectors ) {} - boost::function< FuncType > function_; + std::function< FuncType > function_; std::string identifier_; Set<SUID> requiredSelectors_; Set<SUID> incompatibleSelectors_; @@ -58,7 +58,7 @@ namespace timeloop { { SelectableFunction() {} - SelectableFunction ( boost::function< FuncType > fct, + SelectableFunction ( std::function< FuncType > fct, const std::string& identifier = std::string(), const Set<SUID>& requiredSelectors = Set<SUID>::emptySet(), const Set<SUID>& incompatibleSelectors = Set<SUID>::emptySet() ) @@ -72,14 +72,14 @@ namespace timeloop { return *this; } - selectable::SetSelectableObject< boost::function<FuncType>, SUID > selectableFunc_; + selectable::SetSelectableObject< std::function<FuncType>, SUID > selectableFunc_; }; struct BeforeFunction : public SelectableFunction< void () > { BeforeFunction() {} - BeforeFunction(boost::function< void () > fct, + BeforeFunction(std::function< void () > fct, const std::string& id = std::string(), const Set<SUID>& req = Set<SUID>::emptySet(), const Set<SUID>& incomp = Set<SUID>::emptySet()) @@ -97,7 +97,7 @@ namespace timeloop { struct AfterFunction : public SelectableFunction< void () > { AfterFunction() {} - AfterFunction(boost::function< void () > fct, + AfterFunction(std::function< void () > fct, const std::string& id = std::string(), const Set<SUID>& req = Set<SUID>::emptySet(), const Set<SUID>& incomp = Set<SUID>::emptySet()) @@ -115,14 +115,14 @@ namespace timeloop { template< typename T > struct SweepOnBlock { - SweepOnBlock( boost::function< T* ( IBlock* const block ) > function, + SweepOnBlock( std::function< T* ( IBlock* const block ) > function, const std::string& identifier = std::string(), const Set<SUID>& required = Set<SUID>::emptySet(), const Set<SUID>& incompatible = Set<SUID>::emptySet() ) : function_( function ), identifier_( identifier ), requiredSelectors_( required ), incompatibleSelectors_( incompatible ) {} - boost::function< T* ( IBlock* const block ) > function_; + std::function< T* ( IBlock* const block ) > function_; std::string identifier_; Set<SUID> requiredSelectors_; diff --git a/src/timeloop/SweepTimeloop.h b/src/timeloop/SweepTimeloop.h index 33daeb7b52df4b542ebb4488d89ea42dc01bc96f..a9b4d6d2ad88692a1c86e674e82a1c2f80cd897d 100644 --- a/src/timeloop/SweepTimeloop.h +++ b/src/timeloop/SweepTimeloop.h @@ -26,7 +26,7 @@ #include "Timeloop.h" #include "domain_decomposition/StructuredBlockStorage.h" -#include <boost/function.hpp> +#include <functional> #include <map> diff --git a/src/timeloop/Timeloop.h b/src/timeloop/Timeloop.h index b576f79a36d271ff3993439569a3cf443e4af505..e2cc5500191eab290607be954d4cc6306ae84560 100644 --- a/src/timeloop/Timeloop.h +++ b/src/timeloop/Timeloop.h @@ -30,13 +30,13 @@ #include "core/timing/TimingPool.h" #include "core/uid/SUID.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { namespace timeloop { -typedef boost::function<void ()> VoidFctNoArguments; +typedef std::function<void ()> VoidFctNoArguments; //******************************************************************************************************************* diff --git a/src/vtk/ChainedFilter.h b/src/vtk/ChainedFilter.h index 43411c80d7779832cda4389369f7ba916939ec7d..573fff5c160854ac95cc72880f3b2c192c8e82c6 100644 --- a/src/vtk/ChainedFilter.h +++ b/src/vtk/ChainedFilter.h @@ -25,7 +25,7 @@ #include "core/cell/CellSet.h" #include "domain_decomposition/StructuredBlockStorage.h" -#include <boost/function.hpp> +#include <functional> namespace walberla { @@ -37,7 +37,7 @@ class ChainedFilter { public: - typedef boost::function< void ( CellSet& filteredCells, const IBlock& block, const StructuredBlockStorage& storage, const uint_t ghostLayers ) > CellFilter; + typedef std::function< void ( CellSet& filteredCells, const IBlock& block, const StructuredBlockStorage& storage, const uint_t ghostLayers ) > CellFilter; void addFilter( const CellFilter& filter ) { filters_.push_back( filter ); } diff --git a/src/vtk/Initialization.h b/src/vtk/Initialization.h index 6970130315c2f96d7c7c26e025667e00f20e6937..b08caac6a49eb3f7a0e2f024a32cc6f62d1b2505 100644 --- a/src/vtk/Initialization.h +++ b/src/vtk/Initialization.h @@ -26,7 +26,7 @@ #include "core/config/Config.h" #include "domain_decomposition/StructuredBlockStorage.h" -#include <boost/function.hpp> +#include <functional> #include <string> @@ -37,7 +37,7 @@ namespace vtk { // For documentation see the documentation of function "initializeVTKOutput" in Initialization.cpp -typedef boost::function< void () > OutputFunction; +typedef std::function< void () > OutputFunction; struct SelectableOutputFunction { @@ -76,7 +76,7 @@ void initializeVTKOutput( std::map< std::string, SelectableOutputFunction > & ou const std::map< std::string, VTKOutput::CellFilter > & filters, const std::map< std::string, VTKOutput::BeforeFunction > & beforeFunctions ); -typedef boost::function< void ( std::vector< shared_ptr< BlockCellDataWriterInterface > > & writers, +typedef std::function< void ( std::vector< shared_ptr< BlockCellDataWriterInterface > > & writers, std::map< std::string, VTKOutput::CellFilter > & filters, std::map< std::string, VTKOutput::BeforeFunction > & beforeFunctions ) > RegisterVTKOutputFunction; diff --git a/src/vtk/VTKOutput.h b/src/vtk/VTKOutput.h index 71cec90a9f124875c962ee19cc135851ea1f773e..2f51b9b21f7ad5f8d8232b5f4c119601ed8a4c3b 100644 --- a/src/vtk/VTKOutput.h +++ b/src/vtk/VTKOutput.h @@ -35,7 +35,7 @@ #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> -#include <boost/function.hpp> +#include <functional> #include <boost/tuple/tuple.hpp> #include <fstream> @@ -144,8 +144,8 @@ public: const bool continuousNumbering, const bool binary, const bool littleEndian, const bool useMPIIO, const uint_t initialExecutionCount ); - typedef boost::function< void () > BeforeFunction; - typedef boost::function< void ( CellSet& filteredCells, const IBlock& block, + typedef std::function< void () > BeforeFunction; + typedef std::function< void ( CellSet& filteredCells, const IBlock& block, const StructuredBlockStorage& storage, const uint_t ghostLayers ) > CellFilter; ~VTKOutput(); diff --git a/src/waLBerlaDefinitions.in.h b/src/waLBerlaDefinitions.in.h index 15a6df25970d702d06b0aae11c774f2b8e811e2f..0c4408a40bc7daaedc4f3ef00ff4de125f8c378e 100644 --- a/src/waLBerlaDefinitions.in.h +++ b/src/waLBerlaDefinitions.in.h @@ -23,7 +23,6 @@ #cmakedefine WALBERLA_BUILD_WITH_METIS #cmakedefine WALBERLA_BUILD_WITH_PARMETIS -#cmakedefine WALBERLA_BUILD_WITH_BOOST_THREAD #cmakedefine WALBERLA_BUILD_WITH_PYTHON #cmakedefine WALBERLA_BUILD_WITH_FFT diff --git a/tests/blockforest/BlockDataIOTest.cpp b/tests/blockforest/BlockDataIOTest.cpp index 6a550599a27983226082edef5c75c8a2495ed803..291b3322a6e1b1324bf74f2ce27cbaed5ec0423e 100644 --- a/tests/blockforest/BlockDataIOTest.cpp +++ b/tests/blockforest/BlockDataIOTest.cpp @@ -91,7 +91,7 @@ int main( int argc, char* argv[] ) auto dataHandling = make_shared< field::DefaultBlockDataHandling< FieldType > >( sbf, uint_t(3), 0.0, field::zyxf ); auto originalFieldId = sbf->addBlockData( dataHandling, "OriginalField", None, Empty ); - math::seedRandomGenerator( numeric_cast<boost::mt19937::result_type>( MPIManager::instance()->rank() ) ); + math::seedRandomGenerator( numeric_cast<std::mt19937::result_type>( MPIManager::instance()->rank() ) ); for( auto it = sbf->begin( None, Empty ); it != sbf->end(); ++it ) { diff --git a/tests/blockforest/StructuredBlockForestTest.cpp b/tests/blockforest/StructuredBlockForestTest.cpp index 84032f8091a58b8c749ec008f2e4fc535ce5af2c..fc9ce847cd0c55800623d99128fd6585109fea03 100644 --- a/tests/blockforest/StructuredBlockForestTest.cpp +++ b/tests/blockforest/StructuredBlockForestTest.cpp @@ -25,7 +25,7 @@ #include "core/debug/TestSubsystem.h" #include "core/mpi/Environment.h" -#include <boost/random/mersenne_twister.hpp> +#include <random> namespace walberla { namespace blockforest { @@ -418,7 +418,7 @@ static void test() { bb = *( block->getData< CellInterval >( bid ) ); WALBERLA_CHECK_EQUAL( bb, CellInterval(Cell(150,180,210),Cell(199,239,279)) ); - boost::random::mt19937 eng( 23 ); + std::mt19937 eng( 23 ); for( int i = 0; i < 23; ++i ) { const Vector3<real_t> globalPoint = forest.getDomain().getScaled( real_t(1.25) ).randomPoint( eng ); diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index f81f11461e80d525317c9d909b4ecad08372fd0e..6885cf97661fa507cc240a45207b63a62aec4a43 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -106,10 +106,8 @@ waLBerla_execute_test( NAME EquationSolverTest ) waLBerla_compile_test( FILES mpi/BufferTest.cpp ) waLBerla_execute_test( NAME BufferTest ) -if( WALBERLA_BUILD_WITH_BOOST_THREAD ) - waLBerla_compile_test( FILES mpi/BufferSystemTest.cpp ) - waLBerla_execute_test( NAME BufferSystemTest PROCESSES 4 ) -endif() +waLBerla_compile_test( FILES mpi/BufferSystemTest.cpp ) +waLBerla_execute_test( NAME BufferSystemTest PROCESSES 4 ) waLBerla_compile_test( FILES mpi/BroadcastTest.cpp ) waLBerla_execute_test( NAME BroadcastTest1 COMMAND $<TARGET_FILE:BroadcastTest> ) diff --git a/tests/core/cell/CellIntervalTest.cpp b/tests/core/cell/CellIntervalTest.cpp index bf4f42da5769136b24323e1f3c99eb429bdf2d78..5ce0c57f26552353f4fa117c679c59cb15b687ca 100644 --- a/tests/core/cell/CellIntervalTest.cpp +++ b/tests/core/cell/CellIntervalTest.cpp @@ -23,19 +23,20 @@ #include "core/cell/CellInterval.h" #include "core/debug/TestSubsystem.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> +#include <random> #include <iostream> #include <iterator> using namespace walberla; +typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + CellInterval makeRandomInterval(uint_t maxSize) { - static boost::mt11213b rng; - boost::uniform_int<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min(), std::numeric_limits<cell_idx_t>::max() - cell_idx_c( maxSize ) ); - boost::uniform_int<uint_t> dist2( uint_t(0), maxSize ); + static mt11213b rng; + std::uniform_int_distribution<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min(), std::numeric_limits<cell_idx_t>::max() - cell_idx_c( maxSize ) ); + std::uniform_int_distribution<uint_t> dist2( uint_t(0), maxSize ); cell_idx_t xMin = dist(rng); cell_idx_t yMin = dist(rng); @@ -50,10 +51,10 @@ CellInterval makeRandomInterval(uint_t maxSize) CellInterval makeRandomEmptyInterval(uint_t maxSize) { - static boost::mt11213b rng; - boost::uniform_int<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min() + cell_idx_c( maxSize ), std::numeric_limits<cell_idx_t>::max() - cell_idx_c( maxSize ) ); - boost::uniform_int<uint_t> dist2( uint_t(1), maxSize ); - boost::uniform_int<uint_t> dist3( uint_t(0), uint_t(1) ); + static mt11213b rng; + std::uniform_int_distribution<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min() + cell_idx_c( maxSize ), std::numeric_limits<cell_idx_t>::max() - cell_idx_c( maxSize ) ); + std::uniform_int_distribution<uint_t> dist2( uint_t(1), maxSize ); + std::uniform_int_distribution<uint_t> dist3( uint_t(0), uint_t(1) ); cell_idx_t xMin = dist(rng); cell_idx_t yMin = dist(rng); @@ -81,8 +82,8 @@ CellInterval makeRandomEmptyInterval(uint_t maxSize) Cell makeRandomCell() { - static boost::mt11213b rng; - boost::uniform_int<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min(), std::numeric_limits<cell_idx_t>::max() ); + static mt11213b rng; + std::uniform_int_distribution<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min(), std::numeric_limits<cell_idx_t>::max() ); return Cell( dist(rng), dist(rng), dist(rng) ); } diff --git a/tests/core/cell/CellTest.cpp b/tests/core/cell/CellTest.cpp index 1cdc574744a3dd8da3924483bd50fa925b69b8de..55c6097baf07567577a250c018714b3fd977baff 100644 --- a/tests/core/cell/CellTest.cpp +++ b/tests/core/cell/CellTest.cpp @@ -23,8 +23,7 @@ #include "core/cell/Cell.h" #include "core/debug/TestSubsystem.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> +#include <random> using namespace walberla; @@ -135,8 +134,9 @@ int main( int /*argc*/, char** /*argv*/ ) { debug::enterTestMode(); - boost::mt11213b rng; - boost::uniform_int<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min(), std::numeric_limits<cell_idx_t>::max() ); + typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + mt11213b rng; + std::uniform_int_distribution<cell_idx_t> dist( std::numeric_limits<cell_idx_t>::min(), std::numeric_limits<cell_idx_t>::max() ); for(int i = 0; i < 100000; ++i) { diff --git a/tests/core/load_balancing/MetisTest.cpp b/tests/core/load_balancing/MetisTest.cpp index a69cffb9957c29a37a128add41b0e983646e2e74..a460077c21653d9e628c12f868e330012a7d861f 100644 --- a/tests/core/load_balancing/MetisTest.cpp +++ b/tests/core/load_balancing/MetisTest.cpp @@ -40,7 +40,6 @@ #include "vtk/BlockCellDataWriter.h" #include <boost/lexical_cast.hpp> -#include <boost/random.hpp> int main( int argc, char * argv[] ) { diff --git a/tests/core/load_balancing/ParMetisTest.cpp b/tests/core/load_balancing/ParMetisTest.cpp index ce43ce97b828f197c65e0dacb986d07105616fee..320315e8d86e4f9dbd8bda4c5bd0e6ea8d44aeac 100644 --- a/tests/core/load_balancing/ParMetisTest.cpp +++ b/tests/core/load_balancing/ParMetisTest.cpp @@ -42,7 +42,6 @@ #include "vtk/BlockCellDataWriter.h" #include <boost/lexical_cast.hpp> -#include <boost/random.hpp> int main( int argc, char * argv[] ) { diff --git a/tests/core/math/GenericAABBTest.cpp b/tests/core/math/GenericAABBTest.cpp index 6a5d4ce9ac814ddcf60a238a6d56e7c0494e2259..9194c0ba802093334f89a50532ec45a36b27879b 100644 --- a/tests/core/math/GenericAABBTest.cpp +++ b/tests/core/math/GenericAABBTest.cpp @@ -27,8 +27,7 @@ #include "stencil/D3CornerStencil.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_real.hpp> +#include <random> using namespace walberla; @@ -112,7 +111,7 @@ void testNonEmptyAABB( const GenericAABB< T > & aabb ) WALBERLA_CHECK_FLOAT_EQUAL( tmpAABB.volume(), T(0) ); WALBERLA_CHECK_IDENTICAL( tmpAABB.volume(), aabb.intersectionVolume( intersectingBox ) ); - boost::random::mt19937 urng; + std::mt19937 urng; for( int i = 0; i < 100; ++i ) { auto p = aabb.randomPoint( urng ); @@ -530,9 +529,10 @@ void testConstructors( const T x0, const T y0, const T z0, const T x1, const T y template< typename T > void randomTest() { - boost::mt11213b rng; + typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + mt11213b rng; - boost::uniform_real<T> dist( -T(10), T(10) ); + std::uniform_real_distribution<T> dist( -T(10), T(10) ); for( int i = 0; i < 1000; ++i ) { @@ -600,7 +600,7 @@ void testAABBDistancesRandom( const GenericAABB< T > & baseAABB ) { static const uint_t NUM_BOXES = 100; static const uint_t NUM_POINTS = 1000; - boost::random::mt19937 rng; + std::mt19937 rng; for( uint_t i = 0; i < NUM_BOXES; ++i ) { diff --git a/tests/core/math/PlaneTest.cpp b/tests/core/math/PlaneTest.cpp index b74f2c30fea85eae761c062afad06f544634f1d5..73e7d56c73808062b320609666219077e374398c 100644 --- a/tests/core/math/PlaneTest.cpp +++ b/tests/core/math/PlaneTest.cpp @@ -25,9 +25,7 @@ #include "core/math/Vector3.h" #include "core/mpi/Environment.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/normal_distribution.hpp> -#include <boost/random/variate_generator.hpp> +#include <random> #include <cmath> #include <vector> @@ -39,9 +37,9 @@ template < typename scalar_t > struct RandomPointGenerator { typedef walberla::Vector3<scalar_t> vector_t; - typedef boost::mt11213b RandomNumberEngine; - typedef boost::normal_distribution<scalar_t> NormalDistribution; - typedef boost::variate_generator< RandomNumberEngine, NormalDistribution > Generator; + typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + typedef mt11213b RandomNumberEngine; + typedef std::normal_distribution<scalar_t> NormalDistribution; RandomPointGenerator( const vector_t & mu, const vector_t & sigma ) { @@ -49,17 +47,19 @@ struct RandomPointGenerator { RandomNumberEngine rne; rne.seed( numeric_cast< RandomNumberEngine::result_type >( i * 642573 ) ); - normalDistributions.push_back( Generator( rne, NormalDistribution( mu[i], sigma[i] ) ) ); + engines.push_back( rne ); + normalDistributions.push_back( NormalDistribution( mu[i], sigma[i] ) ); } } vector_t operator()() { - return vector_t( normalDistributions[0](), normalDistributions[1](), normalDistributions[2]() ); + return vector_t( normalDistributions[0](engines[0]), normalDistributions[1](engines[1]), normalDistributions[2](engines[2]) ); } private: - std::vector< Generator > normalDistributions; + std::vector< RandomNumberEngine > engines; + std::vector< NormalDistribution > normalDistributions; }; void testIOStream( const Plane & p ) @@ -135,20 +135,22 @@ int main(int argc, char * argv[]) Vec3Real p1 = rpg(); Vec3Real p2 = rpg(); - if( (p0 - p1).sqrLength() < 1e-6 || (p0 - p2).sqrLength() < 1e-6 || (p2 - p1).sqrLength() < 1e-6 ) + real_t angle = std::acos( (p1-p0) * (p2-p0) / std::sqrt( (p1-p0).sqrLength() * (p2-p0).sqrLength() ) ); + + if( (p0 - p1).sqrLength() < 1e-6 || (p0 - p2).sqrLength() < 1e-6 || (p2 - p1).sqrLength() < 1e-6 || angle < math::PI / real_t(180) ) { --i; continue; } - Plane plane( p0, (p0 - p1) % (p0 - p2) ); + Plane plane( p0, (p0 - p1).getNormalized() % (p0 - p2).getNormalized() ); - WALBERLA_CHECK ( realIsEqual( plane.signedDistance( p0 ), real_t(0) ) ); - WALBERLA_CHECK ( realIsEqual( plane.distance ( p0 ), real_t(0) ) ); - WALBERLA_CHECK ( realIsEqual( plane.signedDistance( p1 ), real_t(0) ) ); - WALBERLA_CHECK ( realIsEqual( plane.distance ( p1 ), real_t(0) ) ); - WALBERLA_CHECK ( realIsEqual( plane.signedDistance( p2 ), real_t(0) ) ); - WALBERLA_CHECK ( realIsEqual( plane.distance ( p2 ), real_t(0) ) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p0 ), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p0 ), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p1 ), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p1 ), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.signedDistance( p2 ), real_t(0) ); + WALBERLA_CHECK_FLOAT_EQUAL( plane.distance ( p2 ), real_t(0) ); WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p0 ), real_t(0) ); WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p1 ), real_t(0) ); WALBERLA_CHECK_GREATER_EQUAL( plane.distance( p2 ), real_t(0) ); diff --git a/tests/core/math/PrimesTest.cpp b/tests/core/math/PrimesTest.cpp index 9e8a776a05e536d62cf04797fc5d5d4753bb08a7..141a9704ba2670a11bba4e8d3e342232b2d49c0f 100644 --- a/tests/core/math/PrimesTest.cpp +++ b/tests/core/math/PrimesTest.cpp @@ -27,8 +27,7 @@ #include "core/math/Primes.h" #include "core/mpi/MPIManager.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> +#include <random> #include <algorithm> #include <numeric> @@ -85,8 +84,9 @@ int main(int argc, char * argv[]) runTests( n ); } - boost::mt11213b rng; - boost::uniform_int<uint_t> dist( 100, 10000 ); + typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + mt11213b rng; + std::uniform_int_distribution<uint_t> dist( 100, 10000 ); for(int i = 0; i < 100; ++i) { const uint_t n = dist(rng); diff --git a/tests/core/mpi/BufferSystemTest.cpp b/tests/core/mpi/BufferSystemTest.cpp index 9aa4d0f83d9afd22c4296d04909898666fc67e0c..a6104a87ed537e76b3ce273f3aaf443d838b97e5 100644 --- a/tests/core/mpi/BufferSystemTest.cpp +++ b/tests/core/mpi/BufferSystemTest.cpp @@ -26,22 +26,22 @@ #include "core/mpi/BufferSystem.h" #include "core/mpi/Environment.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> -#include <boost/random/variate_generator.hpp> -#include <boost/thread/thread.hpp> +#include <random> #include <cmath> #include <iostream> #include <set> +#include <thread> +#include <chrono> using namespace walberla; using mpi::BufferSystem; +using namespace std::literals::chrono_literals; -typedef boost::mt19937 base_generator_type; +typedef std::mt19937 base_generator_type; /** * Utility function for sleeping a random time @@ -58,11 +58,10 @@ void randomSleep( int maxTimeInMs = 20 ) unsigned int seed = static_cast<unsigned int>(std::time(0)) + static_cast<unsigned int>(rank*1000) + counter; generator.seed(seed); - boost::uniform_int<> uni_dist(0,maxTimeInMs); - boost::variate_generator<base_generator_type&, boost::uniform_int<> > uni(generator, uni_dist); + std::uniform_int_distribution<> uni_dist(0,maxTimeInMs); - int sleepTime = uni(); - boost::this_thread::sleep( boost::posix_time::milliseconds( sleepTime ) ); + int sleepTime = uni_dist(generator); + std::this_thread::sleep_for( sleepTime * 1ms ); } diff --git a/tests/core/mpi/BufferTest.cpp b/tests/core/mpi/BufferTest.cpp index 4d1819dcda3c99f99697ae45a6173cf50c918730..34f961f1a5505211c2e538e5dcf82edf758424ef 100644 --- a/tests/core/mpi/BufferTest.cpp +++ b/tests/core/mpi/BufferTest.cpp @@ -36,8 +36,7 @@ #include "core/mpi/RecvBuffer.h" #include "core/mpi/SendBuffer.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> // #include <boost/random/uniform_int_distribution.hpp> +#include <random> #include <cstring> #include <iostream> @@ -48,9 +47,9 @@ using namespace mpi; template<typename T> void initIntegerContainer( T & container ) { - static boost::mt19937 rng; - boost::uniform_int<typename T::value_type> dist; - boost::uniform_int<size_t> size_dist(10,1000); + static std::mt19937 rng; + std::uniform_int_distribution<typename T::value_type> dist; + std::uniform_int_distribution<size_t> size_dist(10,1000); size_t size = size_dist(rng); container.clear(); @@ -61,9 +60,9 @@ void initIntegerContainer( T & container ) template<typename T> void initIntegerAssocContainer( T & container ) { - static boost::mt19937 rng; - boost::uniform_int<typename T::value_type> dist; - boost::uniform_int<size_t> size_dist(10,1000); + static std::mt19937 rng; + std::uniform_int_distribution<typename T::value_type> dist; + std::uniform_int_distribution<size_t> size_dist(10,1000); size_t size = size_dist(rng); container.clear(); @@ -74,9 +73,9 @@ void initIntegerAssocContainer( T & container ) void initVecBool( std::vector<bool> & vecBool ) { - static boost::mt19937 rng; - boost::uniform_int<walberla::uint32_t> dist; - boost::uniform_int<size_t> size_dist(10,1000); + static std::mt19937 rng; + std::uniform_int_distribution<walberla::uint32_t> dist; + std::uniform_int_distribution<size_t> size_dist(10,1000); size_t size = size_dist(rng); vecBool.clear(); @@ -88,10 +87,10 @@ void initVecBool( std::vector<bool> & vecBool ) template<typename T> void initIntegerMap( T & container ) { - static boost::mt19937 rng; - boost::uniform_int<typename T::mapped_type> mapped_dist; - boost::uniform_int<typename T::key_type> key_dist; - boost::uniform_int<size_t> size_dist(10,1000); + static std::mt19937 rng; + std::uniform_int_distribution<typename T::mapped_type> mapped_dist; + std::uniform_int_distribution<typename T::key_type> key_dist; + std::uniform_int_distribution<size_t> size_dist(10,1000); size_t size = size_dist(rng); container.clear(); @@ -103,9 +102,9 @@ void initIntegerMap( T & container ) template<typename T> void initCellContainer( T & container ) { - static boost::mt19937 rng; - boost::uniform_int<cell_idx_t> dist; - boost::uniform_int<size_t> size_dist(10,1000); + static std::mt19937 rng; + std::uniform_int_distribution<cell_idx_t> dist; + std::uniform_int_distribution<size_t> size_dist(10,1000); size_t size = size_dist(rng); container.clear(); @@ -116,8 +115,8 @@ void initCellContainer( T & container ) template<typename T, std::size_t N> void initBoostArray( boost::array< T, N > & array ) { - static boost::mt19937 rng; - boost::uniform_int<T> dist; + static std::mt19937 rng; + std::uniform_int_distribution<T> dist; for( auto it = array.begin(); it != array.end(); ++it ) *it = dist( rng ); diff --git a/tests/core/timing/TimingTreeTest.cpp b/tests/core/timing/TimingTreeTest.cpp index 9d5c539d522657cb51f48bebb3a1737cc44eea8b..862620f326fc8b0eeadcfb55c3b64c6221fd13be 100644 --- a/tests/core/timing/TimingTreeTest.cpp +++ b/tests/core/timing/TimingTreeTest.cpp @@ -25,9 +25,6 @@ #include "core/timing/StaticPolicy.h" #include "core/timing/TimingTree.h" -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/thread/thread.hpp> - #include <iostream> using namespace walberla; @@ -41,8 +38,6 @@ int main( int argc, char ** argv ) { debug::enterTestMode(); -#ifdef WALBERLA_BUILD_WITH_BOOST_THREAD - mpi::Environment mpiEnv(argc, argv); WALBERLA_UNUSED( mpiEnv ); @@ -123,7 +118,6 @@ int main( int argc, char ** argv ) // std::cout << tt2; // std::cout << tt3; } -#endif return 0; } diff --git a/tests/cuda/communication/GPUPackInfoCommunicationTest.cpp b/tests/cuda/communication/GPUPackInfoCommunicationTest.cpp index f3f19d085012b02e8947d2d5100a7c2e3ad1dfb6..8d0d66c8ea643d86778064fc7f0ae6001e1e31d5 100644 --- a/tests/cuda/communication/GPUPackInfoCommunicationTest.cpp +++ b/tests/cuda/communication/GPUPackInfoCommunicationTest.cpp @@ -131,7 +131,7 @@ int main( int argc, char ** argv ) BlockDataID asyncGPUFieldId = blocks->addStructuredBlockData< GPUFieldType >( &createGPUField, "asyncGPUField" ); - math::seedRandomGenerator( numeric_cast<boost::mt19937::result_type>( MPIManager::instance()->rank() ) ); + math::seedRandomGenerator( numeric_cast<std::mt19937::result_type>( MPIManager::instance()->rank() ) ); // Initialize CPU field with random values initFields( blocks, sourceFieldId ); @@ -149,11 +149,11 @@ int main( int argc, char ** argv ) // Setup communication schemes for synchronous GPUPackInfo CommSchemeType syncCommScheme(blocks); - syncCommScheme.addPackInfo( boost::make_shared< GPUPackInfoType >( syncGPUFieldId ) ); + syncCommScheme.addPackInfo( make_shared< GPUPackInfoType >( syncGPUFieldId ) ); // Setup communication scheme for asynchronous GPUPackInfo, which uses CUDA streams CommSchemeType asyncCommScheme(blocks); - asyncCommScheme.addPackInfo( boost::make_shared< GPUPackInfoType >( asyncGPUFieldId, streams ) ); + asyncCommScheme.addPackInfo( make_shared< GPUPackInfoType >( asyncGPUFieldId, streams ) ); // Perform one communication step for each scheme syncCommScheme(); diff --git a/tests/field/AccuracyEvaluationTest.cpp b/tests/field/AccuracyEvaluationTest.cpp index 8fedfe317944aa0b710ac8ab6bd0e6526a5119b5..c7656509fbdf86324d345f76bc027c6f90d2050f 100644 --- a/tests/field/AccuracyEvaluationTest.cpp +++ b/tests/field/AccuracyEvaluationTest.cpp @@ -67,8 +67,8 @@ int main( int argc, char* argv[] ) real_t(1), // dx uint_t( 2), uint_t( 1), uint_t( 2) ); // number of processes - //math::seedRandomGenerator( numeric_cast<boost::mt19937::result_type>( std::time(0) ) ); - math::seedRandomGenerator( numeric_cast<boost::mt19937::result_type>( MPIManager::instance()->rank() ) ); + //math::seedRandomGenerator( numeric_cast<std::mt19937::result_type>( std::time(0) ) ); + math::seedRandomGenerator( numeric_cast<std::mt19937::result_type>( MPIManager::instance()->rank() ) ); auto sId = field::addToStorage< ScalarField_T >( blocks, "scalar field" ); auto vId = field::addToStorage< VectorField_T >( blocks, "vector field" ); diff --git a/tests/field/FieldFileIOTest.cpp b/tests/field/FieldFileIOTest.cpp index 2e33e0dceb77076eafafe99a6353527fc63c01cd..6e7a95a2dec44fb408c17e1039df77867e8fdb0b 100644 --- a/tests/field/FieldFileIOTest.cpp +++ b/tests/field/FieldFileIOTest.cpp @@ -114,7 +114,7 @@ int main( int argc, char* argv[] ) auto originalFieldId = field::addToStorage< FieldType >( sbf, "OriginalField" ); auto readFieldId = field::addToStorage< FieldType >( sbf, "ReadField" ); - math::seedRandomGenerator( numeric_cast<boost::mt19937::result_type>( MPIManager::instance()->rank() ) ); + math::seedRandomGenerator( numeric_cast<std::mt19937::result_type>( MPIManager::instance()->rank() ) ); for( auto it = sbf->begin(); it != sbf->end(); ++it ) { diff --git a/tests/field/FieldMPIDatatypesTest.cpp b/tests/field/FieldMPIDatatypesTest.cpp index f5411aeb535c30152ccbeb346d6c3e371b1f82e6..3328c1bd72c222d404c589041a9866fd2a8e33f3 100644 --- a/tests/field/FieldMPIDatatypesTest.cpp +++ b/tests/field/FieldMPIDatatypesTest.cpp @@ -33,9 +33,7 @@ #include "stencil/D3Q27.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int_distribution.hpp> -#include <boost/random/uniform_real_distribution.hpp> +#include <random> namespace mpi_datatypes_test { @@ -51,7 +49,7 @@ public: template< typename T, uint_t fSize > void operator()( Field< T, fSize > & field ) { - boost::random::uniform_real_distribution< T > distribution; + std::uniform_real_distribution< T > distribution; for( auto it = field.begin(); it != field.end(); ++it ) { @@ -62,7 +60,7 @@ public: template< typename T, uint_t fSize > void operator()( GhostLayerField< T, fSize > & field ) { - boost::random::uniform_real_distribution< T > distribution; + std::uniform_real_distribution< T > distribution; for( auto it = field.beginWithGhostLayer(); it != field.end(); ++it ) { @@ -71,7 +69,7 @@ public: } private: - boost::random::mt19937 generator_; + std::mt19937 generator_; }; diff --git a/tests/field/FieldTiming.cpp b/tests/field/FieldTiming.cpp index 86fdb06f5e664abb5f4789c638639ccdd985bf4e..5e8fd340756e899de7c9c0c6ca2e725682c60bb8 100644 --- a/tests/field/FieldTiming.cpp +++ b/tests/field/FieldTiming.cpp @@ -196,7 +196,7 @@ double initFieldRandom(DoubleField & field) return sum; } -typedef boost::function<double (const DoubleField & field)> Func; +typedef std::function<double (const DoubleField & field)> Func; void timeFunction( WcTimer & timer, Func f, const DoubleField & field, double sum, double epsilon, int nrExecutions=30 ) { for(int i=0 ; i < nrExecutions; ++i) diff --git a/tests/geometry/RandomPointGenerator.h b/tests/geometry/RandomPointGenerator.h index 8275946f4f2b355f07200963ee5a98b878130e80..097f610c487a1bac04a0141057ac9fedb379d8e8 100644 --- a/tests/geometry/RandomPointGenerator.h +++ b/tests/geometry/RandomPointGenerator.h @@ -23,9 +23,7 @@ #include "core/math/Vector3.h" -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/normal_distribution.hpp> -#include <boost/random/variate_generator.hpp> +#include <random> #include <vector> @@ -33,21 +31,25 @@ template < typename scalar_t > struct RandomPointGenerator { typedef walberla::Vector3<scalar_t> vector_t; - typedef boost::mt11213b RandomNumberEngine; - typedef boost::normal_distribution<scalar_t> NormalDistribution; - typedef boost::variate_generator< RandomNumberEngine, NormalDistribution > Generator; + typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + typedef mt11213b RandomNumberEngine; + typedef std::normal_distribution<scalar_t> NormalDistribution; RandomPointGenerator( const vector_t & mu, const vector_t & sigma ) { for( walberla::uint_t i = 0; i < 3; ++i ) - normalDistributions.push_back( Generator( RandomNumberEngine(), NormalDistribution( mu[i], sigma[i] ) ) ); + { + engines.push_back( RandomNumberEngine() ); + normalDistributions.push_back( NormalDistribution( mu[i], sigma[i] ) ); + } } vector_t operator()() { - return vector_t( normalDistributions[0](), normalDistributions[1](), normalDistributions[2]() ); + return vector_t( normalDistributions[0](engines[0]), normalDistributions[1](engines[1]), normalDistributions[2](engines[2]) ); } private: - std::vector< Generator > normalDistributions; + std::vector< RandomNumberEngine > engines; + std::vector< NormalDistribution > normalDistributions; }; diff --git a/tests/geometry/VoxelFileTest.cpp b/tests/geometry/VoxelFileTest.cpp index 3918b08dec89c888e5dc760e3c5f5c51245f4221..8de8c21567b9e00c046a58cc60b5469ba40da4f0 100644 --- a/tests/geometry/VoxelFileTest.cpp +++ b/tests/geometry/VoxelFileTest.cpp @@ -54,8 +54,7 @@ #include <boost/filesystem.hpp> #include <boost/foreach.hpp> -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int.hpp> +#include <random> #ifdef _MSC_VER # pragma warning(push) @@ -69,15 +68,17 @@ # pragma warning(pop) #endif //_MSC_VER +typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; + /// randomize the memory underlying the vector up the maximal size (== capacity) template<typename T> void randomizeVector( std::vector<T> & v ) { - //boost::random::mt11213b rng; - boost::mt11213b rng; - //boost::random::uniform_int_distribution<T> dist( std::numeric_limits<T>::min(), std::numeric_limits<T>::max() ); - boost::uniform_int<T> dist( std::numeric_limits<T>::min(), std::numeric_limits<T>::max() ); + static_assert(sizeof(T) > sizeof(char), "cannot use char"); + + mt11213b rng; + std::uniform_int_distribution<T> dist( std::numeric_limits<T>::min(), std::numeric_limits<T>::max() ); size_t oldSize = v.size(); v.resize( v.capacity() ); @@ -86,18 +87,64 @@ void randomizeVector( std::vector<T> & v ) v.resize(oldSize); } +template<> +void randomizeVector( std::vector<unsigned char> & v ) +{ + mt11213b rng; + std::uniform_int_distribution<walberla::int16_t> dist( std::numeric_limits<unsigned char>::min(), std::numeric_limits<unsigned char>::max() ); + + size_t oldSize = v.size(); + v.resize( v.capacity() ); + for(typename std::vector<unsigned char>::iterator it = v.begin(); it != v.end(); ++it) + *it = static_cast<unsigned char>( dist(rng) ); + v.resize(oldSize); +} + +template<> +void randomizeVector( std::vector<char> & v ) +{ + mt11213b rng; + std::uniform_int_distribution<int16_t> dist( std::numeric_limits<char>::min(), std::numeric_limits<char>::max() ); + + size_t oldSize = v.size(); + v.resize( v.capacity() ); + for(typename std::vector<char>::iterator it = v.begin(); it != v.end(); ++it) + *it = static_cast<char>( dist(rng) ); + v.resize(oldSize); +} + template<typename T> void makeRandomMultiArray( boost::multi_array<T, 3> & ma) { - //boost::random::mt11213b rng; - boost::mt11213b rng; - //boost::random::uniform_int_distribution<T> dist( std::numeric_limits<T>::min(), std::numeric_limits<T>::max() ); - boost::uniform_int<T> dist( std::numeric_limits<T>::min(), std::numeric_limits<T>::max() ); + static_assert(sizeof(T) > sizeof(char), "cannot use char"); + + mt11213b rng; + std::uniform_int_distribution<T> dist( std::numeric_limits<T>::min(), std::numeric_limits<T>::max() ); for(T* it = ma.data(); it != ma.data() + ma.num_elements(); ++it) *it = dist(rng); } +template<> +void makeRandomMultiArray( boost::multi_array<unsigned char, 3> & ma) +{ + mt11213b rng; + std::uniform_int_distribution<walberla::int16_t> dist( std::numeric_limits<unsigned char>::min(), std::numeric_limits<unsigned char>::max() ); + + for(unsigned char* it = ma.data(); it != ma.data() + ma.num_elements(); ++it) + *it = static_cast<unsigned char>( dist(rng) ); +} + +template<> +void makeRandomMultiArray( boost::multi_array<char, 3> & ma) +{ + mt11213b rng; + std::uniform_int_distribution<int16_t> dist( std::numeric_limits<char>::min(), std::numeric_limits<char>::max() ); + + for(char* it = ma.data(); it != ma.data() + ma.num_elements(); ++it) + *it = static_cast<char>( dist(rng) ); +} + template<typename T> void runTests(const std::string & filename, size_t xSize, size_t ySize, size_t zSize); diff --git a/tests/lbm/Poiseuille.cpp b/tests/lbm/Poiseuille.cpp index c1bd59992ee499f2283141d7a3bd27d3a4f3a99a..5e56138fe75b24a278d201d9af3a15226e76582b 100644 --- a/tests/lbm/Poiseuille.cpp +++ b/tests/lbm/Poiseuille.cpp @@ -118,7 +118,7 @@ public: lastMeanError_( 0 ), lastMaxError_( 0 ) { if ( filename.size() > 0 ) - graphWriter_ = boost::make_shared<gather::GnuPlotGraphWriter>( filename ); + graphWriter_ = make_shared<gather::GnuPlotGraphWriter>( filename ); } virtual ~PoiseuilleVelocityDataProcessor() {} diff --git a/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp b/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp index 4515cc13c0dec9b3147fff7d60cfa1629bb76dc6..d28603a3feb1553d8d321d7b2ab216bc3ef14960 100644 --- a/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp +++ b/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp @@ -75,6 +75,7 @@ #include <boost/lexical_cast.hpp> #include <stdexcept> +#include <array> #include "gather/GnuPlotGraphWriter.h" #include "field/vtk/FlagFieldCellFilter.h" @@ -240,6 +241,7 @@ public: piInv_(real_t(1)/math::PI), valid_(uint_c(std::ceil(omega*omega*omega*real_t(10)))), time_( time ), + expArray(), timestep_( uint_t(0u) ), E_max_(maxValue-minValue), E_mean_(maxValue-minValue) @@ -265,7 +267,7 @@ private: const uint_t valid_; const uint_t time_; - real_t expArray[1000]; + std::array<real_t,1000> expArray; uint_t timestep_; real_t E_max_; diff --git a/tests/lbm/geometry/IntersectionRatioTest.cpp b/tests/lbm/geometry/IntersectionRatioTest.cpp index d0296018434b61f6d15df32f88df83d729927bc3..ae7a4a159f2f60f62220b0b691cd9db0826add58 100644 --- a/tests/lbm/geometry/IntersectionRatioTest.cpp +++ b/tests/lbm/geometry/IntersectionRatioTest.cpp @@ -26,7 +26,7 @@ #include "geometry/bodies/Sphere.h" #include "geometry/bodies/AABBBody.h" -#include <boost/random/mersenne_twister.hpp> +#include <random> namespace walberla { @@ -77,7 +77,7 @@ void testAABB() static const math::Vector3<real_t> UNIT( real_t( 1 ), real_t( 1 ), real_t( 1 ) ); static const real_t EPSILON = real_t(1e-4); - boost::random::mt19937 randomEngine; + std::mt19937 randomEngine; std::vector<math::AABB> testAABBs; testAABBs.push_back( math::AABB( -UNIT, UNIT ) ); diff --git a/tests/mesh/MeshAABBIntersectionTest.cpp b/tests/mesh/MeshAABBIntersectionTest.cpp index f950e7609647dbec0a6dc690c5230f58b2a6cdea..fc4711134edbc3068b2011262fa0128330cc4ed6 100644 --- a/tests/mesh/MeshAABBIntersectionTest.cpp +++ b/tests/mesh/MeshAABBIntersectionTest.cpp @@ -29,7 +29,7 @@ #include "mesh/DistanceComputations.h" #include "mesh/TriangleMeshes.h" -#include <boost/random.hpp> +#include <random> #include <boost/lexical_cast.hpp> #include <vector> @@ -53,7 +53,7 @@ void runTests( const uint_t numAABBs ) WALBERLA_CHECK( isIntersecting( triDist, meshAABB, real_t(0) ) ); - boost::random::mt19937 rng( uint32_t(42) ); + std::mt19937 rng( uint32_t(42) ); for(uint_t i = 0; i < numAABBs; ++i) { diff --git a/tests/mesh/MeshAABBSelectionTest.cpp b/tests/mesh/MeshAABBSelectionTest.cpp index 7a95cb4ea38b676e6b0aaf381d6ff7c7b16cbb55..37d421bfe5656e1ec59efe9b8d6e36463f3aa32b 100644 --- a/tests/mesh/MeshAABBSelectionTest.cpp +++ b/tests/mesh/MeshAABBSelectionTest.cpp @@ -31,7 +31,7 @@ #include "mesh/MeshIO.h" #include "mesh/MeshOperations.h" -#include <boost/random.hpp> +#include <random> #include <boost/lexical_cast.hpp> #include <algorithm> @@ -61,7 +61,7 @@ int main( int argc, char * argv[] ) auto aabb = computeAABB( *mesh ); - boost::random::mt19937 rng; + std::mt19937 rng; for( uint_t i = 0; i < numBoxes; ++i ) { diff --git a/tests/mesh/MeshContainmentOctreeTest.cpp b/tests/mesh/MeshContainmentOctreeTest.cpp index 8858790eb3a7e2bacda2ba1372bb87149dc64e74..4e922e17a8e5f6a4a54f49437fccc32037052b91 100644 --- a/tests/mesh/MeshContainmentOctreeTest.cpp +++ b/tests/mesh/MeshContainmentOctreeTest.cpp @@ -35,7 +35,7 @@ #include "mesh/vtk/VTKMeshWriter.h" #include "mesh/vtk/CommonDataSources.h" -#include <boost/random.hpp> +#include <random> #include <vector> #include <string> @@ -104,7 +104,7 @@ int main( int argc, char * argv[] ) if( writeVtk ) containmentOctree.writeVTKOutput( "containment_octree" ); - boost::random::mt19937 rng; + std::mt19937 rng; for( int i = 0; i < 10000; ++i ) { diff --git a/tests/mesh/MeshDistanceCompareTest.cpp b/tests/mesh/MeshDistanceCompareTest.cpp index ee89527ec5fd70ad6804516af4a4f955f765b850..4067a28e853b3e24ca8f6b84bff7883e013e635e 100644 --- a/tests/mesh/MeshDistanceCompareTest.cpp +++ b/tests/mesh/MeshDistanceCompareTest.cpp @@ -32,7 +32,7 @@ #include "mesh/DistanceComputations.h" #include "mesh/MeshIO.h" -#include <boost/random.hpp> +#include <random> #include <vector> #include <string> @@ -54,7 +54,7 @@ void testAABBDistance( const Vector3<real_t> & translationVector = Vector3<real_ TriangleDistance<MeshType> triDist( mesh ); - boost::random::mt19937 rng; + std::mt19937 rng; for( int i = 0; i < 10000; ++i ) { diff --git a/tests/mesh/MeshDistanceOctreeTest.cpp b/tests/mesh/MeshDistanceOctreeTest.cpp index 24601416f276671a9b405e605034e2ac146bff36..3d849c3f6b71909f9f30dd60a748ba03d26e4c25 100644 --- a/tests/mesh/MeshDistanceOctreeTest.cpp +++ b/tests/mesh/MeshDistanceOctreeTest.cpp @@ -32,7 +32,7 @@ #include "mesh/distance_octree/DistanceOctree.h" #include "mesh/MeshIO.h" -#include <boost/random.hpp> +#include <random> #include <vector> #include <string> @@ -55,7 +55,7 @@ void test( const std::string & meshFile ) //distanceOctree.writeVTKOutput( "distance_octree" ); - boost::random::mt19937 rng; + std::mt19937 rng; for( int i = 0; i < 1000; ++i ) { diff --git a/tests/mesh/MeshDistancePlausibilityTest.cpp b/tests/mesh/MeshDistancePlausibilityTest.cpp index 69b76016696ab8af49ea07c3160feedee153d7d7..5ca33efc11439636d2df20583682947407f18580 100644 --- a/tests/mesh/MeshDistancePlausibilityTest.cpp +++ b/tests/mesh/MeshDistancePlausibilityTest.cpp @@ -45,7 +45,6 @@ #include "stencil/D3Q27.h" #include <boost/lexical_cast.hpp> -#include <boost/random.hpp> #include <vector> #include <string> @@ -207,8 +206,8 @@ int main( int argc, char * argv[] ) auto vtkOutput = vtk::createVTKOutput_BlockData( blocks, "plausibility test" ); - vtkOutput->addCellDataWriter( boost::make_shared< field::VTKWriter< DistanceField, float > >( distanceFieldId , "distance field" ) ); - vtkOutput->addCellDataWriter( boost::make_shared< field::VTKWriter< ErrorMarkerField > >( errorMarkerFieldId, "error marker" ) ); + vtkOutput->addCellDataWriter( make_shared< field::VTKWriter< DistanceField, float > >( distanceFieldId , "distance field" ) ); + vtkOutput->addCellDataWriter( make_shared< field::VTKWriter< ErrorMarkerField > >( errorMarkerFieldId, "error marker" ) ); writeFiles( vtkOutput, true )(); } diff --git a/tests/mesh/MeshVTKTest.cpp b/tests/mesh/MeshVTKTest.cpp index 211bffd112c110e3f96ff3f72d2e04c868ff0f8e..ac6ecd3074bed19b2f724fe53c778b84be18584f 100644 --- a/tests/mesh/MeshVTKTest.cpp +++ b/tests/mesh/MeshVTKTest.cpp @@ -30,8 +30,6 @@ #include "mesh/vtk/CommonDataSources.h" #include "mesh/vtk/CommonFilters.h" -#include <boost/random.hpp> - #include <vector> #include <string> diff --git a/tests/mesh/PeVTKMeshWriterTest.cpp b/tests/mesh/PeVTKMeshWriterTest.cpp index 4c0f683dc4aded284648b6f1a13ae00be345434f..a765f30c4290e09240027168fd90591314c48eb4 100644 --- a/tests/mesh/PeVTKMeshWriterTest.cpp +++ b/tests/mesh/PeVTKMeshWriterTest.cpp @@ -38,10 +38,11 @@ #include <core/logging/Logging.h> #include <core/timing/TimingTree.h> #include <core/waLBerlaBuildInfo.h> +#include <core/math/Utility.h> #include <postprocessing/sqlite/SQLite.h> #include <vtk/VTKOutput.h> -#include <boost/random.hpp> +#include <random> using namespace walberla; using namespace walberla::pe; @@ -86,15 +87,16 @@ std::vector<Vector3<real_t>> generatePointCloudDodecahedron() template< typename RNG > std::vector<Vector3<real_t>> generatPointCloudOnSphere( const real_t radius, const uint_t numPoints, RNG & rng ) { - boost::uniform_on_sphere<real_t> distribution(3); + std::uniform_real_distribution<real_t> distribution; std::vector<Vector3<real_t>> pointCloud( numPoints ); for( auto & p : pointCloud ) { - auto v = distribution(rng); - p[0] = v[0] * radius; - p[1] = v[1] * radius; - p[2] = v[2] * radius; + real_t theta = 2 * math::PI * distribution(rng); + real_t phi = std::acos( real_t(1.0) - real_t(2.0) * distribution(rng) ); + p[0] = std::sin(phi) * std::cos(theta) * radius; + p[1] = std::sin(phi) * std::sin(theta) * radius; + p[2] = std::cos(phi) * radius; } return pointCloud; @@ -140,7 +142,7 @@ int main( int argc, char ** argv ) cr.setRelaxationParameter( real_t(0.7) ); cr.setGlobalLinearAcceleration( Vec3(0,0,5) ); - boost::function<void(void)> syncCall = boost::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + std::function<void(void)> syncCall = boost::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); typedef mesh::FloatPolyMesh OutputMeshType; typedef mesh::pe::DefaultTesselation<OutputMeshType> TesselationType; @@ -177,7 +179,7 @@ int main( int argc, char ** argv ) //for( auto & p: pointCloud) // p = p.getNormalized() * radius; - boost::random::mt19937 rng(42); + std::mt19937 rng(42); for (auto blkIt = forest->begin(); blkIt != forest->end(); ++blkIt) { IBlock & currentBlock = *blkIt; diff --git a/tests/mesh/QHullTest.cpp b/tests/mesh/QHullTest.cpp index 1183325e0b73041efdec3031e76f80c7f1d5b1e1..c755a46ec3fa3bb9e93f4fa3a1497e6c03c3c630 100644 --- a/tests/mesh/QHullTest.cpp +++ b/tests/mesh/QHullTest.cpp @@ -23,6 +23,7 @@ #include "core/logging/Logging.h" #include "core/mpi/Environment.h" #include "core/timing/Timer.h" +#include "core/math/Utility.h" #include "mesh/TriangleMeshes.h" #include "mesh/QHull.h" @@ -32,7 +33,7 @@ #include "vtk/VTKOutput.h" #include "vtk/PointDataSource.h" -#include <boost/random.hpp> +#include <random> #include <vector> #include <string> @@ -190,7 +191,7 @@ std::vector<Vector3<real_t>> generatePointCloudDodecahedron() std::vector<Vector3<real_t>> generatePointCloudInAABB( const math::AABB & aabb, const uint_t numPoints ) { - boost::random::mt19937 rng(42); + std::mt19937 rng(42); std::vector<Vector3<real_t>> pointCloud( numPoints ); for( auto & p : pointCloud ) @@ -202,16 +203,17 @@ std::vector<Vector3<real_t>> generatePointCloudInAABB( const math::AABB & aabb, std::vector<Vector3<real_t>> generatPointCloudOnSphere( const real_t radius, const uint_t numPoints ) { - boost::random::mt19937 rng(42); - boost::uniform_on_sphere<real_t> distribution(3); + std::mt19937 rng(42); + std::uniform_real_distribution<real_t> distribution; std::vector<Vector3<real_t>> pointCloud( numPoints ); for( auto & p : pointCloud ) { - auto v = distribution(rng); - p[0] = v[0] * radius; - p[1] = v[1] * radius; - p[2] = v[2] * radius; + real_t theta = 2 * math::PI * distribution(rng); + real_t phi = std::acos( real_t(1.0) - real_t(2.0) * distribution(rng) ); + p[0] = std::sin(phi) * std::cos(theta) * radius; + p[1] = std::sin(phi) * std::sin(theta) * radius; + p[2] = std::cos(phi) * radius; } return pointCloud; diff --git a/tests/pe/DeleteBody.cpp b/tests/pe/DeleteBody.cpp index 9b0d149bc327ed2bdfc6c9f79e6eeacfb5c8a0ba..64f03d42a807a89b5cce96903acf13ee7fe5220d 100644 --- a/tests/pe/DeleteBody.cpp +++ b/tests/pe/DeleteBody.cpp @@ -80,7 +80,7 @@ int main( int argc, char** argv ) } WALBERLA_CHECK_UNEQUAL(firstStorage, secondStorage); - boost::function<void(void)> syncCall; + std::function<void(void)> syncCall; if (!syncShadowOwners) { syncCall = boost::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); diff --git a/tests/pe/ShadowCopy.cpp b/tests/pe/ShadowCopy.cpp index d0d3c119fd47b8c7f3a2ccef15a08f86ab935870..cbd4958e34ede91c698393f37f42633925f15abc 100644 --- a/tests/pe/ShadowCopy.cpp +++ b/tests/pe/ShadowCopy.cpp @@ -62,7 +62,7 @@ int main( int argc, char** argv ) // logging::Logging::instance()->includeLoggingToFile("ShadowCopy"); bool syncShadowOwners = false; - boost::function<void(void)> syncCall; + std::function<void(void)> syncCall; if (!syncShadowOwners) { syncCall = boost::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); diff --git a/tests/pe/SyncEquivalence.cpp b/tests/pe/SyncEquivalence.cpp index 9d5cb83b52bfeb5e2c9a977e8a9f191215dc9827..c311e1d6728ebd00a11b86451b0a8b208ef94d33 100644 --- a/tests/pe/SyncEquivalence.cpp +++ b/tests/pe/SyncEquivalence.cpp @@ -95,9 +95,9 @@ void createSimulation(math::AABB& simulationDomain, real_t vMax, SimInfo& info) { - boost::mt19937 generator; + std::mt19937 generator; generator.seed(1337); - //math::seedRandomGenerator( 1337 ); //static_cast<boost::mt19937::result_type>(1337 * mpi::MPIManager::instance()->worldRank()) ); + //math::seedRandomGenerator( 1337 ); //static_cast<std::mt19937::result_type>(1337 * mpi::MPIManager::instance()->worldRank()) ); info.globalBodyStorage = make_shared<BodyStorage>(); diff --git a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp index 8786074ddbe78cea3ca1a560f4f6b8ff2d03fda6..cc700fde4efd3e4836ff398026a69e491b2fbbcb 100644 --- a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp @@ -337,7 +337,7 @@ public: QuantityEvaluator( SweepTimeloop* timeloop, StructuredBlockStorage & blocks, const BlockDataID & bodyStorageID, const BlockDataID & forceFieldID, const BlockDataID & pdfFieldID, const std::string & fileName, bool fileIO, const uint_t & numSpheres, const real_t & velExpected, - const boost::function<Vector3<real_t> ()> & evaluateMeanFluidVelocity ) : + const std::function<Vector3<real_t> ()> & evaluateMeanFluidVelocity ) : timeloop_( timeloop ), blocks_( blocks ), bodyStorageID_( bodyStorageID ), forceFieldID_( forceFieldID ), pdfFieldID_( pdfFieldID ), fileName_( fileName ), fileIO_( fileIO ), numSpheres_( numSpheres ), velExpected_( velExpected ), evaluateMeanFluidVelocity_( evaluateMeanFluidVelocity ) @@ -484,7 +484,7 @@ private: const uint_t numSpheres_; const real_t velExpected_; - boost::function<Vector3<real_t> ()> evaluateMeanFluidVelocity_; + std::function<Vector3<real_t> ()> evaluateMeanFluidVelocity_; }; @@ -1044,7 +1044,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; @@ -1075,7 +1075,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; @@ -1090,7 +1090,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; @@ -1105,7 +1105,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; @@ -1137,7 +1137,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) { @@ -1202,7 +1202,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 ) @@ -1262,7 +1262,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 ) @@ -1322,7 +1322,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) ) { if( useLubricationCorrection ) @@ -1343,7 +1343,7 @@ int main( int argc, char **argv ) // function to evaluate the mean fluid velocity - boost::function<Vector3<real_t> ()> evaluateMeanFluidVelocity = boost::bind(getGNSMeanFluidVelocity, blocks, pdfFieldID, svfFieldID, domainVolume); + std::function<Vector3<real_t> ()> evaluateMeanFluidVelocity = boost::bind(getGNSMeanFluidVelocity, blocks, pdfFieldID, svfFieldID, domainVolume); ////////////////////////////// diff --git a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp index 8b4616f72d3d8b3cebae47ebd4894ee6ab26dc08..3ac3679f58cc454677672cd5a923d61404d6af52 100644 --- a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp @@ -840,7 +840,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; @@ -871,7 +871,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; @@ -886,7 +886,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; @@ -901,7 +901,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; @@ -933,7 +933,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) { @@ -998,7 +998,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 ) @@ -1059,7 +1059,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 ) @@ -1119,7 +1119,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) ) { if( useLubricationCorrection ) diff --git a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp index e47a1d4cbe0d44769c633b29bb900a9f2d0a4c6c..4133741c77ebb5f7bf427b77ad096f0ab0c2ea33 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp @@ -281,7 +281,7 @@ int main( int argc, char **argv ) // connect to pe const real_t overlap = real_c( 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 ); auto sphereMaterialID = pe::createMaterial( "sphereMat", real_c(1) , real_c(0.3), real_c(0.2), real_c(0.2), real_c(0.24), real_c(200), real_c(200), real_c(0), real_c(0) ); // create two spheres: one which overlaps with a block boundary and one inside the block diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp index 1e4bf71b5d9d87f25d6822e22372d4c690285918..c1d3d69a0964a5d187d79d9304497c00d4bf4ce6 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp @@ -516,7 +516,7 @@ int main( int argc, char **argv ) SweepTimeloop timeloop( blocks->getBlockStorage(), timesteps ); // 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::D3Q27 > scheme( blocks ); scheme.addPackInfo( make_shared< field::communication::PackInfo< PdfField_T > >( pdfFieldID ) ); diff --git a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp index e833f9a7134c8d7cdcaee07ac7711f928b4bc502..27626a2e5d93b95e14850edf93265aebfd06bca5 100644 --- a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp @@ -391,7 +391,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; diff --git a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp index 2569114b661f0143c030adc415601dbb42638450..d0d021395ac9fdebda1baca45cb0bc78b13449ae 100644 --- a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp @@ -789,7 +789,7 @@ int main( int argc, char **argv ) // set up synchronization procedure const real_t overlap = real_c( 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 the material const auto myMat = pe::createMaterial( "myMat", real_c(1.4), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); @@ -940,7 +940,7 @@ int main( int argc, char **argv ) << Sweep( pe_coupling::PDFReconstruction< LatticeModel_T, BoundaryHandling_T, Reconstructor_T >( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" ); // setup of the LBM communication for synchronizing the pdf field between neighboring blocks - boost::function< void () > commFunction; + std::function< void () > commFunction; if( fullPDFSync ) { blockforest::communication::UniformBufferedScheme< stencil::D3Q27 > scheme( blocks ); diff --git a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp index 15d44380b97143cfaeb25476b5b4a9652578daa3..ef64aa7a87b345e84e5bd1390f18b008667064a7 100644 --- a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp @@ -413,7 +413,7 @@ int main( int argc, char **argv ) // set up synchronization procedure const real_t overlap = real_c( 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 const auto material = pe::createMaterial( "granular", real_c(1.2), real_c(0.25), real_c(0.4), real_c(0.4), real_c(0.35), real_c(1.39e11), real_c(5.18e7), real_c(1.07e2), real_c(1.07e2) ); @@ -524,7 +524,7 @@ int main( int argc, char **argv ) reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" ); // setup of the LBM communication for synchronizing the pdf field between neighboring blocks - boost::function< void () > commFunction; + std::function< void () > commFunction; if( fullPDFSync ) { blockforest::communication::UniformBufferedScheme< stencil::D3Q27 > scheme( blocks ); diff --git a/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp index 6cfeb3dea5941f075fd70d3305529ebb096e0956..6ccc9f5c7d5156ba058991860ccb271ecbcbfe91 100644 --- a/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp @@ -546,7 +546,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 (!syncShadowOwners) { syncCall = boost::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); @@ -623,7 +623,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; @@ -670,9 +670,9 @@ int main( int argc, char **argv ) } shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); + std::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); + std::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); bodiesFTContainer2->store(); diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp index 0dfd102a5a61d08575b626f706b98f08b1451396..1b0d57f8e085afef600e8b85d0b9d2bfef6b0ba4 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp @@ -457,7 +457,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 @@ -509,7 +509,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; @@ -530,11 +530,11 @@ int main( int argc, char **argv ) ( blocks, boundaryHandlingID, bodyStorageID, globalBodyStorage, bodyFieldID, reconstructor, FormerMO_Flag, Fluid_Flag ), "PDF Restore" ); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); + std::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); + std::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, real_t(1)); - boost::function<void(void)> setForceScalingFactorToHalf = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); + std::function<void(void)> setForceScalingFactorToHalf = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); if( averageForceTorqueOverTwoTimSteps ) { bodiesFTContainer2->store(); diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp index 75b9ff72e24c4792a8bce5a4bbf3128d564b908d..469892c98be27ce0920bcf5c52e4c609f838e9f5 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp @@ -677,7 +677,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 @@ -728,12 +728,12 @@ int main( int argc, char **argv ) // force averaging functionality shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); + std::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); + std::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, real_t(0.5)); - boost::function<void(void)> setForceScalingFactorToOne = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(1)); - boost::function<void(void)> setForceScalingFactorToHalf = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); + std::function<void(void)> setForceScalingFactorToOne = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(1)); + std::function<void(void)> setForceScalingFactorToHalf = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); if( averageForceTorqueOverTwoTimSteps ) { bodiesFTContainer2->store(); @@ -746,7 +746,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; diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp index d93c8731e1272efdb81d71f6509a9de44121080a..7a0734d33b7845eb778b275d79e6b0b043202fcd 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp @@ -544,7 +544,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 @@ -595,11 +595,11 @@ int main( int argc, char **argv ) // force averaging functionality shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer1 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); + std::function<void(void)> storeForceTorqueInCont1 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::store, bodiesFTContainer1); shared_ptr<pe_coupling::BodiesForceTorqueContainer> bodiesFTContainer2 = make_shared<pe_coupling::BodiesForceTorqueContainer>(blocks, bodyStorageID); - boost::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); + std::function<void(void)> setForceTorqueOnBodiesFromCont2 = boost::bind(&pe_coupling::BodiesForceTorqueContainer::setOnBodies, bodiesFTContainer2); shared_ptr<pe_coupling::ForceTorqueOnBodiesScaler> forceScaler = make_shared<pe_coupling::ForceTorqueOnBodiesScaler>(blocks, bodyStorageID, real_t(1)); - boost::function<void(void)> setForceScalingFactorToHalf = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); + std::function<void(void)> setForceScalingFactorToHalf = boost::bind(&pe_coupling::ForceTorqueOnBodiesScaler::resetScalingFactor,forceScaler,real_t(0.5)); if( averageForceTorqueOverTwoTimSteps ) { bodiesFTContainer2->store(); @@ -610,7 +610,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; diff --git a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp index 00ce16ed011c41a33eb4a42b8b8a2cb706dc94a7..82fd1093713a0421ace63341e6a65225b41f2534 100644 --- a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp @@ -289,7 +289,7 @@ int main(int argc, char **argv) { return EXIT_FAILURE; } - boost::function<void(void)> syncCall = boost::bind(pe::syncShadowOwners<BodyTypeTuple>, + std::function<void(void)> syncCall = boost::bind(pe::syncShadowOwners<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); @@ -358,7 +358,7 @@ int main(int argc, char **argv) { "PDF Restore"); // 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::D3Q27> scheme(blocks); scheme.addPackInfo(make_shared<field::communication::PackInfo<PdfField_T> >(pdfFieldID)); diff --git a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp index 1b8d4677ec81ff4777f62a811fe0a2ee44a13c20..e6d43a5d0039a43d1aee67b9723f95d971e0b4de 100644 --- a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp @@ -303,7 +303,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 const auto material = pe::createMaterial( "granular", real_t(1.2), real_t(0.25), real_t(0.4), real_t(0.4), real_t(0.35), real_t(1.39e11), real_t(5.18e7), real_t(1.07e2), real_t(1.07e2) ); @@ -348,7 +348,7 @@ int main( int argc, char **argv ) SweepTimeloop timeloop( blocks->getBlockStorage(), timesteps ); // 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; diff --git a/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp index 85cc5083ed638f8dd62b4802507f7333c8d56dbc..2ff3f3c98e779a184d5c5e51e1407df41814814f 100644 --- a/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp @@ -466,7 +466,7 @@ int main( int argc, char **argv ) SweepTimeloop timeloop( blocks->getBlockStorage(), timesteps ); // 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::D3Q27 > scheme( blocks ); scheme.addPackInfo( make_shared< field::communication::PackInfo< PdfField_T > >( pdfFieldID ) ); diff --git a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp index 79e3c2f4901866bc7a1dd3e9304fc0629981da8a..1547b5baa773303c0002aa8779127d5cecc4e711 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp @@ -455,7 +455,7 @@ int main( int argc, char **argv ) SweepTimeloop timeloop( blocks->getBlockStorage(), timesteps ); // 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< field::communication::PackInfo< PdfField_T > >( pdfFieldID ) ); diff --git a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp index 563828ee360da2151c6e5ee36e27d30e9b337a56..7e0ad3250d28b0cb1f219bbae034dfdc77e817e2 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp @@ -502,7 +502,7 @@ int main( int argc, char **argv ) // set up synchronization procedure const real_t overlap = real_c( 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 @@ -568,7 +568,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; diff --git a/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp index 31921f2f02306b36cd19480d3b3d043504072583..f91b5566e82396466744845bae224e5028e769a6 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp @@ -402,7 +402,7 @@ int main( int argc, char **argv ) SweepTimeloop timeloop( blocks->getBlockStorage(), timesteps ); // 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::D3Q27 > scheme( blocks ); scheme.addPackInfo( make_shared< field::communication::PackInfo< PdfField_T > >( pdfFieldID ) );