diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7fcdc8c5dfa6d3dd887ed8f4c6fcf4093e753869..f7332d1583563a03bcd389b8c562bf416ec4ecb0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -795,6 +795,22 @@ gcc_8_hybrid_dbg: tags: - docker +gcc_8_hybrid_dbg_noboost: + <<: *build_definition + image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:8 + before_script: + - rm -rf /opt/boost /usr/include/boost + variables: + <<: *build_hybrid_dbg_variables + WALBERLA_BUILD_WITH_CUDA: "OFF" + WALBERLA_ENABLE_GUI: 0 + WALBERLA_BUILD_WITH_PYTHON: "OFF" + except: + variables: + - $DISABLE_PER_COMMIT_BUILDS + tags: + - docker + gcc_8_hybrid_dbg_sp: <<: *build_definition image: i10git.cs.fau.de:5005/walberla/buildenvs/gcc:8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 735bbe5eda82c3a69cef0c98975c2ee2cbe9429b..d3234150dd933d903341b1d06b424c052f7c05e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -718,9 +718,18 @@ if ( Boost_FOUND ) list( APPEND LINK_DIRS ${PYTHON_LIBRARY_DIR}/libs ) endif() + set( WALBERLA_BUILD_WITH_BOOST TRUE CACHE INTERNAL "Build with Boost" ) else( Boost_FOUND ) - # Search again, this time with the REQUIRED option. This will give a CMAKE error and a detailed error message for the user - find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} REQUIRED ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} ) + if( (WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM OR WALBERLA_USE_STD_FILESYSTEM) AND (WALBERLA_USE_STD_EXPERIMENTAL_ANY OR WALBERLA_USE_STD_ANY) AND (WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL OR WALBERLA_USE_STD_OPTIONAL) AND NOT WALBERLA_BUILD_WITH_PYTHON) + # we don't really need Boost + set( WALBERLA_BUILD_WITH_BOOST FALSE CACHE INTERNAL "Build with Boost" ) + else() + # Search again, this time with the REQUIRED option. This will give a CMAKE error and a detailed error message for the user + find_package ( Boost ${waLBerla_REQUIRED_MIN_BOOST_VERSION} REQUIRED ${waLBerla_REQUIRED_BOOST_COMPONENTS} OPTIONAL_COMPONENTS ${waLBerla_OPTIONAL_BOOST_COMPONENTS} ) + if( (WALBERLA_USE_STD_EXPERIMENTAL_FILESYSTEM OR WALBERLA_USE_STD_FILESYSTEM) AND (WALBERLA_USE_STD_EXPERIMENTAL_ANY OR WALBERLA_USE_STD_ANY) AND (WALBERLA_USE_STD_EXPERIMENTAL_OPTIONAL OR WALBERLA_USE_STD_OPTIONAL) ) + message(WARNING "If you set WALBERLA_BUILD_WITH_PYTHON=OFF, you can build without the Boost library.") + endif() + endif() endif( Boost_FOUND ) diff --git a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp index 42cbcd96183881ed58ce5e718fedd0e9d371214b..750a8e96459db775bf75fa9e4ec3c79659429f70 100644 --- a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp +++ b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/AMRSedimentSettling.cpp @@ -106,8 +106,7 @@ typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< NoSlip_T, MO_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, MO_T > BoundaryHandling_T; typedef std::tuple<pe::Sphere, pe::Ellipsoid, pe::Plane> BodyTypeTuple; @@ -590,8 +589,8 @@ BoundaryHandling_T * MyBoundaryHandling::initialize( IBlock * const block ) WALBERLA_CHECK_NOT_NULLPTR( blocksPtr ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *blocksPtr, *block ) ), + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *blocksPtr, *block ), BoundaryHandling_T::Mode::ENTIRE_FIELD_TRAVERSAL); handling->fillWithDomain( FieldGhostLayers ); diff --git a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp index 239c024bb39b958721d44d013ecaec6b43bfcf2f..588007edfb0baa0d18b8d843ec3cc86b3f58477a 100644 --- a/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp +++ b/apps/benchmarks/AdaptiveMeshRefinementFluidParticleCoupling/WorkloadEvaluation.cpp @@ -71,8 +71,6 @@ #include "field/vtk/all.h" #include "lbm/vtk/all.h" -#include <boost/tuple/tuple.hpp> - #include <vector> #include <iomanip> #include <iostream> @@ -102,8 +100,7 @@ const uint_t FieldGhostLayers = 1; // boundary handling typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_CLI_T; -typedef boost::tuples::tuple<MO_CLI_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_CLI_T > BoundaryHandling_T; typedef std::tuple<pe::Sphere, pe::Ellipsoid, pe::Plane> BodyTypeTuple; @@ -152,7 +149,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const BoundaryHandling_T::Mode mode = (useEntireFieldTraversal_) ? BoundaryHandling_T::Mode::ENTIRE_FIELD_TRAVERSAL : BoundaryHandling_T::Mode::OPTIMIZED_SPARSE_TRAVERSAL ; BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ), + MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), mode); // boundaries are set by mapping the planes into the domain diff --git a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp index 05126f0202fecd9662a03202b8572fa1a526c98b..9ce1da4a306fdfc381026928ce534a14efd17ec3 100644 --- a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp +++ b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp @@ -373,9 +373,7 @@ public: typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; - typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; - - typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, NoSlip_T, UBB_T > BoundaryHandling_T; @@ -405,8 +403,8 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block ) const const flag_t fluid = flagField->registerFlag( Fluid_Flag ); return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_t(0), real_t(0) ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_t(0), real_t(0) ) ); } diff --git a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp index ea62c617f7ad751fe2749a7b2d1c77483a7c1c5d..b78fd4395482d64c340b7acc27011a432fc898aa 100644 --- a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp +++ b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp @@ -95,8 +95,7 @@ const uint_t FieldGhostLayers = 4; typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_SBB_T; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_CLI_T; -typedef boost::tuples::tuple< MO_SBB_T, MO_CLI_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_SBB_T, MO_CLI_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -238,8 +237,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_SBB_T( "MO_SBB", MO_SBB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_CLI_T( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + MO_SBB_T( "MO_SBB", MO_SBB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), + MO_CLI_T( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); // boundary conditions are set by mapping the (moving) planes into the domain diff --git a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp index e7743f7959ecde538ce55734bbdc56da60371ac6..de0647508960abe3cb40b4e51e8ec8e7e0ee493d 100644 --- a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp +++ b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp @@ -98,8 +98,7 @@ typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MEM_BB_T; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MEM_CLI_T; typedef pe_coupling::CurvedQuadratic< LatticeModel_T, FlagField_T > MEM_MR_T; -typedef boost::tuples::tuple< UBB_T, Outlet_T, MEM_BB_T, MEM_CLI_T, MEM_MR_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, UBB_T, Outlet_T, MEM_BB_T, MEM_CLI_T, MEM_MR_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere>; @@ -199,11 +198,11 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( UBB_T( "UBB", UBB_Flag, pdfField, velocity_), + UBB_T( "UBB", UBB_Flag, pdfField, velocity_), Outlet_T( "Outlet", Outlet_Flag, pdfField, real_t(1) ), MEM_BB_T ( "MEM_BB", MEM_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), MEM_CLI_T( "MEM_CLI", MEM_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MEM_MR_T ( "MEM_MR", MEM_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ) ); + MEM_MR_T ( "MEM_MR", MEM_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ); const auto ubb = flagField->getFlag( UBB_Flag ); const auto outlet = flagField->getFlag( Outlet_Flag ); diff --git a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp index 3a50ad87572dae545de03b87c1fded47f6c0d4b6..f4528cbf65db1514641c07921a1e71d3fcbacc91 100644 --- a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp +++ b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp @@ -434,9 +434,7 @@ struct MyBoundaryTypes typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; - typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; - - typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, NoSlip_T, UBB_T > BoundaryHandling_T; }; template< typename LatticeModel_T > @@ -447,8 +445,6 @@ public: using NoSlip_T = typename MyBoundaryTypes< LatticeModel_T >::NoSlip_T; using UBB_T = typename MyBoundaryTypes< LatticeModel_T >::UBB_T; - using BoundaryConditions_T = typename MyBoundaryTypes< LatticeModel_T >::BoundaryConditions_T; - using BoundaryHandling_T = typename MyBoundaryTypes< LatticeModel_T >::BoundaryHandling_T; @@ -484,8 +480,8 @@ MyBoundaryHandling<LatticeModel_T>::initialize( IBlock * const block ) const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ) ); auto forest = forest_.lock(); WALBERLA_CHECK_NOT_NULLPTR( forest ); diff --git a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp index 15dbd17058095c4aba2b7e680c51ea46dc2d1d31..ff9d0f46beaaeb6c567244fa0e738ca01d4c72ad 100644 --- a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp +++ b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp @@ -458,9 +458,7 @@ public: typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::Curved< LatticeModel_T, FlagField_T > Curved_T; - typedef boost::tuples::tuple< NoSlip_T, Curved_T > BoundaryConditions_T; - - typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, NoSlip_T, Curved_T > BoundaryHandling_T; @@ -488,8 +486,8 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block ) const const flag_t fluid = flagField->registerFlag( Fluid_Flag ); return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - Curved_T( "curved", Curved_Flag, pdfField, flagField, fluid ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + Curved_T( "curved", Curved_Flag, pdfField, flagField, fluid ) ); } diff --git a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp index 46bd0c3663a74e75114bbd94635272fca517c877..2f7a5f6b5858cf51664abc1d0938abf590aab18d 100644 --- a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp +++ b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp @@ -784,11 +784,8 @@ struct MyBoundaryTypes typedef lbm::Outlet< LatticeModel_T, FlagField_T, 2, 1 > Outlet21_T; typedef lbm::Outlet< LatticeModel_T, FlagField_T, 4, 3 > Outlet43_T; typedef lbm::SimplePressure< LatticeModel_T, flag_t > PressureOutlet_T; - - - typedef boost::tuples::tuple< NoSlip_T, Obstacle_T, Curved_T, DynamicUBB_T, Outlet21_T, Outlet43_T, PressureOutlet_T > BoundaryConditions_T; - typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, NoSlip_T, Obstacle_T, Curved_T, DynamicUBB_T, Outlet21_T, Outlet43_T, PressureOutlet_T > BoundaryHandling_T; }; @@ -805,8 +802,6 @@ public: using Outlet43_T = typename MyBoundaryTypes<LatticeModel_T>::Outlet43_T; using PressureOutlet_T = typename MyBoundaryTypes<LatticeModel_T>::PressureOutlet_T; - using BoundaryConditions_T = typename MyBoundaryTypes<LatticeModel_T>::BoundaryConditions_T; - using BoundaryHandling_T = typename MyBoundaryTypes<LatticeModel_T>::BoundaryHandling_T; @@ -848,13 +843,13 @@ MyBoundaryHandling<LatticeModel_T>::initialize( IBlock * const block ) SinusInflowVelocity<Is2D< LatticeModel_T >::value> velocity( setup_.inflowVelocity_L, setup_.raisingTime_L, setup_.sinPeriod_L, setup_.H ); return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), Obstacle_T( "obstacle (staircase)", Obstacle_Flag, pdfField ), Curved_T( "obstacle (curved)", Curved_Flag, pdfField, flagField, fluid ), DynamicUBB_T( "velocity bounce back", UBB_Flag, pdfField, timeTracker_, blocks->getLevel(*block), velocity, block->getAABB() ), Outlet21_T( "outlet (2/1)", Outlet21_Flag, pdfField, flagField, fluid ), Outlet43_T( "outlet (4/3)", Outlet43_Flag, pdfField, flagField, fluid ), - PressureOutlet_T( "pressure outlet", PressureOutlet_Flag, pdfField, real_t(1) ) ) ); + PressureOutlet_T( "pressure outlet", PressureOutlet_Flag, pdfField, real_t(1) ) ); } diff --git a/apps/benchmarks/UniformGrid/UniformGrid.cpp b/apps/benchmarks/UniformGrid/UniformGrid.cpp index f237a4b8f51e342ef205e873393c109b9067b6db..96e50eb129069daa7b5006ca9fe144eb005bdf7a 100644 --- a/apps/benchmarks/UniformGrid/UniformGrid.cpp +++ b/apps/benchmarks/UniformGrid/UniformGrid.cpp @@ -353,9 +353,7 @@ public: typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; - typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; - - typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename Types<LatticeModel_T>::Stencil_T, NoSlip_T, UBB_T > BoundaryHandling_T; @@ -388,8 +386,8 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const Stru const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ) ); CellInterval domainBB = storage->getDomainCellBB(); storage->transformGlobalToBlockLocalCellInterval( domainBB, *block ); diff --git a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp index 34cb30ae1d1530649f93ab9fd81a5c62cfb60ba5..b91418447e3a8a5b0e7bcf503aa1bfbe98c4f580 100644 --- a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp +++ b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp @@ -98,8 +98,7 @@ typedef lbm::Outlet< LatticeModel_T, FlagField_T > Outflow_T typedef lbm::SimplePressure< LatticeModel_T, flag_t > Outflow_T; #endif -typedef boost::tuples::tuple< NoSlip_T, Inflow_T, Outflow_T > BoundaryConditions_T; -typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; +typedef BoundaryHandling<FlagField_T, Stencil_T, NoSlip_T, Inflow_T, Outflow_T> BoundaryHandling_T; typedef std::tuple<pe::Plane, pe::Sphere> BodyTypeTuple ; @@ -165,14 +164,14 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const #ifdef OutletBC BoundaryHandling_T * handling = new BoundaryHandling_T( "Boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), Inflow_T( "Inflow", Inflow_Flag, pdfField, Vector3<real_t>(real_t(0),real_t(0),uInflow_) ), - Outflow_T( "Outflow", Outflow_Flag, pdfField, flagField, fluid ) ) ); + Outflow_T( "Outflow", Outflow_Flag, pdfField, flagField, fluid ) ); #else BoundaryHandling_T * handling = new BoundaryHandling_T( "Boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), Inflow_T( "Inflow", Inflow_Flag, pdfField, Vector3<real_t>(real_t(0),real_t(0),uInflow_) ), - Outflow_T( "Outflow", Outflow_Flag, pdfField, real_t(1) ) ) ); + Outflow_T( "Outflow", Outflow_Flag, pdfField, real_t(1) ) ); #endif const auto noslip = flagField->getFlag( NoSlip_Flag ); diff --git a/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp b/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp index e28259f8d46d35eb081635ec455fa71be16b8caf..7aa2e29bc21be81d2d2877dcea2abb3af21b5662 100644 --- a/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp +++ b/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp @@ -79,10 +79,7 @@ typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; // no slip boundary typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; // velocity bounce back boundary condition that internally works with one ... // ... constant velocity that must be set during the setup phase -typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; // a collection of all boundary conditions - required for - // defining the type of the boundary handling (see below) - -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; // the boundary handling +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, UBB_T > BoundaryHandling_T; // the boundary handling, includes a collection of all boundary conditions /////////// // FLAGS // @@ -139,11 +136,11 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block ) cons // The fluid flag is used in order to decide whether a certain cell is part of the domain (and therefore has to be // treated by the boundary handling if it is located next to a boundary). Also, the no slip and velocity bounce back // boundary conditions are initialized (Please note that the order in which these boundary conditions are initialized - // must be identical to the order in 'BoundaryConditions_T'!). + // must be identical to the order of the template arguments of 'BoundaryHandling_T'!). return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_c(0), real_c(0) ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_c(0), real_c(0) ) ); } @@ -420,4 +417,4 @@ int main( int argc, char ** argv ) int main( int argc, char ** argv ) { return walberla::main(argc, argv); -} \ No newline at end of file +} diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h index c109a605390f9f6213006de800ee697f4d0a91ab..45f39dcef889354810be9a7acd2e9e460d76ddec 100644 --- a/src/blockforest/BlockForest.h +++ b/src/blockforest/BlockForest.h @@ -854,7 +854,7 @@ template< typename T > inline BlockDataID BlockForest::addBlockData( const shared_ptr< T > & dataHandling, const std::string & identifier, const Set<SUID> & requiredSelectors, const Set<SUID> & incompatibleSelectors ) { - //static_assert( boost::is_base_of< BlockDataHandling<typename T::value_type>, T >::value ); + //static_assert( std::is_base_of< BlockDataHandling<typename T::value_type>, T >::value ); auto downcast = dynamic_pointer_cast< blockforest::BlockDataHandling<typename T::value_type> >( dataHandling ); diff --git a/src/boundary/BoundaryHandling.h b/src/boundary/BoundaryHandling.h index 981cc3e4fc34f960951631c0202e428d6a5d3269..96f93c991b7dc80579317daf06940b03d7c98525 100644 --- a/src/boundary/BoundaryHandling.h +++ b/src/boundary/BoundaryHandling.h @@ -39,7 +39,7 @@ #include "stencil/Directions.h" -#include <boost/tuple/tuple.hpp> +#include <tuple> #include <ostream> #include <string> #include <type_traits> @@ -49,6 +49,20 @@ namespace walberla { namespace boundary { +namespace internal { +#if defined(__GLIBCXX__) && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < 7) +template< typename T > +struct tuple_size : std::tuple_size<std::tuple<>> +{}; + +template< typename... Members > +struct tuple_size< std::tuple<Members...> > : std::tuple_size<std::tuple<Members...>> +{}; +#else +using std::tuple_size; +#endif +} + class BHUIDGenerator : public uid::IndexGenerator< BHUIDGenerator, uint_t >{}; @@ -56,12 +70,12 @@ typedef UID< BHUIDGenerator > BoundaryHandlingUID; -template< typename FlagField_T, typename Stencil, typename Tuple > // Tuple: all the boundary classes that are considered by this boundary handler +template< typename FlagField_T, typename Stencil, typename... Boundaries > // Boundaries: all the boundary classes that are considered by this boundary handler class BoundaryHandling { public: - template< typename F, typename T > + template< typename F, typename... T > friend class BoundaryHandlingCollection; typedef FlagField_T FlagField; @@ -87,8 +101,11 @@ public: - BoundaryHandling( const std::string & identifier, FlagField_T * const flagField, const flag_t domain, const Tuple & boundaryConditions, - const Mode mode = OPTIMIZED_SPARSE_TRAVERSAL ); + BoundaryHandling( const std::string & identifier, FlagField_T * const flagField, const flag_t domain, const Boundaries & ... boundaryConditions, + const Mode mode ); + BoundaryHandling( const std::string & identifier, FlagField_T * const flagField, const flag_t domain, const Boundaries & ... boundaryConditions ) : + BoundaryHandling( identifier, flagField, domain, boundaryConditions..., OPTIMIZED_SPARSE_TRAVERSAL ) + {} bool operator==( const BoundaryHandling & rhs ) const { WALBERLA_CHECK( false, "You are trying to compare boundary handling " << uid_ << // For testing purposes, block data items must be comparable with operator "==". " with boundary handling " << rhs.getUID() << // Since instances of type "BoundaryHandling" are registered as block data items, @@ -242,7 +259,7 @@ public: //** Remove Boundary Cells ****************************************************************************************** /*! \name Remove Boundary Cells */ //@{ - inline void removeBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); + inline void removeBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); inline void removeBoundary( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); inline void removeBoundary( const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); @@ -363,26 +380,31 @@ private: CellInterval getGhostLayerCellInterval( const uint_t numberOfGhostLayersToInclude ) const; - template< typename Head, typename Tail > - void setupBoundaryConditions( boost::tuples::cons<Head, Tail> & boundaryConditions ); - void setupBoundaryConditions( const boost::tuples::null_type & ) const {} + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + typename std::enable_if<(N!=-1), void>::type setupBoundaryConditions( BoundariesTuple & boundaryConditions ); + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + typename std::enable_if<(N==-1), void>::type setupBoundaryConditions( const BoundariesTuple & ) const {} inline std::vector< BoundaryUID > getBoundaryUIDs() const; - template< typename Head, typename Tail > - inline void getBoundaryUIDs( const boost::tuples::cons<Head, Tail> & boundaryConditions, std::vector< BoundaryUID > & uids ) const; - inline void getBoundaryUIDs( const boost::tuples::null_type &, std::vector< BoundaryUID > & ) const {} - - template< typename Head, typename Tail > - inline BoundaryUID getBoundaryUID( const boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag ) const; - inline BoundaryUID getBoundaryUID( const boost::tuples::null_type &, const flag_t flagUID ) const; - - template< typename Head, typename Tail > - inline bool containsBoundaryCondition( const boost::tuples::cons<Head, Tail> & boundaryConditions, const BoundaryUID & uid ) const; - inline bool containsBoundaryCondition( const boost::tuples::null_type &, const BoundaryUID & ) const { return false; } - - template< typename Head, typename Tail > - inline flag_t getBoundaryMask( const boost::tuples::cons<Head, Tail> & boundaryConditions, const BoundaryUID & uid ) const; - inline flag_t getBoundaryMask( const boost::tuples::null_type &, const BoundaryUID & ) const { return numeric_cast<flag_t>(0); } + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type getBoundaryUIDs( const BoundariesTuple & boundaryConditions, std::vector< BoundaryUID > & uids ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type getBoundaryUIDs( const BoundariesTuple &, std::vector< BoundaryUID > & ) const {} + + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), BoundaryUID>::type getBoundaryUID( const BoundariesTuple & boundaryConditions, const flag_t flag ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), BoundaryUID>::type getBoundaryUID( const BoundariesTuple &, const flag_t flagUID ) const; + + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type containsBoundaryCondition( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type containsBoundaryCondition( const BoundariesTuple &, const BoundaryUID & ) const { return false; } + + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), flag_t>::type getBoundaryMask( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), flag_t>::type getBoundaryMask( const BoundariesTuple &, const BoundaryUID & ) const { return numeric_cast<flag_t>(0); } //** Get Boundary Class (private helper functions) ****************************************************************** /*! \name Get Boundary Class (private helper functions) */ @@ -390,24 +412,22 @@ private: // matching type (-> Boundary_T) not yet found ... - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition( const BoundaryUID & uid, const boost::tuples::cons<Head, Tail> & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, Head >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, - std::false_type >::value >::type* /*dummy*/ = 0 ) const + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryConditions.get_head().getUID() ) - return boundaryConditions.get_head(); + if( uid == std::get<N>( boundaryConditions ).getUID() ) + return std::get<N>( boundaryConditions ); else - return getBoundaryCondition_TypeExists< Boundary_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryConditions.get_tail() ); + return getBoundaryCondition_TypeExists< Boundary_T, BoundariesTuple, N-1 >( uid, boundaryConditions ); } - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition( const BoundaryUID & uid, const boost::tuples::cons<Head, boost::tuples::null_type> & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, Head >::value >::type* /*dummy*/ = 0 ) const + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N==0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryConditions.get_head().getUID() ) - return boundaryConditions.get_head(); + if( uid == std::get<N>( boundaryConditions ).getUID() ) + return std::get<N>( boundaryConditions ); else WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); @@ -416,50 +436,41 @@ private: #endif } - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition( const BoundaryUID & uid, const boost::tuples::cons<Head, Tail> & boundaryConditions, - typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, Head >::type, + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, + typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, - std::false_type >::value >::type* /*dummy*/ = 0 ) const + typename std::enable_if< (N>0) >::type* /*dummy*/ = 0 ) const { - return getBoundaryCondition< Boundary_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryConditions.get_tail() ); + return getBoundaryCondition< Boundary_T, BoundariesTuple, N-1 >( uid, boundaryConditions ); } - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition( const BoundaryUID & /*uid*/, const boost::tuples::cons<Head, boost::tuples::null_type> & /*boundaryConditions*/, - typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, Head >::type, + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N==0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & /*uid*/, const BoundariesTuple & /*boundaryConditions*/, + typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, typename std::tuple_element<0, BoundariesTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { static_assert( sizeof(Boundary_T) == 0, "The requested boundary class is not part of this boundary handling." ); } - //template< typename Boundary_T > - //inline const Boundary_T & getBoundaryCondition( const BoundaryUID & /*uid*/, const boost::tuples::null_type & ) const - //{ - // static_assert( sizeof(Boundary_T) == 0, "The requested boundary class is not part of this boundary handling." ); - //} - // matching type (-> Boundary_T) exists! - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const boost::tuples::cons<Head, Tail> & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, Head >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, - std::false_type >::value >::type* /*dummy*/ = 0 ) const + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryConditions.get_head().getUID() ) - return boundaryConditions.get_head(); + if( uid == std::get<N>( boundaryConditions ).getUID() ) + return std::get<N>( boundaryConditions ); else - return getBoundaryCondition_TypeExists< Boundary_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryConditions.get_tail() ); + return getBoundaryCondition_TypeExists< Boundary_T, BoundariesTuple, N-1 >( uid, boundaryConditions ); } - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const boost::tuples::cons<Head, boost::tuples::null_type> & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, Head >::value >::type* /*dummy*/ = 0 ) const + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N==0), Boundary_T>::type & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<0, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryConditions.get_head().getUID() ) - return boundaryConditions.get_head(); + if( uid == std::get<0>( boundaryConditions ).getUID() ) + return std::get<0>( boundaryConditions ); else WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); @@ -468,19 +479,17 @@ private: #endif } - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const boost::tuples::cons<Head, Tail> & boundaryConditions, - typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, Head >::type, - std::false_type >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, + typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { - return getBoundaryCondition_TypeExists< Boundary_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryConditions.get_tail() ); + return getBoundaryCondition_TypeExists< Boundary_T, BoundariesTuple, N-1 >( uid, boundaryConditions ); } - template< typename Boundary_T, typename Head, typename Tail > - inline const Boundary_T & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const boost::tuples::cons<Head, boost::tuples::null_type> & /*boundaryConditions*/, - typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, Head >::type, + template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline const typename std::enable_if<(N==0), Boundary_T>::type & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const BoundariesTuple & /*boundaryConditions*/, + typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, typename std::tuple_element<0, BoundariesTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); @@ -490,23 +499,19 @@ private: #endif } - //template< typename Boundary_T > - //inline const Boundary_T & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const boost::tuples::null_type & ) const - //{ - // WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); - //} - //@} //******************************************************************************************************************* inline uint_t numberOfMatchingBoundaryConditions( const BoundaryUID & uid ) const; - template< typename Head, typename Tail > - inline uint_t numberOfMatchingBoundaryConditions( const boost::tuples::cons<Head, Tail> & boundaryConditions, const BoundaryUID & uid ) const; - inline uint_t numberOfMatchingBoundaryConditions( const boost::tuples::null_type &, const BoundaryUID & ) const { return uint_c(0); } + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), uint_t>::type numberOfMatchingBoundaryConditions( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), uint_t>::type numberOfMatchingBoundaryConditions( const BoundariesTuple &, const BoundaryUID & ) const { return uint_c(0); } - template< typename Head, typename Tail > - inline uint_t numberOfMatchingBoundaryConditions( const boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t mask ) const; - inline uint_t numberOfMatchingBoundaryConditions( const boost::tuples::null_type &, const flag_t ) const { return uint_c(0); } + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), uint_t>::type numberOfMatchingBoundaryConditions( const BoundariesTuple & boundaryConditions, const flag_t mask ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), uint_t>::type numberOfMatchingBoundaryConditions( const BoundariesTuple &, const flag_t ) const { return uint_c(0); } inline bool checkFlagField( const uint_t numberOfGhostLayersToInclude = 0 ) const; @@ -515,67 +520,76 @@ private: //** Set Boundary Cells (private helper functions) ****************************************************************** /*! \name Set Boundary Cells (private helper functions) */ //@{ - template< typename Head, typename Tail > - inline shared_ptr<BoundaryConfiguration> createBoundaryConfiguration( const boost::tuples::cons<Head, Tail> & boundaryConditions, + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), shared_ptr<BoundaryConfiguration>>::type createBoundaryConfiguration( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid, const Config::BlockHandle & config ) const; - inline shared_ptr<BoundaryConfiguration> createBoundaryConfiguration( const boost::tuples::null_type &, const BoundaryUID & uid, + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), shared_ptr<BoundaryConfiguration>>::type createBoundaryConfiguration( const BoundariesTuple &, const BoundaryUID & uid, const Config::BlockHandle & ) const; inline void addNearBoundary( const CellInterval & cells ); inline void addBoundary( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - template< typename Head, typename Tail > - inline void setBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag, + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type setBoundary( BoundariesTuple & boundaryConditions, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ); - inline void setBoundary( const boost::tuples::null_type &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t, + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type setBoundary( const BoundariesTuple &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t, const BoundaryConfiguration & ) const; - template< typename Head, typename Tail > - inline void setBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag, const CellInterval & cells, + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type setBoundary( BoundariesTuple & boundaryConditions, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ); - inline void setBoundary( const boost::tuples::null_type &, const flag_t, const CellInterval &, const BoundaryConfiguration & ) const; + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type setBoundary( const BoundariesTuple &, const flag_t, const CellInterval &, const BoundaryConfiguration & ) const; - template< typename Head, typename Tail > - inline void setBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag, const CellVector & cells, + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type setBoundary( BoundariesTuple & boundaryConditions, const flag_t flag, const CellVector & cells, const BoundaryConfiguration & parameter ); - inline void setBoundary( const boost::tuples::null_type &, const flag_t, const CellVector &, const BoundaryConfiguration & ) const; + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type setBoundary( const BoundariesTuple &, const flag_t, const CellVector &, const BoundaryConfiguration & ) const; //@} //******************************************************************************************************************* //** Remove Boundary Cells (private helper functions) *************************************************************** /*! \name Remove Boundary Cells (private helper functions) */ //@{ - template< typename Head, typename Tail > - inline void removeBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type removeBoundary( BoundariesTuple & boundaryConditions, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const bool checkNearBoundaryFlags = true ); - inline void removeBoundary( const boost::tuples::null_type &, const cell_idx_t, const cell_idx_t, const cell_idx_t, const bool ) const { WALBERLA_CHECK( false ); } + template< typename BoundariesTuple, int N = internal::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type removeBoundary( const BoundariesTuple &, const cell_idx_t, const cell_idx_t, const cell_idx_t, const bool ) const { WALBERLA_CHECK( false ); } //@} //******************************************************************************************************************* //** Boundary Treatment (private helper functions) ****************************************************************** /*! \name Boundary Treatment (private helper functions) */ //@{ - template< typename Head, typename Tail > - inline void treatDirection( boost::tuples::cons<Head, Tail> & boundaryConditions, const uint_t index, + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type treatDirection( BoundariesTuple & boundaryConditions, const uint_t index, const std::vector< std::vector< std::pair< Cell, stencil::Direction > > > & cellDirectionPairs ); - inline void treatDirection( const boost::tuples::null_type &, const uint_t, + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type treatDirection( const BoundariesTuple &, const uint_t, const std::vector< std::vector< std::pair< Cell, stencil::Direction > > > & ) const {} - template< typename Head, typename Tail > - inline void treatDirection( boost::tuples::cons<Head, Tail> & boundaryConditions, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type treatDirection( BoundariesTuple & boundaryConditions, 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 ); - inline void treatDirection( const boost::tuples::null_type & , const cell_idx_t, const cell_idx_t, const cell_idx_t, const stencil::Direction, + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type treatDirection( const BoundariesTuple & , const cell_idx_t, const cell_idx_t, const cell_idx_t, const stencil::Direction, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { WALBERLA_CHECK( false ); } - template< typename Head, typename Tail > - inline void beforeBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryConditions ); - inline void beforeBoundaryTreatment( const boost::tuples::null_type & ) const {} + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type beforeBoundaryTreatment( BoundariesTuple & boundaryConditions ); + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type beforeBoundaryTreatment( const BoundariesTuple & ) const {} - template< typename Head, typename Tail > - inline void afterBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryConditions ); - inline void afterBoundaryTreatment( const boost::tuples::null_type & ) const {} + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type afterBoundaryTreatment( BoundariesTuple & boundaryConditions ); + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type afterBoundaryTreatment( const BoundariesTuple & ) const {} //@} //******************************************************************************************************************* @@ -595,11 +609,11 @@ private: template< typename Buffer_T > inline void pack( Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; - template< typename Buffer_T, typename Head, typename Tail > - inline void pack( const boost::tuples::cons<Head, Tail> & boundaryConditions, Buffer_T & buffer, + template< typename Buffer_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type pack( const BoundariesTuple & boundaryConditions, Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; - template< typename Buffer_T > - void pack( const boost::tuples::null_type &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) + template< typename Buffer_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + typename std::enable_if<(N==-1), void>::type pack( const BoundariesTuple &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { WALBERLA_CHECK( false ); } template< typename Buffer_T > @@ -608,18 +622,19 @@ private: template< typename Buffer_T > inline void unpackBoundary( Buffer_T & buffer, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - template< typename Buffer_T, typename Head, typename Tail > - inline void unpackBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, Buffer_T & buffer, const flag_t flag, + template< typename Buffer_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type unpackBoundary( BoundariesTuple & boundaryConditions, Buffer_T & buffer, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - template< typename Buffer_T > - inline void unpackBoundary( const boost::tuples::null_type &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t) + template< typename Buffer_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type unpackBoundary( const BoundariesTuple &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t) const { WALBERLA_CHECK( false ); } //@} //******************************************************************************************************************* - template< typename Head, typename Tail > - void getBoundaryConditions( const boost::tuples::cons<Head, Tail> & boundaryConditions, std::vector< std::string > & bcs ) const; - void getBoundaryConditions( const boost::tuples::null_type &, std::vector< std::string > & ) const {} + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + typename std::enable_if<(N!=-1), void>::type getBoundaryConditions( const BoundariesTuple & boundaryConditions, std::vector< std::string > & bcs ) const; + template< typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > + typename std::enable_if<(N==-1), void>::type getBoundaryConditions( const BoundariesTuple &, std::vector< std::string > & ) const {} template< typename T > static void valueToStream( std::ostream & os, const T value ) { os << value; } static void valueToStream( std::ostream & os, const int8_t value ) { os << int_c( value ); } @@ -649,6 +664,7 @@ private: std::vector< std::vector< std::vector< std::pair< Cell, stencil::Direction > > > > cellDirectionPairs_; // 1st vector: numberOfGhostLayersToInclude // 2nd vector: boundary condition index // 3rd vector: vector of cell<->direction pairs + typedef std::tuple<Boundaries...> Tuple; Tuple boundaryConditions_; bool threadSafeBCs_; @@ -656,9 +672,9 @@ private: -template< typename FlagField_T, typename Stencil, typename Tuple > -BoundaryHandling< FlagField_T, Stencil, Tuple >::BoundaryHandling( const std::string & identifier, FlagField_T * const flagField, - const flag_t domain, const Tuple & boundaryConditions, const Mode mode ) : +template< typename FlagField_T, typename Stencil, typename... Boundaries > +BoundaryHandling< FlagField_T, Stencil, Boundaries... >::BoundaryHandling( const std::string & identifier, FlagField_T * const flagField, + const flag_t domain, const Boundaries & ... boundaryConditions, const Mode mode ) : uid_( identifier ), flagField_( flagField ), @@ -673,7 +689,7 @@ BoundaryHandling< FlagField_T, Stencil, Tuple >::BoundaryHandling( const std::st domain_( domain ), mode_( mode ), dirty_( false ), - boundaryConditions_( boundaryConditions ), + boundaryConditions_( std::make_tuple(boundaryConditions...) ), threadSafeBCs_( true ) { setupBoundaryConditions( boundaryConditions_ ); @@ -694,40 +710,40 @@ BoundaryHandling< FlagField_T, Stencil, Tuple >::BoundaryHandling( const std::st -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isEmpty( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isEmpty( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { return !flagField_->isPartOfMaskSet( x, y, z, boundary_ ) && !flagField_->isPartOfMaskSet( x, y, z, domain_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isNearBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isNearBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { return flagField_->isFlagSet( x, y, z, nearBoundary_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { return flagField_->isPartOfMaskSet( x, y, z, boundary_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { return flagField_->isPartOfMaskSet( x, y, z, domain_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isEmpty( const Cell & cell ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isEmpty( const Cell & cell ) const { return !flagField_->isPartOfMaskSet( cell.x(), cell.y(), cell.z(), boundary_ ) && !flagField_->isPartOfMaskSet( cell.x(), cell.y(), cell.z(), domain_ ); @@ -735,32 +751,32 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isEmpty( const Cell -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isNearBoundary( const Cell & cell ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isNearBoundary( const Cell & cell ) const { return flagField_->isFlagSet( cell.x(), cell.y(), cell.z(), nearBoundary_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isBoundary( const Cell & cell ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isBoundary( const Cell & cell ) const { return flagField_->isPartOfMaskSet( cell.x(), cell.y(), cell.z(), boundary_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isDomain( const Cell & cell ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isDomain( const Cell & cell ) const { return flagField_->isPartOfMaskSet( cell.x(), cell.y(), cell.z(), domain_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isEmpty( const ConstFlagFieldBaseIterator & it ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isEmpty( const ConstFlagFieldBaseIterator & it ) const { WALBERLA_ASSERT_EQUAL( it.getField(), flagField_ ); @@ -769,8 +785,8 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isEmpty( const Cons -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isNearBoundary( const ConstFlagFieldBaseIterator & it ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isNearBoundary( const ConstFlagFieldBaseIterator & it ) const { WALBERLA_ASSERT_EQUAL( it.getField(), flagField_ ); @@ -779,8 +795,8 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isNearBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isBoundary( const ConstFlagFieldBaseIterator & it ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isBoundary( const ConstFlagFieldBaseIterator & it ) const { WALBERLA_ASSERT_EQUAL( it.getField(), flagField_ ); @@ -789,8 +805,8 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isBoundary( const C -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isDomain( const ConstFlagFieldBaseIterator & it ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::isDomain( const ConstFlagFieldBaseIterator & it ) const { WALBERLA_ASSERT_EQUAL( it.getField(), flagField_ ); @@ -799,16 +815,16 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::isDomain( const Con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::containsBoundaryCondition( const BoundaryUID & uid ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::containsBoundaryCondition( const BoundaryUID & uid ) const { return containsBoundaryCondition( boundaryConditions_, uid ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::containsBoundaryCondition( const FlagUID & flag ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::containsBoundaryCondition( const FlagUID & flag ) const { if( !flagField_->flagExists( flag ) ) return false; @@ -818,26 +834,26 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::containsBoundaryCon -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Boundary_T > -inline const Boundary_T & BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryCondition( const BoundaryUID & uid ) const +inline const Boundary_T & BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryCondition( const BoundaryUID & uid ) const { - return getBoundaryCondition< Boundary_T, typename Tuple::head_type, typename Tuple::tail_type >( uid, boundaryConditions_ ); + return getBoundaryCondition< Boundary_T, std::tuple< Boundaries... > >( uid, boundaryConditions_ ); } -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Boundary_T > -inline Boundary_T & BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryCondition( const BoundaryUID & uid ) +inline Boundary_T & BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryCondition( const BoundaryUID & uid ) { return const_cast< Boundary_T & >( static_cast< const BoundaryHandling * >( this )->template getBoundaryCondition< Boundary_T >( uid ) ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryUID( const FlagUID & flag ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryUID( const FlagUID & flag ) const { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -846,8 +862,8 @@ inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryU -template< typename FlagField_T, typename Stencil, typename Tuple > -inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryUID( const flag_t flag ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryUID( const flag_t flag ) const { WALBERLA_ASSERT( field::isFlag( flag ) ); WALBERLA_ASSERT( flagField_->isRegistered( flag ) ); @@ -857,16 +873,16 @@ inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryU -template< typename FlagField_T, typename Stencil, typename Tuple > -inline uint_t BoundaryHandling< FlagField_T, Stencil, Tuple >::numberOfMatchingBoundaryConditions( const flag_t mask ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline uint_t BoundaryHandling< FlagField_T, Stencil, Boundaries... >::numberOfMatchingBoundaryConditions( const flag_t mask ) const { return numberOfMatchingBoundaryConditions( boundaryConditions_, mask ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::checkConsistency( const uint_t numberOfGhostLayersToInclude ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::checkConsistency( const uint_t numberOfGhostLayersToInclude ) const { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); return checkConsistency( cells ); @@ -874,8 +890,8 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::checkConsistency( c -template< typename FlagField_T, typename Stencil, typename Tuple > -bool BoundaryHandling< FlagField_T, Stencil, Tuple >::checkConsistency( const CellInterval & cells ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::checkConsistency( const CellInterval & cells ) const { CellInterval localCells( innerBB_ ); localCells.intersect( cells ); @@ -937,8 +953,8 @@ bool BoundaryHandling< FlagField_T, Stencil, Tuple >::checkConsistency( const Ce -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::refresh( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::refresh( const uint_t numberOfGhostLayersToInclude ) { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); refresh( cells ); @@ -946,8 +962,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::refresh( const uint -template< typename FlagField_T, typename Stencil, typename Tuple > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::refresh( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::refresh( const CellInterval & cells ) { CellInterval localCells( innerBB_ ); localCells.intersect( cells ); @@ -974,8 +990,8 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::refresh( const CellInterva -template< typename FlagField_T, typename Stencil, typename Tuple > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::refreshOutermostLayer( cell_idx_t thickness ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::refreshOutermostLayer( cell_idx_t thickness ) { uint_t extent = std::min( std::min( innerBB_.xSize(), innerBB_.ySize() ), innerBB_.zSize() ); WALBERLA_ASSERT_GREATER( extent, uint_t(0) ); @@ -1015,8 +1031,8 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::refreshOutermostLayer( cel -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( field::isFlag( domain_ ) ); setDomain( domain_, x, y, z ); @@ -1024,8 +1040,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const ce -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const flag_t domainSubFlag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setDomain( const flag_t domainSubFlag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); @@ -1037,8 +1053,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const fl -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setDomain( const CellInterval & cells ) { WALBERLA_ASSERT( field::isFlag( domain_ ) ); setDomain( domain_, cells ); @@ -1046,8 +1062,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const Ce -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const flag_t domainSubFlag, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setDomain( const flag_t domainSubFlag, const CellInterval & cells ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); WALBERLA_ASSERT( field::isFlag( domainSubFlag ) ); @@ -1090,9 +1106,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const fl -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setDomain( const CellIterator & begin, const CellIterator & end ) { WALBERLA_ASSERT( field::isFlag( domain_ ) ); setDomain( domain_, begin, end ); @@ -1100,9 +1116,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const Ce -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const flag_t domainSubFlag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setDomain( const flag_t domainSubFlag, const CellIterator & begin, const CellIterator & end ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); WALBERLA_ASSERT( field::isFlag( domainSubFlag ) ); @@ -1120,16 +1136,16 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setDomain( const fl -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { forceDomain( domain_, x, y, z ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const flag_t domainSubFlag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceDomain( const flag_t domainSubFlag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { clear( x, y, z ); @@ -1138,16 +1154,16 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceDomain( const CellInterval & cells ) { forceDomain( domain_, cells ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const flag_t domainSubFlag, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceDomain( const flag_t domainSubFlag, const CellInterval & cells ) { clear( cells ); setDomain( domainSubFlag, cells ); @@ -1155,18 +1171,18 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceDomain( const CellIterator & begin, const CellIterator & end ) { forceDomain( domain_, begin, end ); } -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const flag_t domainSubFlag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceDomain( const flag_t domainSubFlag, const CellIterator & begin, const CellIterator & end ) { clear( begin, end ); setDomain( domainSubFlag, begin, end ); @@ -1174,8 +1190,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_GREATER_EQUAL( flagField_->nrOfGhostLayers(), numberOfGhostLayersToInclude ); WALBERLA_ASSERT( field::isFlag( domain_ ) ); @@ -1184,8 +1200,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const flag_t domainSubFlag, const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const flag_t domainSubFlag, const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); WALBERLA_ASSERT( field::isFlag( domainSubFlag ) ); @@ -1197,8 +1213,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( field::isFlag( domain_ ) ); fillWithDomain( domain_, x, y, z ); @@ -1206,8 +1222,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const flag_t domainSubFlag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const flag_t domainSubFlag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); @@ -1219,8 +1235,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const CellInterval & cells ) { WALBERLA_ASSERT( field::isFlag( domain_ ) ); fillWithDomain( domain_, cells ); @@ -1228,8 +1244,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const flag_t domainSubFlag, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const flag_t domainSubFlag, const CellInterval & cells ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); WALBERLA_ASSERT( field::isFlag( domainSubFlag ) ); @@ -1253,18 +1269,18 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const CellIterator & begin, const CellIterator & end ) { fillWithDomain( domain_, begin, end ); } -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( const flag_t domainSubFlag, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::fillWithDomain( const flag_t domainSubFlag, const CellIterator & begin, const CellIterator & end ) { WALBERLA_ASSERT_EQUAL( domain_ & domainSubFlag, domainSubFlag ); @@ -1283,8 +1299,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::fillWithDomain( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline shared_ptr<BoundaryConfiguration> BoundaryHandling< FlagField_T, Stencil, Tuple >::createBoundaryConfiguration( const BoundaryUID & uid, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline shared_ptr<BoundaryConfiguration> BoundaryHandling< FlagField_T, Stencil, Boundaries... >::createBoundaryConfiguration( const BoundaryUID & uid, const Config::BlockHandle & config ) const { return createBoundaryConfiguration( boundaryConditions_, uid, config ); @@ -1292,8 +1308,8 @@ inline shared_ptr<BoundaryConfiguration> BoundaryHandling< FlagField_T, Stencil, -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const FlagUID & flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { @@ -1304,8 +1320,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { @@ -1319,8 +1335,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const FlagUID & flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const FlagUID & flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1330,8 +1346,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const flag_t flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT_EQUAL( flag & boundary_, flag ); @@ -1349,9 +1365,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1361,9 +1377,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const flag_t flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const flag_t flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT_EQUAL( flag & boundary_, flag ); @@ -1379,8 +1395,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( const FlagUID & flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceBoundary( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { @@ -1391,8 +1407,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( cons -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceBoundary( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { @@ -1403,8 +1419,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( cons -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( const FlagUID & flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceBoundary( const FlagUID & flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1414,8 +1430,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( cons -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( const flag_t flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceBoundary( const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { clear( cells ); @@ -1424,9 +1440,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( cons -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceBoundary( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1436,9 +1452,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( cons -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( const flag_t flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceBoundary( const flag_t flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { for( auto cell = begin; cell != end; ++cell ) @@ -1450,8 +1466,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceBoundary( cons -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( outerBB_.contains(x,y,z) ) { @@ -1463,8 +1479,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const flag_t mask, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( outerBB_.contains(x,y,z) ) @@ -1480,8 +1496,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_GREATER_EQUAL( flagField_->nrOfGhostLayers(), numberOfGhostLayersToInclude ); @@ -1491,8 +1507,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const CellInterval & cells ) { CellInterval localCells( outerBB_ ); localCells.intersect( cells ); @@ -1511,8 +1527,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const flag_t mask, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const flag_t mask, const CellInterval & cells ) { const flag_t dMask = mask & domain_; if( dMask == 0 ) @@ -1537,9 +1553,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const CellIterator & begin, const CellIterator & end ) { for( auto cell = begin; cell != end; ++cell ) removeDomain( cell->x(), cell->y(), cell->z() ); @@ -1547,9 +1563,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const flag_t mask, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeDomain( const flag_t mask, const CellIterator & begin, const CellIterator & end ) { const flag_t dMask = mask & domain_; if( dMask == 0 ) @@ -1575,8 +1591,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeDomain( const -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( outerBB_.contains(x,y,z) && flagField_->isPartOfMaskSet( x, y, z, boundary_ ) ) removeBoundary( boundaryConditions_, x, y, z ); @@ -1584,8 +1600,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const FlagUID & flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( !flagField_->flagExists( flag ) ) @@ -1596,8 +1612,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const flag_t mask, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { const flag_t bMask = mask & boundary_; @@ -1610,8 +1626,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_GREATER_EQUAL( flagField_->nrOfGhostLayers(), numberOfGhostLayersToInclude ); @@ -1621,8 +1637,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const CellInterval & cells ) { CellInterval localCells( outerBB_ ); localCells.intersect( cells ); @@ -1675,8 +1691,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const FlagUID & flag, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const FlagUID & flag, const CellInterval & cells ) { if( !flagField_->flagExists( flag ) ) return; @@ -1686,8 +1702,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const flag_t mask, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const flag_t mask, const CellInterval & cells ) { const flag_t bMask = mask & boundary_; if( bMask == 0 ) @@ -1703,18 +1719,18 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const CellIterator & begin, const CellIterator & end ) { removeBoundary( boundary_, begin, end ); } -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const FlagUID & flag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const FlagUID & flag, const CellIterator & begin, const CellIterator & end ) { if( !flagField_->flagExists( flag ) ) return; @@ -1724,9 +1740,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( const flag_t mask, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( const flag_t mask, const CellIterator & begin, const CellIterator & end ) { const flag_t bMask = mask & boundary_; if( bMask == 0 ) @@ -1745,8 +1761,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1756,8 +1772,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const Flag -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -1775,8 +1791,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const flag -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const FlagUID & flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setFlag( const FlagUID & flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1786,8 +1802,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const Flag -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const flag_t flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setFlag( const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -1812,9 +1828,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const flag -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1824,9 +1840,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const Flag -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -1848,8 +1864,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setFlag( const flag -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1859,8 +1875,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const Fl -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -1875,8 +1891,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const fl -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const FlagUID & flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceFlag( const FlagUID & flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1886,8 +1902,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const Fl -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const flag_t flag, const CellInterval & cells, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceFlag( const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -1909,9 +1925,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const fl -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1921,9 +1937,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const Fl -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::forceFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -1942,8 +1958,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::forceFlag( const fl -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const FlagUID & flag, const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const FlagUID & flag, const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1952,8 +1968,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const F -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const flag_t flag, const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const flag_t flag, const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_GREATER_EQUAL( flagField_->nrOfGhostLayers(), numberOfGhostLayersToInclude ); @@ -1963,8 +1979,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const f -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1973,8 +1989,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const F -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( ( flag & boundary_ ) == flag ) removeBoundary( flag, x, y, z ); @@ -1986,8 +2002,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const f -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const FlagUID & flag, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const FlagUID & flag, const CellInterval & cells ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1996,8 +2012,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const F -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const flag_t flag, const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const flag_t flag, const CellInterval & cells ) { if( ( flag & boundary_ ) == flag ) removeBoundary( flag, cells ); @@ -2016,9 +2032,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const f -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -2027,9 +2043,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const F -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end ) { if( ( flag & boundary_ ) == flag ) removeBoundary( flag, begin, end ); @@ -2045,8 +2061,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeFlag( const f -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::clear( const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_GREATER_EQUAL( flagField_->nrOfGhostLayers(), numberOfGhostLayersToInclude ); @@ -2056,8 +2072,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const uint_t -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::clear( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( outerBB_.contains(x,y,z) ) { @@ -2073,8 +2089,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const cell_i -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::clear( const CellInterval & cells ) { CellInterval localCells( outerBB_ ); localCells.intersect( cells ); @@ -2112,9 +2128,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const CellIn -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::clear( const CellIterator & begin, const CellIterator & end ) { for( auto cell = begin; cell != end; ++cell ) clear( cell->x(), cell->y(), cell->z() ); @@ -2122,8 +2138,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::clear( const CellIt -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::operator()( const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT_LESS( numberOfGhostLayersToInclude, flagField_->nrOfGhostLayers() ); WALBERLA_ASSERT( checkConsistency( numberOfGhostLayersToInclude ) ); @@ -2182,8 +2198,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const u -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::operator()( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( innerBB_.contains(x,y,z) ); @@ -2203,8 +2219,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const c -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::operator()( const CellInterval & cells ) { CellInterval localCells( innerBB_ ); localCells.intersect( cells ); @@ -2234,9 +2250,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const C -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename CellIterator > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::operator()( const CellIterator & begin, const CellIterator & end ) { for( auto cell = begin; cell != end; ++cell ) { @@ -2251,9 +2267,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::operator()( const C -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( Buffer_T & buffer, const CellInterval & interval, const bool assumeIdenticalFlagMapping ) const +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::pack( Buffer_T & buffer, const CellInterval & interval, const bool assumeIdenticalFlagMapping ) const { WALBERLA_UNUSED( assumeIdenticalFlagMapping ); @@ -2283,9 +2299,9 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( Buffer_T & buffer, c -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpack( Buffer_T & buffer, const CellInterval & interval, const bool assumeIdenticalFlagMapping ) +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::unpack( Buffer_T & buffer, const CellInterval & interval, const bool assumeIdenticalFlagMapping ) { bool identicalFlagMapping = false; std::vector< flag_t > flagMapping = getNeighborFlagMapping( buffer, assumeIdenticalFlagMapping, identicalFlagMapping ); // neighbor-flag_t -> flag_t @@ -2322,9 +2338,9 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpack( Buffer_T & buffer, -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::pack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, const bool assumeIdenticalFlagMapping ) const { CellInterval interval = getPackingInterval( direction, numberOfLayers ); @@ -2333,9 +2349,9 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( Buffer_T & buffer, s -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::unpack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, const bool assumeIdenticalFlagMapping ) { CellInterval interval = getUnpackingInterval( direction, numberOfLayers ); @@ -2344,8 +2360,8 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpack( Buffer_T & buffer, -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::toStream( std::ostream & os ) const { +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::toStream( std::ostream & os ) const { os << "==================== BoundaryHandling ====================\n\n" << "Identifier: " << uid_.getIdentifier() << "\n\n" @@ -2370,8 +2386,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::toStream( std::ostr -template< typename FlagField_T, typename Stencil, typename Tuple > -inline std::string BoundaryHandling< FlagField_T, Stencil, Tuple >::toString() const { +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline std::string BoundaryHandling< FlagField_T, Stencil, Boundaries... >::toString() const { std::ostringstream oss; toStream( oss ); @@ -2380,8 +2396,8 @@ inline std::string BoundaryHandling< FlagField_T, Stencil, Tuple >::toString() c -template< typename FlagField_T, typename Stencil, typename Tuple > -CellInterval BoundaryHandling< FlagField_T, Stencil, Tuple >::getGhostLayerCellInterval( const uint_t numberOfGhostLayersToInclude ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +CellInterval BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getGhostLayerCellInterval( const uint_t numberOfGhostLayersToInclude ) const { CellInterval cells( -cell_idx_c( numberOfGhostLayersToInclude ), -cell_idx_c( numberOfGhostLayersToInclude ), @@ -2394,11 +2410,12 @@ CellInterval BoundaryHandling< FlagField_T, Stencil, Tuple >::getGhostLayerCellI -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::setupBoundaryConditions( boost::tuples::cons<Head, Tail> & boundaryConditions ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setupBoundaryConditions( BoundariesTuple & boundaryConditions ) { - Head & boundaryCondition = boundaryConditions.get_head(); + using BoundaryType = typename std::tuple_element<N, BoundariesTuple>::type; + BoundaryType & boundaryCondition = std::get<N>( boundaryConditions ); if( numberOfMatchingBoundaryConditions( boundaryCondition.getUID() ) != 1 ) WALBERLA_ABORT( "Every boundary condition registered at the same boundary handler must have a unique boundary UID!\n" @@ -2423,15 +2440,15 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::setupBoundaryConditions( b bcMaskMapping_.push_back( mask ); - threadSafeBCs_ &= isThreadSafe< Head >::value; + threadSafeBCs_ &= isThreadSafe< BoundaryType >::value; - setupBoundaryConditions( boundaryConditions.get_tail() ); + setupBoundaryConditions< BoundariesTuple, N-1 >( boundaryConditions ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline std::vector< BoundaryUID > BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryUIDs() const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline std::vector< BoundaryUID > BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryUIDs() const { std::vector< BoundaryUID > uids; getBoundaryUIDs( boundaryConditions_, uids ); @@ -2440,23 +2457,23 @@ inline std::vector< BoundaryUID > BoundaryHandling< FlagField_T, Stencil, Tuple -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryUIDs( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryUIDs( const BoundariesTuple & boundaryConditions, std::vector< BoundaryUID > & uids ) const { - uids.push_back( boundaryConditions.get_head().getUID() ); - getBoundaryUIDs( boundaryConditions.get_tail(), uids ); + uids.push_back( std::get<N>( boundaryConditions ).getUID() ); + getBoundaryUIDs< BoundariesTuple, N-1 >( boundaryConditions, uids ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryUID( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), BoundaryUID>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryUID( const BoundariesTuple & boundaryConditions, const flag_t flag ) const { - const Head & boundaryCondition = boundaryConditions.get_head(); + const auto & boundaryCondition = std::get<N>( boundaryConditions ); if( ( boundaryCondition.getMask() & flag ) == flag ) { @@ -2464,14 +2481,15 @@ inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryU } else { - return getBoundaryUID( boundaryConditions.get_tail(), flag ); + return getBoundaryUID< BoundariesTuple, N-1 >( boundaryConditions, flag ); } } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryUID( const boost::tuples::null_type &, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N==-1), BoundaryUID>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryUID( const BoundariesTuple &, const flag_t flag ) const { if( !flagField_->isRegistered( flag ) ) @@ -2489,65 +2507,65 @@ inline BoundaryUID BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryU -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::containsBoundaryCondition( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::containsBoundaryCondition( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid ) const { - if( boundaryConditions.get_head().getUID() == uid ) + if( std::get<N>( boundaryConditions ).getUID() == uid ) return true; - return containsBoundaryCondition( boundaryConditions.get_tail(), uid ); + return containsBoundaryCondition< BoundariesTuple, N-1 >( boundaryConditions, uid ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline typename BoundaryHandling< FlagField_T, Stencil, Tuple >::flag_t - BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryMask( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), typename BoundaryHandling< FlagField_T, Stencil, Boundaries... >::flag_t>::type + BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryMask( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid ) const { - const Head & boundaryCondition = boundaryConditions.get_head(); + const auto & boundaryCondition = std::get<N>( boundaryConditions ); if( boundaryCondition.getUID() == uid ) return boundaryCondition.getMask(); - return getBoundaryMask( boundaryConditions.get_tail(), uid ); + return getBoundaryMask< BoundariesTuple, N-1 >( boundaryConditions, uid ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline uint_t BoundaryHandling< FlagField_T, Stencil, Tuple >::numberOfMatchingBoundaryConditions( const BoundaryUID & uid ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline uint_t BoundaryHandling< FlagField_T, Stencil, Boundaries... >::numberOfMatchingBoundaryConditions( const BoundaryUID & uid ) const { return numberOfMatchingBoundaryConditions( boundaryConditions_, uid ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline uint_t BoundaryHandling< FlagField_T, Stencil, Tuple >::numberOfMatchingBoundaryConditions( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), uint_t>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::numberOfMatchingBoundaryConditions( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid ) const { - return ( ( boundaryConditions.get_head().getUID() == uid ) ? uint_c(1) : uint_c(0) ) + - numberOfMatchingBoundaryConditions( boundaryConditions.get_tail(), uid ); + return ( ( std::get<N>( boundaryConditions ).getUID() == uid ) ? uint_c(1) : uint_c(0) ) + + numberOfMatchingBoundaryConditions< BoundariesTuple, N-1 >( boundaryConditions, uid ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline uint_t BoundaryHandling< FlagField_T, Stencil, Tuple >::numberOfMatchingBoundaryConditions( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), uint_t>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::numberOfMatchingBoundaryConditions( const BoundariesTuple & boundaryConditions, const flag_t mask ) const { - return ( ( ( boundaryConditions.get_head().getMask() & mask ) != 0 ) ? uint_c(1) : uint_c(0) ) + - numberOfMatchingBoundaryConditions( boundaryConditions.get_tail(), mask ); + return ( ( ( std::get<N>( boundaryConditions ).getMask() & mask ) != 0 ) ? uint_c(1) : uint_c(0) ) + + numberOfMatchingBoundaryConditions< BoundariesTuple, N-1 >( boundaryConditions, mask ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::checkFlagField( const uint_t numberOfGhostLayersToInclude ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline bool BoundaryHandling< FlagField_T, Stencil, Boundaries... >::checkFlagField( const uint_t numberOfGhostLayersToInclude ) const { if( !flagField_->isRegistered( nearBoundary_ ) ) return false; @@ -2589,8 +2607,8 @@ inline bool BoundaryHandling< FlagField_T, Stencil, Tuple >::checkFlagField( con -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::addDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const flag_t domain ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::addDomain( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const flag_t domain ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); WALBERLA_ASSERT_EQUAL( domain_ & domain, domain ); @@ -2617,19 +2635,23 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::addDomain( const ce -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline shared_ptr<BoundaryConfiguration> BoundaryHandling< FlagField_T, Stencil, Tuple >::createBoundaryConfiguration( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), shared_ptr<BoundaryConfiguration>>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::createBoundaryConfiguration( const BoundariesTuple & boundaryConditions, const BoundaryUID & uid, const Config::BlockHandle & config ) const { - if( boundaryConditions.get_head().getUID() == uid ) - return Head::createConfiguration( config ); + using BoundaryType = typename std::tuple_element<N, BoundariesTuple>::type; + const BoundaryType & boundaryCondition = std::get<N>( boundaryConditions ); + + if( boundaryCondition.getUID() == uid ) + return BoundaryType::createConfiguration( config ); - return createBoundaryConfiguration( boundaryConditions.get_tail(), uid, config ); + return createBoundaryConfiguration< BoundariesTuple, N-1 >( boundaryConditions, uid, config ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline shared_ptr<BoundaryConfiguration> BoundaryHandling< FlagField_T, Stencil, Tuple >::createBoundaryConfiguration( const boost::tuples::null_type &, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N==-1), shared_ptr<BoundaryConfiguration>>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::createBoundaryConfiguration( const BoundariesTuple &, const BoundaryUID & uid, const Config::BlockHandle & ) const { WALBERLA_CHECK( false, "There is no boundary condition registered at boundary handling " << uid_ << " for a boundary with UID" << uid << "." ); @@ -2639,8 +2661,8 @@ inline shared_ptr<BoundaryConfiguration> BoundaryHandling< FlagField_T, Stencil, -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::addNearBoundary( const CellInterval & cells ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::addNearBoundary( const CellInterval & cells ) { WALBERLA_ASSERT( innerBB_.contains( cells ) ); @@ -2660,8 +2682,8 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::addNearBoundary( co -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::addBoundary( const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::addBoundary( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); @@ -2683,15 +2705,15 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::addBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( BoundariesTuple & boundaryConditions, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); if( ( boundaryCondition.getMask() & flag ) == flag ) { addBoundary( flag, x, y, z ); @@ -2699,11 +2721,12 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( boost: boundaryCondition.registerCell( flag, x, y, z, parameter ); } else - setBoundary( boundaryConditions.get_tail(), flag, x, y, z, parameter ); + setBoundary< BoundariesTuple, N-1 >( boundaryConditions, flag, x, y, z, parameter ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const boost::tuples::null_type &, const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N==-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const BoundariesTuple &, const flag_t flag, const cell_idx_t, const cell_idx_t, const cell_idx_t, const BoundaryConfiguration & ) const { @@ -2719,15 +2742,15 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( BoundariesTuple & boundaryConditions, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( outerBB_.contains( cells ) ); WALBERLA_ASSERT( !cells.empty() ); - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); if( ( boundaryCondition.getMask() & flag ) == flag ) { // setting boundary flag @@ -2751,11 +2774,12 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( boost: boundaryCondition.registerCells( flag, cells, parameter ); } else - setBoundary( boundaryConditions.get_tail(), flag, cells, parameter ); + setBoundary< BoundariesTuple, N-1 >( boundaryConditions, flag, cells, parameter ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const boost::tuples::null_type &, const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N==-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const BoundariesTuple &, const flag_t flag, const CellInterval &, const BoundaryConfiguration & ) const { if( flagField_->isRegistered( flag ) ) @@ -2770,15 +2794,15 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( BoundariesTuple & boundaryConditions, const flag_t flag, const CellVector & cells, const BoundaryConfiguration & parameter ) { if( cells.empty() ) return; - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); if( ( boundaryCondition.getMask() & flag ) == flag ) { for( auto cell = cells.begin(); cell != cells.end(); ++cell ) @@ -2787,11 +2811,12 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( boost: boundaryCondition.registerCells( flag, cells.begin(), cells.end(), parameter ); } else - setBoundary( boundaryConditions.get_tail(), flag, cells, parameter ); + setBoundary< BoundariesTuple, N-1 >( boundaryConditions, flag, cells, parameter ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const boost::tuples::null_type &, const flag_t flag, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N==-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::setBoundary( const BoundariesTuple &, const flag_t flag, const CellVector &, const BoundaryConfiguration & ) const { if( flagField_->isRegistered( flag ) ) @@ -2806,16 +2831,16 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::setBoundary( const -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::removeBoundary( BoundariesTuple & boundaryConditions, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const bool checkNearBoundaryFlags ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); WALBERLA_ASSERT( flagField_->isPartOfMaskSet( x, y, z, boundary_ ) ); - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); if( flagField_->isPartOfMaskSet( x, y, z, boundaryCondition.getMask() ) ) { @@ -2858,18 +2883,18 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::removeBoundary( boo } else { - removeBoundary( boundaryConditions.get_tail(), x, y, z, checkNearBoundaryFlags ); + removeBoundary< BoundariesTuple, N-1 >( boundaryConditions, x, y, z, checkNearBoundaryFlags ); } } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::treatDirection( boost::tuples::cons<Head, Tail> & boundaryConditions, const uint_t index, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::treatDirection( BoundariesTuple & boundaryConditions, const uint_t index, const std::vector< std::vector< std::pair< Cell, stencil::Direction > > > & cellDirectionPairs ) { - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); WALBERLA_ASSERT_LESS( index, cellDirectionPairs.size() ); @@ -2892,19 +2917,19 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::treatDirection( boo boundaryCondition.treatDirection( x, y, z, direction, nx, ny, nz, flagField_->get(nx,ny,nz) ); } - treatDirection( boundaryConditions.get_tail(), index + uint_t(1), cellDirectionPairs ); + treatDirection< BoundariesTuple, N-1 >( boundaryConditions, index + uint_t(1), cellDirectionPairs ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::treatDirection( boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::treatDirection( BoundariesTuple & boundaryConditions, 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 ) { - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); if( flagField_->isPartOfMaskSet( nx, ny, nz, boundaryCondition.getMask() ) ) { @@ -2912,37 +2937,37 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::treatDirection( boo } else { - treatDirection( boundaryConditions.get_tail(), x, y, z, dir, nx, ny, nz ); + treatDirection< BoundariesTuple, N-1 >( boundaryConditions, x, y, z, dir, nx, ny, nz ); } } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::beforeBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryConditions ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::beforeBoundaryTreatment( BoundariesTuple & boundaryConditions ) { - boundaryConditions.get_head().beforeBoundaryTreatment(); + std::get<N>( boundaryConditions ).beforeBoundaryTreatment(); - beforeBoundaryTreatment( boundaryConditions.get_tail() ); + beforeBoundaryTreatment< BoundariesTuple, N-1 >( boundaryConditions ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::afterBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryConditions ) +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::afterBoundaryTreatment( BoundariesTuple & boundaryConditions ) { - boundaryConditions.get_head().afterBoundaryTreatment(); + std::get<N>( boundaryConditions ).afterBoundaryTreatment(); - afterBoundaryTreatment( boundaryConditions.get_tail() ); + afterBoundaryTreatment< BoundariesTuple, N-1 >( boundaryConditions ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -inline std::map< std::string, typename BoundaryHandling< FlagField_T, Stencil, Tuple >::flag_t > -BoundaryHandling< FlagField_T, Stencil, Tuple >::getFlagMapping() const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline std::map< std::string, typename BoundaryHandling< FlagField_T, Stencil, Boundaries... >::flag_t > +BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getFlagMapping() const { std::map< std::string, flag_t > mapping; const auto uidMapping = flagField_->getMapping(); @@ -2953,10 +2978,10 @@ BoundaryHandling< FlagField_T, Stencil, Tuple >::getFlagMapping() const -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -std::vector< typename BoundaryHandling< FlagField_T, Stencil, Tuple >::flag_t > -BoundaryHandling< FlagField_T, Stencil, Tuple >::getNeighborFlagMapping( Buffer_T & buffer, const bool assumeIdenticalFlagMapping, +std::vector< typename BoundaryHandling< FlagField_T, Stencil, Boundaries... >::flag_t > +BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getNeighborFlagMapping( Buffer_T & buffer, const bool assumeIdenticalFlagMapping, bool & identicalFlagMapping ) const { identicalFlagMapping = assumeIdenticalFlagMapping; @@ -3000,8 +3025,8 @@ BoundaryHandling< FlagField_T, Stencil, Tuple >::getNeighborFlagMapping( Buffer_ -template< typename FlagField_T, typename Stencil, typename Tuple > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::translateMask( flag_t & mask, const std::vector< flag_t > & flagMapping ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::translateMask( flag_t & mask, const std::vector< flag_t > & flagMapping ) const { flag_t neighbor( mask ); mask = static_cast< flag_t >(0); @@ -3012,8 +3037,8 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::translateMask( flag_t & ma -template< typename FlagField_T, typename Stencil, typename Tuple > -CellInterval BoundaryHandling< FlagField_T, Stencil, Tuple >::getPackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +CellInterval BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getPackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const { CellInterval interval = getUnpackingInterval( direction, numberOfLayers ); @@ -3029,8 +3054,8 @@ CellInterval BoundaryHandling< FlagField_T, Stencil, Tuple >::getPackingInterval -template< typename FlagField_T, typename Stencil, typename Tuple > -CellInterval BoundaryHandling< FlagField_T, Stencil, Tuple >::getUnpackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const +template< typename FlagField_T, typename Stencil, typename... Boundaries > +CellInterval BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getUnpackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const { WALBERLA_ASSERT_GREATER_EQUAL( numberOfLayers, uint_t(1) ); WALBERLA_ASSERT( stencil::cx[direction] == 0 || outerBB_.xSize() >= ( uint_c(4) * numberOfLayers ) ); @@ -3058,9 +3083,9 @@ CellInterval BoundaryHandling< FlagField_T, Stencil, Tuple >::getUnpackingInterv -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( Buffer_T & buffer, const flag_t mask, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::pack( Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { if( field::isPartOfMaskSet( mask, boundary_ ) ) @@ -3069,25 +3094,25 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( Buffer_T & bu -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Buffer_T, typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::pack( const boost::tuples::cons<Head, Tail> & boundaryConditions, Buffer_T & buffer, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename Buffer_T, typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::pack( const BoundariesTuple & boundaryConditions, Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { - const Head & boundaryCondition = boundaryConditions.get_head(); + const auto & boundaryCondition = std::get<N>( boundaryConditions ); if( field::isPartOfMaskSet( mask, boundaryCondition.getMask() ) ) { boundaryCondition.packCell( buffer, x, y, z ); } else - pack( boundaryConditions.get_tail(), buffer, mask, x, y, z ); + pack< Buffer_T, BoundariesTuple, N-1 >( boundaryConditions, buffer, mask, x, y, z ); } -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpack( Buffer_T & buffer, const flag_t flag, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::unpack( Buffer_T & buffer, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( field::isFlag(flag) ); @@ -3100,9 +3125,9 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpack( Buffer_T & -template< typename FlagField_T, typename Stencil, typename Tuple > +template< typename FlagField_T, typename Stencil, typename... Boundaries > template< typename Buffer_T > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpackBoundary( Buffer_T & buffer, const flag_t flag, +inline void BoundaryHandling< FlagField_T, Stencil, Boundaries... >::unpackBoundary( Buffer_T & buffer, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT_EQUAL( flag & boundary_, flag ); @@ -3115,15 +3140,15 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpackBoundary( Buf -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Buffer_T, typename Head, typename Tail > -inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpackBoundary( boost::tuples::cons<Head, Tail> & boundaryConditions, Buffer_T & buffer, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename Buffer_T, typename BoundariesTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::unpackBoundary( BoundariesTuple & boundaryConditions, Buffer_T & buffer, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); - Head & boundaryCondition = boundaryConditions.get_head(); + auto & boundaryCondition = std::get<N>( boundaryConditions ); if( ( boundaryCondition.getMask() & flag ) == flag ) { addBoundary( flag, x, y, z ); @@ -3131,17 +3156,17 @@ inline void BoundaryHandling< FlagField_T, Stencil, Tuple >::unpackBoundary( boo boundaryCondition.registerCell( buffer, flag, x, y, z ); } else - unpackBoundary( boundaryConditions.get_tail(), buffer, flag, x, y, z ); + unpackBoundary< Buffer_T, BoundariesTuple, N-1 >( boundaryConditions, buffer, flag, x, y, z ); } -template< typename FlagField_T, typename Stencil, typename Tuple > -template< typename Head, typename Tail > -void BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryConditions( const boost::tuples::cons<Head, Tail> & boundaryConditions, +template< typename FlagField_T, typename Stencil, typename... Boundaries > +template< typename BoundariesTuple, int N > +typename std::enable_if<(N!=-1), void>::type BoundaryHandling< FlagField_T, Stencil, Boundaries... >::getBoundaryConditions( const BoundariesTuple & boundaryConditions, std::vector< std::string > & bcs ) const { - const Head & boundaryCondition = boundaryConditions.get_head(); + const auto & boundaryCondition = std::get<N>( boundaryConditions ); std::ostringstream oss; oss << boundaryCondition.getUID().getIdentifier() << " ("; @@ -3161,7 +3186,7 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryConditions( con bcs.push_back( oss.str() ); - getBoundaryConditions( boundaryConditions.get_tail(), bcs ); + getBoundaryConditions< BoundariesTuple, N-1 >( boundaryConditions, bcs ); } @@ -3172,8 +3197,8 @@ void BoundaryHandling< FlagField_T, Stencil, Tuple >::getBoundaryConditions( con using boundary::BoundaryHandling; -template< typename FlagField_T, typename Stencil, typename Tuple > -inline std::ostream & operator<<( std::ostream & os, const BoundaryHandling< FlagField_T, Stencil, Tuple > & boundaryHandling ) { +template< typename FlagField_T, typename Stencil, typename... Boundaries > +inline std::ostream & operator<<( std::ostream & os, const BoundaryHandling< FlagField_T, Stencil, Boundaries... > & boundaryHandling ) { boundaryHandling.toStream( os ); return os; diff --git a/src/boundary/BoundaryHandlingCollection.h b/src/boundary/BoundaryHandlingCollection.h index b30ba815e269e241b76cb730f0c50c82e2503701..66292b4b8e8b7bad9f6a2014fd1a0ea7bfb3b414 100644 --- a/src/boundary/BoundaryHandlingCollection.h +++ b/src/boundary/BoundaryHandlingCollection.h @@ -35,7 +35,7 @@ #include "field/FlagField.h" -#include <boost/tuple/tuple.hpp> +#include <tuple> #include <ostream> #include <string> @@ -53,7 +53,7 @@ typedef UID< BHCUIDGenerator > BoundaryHandlingCollectionUID; -template< typename FlagField_T, typename Tuple > // Tuple: all the boundary handlers that are considered by this boundary handling collection +template< typename FlagField_T, typename... Handlers > // Handlers: all the boundary handlers that are considered by this boundary handling collection class BoundaryHandlingCollection { public: @@ -79,7 +79,7 @@ public: - BoundaryHandlingCollection( const std::string & identifier, FlagField_T * const flagField, const Tuple & boundaryHandlers ); + BoundaryHandlingCollection( const std::string & identifier, FlagField_T * const flagField, const Handlers & ... boundaryHandlers ); bool operator==( const BoundaryHandlingCollection & ) const { WALBERLA_ASSERT( false ); return false; } // For testing purposes, block data items must be comparable with operator "==". // Since instances of type "BoundaryHandlingCollection" are registered as block data items, @@ -229,21 +229,25 @@ private: CellInterval getGhostLayerCellInterval( const uint_t numberOfGhostLayersToInclude ) const; - template< typename Head, typename Tail > - inline bool isEmpty( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; - inline bool isEmpty( const boost::tuples::null_type &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return true; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type isEmpty( const HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type isEmpty( const HandlersTuple &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return true; } - template< typename Head, typename Tail > - inline bool isEmpty( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const ConstFlagFieldBaseIterator & it ) const; - inline bool isEmpty( const boost::tuples::null_type &, const ConstFlagFieldBaseIterator & ) const { return true; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type isEmpty( const HandlersTuple & boundaryHandlers, const ConstFlagFieldBaseIterator & it ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type isEmpty( const HandlersTuple &, const ConstFlagFieldBaseIterator & ) const { return true; } - template< typename Head, typename Tail > - inline bool consideredByAllHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; - inline bool consideredByAllHandlers( const boost::tuples::null_type &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return true; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type consideredByAllHandlers( const HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type consideredByAllHandlers( const HandlersTuple &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return true; } - template< typename Head, typename Tail > - inline bool consideredByAllHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const ConstFlagFieldBaseIterator & it ) const; - inline bool consideredByAllHandlers( const boost::tuples::null_type &, const ConstFlagFieldBaseIterator & ) const { return true; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type consideredByAllHandlers( const HandlersTuple & boundaryHandlers, const ConstFlagFieldBaseIterator & it ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type consideredByAllHandlers( const HandlersTuple &, const ConstFlagFieldBaseIterator & ) const { return true; } //** Get Boundary Handling (private helper functions) *************************************************************** /*! \name Get Boundary Handling (private helper functions) */ @@ -251,246 +255,251 @@ private: // matching type (-> BoundaryHandling_T) not yet found ... - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, Tail> & boundaryHandlers, - typename std::enable_if< std::is_same< BoundaryHandling_T, Head >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, - std::false_type >::value >::type* /*dummy*/ = 0 ) const + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), BoundaryHandling_T>::type & getBoundaryHandling( const BoundaryHandlingUID & uid, const HandlersTuple & boundaryHandlers, + typename std::enable_if< std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryHandlers.get_head().getUID() ) - return boundaryHandlers.get_head(); + if( uid == std::get<N>( boundaryHandlers ).getUID() ) + return std::get<N>( boundaryHandlers ); else - return getBoundaryHandling_TypeExists< BoundaryHandling_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryHandlers.get_tail() ); + return getBoundaryHandling_TypeExists< BoundaryHandling_T, HandlersTuple, N-1 >( uid, boundaryHandlers ); } - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, boost::tuples::null_type> & boundaryHandlers, - typename std::enable_if< std::is_same< BoundaryHandling_T, Head >::value >::type* /*dummy*/ = 0 ) const + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N==0), BoundaryHandling_T>::type & getBoundaryHandling( const BoundaryHandlingUID & uid, const HandlersTuple & boundaryHandlers, + typename std::enable_if< std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryHandlers.get_head().getUID() ) - return boundaryHandlers.get_head(); + if( uid == std::get<N>( boundaryHandlers ).getUID() ) + return std::get<N>( boundaryHandlers ); else WALBERLA_ABORT( "The requested boundary handler " << uid.getIdentifier() << " is not part of this boundary handling collection." ); } - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, Tail> & boundaryHandlers, - typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, Head >::type, - std::false_type >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), BoundaryHandling_T>::type & getBoundaryHandling( const BoundaryHandlingUID & uid, const HandlersTuple & boundaryHandlers, + typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { - return getBoundaryHandling< BoundaryHandling_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryHandlers.get_tail() ); + return getBoundaryHandling< BoundaryHandling_T, HandlersTuple, N-1 >( uid, boundaryHandlers ); } - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling( const BoundaryHandlingUID & /*uid*/, const boost::tuples::cons<Head, boost::tuples::null_type> & /*boundaryHandlers*/, - typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, Head >::type, + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N==0), BoundaryHandling_T>::type & getBoundaryHandling( const BoundaryHandlingUID & /*uid*/, const HandlersTuple & /*boundaryHandlers*/, + typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { static_assert( sizeof(BoundaryHandling_T) == 0, "The requested boundary handling is not part of this boundary handling collection." ); } - //template< typename BoundaryHandling_T > - //inline const BoundaryHandling_T & getBoundaryHandling( const BoundaryHandlingUID & /*uid*/, const boost::tuples::null_type & ) const - //{ - // static_assert( sizeof(BoundaryHandling_T) == 0, "The requested boundary handling is not part of this boundary handling collection." ); - //} - // matching type (-> BoundaryHandling_T) exists! - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, Tail> & boundaryHandlers, - typename std::enable_if< std::is_same< BoundaryHandling_T, Head >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, - std::false_type >::value >::type* /*dummy*/ = 0 ) const + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), BoundaryHandling_T>::type & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const HandlersTuple & boundaryHandlers, + typename std::enable_if< std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryHandlers.get_head().getUID() ) - return boundaryHandlers.get_head(); + if( uid == std::get<N>( boundaryHandlers ).getUID() ) + return std::get<N>( boundaryHandlers ); else - return getBoundaryHandling_TypeExists< BoundaryHandling_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryHandlers.get_tail() ); + return getBoundaryHandling_TypeExists< BoundaryHandling_T, HandlersTuple, N-1 >( uid, boundaryHandlers ); } - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, boost::tuples::null_type> & boundaryHandlers, - typename std::enable_if< std::is_same< BoundaryHandling_T, Head >::value >::type* /*dummy*/ = 0 ) const + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N==0), BoundaryHandling_T>::type & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const HandlersTuple & boundaryHandlers, + typename std::enable_if< std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::value >::type* /*dummy*/ = 0 ) const { - if( uid == boundaryHandlers.get_head().getUID() ) - return boundaryHandlers.get_head(); + if( uid == std::get<N>( boundaryHandlers ).getUID() ) + return std::get<N>( boundaryHandlers ); else WALBERLA_ABORT( "The requested boundary handler " << uid.getIdentifier() << " is not part of this boundary handling collection." ); } - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, Tail> & boundaryHandlers, - typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, Head >::type, - std::false_type >::value >::type* /*dummy*/ = 0, - typename std::enable_if< std::is_same< typename std::is_same< Tail, boost::tuples::null_type >::type, + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N!=0), BoundaryHandling_T>::type & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const HandlersTuple & boundaryHandlers, + typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { - return getBoundaryHandling_TypeExists< BoundaryHandling_T, typename Tail::head_type, typename Tail::tail_type >( uid, boundaryHandlers.get_tail() ); + return getBoundaryHandling_TypeExists< BoundaryHandling_T, HandlersTuple, N-1 >( uid, boundaryHandlers ); } - template< typename BoundaryHandling_T, typename Head, typename Tail > - inline const BoundaryHandling_T & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const boost::tuples::cons<Head, boost::tuples::null_type> & /*boundaryHandlers*/, - typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, Head >::type, + template< typename BoundaryHandling_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline const typename std::enable_if<(N==0), BoundaryHandling_T>::type & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const HandlersTuple & /*boundaryHandlers*/, + typename std::enable_if< std::is_same< typename std::is_same< BoundaryHandling_T, typename std::tuple_element<N, HandlersTuple>::type >::type, std::false_type >::value >::type* /*dummy*/ = 0 ) const { WALBERLA_ABORT( "The requested boundary handler " << uid.getIdentifier() << " is not part of this boundary handling collection." ); } - //template< typename BoundaryHandling_T > - //inline const BoundaryHandling_T & getBoundaryHandling_TypeExists( const BoundaryHandlingUID & uid, const boost::tuples::null_type & ) const - //{ - // WALBERLA_ABORT( "The requested boundary handler " << uid.getIdentifier() << " is not part of this boundary handling collection." ); - //} - //@} //******************************************************************************************************************* - template< typename Head, typename Tail > - inline void checkForUniqueBoundaryHandlingUIDs( const boost::tuples::cons<Head, Tail> & boundaryHandlers ) const; - inline void checkForUniqueBoundaryHandlingUIDs( const boost::tuples::null_type & ) const {} + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type checkForUniqueBoundaryHandlingUIDs( const HandlersTuple & boundaryHandlers ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type checkForUniqueBoundaryHandlingUIDs( const HandlersTuple & ) const {} inline std::vector< BoundaryUID > getBoundaryUIDs() const; - template< typename Head, typename Tail > - inline void getBoundaryUIDs( const boost::tuples::cons<Head, Tail> & boundaryHandlers, std::vector< BoundaryUID > & uids ) const; - inline void getBoundaryUIDs( const boost::tuples::null_type &, std::vector< BoundaryUID > & ) const {} + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type getBoundaryUIDs( const HandlersTuple & boundaryHandlers, std::vector< BoundaryUID > & uids ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type getBoundaryUIDs( const HandlersTuple &, std::vector< BoundaryUID > & ) const {} - template< typename Head, typename Tail > - inline bool checkForIdenticalFlagFields( const boost::tuples::cons<Head, Tail> & boundaryHandlers ) const; - inline bool checkForIdenticalFlagFields( const boost::tuples::null_type & ) const { return true; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type checkForIdenticalFlagFields( const HandlersTuple & boundaryHandlers ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type checkForIdenticalFlagFields( const HandlersTuple & ) const { return true; } inline uint_t numberOfMatchingBoundaryHandlers( const BoundaryHandlingUID & uid ) const; - template< typename Head, typename Tail > - inline uint_t numberOfMatchingBoundaryHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const BoundaryHandlingUID & uid ) const; - inline uint_t numberOfMatchingBoundaryHandlers( const boost::tuples::null_type &, const BoundaryHandlingUID & ) const { return uint_c(0); } - - template< typename Head, typename Tail > - inline uint_t numberOfMatchingHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag ) const; - inline uint_t numberOfMatchingHandlers( const boost::tuples::null_type &, const flag_t ) const { return uint_c(0); } - - template< typename Head, typename Tail > - inline uint_t numberOfMatchingHandlersForDomain( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag ) const; - inline uint_t numberOfMatchingHandlersForDomain( const boost::tuples::null_type &, const flag_t ) const { return uint_c(0); } - - template< typename Head, typename Tail > - inline uint_t numberOfMatchingHandlersForBoundary( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag ) const; - inline uint_t numberOfMatchingHandlersForBoundary( const boost::tuples::null_type &, const flag_t ) const { return uint_c(0); } - - template< typename Head, typename Tail > - inline bool containsBoundaryCondition( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const BoundaryUID & uid ) const; - inline bool containsBoundaryCondition( const boost::tuples::null_type &, const BoundaryUID & ) const { return false; } - - template< typename Head, typename Tail > - inline bool containsBoundaryCondition( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag ) const; - inline bool containsBoundaryCondition( const boost::tuples::null_type &, const flag_t ) const { return false; } - - template< typename Head, typename Tail > - inline flag_t getBoundaryMask( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const BoundaryUID & uid ) const; - inline flag_t getBoundaryMask( const boost::tuples::null_type &, const BoundaryUID & ) const { return numeric_cast<flag_t>(0); } - - template< typename Head, typename Tail > - inline BoundaryUID getBoundaryUID( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag ) const; - inline BoundaryUID getBoundaryUID( const boost::tuples::null_type &, const flag_t ) const; - - template< typename Head, typename Tail > - inline shared_ptr<BoundaryConfiguration> createBoundaryConfiguration( const boost::tuples::cons<Head, Tail> & boundaryHandlers, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), uint_t>::type numberOfMatchingBoundaryHandlers( const HandlersTuple & boundaryHandlers, const BoundaryHandlingUID & uid ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), uint_t>::type numberOfMatchingBoundaryHandlers( const HandlersTuple &, const BoundaryHandlingUID & ) const { return uint_c(0); } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), uint_t>::type numberOfMatchingHandlers( const HandlersTuple & boundaryHandlers, const flag_t flag ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), uint_t>::type numberOfMatchingHandlers( const HandlersTuple &, const flag_t ) const { return uint_c(0); } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), uint_t>::type numberOfMatchingHandlersForDomain( const HandlersTuple & boundaryHandlers, const flag_t flag ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), uint_t>::type numberOfMatchingHandlersForDomain( const HandlersTuple &, const flag_t ) const { return uint_c(0); } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), uint_t>::type numberOfMatchingHandlersForBoundary( const HandlersTuple & boundaryHandlers, const flag_t flag ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), uint_t>::type numberOfMatchingHandlersForBoundary( const HandlersTuple &, const flag_t ) const { return uint_c(0); } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type containsBoundaryCondition( const HandlersTuple & boundaryHandlers, const BoundaryUID & uid ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type containsBoundaryCondition( const HandlersTuple &, const BoundaryUID & ) const { return false; } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type containsBoundaryCondition( const HandlersTuple & boundaryHandlers, const flag_t flag ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type containsBoundaryCondition( const HandlersTuple &, const flag_t ) const { return false; } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), flag_t>::type getBoundaryMask( const HandlersTuple & boundaryHandlers, const BoundaryUID & uid ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), flag_t>::type getBoundaryMask( const HandlersTuple &, const BoundaryUID & ) const { return numeric_cast<flag_t>(0); } + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), BoundaryUID>::type getBoundaryUID( const HandlersTuple & boundaryHandlers, const flag_t flag ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), BoundaryUID>::type getBoundaryUID( const HandlersTuple &, const flag_t ) const; + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), shared_ptr<BoundaryConfiguration>>::type createBoundaryConfiguration( const HandlersTuple & boundaryHandlers, const BoundaryUID & uid, const Config::BlockHandle & config ) const; - inline shared_ptr<BoundaryConfiguration> createBoundaryConfiguration( const boost::tuples::null_type &, const BoundaryUID &, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), shared_ptr<BoundaryConfiguration>>::type createBoundaryConfiguration( const HandlersTuple &, const BoundaryUID &, const Config::BlockHandle & ) const { WALBERLA_ASSERT( false ); return make_shared<BoundaryConfiguration>(); } - template< typename Head, typename Tail > - inline bool checkConsistency( const boost::tuples::cons<Head, Tail> & boundaryHandlers, const CellInterval & cells ) const; - inline bool checkConsistency( const boost::tuples::null_type &, const CellInterval & ) const { return true; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), bool>::type checkConsistency( const HandlersTuple & boundaryHandlers, const CellInterval & cells ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), bool>::type checkConsistency( const HandlersTuple &, const CellInterval & ) const { return true; } - template< typename Head, typename Tail > - inline void refresh( boost::tuples::cons<Head, Tail> & boundaryHandlers, const CellInterval & cells ); - inline void refresh( const boost::tuples::null_type &, const CellInterval & ) const {} + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type refresh( HandlersTuple & boundaryHandlers, const CellInterval & cells ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type refresh( const HandlersTuple &, const CellInterval & ) const {} - template< typename Head, typename Tail > - inline void refreshOutermostLayer( boost::tuples::cons<Head, Tail> & boundaryHandlers, cell_idx_t thickness ); - inline void refreshOutermostLayer( const boost::tuples::null_type &, cell_idx_t ) const {} + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type refreshOutermostLayer( HandlersTuple & boundaryHandlers, cell_idx_t thickness ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type refreshOutermostLayer( const HandlersTuple &, cell_idx_t ) const {} //** General Flag Handling (private helper functions) *************************************************************** /*! \name General Flag Handling (private helper functions) */ //@{ - template< typename Head, typename Tail > - void setFlag( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + typename std::enable_if<(N!=-1), void>::type setFlag( HandlersTuple & boundaryHandlers, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ); - inline void setFlag( const boost::tuples::null_type &, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type setFlag( const HandlersTuple &, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & ); - template< typename Head, typename Tail > - void setFlag( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + typename std::enable_if<(N!=-1), void>::type setFlag( HandlersTuple & boundaryHandlers, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ); - inline void setFlag( const boost::tuples::null_type &, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type setFlag( const HandlersTuple &, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & ); void forceFlagHelper( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ); - template< typename Head, typename Tail > - flag_t flagsToRemove( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + typename std::enable_if<(N!=-1), flag_t>::type flagsToRemove( HandlersTuple & boundaryHandlers, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - inline flag_t flagsToRemove( const boost::tuples::null_type &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return 0; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), flag_t>::type flagsToRemove( const HandlersTuple &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return 0; } - template< typename Head, typename Tail > - void removeFlag( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + typename std::enable_if<(N!=-1), void>::type removeFlag( HandlersTuple & boundaryHandlers, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - inline void removeFlag( const boost::tuples::null_type &, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type removeFlag( const HandlersTuple &, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); //@} //******************************************************************************************************************* //** Clear Cells (private helper functions) ************************************************************************* /*! \name Clear Cells (private helper functions) */ //@{ - template< typename Head, typename Tail > - flag_t clear( boost::tuples::cons<Head, Tail> & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - inline flag_t clear( const boost::tuples::null_type &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return 0; } + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + typename std::enable_if<(N!=-1), flag_t>::type clear( HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), flag_t>::type clear( const HandlersTuple &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const { return 0; } //@} //******************************************************************************************************************* //** Boundary Treatment (private helper functions) ****************************************************************** /*! \name Boundary Treatment (private helper functions) */ //@{ - template< typename Head, typename Tail > - inline void execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, const uint_t numberOfGhostLayersToInclude ); - inline void execute( const boost::tuples::null_type &, const uint_t ) const {} - - template< typename Head, typename Tail > - inline void execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - inline void execute( const boost::tuples::null_type &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const {} - - template< typename Head, typename Tail > - inline void execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, const CellInterval & cells ); - inline void execute( const boost::tuples::null_type &, const CellInterval & ) const {} - - template< typename CellIterator, typename Head, typename Tail > - inline void execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, const CellIterator & begin, const CellIterator & end ); - template< typename CellIterator > - inline void execute( const boost::tuples::null_type &, const CellIterator &, const CellIterator & ) const {} - - template< typename Head, typename Tail > - inline void beforeBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryHandlers ); - inline void beforeBoundaryTreatment( const boost::tuples::null_type & ) const {} - - template< typename Head, typename Tail > - inline void afterBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryHandlers ); - inline void afterBoundaryTreatment( const boost::tuples::null_type & ) const {} + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type execute( HandlersTuple & boundaryHandlers, const uint_t numberOfGhostLayersToInclude ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type execute( const HandlersTuple &, const uint_t ) const {} + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type execute( HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type execute( const HandlersTuple &, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const {} + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type execute( HandlersTuple & boundaryHandlers, const CellInterval & cells ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type execute( const HandlersTuple &, const CellInterval & ) const {} + + template< typename CellIterator, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type execute( HandlersTuple & boundaryHandlers, const CellIterator & begin, const CellIterator & end ); + template< typename CellIterator, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type execute( const HandlersTuple &, const CellIterator &, const CellIterator & ) const {} + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type beforeBoundaryTreatment( HandlersTuple & boundaryHandlers ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type beforeBoundaryTreatment( const HandlersTuple & ) const {} + + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type afterBoundaryTreatment( HandlersTuple & boundaryHandlers ); + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type afterBoundaryTreatment( const HandlersTuple & ) const {} //@} //******************************************************************************************************************* //** Pack / Unpack boundary handling (private helper functions) ***************************************************** /*! \name Pack / Unpack boundary handling (private helper functions) */ //@{ - std::map< std::string, flag_t > getFlagMapping() const { return boundaryHandlers_.get_head().getFlagMapping(); } + std::map< std::string, flag_t > getFlagMapping() const { return std::get<0>( boundaryHandlers_ ).getFlagMapping(); } template< typename Buffer_T > std::vector< flag_t > getNeighborFlagMapping( Buffer_T & buffer, const bool assumeIdenticalFlagMapping, bool & identicalFlagMapping ) const { - return boundaryHandlers_.get_head().getNeighborFlagMapping( buffer, assumeIdenticalFlagMapping, identicalFlagMapping ); + return std::get<0>( boundaryHandlers_ ).getNeighborFlagMapping( buffer, assumeIdenticalFlagMapping, identicalFlagMapping ); } inline void translateMask( flag_t & mask, const std::vector< flag_t > & flagMapping ) const; @@ -498,23 +507,24 @@ private: inline CellInterval getPackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const; inline CellInterval getUnpackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const; - template< typename Head, typename Tail, typename Buffer_T > - inline void pack( const boost::tuples::cons<Head, Tail> & boundaryHandlers, Buffer_T & buffer, const flag_t mask, + template< typename Buffer_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type pack( const HandlersTuple & boundaryHandlers, Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const; - template< typename Buffer_T > - inline void pack( const boost::tuples::null_type &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const {} + template< typename Buffer_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type pack( const HandlersTuple &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const {} - template< typename Head, typename Tail, typename Buffer_T > - inline void unpack( boost::tuples::cons<Head, Tail> & boundaryHandlers, Buffer_T & buffer, const flag_t mask, + template< typename Buffer_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type unpack( HandlersTuple & boundaryHandlers, Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ); - template< typename Buffer_T > - inline void unpack( const boost::tuples::null_type &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const {} + template< typename Buffer_T, typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type unpack( const HandlersTuple &, Buffer_T &, const flag_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) const {} //@} //******************************************************************************************************************* - template< typename Head, typename Tail > - inline void toStream( const boost::tuples::cons<Head, Tail> & boundaryHandlers, std::ostream & os ) const; - inline void toStream( const boost::tuples::null_type &, std::ostream & ) const {} + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N!=-1), void>::type toStream( const HandlersTuple & boundaryHandlers, std::ostream & os ) const; + template< typename HandlersTuple, int N = std::tuple_size<HandlersTuple>::value - 1 > + inline typename std::enable_if<(N==-1), void>::type toStream( const HandlersTuple &, std::ostream & ) const {} @@ -524,22 +534,23 @@ private: const CellInterval outerBB_; + typedef std::tuple<Handlers...> Tuple; Tuple boundaryHandlers_; }; // class BoundaryHandlingCollection -template< typename FlagField_T, typename Tuple > -BoundaryHandlingCollection< FlagField_T, Tuple >::BoundaryHandlingCollection( const std::string & identifier, FlagField_T * const flagField, - const Tuple & boundaryHandlers ) : +template< typename FlagField_T, typename... Handlers > +BoundaryHandlingCollection< FlagField_T, Handlers... >::BoundaryHandlingCollection( const std::string & identifier, FlagField_T * const flagField, + const Handlers & ... boundaryHandlers ) : uid_( identifier ), flagField_( flagField ), outerBB_( -cell_idx_c( flagField_->nrOfGhostLayers() ), -cell_idx_c( flagField_->nrOfGhostLayers() ), -cell_idx_c( flagField_->nrOfGhostLayers() ), cell_idx_c( flagField_->xSize() + flagField_->nrOfGhostLayers() ) - 1, cell_idx_c( flagField_->ySize() + flagField_->nrOfGhostLayers() ) - 1, cell_idx_c( flagField_->zSize() + flagField_->nrOfGhostLayers() ) - 1 ), - boundaryHandlers_( boundaryHandlers ) + boundaryHandlers_( std::make_tuple(boundaryHandlers...) ) { if( flagField_->nrOfGhostLayers() < 1 ) WALBERLA_ABORT( "The flag field passed to the boundary handling collection\"" << identifier << "\" must contain at least one ghost layer!" ); @@ -560,8 +571,8 @@ BoundaryHandlingCollection< FlagField_T, Tuple >::BoundaryHandlingCollection( co -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::isEmpty( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::isEmpty( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); @@ -570,8 +581,8 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::isEmpty( const cel -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::isEmpty( const ConstFlagFieldBaseIterator & it ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::isEmpty( const ConstFlagFieldBaseIterator & it ) const { WALBERLA_ASSERT_EQUAL( it.getField(), flagField_ ); WALBERLA_ASSERT( outerBB_.contains(it.x(),it.y(),it.z()) ); @@ -581,8 +592,8 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::isEmpty( const Con -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const uint_t numberOfGhostLayersToInclude ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const uint_t numberOfGhostLayersToInclude ) const { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); return consideredByAllHandlers( cells ); @@ -590,8 +601,8 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHan -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); @@ -600,8 +611,8 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHan -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const ConstFlagFieldBaseIterator & it ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const ConstFlagFieldBaseIterator & it ) const { WALBERLA_ASSERT_EQUAL( it.getField(), flagField_ ); WALBERLA_ASSERT( outerBB_.contains(it.x(),it.y(),it.z()) ); @@ -611,8 +622,8 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHan -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const CellInterval & cells ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const CellInterval & cells ) const { WALBERLA_ASSERT( outerBB_.contains( cells ) ); @@ -625,9 +636,9 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHan -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const CellIterator & begin, const CellIterator & end ) const +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const CellIterator & begin, const CellIterator & end ) const { for( auto cell = begin; cell != end; ++cell ) if( !consideredByAllHandlers( cell->x(), cell->y(), cell->z() ) ) @@ -637,26 +648,26 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHan -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename BoundaryHandling_T > -inline const BoundaryHandling_T & BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryHandling( const BoundaryHandlingUID & uid ) const +inline const BoundaryHandling_T & BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryHandling( const BoundaryHandlingUID & uid ) const { - return getBoundaryHandling< BoundaryHandling_T, typename Tuple::head_type, typename Tuple::tail_type >( uid, boundaryHandlers_ ); + return getBoundaryHandling< BoundaryHandling_T, std::tuple< Handlers... >>( uid, boundaryHandlers_ ); } -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename BoundaryHandling_T > -inline BoundaryHandling_T & BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryHandling( const BoundaryHandlingUID & uid ) +inline BoundaryHandling_T & BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryHandling( const BoundaryHandlingUID & uid ) { return const_cast< BoundaryHandling_T & >( static_cast< const BoundaryHandlingCollection * >( this )->template getBoundaryHandling< BoundaryHandling_T >( uid ) ); } -template< typename FlagField_T, typename Tuple > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingHandlers( const flag_t flag ) const +template< typename FlagField_T, typename... Handlers > +inline uint_t BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingHandlers( const flag_t flag ) const { WALBERLA_ASSERT( field::isFlag(flag) ); return numberOfMatchingHandlers( boundaryHandlers_, flag ); @@ -664,8 +675,8 @@ inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatching -template< typename FlagField_T, typename Tuple > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingHandlersForDomain( const flag_t flag ) const +template< typename FlagField_T, typename... Handlers > +inline uint_t BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingHandlersForDomain( const flag_t flag ) const { WALBERLA_ASSERT( field::isFlag(flag) ); return numberOfMatchingHandlersForDomain( boundaryHandlers_, flag ); @@ -673,8 +684,8 @@ inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatching -template< typename FlagField_T, typename Tuple > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingHandlersForBoundary( const flag_t flag ) const +template< typename FlagField_T, typename... Handlers > +inline uint_t BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingHandlersForBoundary( const flag_t flag ) const { WALBERLA_ASSERT( field::isFlag(flag) ); return numberOfMatchingHandlersForBoundary( boundaryHandlers_, flag ); @@ -682,16 +693,16 @@ inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatching -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::containsBoundaryCondition( const BoundaryUID & uid ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::containsBoundaryCondition( const BoundaryUID & uid ) const { return containsBoundaryCondition( boundaryHandlers_, uid ); } -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::containsBoundaryCondition( const FlagUID & flag ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::containsBoundaryCondition( const FlagUID & flag ) const { if( flagField_->flagExists( flag ) ) return containsBoundaryCondition( flagField_->getFlag( flag ) ); @@ -700,16 +711,16 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::containsBoundaryCo -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::containsBoundaryCondition( const flag_t flag ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::containsBoundaryCondition( const flag_t flag ) const { return containsBoundaryCondition( boundaryHandlers_, flag ); } -template< typename FlagField_T, typename Tuple > -inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryUID( const FlagUID & flag ) const +template< typename FlagField_T, typename... Handlers > +inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryUID( const FlagUID & flag ) const { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -718,8 +729,8 @@ inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundary -template< typename FlagField_T, typename Tuple > -inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryUID( const flag_t flag ) const +template< typename FlagField_T, typename... Handlers > +inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryUID( const flag_t flag ) const { WALBERLA_ASSERT( field::isFlag( flag ) ); WALBERLA_ASSERT( flagField_->isRegistered( flag ) ); @@ -729,8 +740,8 @@ inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundary -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::checkConsistency( const uint_t numberOfGhostLayersToInclude ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::checkConsistency( const uint_t numberOfGhostLayersToInclude ) const { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); return checkConsistency( cells ); @@ -738,16 +749,16 @@ inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::checkConsistency( -template< typename FlagField_T, typename Tuple > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::checkConsistency( const CellInterval & cells ) const +template< typename FlagField_T, typename... Handlers > +inline bool BoundaryHandlingCollection< FlagField_T, Handlers... >::checkConsistency( const CellInterval & cells ) const { return checkConsistency( boundaryHandlers_, cells ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::refresh( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::refresh( const uint_t numberOfGhostLayersToInclude ) { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); refresh( cells ); @@ -755,24 +766,24 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::refresh( const uin -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::refresh( const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::refresh( const CellInterval & cells ) { refresh( boundaryHandlers_, cells ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::refreshOutermostLayer( cell_idx_t thickness ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::refreshOutermostLayer( cell_idx_t thickness ) { refreshOutermostLayer( boundaryHandlers_, thickness ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -782,8 +793,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const Fla -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { if( !outerBB_.contains(x,y,z) ) @@ -796,8 +807,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const fla -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const FlagUID & flag, const CellInterval & cells, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const FlagUID & flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -807,8 +818,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const Fla -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const flag_t flag, const CellInterval & cells, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { CellInterval localCells( outerBB_ ); @@ -827,9 +838,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const fla -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -839,9 +850,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const Fla -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { for( auto cell = begin; cell != end; ++cell ) @@ -850,8 +861,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const fla -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -861,8 +872,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const F -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { if( !outerBB_.contains(x,y,z) ) @@ -873,8 +884,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const f -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const FlagUID & flag, const CellInterval & cells, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlag( const FlagUID & flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -884,8 +895,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const F -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const flag_t flag, const CellInterval & cells, +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlag( const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { CellInterval localCells( outerBB_ ); @@ -902,9 +913,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const f -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -914,9 +925,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const F -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end, const BoundaryConfiguration & parameter ) { for( auto cell = begin; cell != end; ++cell ) @@ -925,8 +936,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlag( const f -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const FlagUID & flag, const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const FlagUID & flag, const uint_t numberOfGhostLayersToInclude ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -935,8 +946,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const flag_t flag, const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const flag_t flag, const uint_t numberOfGhostLayersToInclude ) { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); removeFlag( flag, cells ); @@ -944,8 +955,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const FlagUID & flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -954,8 +965,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( !outerBB_.contains(x,y,z) || !flagField_->isFlagSet( x, y, z, flag ) ) return; @@ -965,8 +976,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const FlagUID & flag, const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const FlagUID & flag, const CellInterval & cells ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -975,8 +986,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const flag_t flag, const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const flag_t flag, const CellInterval & cells ) { CellInterval localCells( outerBB_ ); localCells.intersect( cells ); @@ -993,9 +1004,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const FlagUID & flag, const CellIterator & begin, const CellIterator & end ) { WALBERLA_ASSERT( flagField_->flagExists( flag ) ); @@ -1004,9 +1015,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const flag_t flag, const CellIterator & begin, const CellIterator & end ) { for( auto cell = begin; cell != end; ++cell ) removeFlag( flag, cell->x(), cell->y(), cell->z() ); @@ -1014,8 +1025,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::clear( const uint_t numberOfGhostLayersToInclude ) { CellInterval cells = getGhostLayerCellInterval( numberOfGhostLayersToInclude ); clear( cells ); @@ -1023,8 +1034,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const uint_ -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::clear( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { if( !outerBB_.contains(x,y,z) ) return; @@ -1034,8 +1045,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const cell_ -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::clear( const CellInterval & cells ) { CellInterval localCells( outerBB_ ); localCells.intersect( cells ); @@ -1051,9 +1062,9 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const CellI -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::clear( const CellIterator & begin, const CellIterator & end ) { for( auto cell = begin; cell != end; ++cell ) clear( cell->x(), cell->y(), cell->z() ); @@ -1061,42 +1072,42 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::clear( const CellI -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::operator()( const uint_t numberOfGhostLayersToInclude ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::operator()( const uint_t numberOfGhostLayersToInclude ) { execute( boundaryHandlers_, numberOfGhostLayersToInclude ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::operator()( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::operator()( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { execute( boundaryHandlers_, x, y, z ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::operator()( const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::operator()( const CellInterval & cells ) { execute( boundaryHandlers_, cells ); } -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename CellIterator > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::operator()( const CellIterator & begin, const CellIterator & end ) +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::operator()( const CellIterator & begin, const CellIterator & end ) { execute( boundaryHandlers_, begin, end ); } -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename Buffer_T > -void BoundaryHandlingCollection< FlagField_T, Tuple >::pack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, +void BoundaryHandlingCollection< FlagField_T, Handlers... >::pack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, const bool assumeIdenticalFlagMapping ) const { #ifdef NDEBUG @@ -1120,9 +1131,9 @@ void BoundaryHandlingCollection< FlagField_T, Tuple >::pack( Buffer_T & buffer, -template< typename FlagField_T, typename Tuple > +template< typename FlagField_T, typename... Handlers > template< typename Buffer_T > -void BoundaryHandlingCollection< FlagField_T, Tuple >::unpack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, +void BoundaryHandlingCollection< FlagField_T, Handlers... >::unpack( Buffer_T & buffer, stencil::Direction direction, const uint_t numberOfLayers, const bool assumeIdenticalFlagMapping ) { bool identicalFlagMapping = false; @@ -1150,8 +1161,8 @@ void BoundaryHandlingCollection< FlagField_T, Tuple >::unpack( Buffer_T & buffer -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::toStream( std::ostream & os ) const { +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::toStream( std::ostream & os ) const { os << "========================= BoundaryHandlingCollection =========================\n\n" << "Identifier: " << uid_.getIdentifier() << "\n\n" @@ -1164,8 +1175,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::toStream( std::ost -template< typename FlagField_T, typename Tuple > -inline std::string BoundaryHandlingCollection< FlagField_T, Tuple >::toString() const { +template< typename FlagField_T, typename... Handlers > +inline std::string BoundaryHandlingCollection< FlagField_T, Handlers... >::toString() const { std::ostringstream oss; toStream( oss ); @@ -1174,8 +1185,8 @@ inline std::string BoundaryHandlingCollection< FlagField_T, Tuple >::toString() -template< typename FlagField_T, typename Tuple > -CellInterval BoundaryHandlingCollection< FlagField_T, Tuple >::getGhostLayerCellInterval( const uint_t numberOfGhostLayersToInclude ) const +template< typename FlagField_T, typename... Handlers > +CellInterval BoundaryHandlingCollection< FlagField_T, Handlers... >::getGhostLayerCellInterval( const uint_t numberOfGhostLayersToInclude ) const { CellInterval cells( -cell_idx_c( numberOfGhostLayersToInclude ), -cell_idx_c( numberOfGhostLayersToInclude ), @@ -1188,69 +1199,69 @@ CellInterval BoundaryHandlingCollection< FlagField_T, Tuple >::getGhostLayerCell -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::isEmpty( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::isEmpty( const HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { - if( !(boundaryHandlers.get_head().isEmpty(x,y,z)) ) + if( !(std::get<N>( boundaryHandlers ).isEmpty(x,y,z)) ) return false; - return isEmpty( boundaryHandlers.get_tail(), x, y, z ); + return isEmpty< HandlersTuple, N-1 >( boundaryHandlers, x, y, z ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::isEmpty( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::isEmpty( const HandlersTuple & boundaryHandlers, const ConstFlagFieldBaseIterator & it ) const { - if( !(boundaryHandlers.get_head().isEmpty(it)) ) + if( !(std::get<N>( boundaryHandlers ).isEmpty(it)) ) return false; - return isEmpty( boundaryHandlers.get_tail(), it ); + return isEmpty< HandlersTuple, N-1 >( boundaryHandlers, it ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { - if( boundaryHandlers.get_head().isEmpty(x,y,z) ) + if( std::get<N>( boundaryHandlers ).isEmpty(x,y,z) ) return false; - return consideredByAllHandlers( boundaryHandlers.get_tail(), x, y, z ); + return consideredByAllHandlers< HandlersTuple, N-1 >( boundaryHandlers, x, y, z ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::consideredByAllHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::consideredByAllHandlers( const HandlersTuple & boundaryHandlers, const ConstFlagFieldBaseIterator & it ) const { - if( boundaryHandlers.get_head().isEmpty(it) ) + if( std::get<N>( boundaryHandlers ).isEmpty(it) ) return false; - return consideredByAllHandlers( boundaryHandlers.get_tail(), it ); + return consideredByAllHandlers< HandlersTuple, N-1 >( boundaryHandlers, it ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::checkForUniqueBoundaryHandlingUIDs( const boost::tuples::cons<Head, Tail> & boundaryHandlers ) const +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::checkForUniqueBoundaryHandlingUIDs( const HandlersTuple & boundaryHandlers ) const { - if( numberOfMatchingBoundaryHandlers( boundaryHandlers.get_head().getUID() ) != uint_c(1) ) + if( numberOfMatchingBoundaryHandlers( std::get<N>( boundaryHandlers ).getUID() ) != uint_c(1) ) WALBERLA_ABORT( "Every boundary handler registered at the same boundary handling collection must have a unique boundary handling UID!\n" - "The boundary handling UID \"" << boundaryHandlers.get_head().getUID() << "\" is not unique for boundary handling collection \"" << uid_.getIdentifier() << "\"." ); + "The boundary handling UID \"" << std::get<N>( boundaryHandlers ).getUID() << "\" is not unique for boundary handling collection \"" << uid_.getIdentifier() << "\"." ); - checkForUniqueBoundaryHandlingUIDs( boundaryHandlers.get_tail() ); + checkForUniqueBoundaryHandlingUIDs< HandlersTuple, N-1 >( boundaryHandlers ); } -template< typename FlagField_T, typename Tuple > -inline std::vector< BoundaryUID > BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryUIDs() const +template< typename FlagField_T, typename... Handlers > +inline std::vector< BoundaryUID > BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryUIDs() const { std::vector< BoundaryUID > uids; getBoundaryUIDs( boundaryHandlers_, uids ); @@ -1259,123 +1270,123 @@ inline std::vector< BoundaryUID > BoundaryHandlingCollection< FlagField_T, Tuple -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryUIDs( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryUIDs( const HandlersTuple & boundaryHandlers, std::vector< BoundaryUID > & uids ) const { - std::vector< BoundaryUID > handlerUIDs = boundaryHandlers.get_head().getBoundaryUIDs(); + std::vector< BoundaryUID > handlerUIDs = std::get<N>( boundaryHandlers ).getBoundaryUIDs(); uids.insert( uids.end(), handlerUIDs.begin(), handlerUIDs.end() ); - getBoundaryUIDs( boundaryHandlers.get_tail(), uids ); + getBoundaryUIDs< HandlersTuple, N-1 >( boundaryHandlers, uids ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::checkForIdenticalFlagFields( const boost::tuples::cons<Head, Tail> & boundaryHandlers ) const +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::checkForIdenticalFlagFields( const HandlersTuple & boundaryHandlers ) const { - return checkForIdenticalFlagFields( boundaryHandlers.get_tail() ) && - boundaryHandlers.get_head().getFlagField() == flagField_ && boundaryHandlers.get_head().outerBB_ == outerBB_; + return checkForIdenticalFlagFields< HandlersTuple, N-1 >( boundaryHandlers ) && + std::get<N>( boundaryHandlers ).getFlagField() == flagField_ && std::get<N>( boundaryHandlers ).outerBB_ == outerBB_; } -template< typename FlagField_T, typename Tuple > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingBoundaryHandlers( const BoundaryHandlingUID & uid ) const +template< typename FlagField_T, typename... Handlers > +inline uint_t BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingBoundaryHandlers( const BoundaryHandlingUID & uid ) const { return numberOfMatchingBoundaryHandlers( boundaryHandlers_, uid ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingBoundaryHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), uint_t>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingBoundaryHandlers( const HandlersTuple & boundaryHandlers, const BoundaryHandlingUID & uid ) const { - return ( ( boundaryHandlers.get_head().getUID() == uid ) ? uint_c(1) : uint_c(0) ) + - numberOfMatchingBoundaryHandlers( boundaryHandlers.get_tail(), uid ); + return ( ( std::get<N>( boundaryHandlers ).getUID() == uid ) ? uint_c(1) : uint_c(0) ) + + numberOfMatchingBoundaryHandlers< HandlersTuple, N-1 >( boundaryHandlers, uid ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingHandlers( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), uint_t>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingHandlers( const HandlersTuple & boundaryHandlers, const flag_t flag ) const { - return ( ( (boundaryHandlers.get_head().getBoundaryMask() | boundaryHandlers.get_head().getDomainMask()) & flag ) == flag ? 1 : 0 ) + - numberOfMatchingHandlers( boundaryHandlers.get_tail(), flag ); + return ( ( (std::get<N>( boundaryHandlers ).getBoundaryMask() | std::get<N>( boundaryHandlers ).getDomainMask()) & flag ) == flag ? 1 : 0 ) + + numberOfMatchingHandlers< HandlersTuple, N-1 >( boundaryHandlers, flag ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingHandlersForDomain( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), uint_t>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingHandlersForDomain( const HandlersTuple & boundaryHandlers, const flag_t flag ) const { - return ( ( boundaryHandlers.get_head().getDomainMask() & flag ) == flag ? 1 : 0 ) + - numberOfMatchingHandlersForDomain( boundaryHandlers.get_tail(), flag ); + return ( ( std::get<N>( boundaryHandlers ).getDomainMask() & flag ) == flag ? 1 : 0 ) + + numberOfMatchingHandlersForDomain< HandlersTuple, N-1 >( boundaryHandlers, flag ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline uint_t BoundaryHandlingCollection< FlagField_T, Tuple >::numberOfMatchingHandlersForBoundary( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), uint_t>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::numberOfMatchingHandlersForBoundary( const HandlersTuple & boundaryHandlers, const flag_t flag ) const { - return ( ( boundaryHandlers.get_head().getBoundaryMask() & flag ) == flag ? 1 : 0 ) + - numberOfMatchingHandlersForBoundary( boundaryHandlers.get_tail(), flag ); + return ( ( std::get<N>( boundaryHandlers ).getBoundaryMask() & flag ) == flag ? 1 : 0 ) + + numberOfMatchingHandlersForBoundary< HandlersTuple, N-1 >( boundaryHandlers, flag ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::containsBoundaryCondition( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::containsBoundaryCondition( const HandlersTuple & boundaryHandlers, const BoundaryUID & uid ) const { - if( boundaryHandlers.get_head().containsBoundaryCondition( uid ) ) + if( std::get<N>( boundaryHandlers ).containsBoundaryCondition( uid ) ) return true; - return containsBoundaryCondition( boundaryHandlers.get_tail(), uid ); + return containsBoundaryCondition< HandlersTuple, N-1 >( boundaryHandlers, uid ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::containsBoundaryCondition( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::containsBoundaryCondition( const HandlersTuple & boundaryHandlers, const flag_t flag ) const { - if( boundaryHandlers.get_head().containsBoundaryCondition( flag ) ) + if( std::get<N>( boundaryHandlers ).containsBoundaryCondition( flag ) ) return true; - return containsBoundaryCondition( boundaryHandlers.get_tail(), flag ); + return containsBoundaryCondition< HandlersTuple, N-1 >( boundaryHandlers, flag ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline typename BoundaryHandlingCollection< FlagField_T, Tuple >::flag_t - BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryMask( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), typename BoundaryHandlingCollection< FlagField_T, Handlers... >::flag_t>::type + BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryMask( const HandlersTuple & boundaryHandlers, const BoundaryUID & uid ) const { - if( boundaryHandlers.get_head().containsBoundaryCondition(uid) ) - return boundaryHandlers.get_head().getBoundaryMask(uid); - return getBoundaryMask( boundaryHandlers.get_tail(), uid ); + if( std::get<N>( boundaryHandlers ).containsBoundaryCondition(uid) ) + return std::get<N>( boundaryHandlers ).getBoundaryMask(uid); + return getBoundaryMask< HandlersTuple, N-1 >( boundaryHandlers, uid ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryUID( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), BoundaryUID>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryUID( const HandlersTuple & boundaryHandlers, const flag_t flag ) const { - const Head & boundaryHandler = boundaryHandlers.get_head(); + const auto & boundaryHandler = std::get<N>( boundaryHandlers ); if( boundaryHandler.containsBoundaryCondition( flag ) ) { @@ -1383,14 +1394,15 @@ inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundary } else { - return getBoundaryUID( boundaryHandlers.get_tail(), flag ); + return getBoundaryUID< HandlersTuple, N-1 >( boundaryHandlers, flag ); } } -template< typename FlagField_T, typename Tuple > -inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundaryUID( const boost::tuples::null_type &, const flag_t flag ) const +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N==-1), BoundaryUID>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::getBoundaryUID( const HandlersTuple &, const flag_t flag ) const { if( !flagField_->isRegistered( flag ) ) WALBERLA_ABORT( "The requested flag with value " << flag << " is not registered at the flag field and is not handled "\ @@ -1403,59 +1415,59 @@ inline BoundaryUID BoundaryHandlingCollection< FlagField_T, Tuple >::getBoundary -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline shared_ptr<BoundaryConfiguration> - BoundaryHandlingCollection< FlagField_T, Tuple >::createBoundaryConfiguration( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), shared_ptr<BoundaryConfiguration>>::type + BoundaryHandlingCollection< FlagField_T, Handlers... >::createBoundaryConfiguration( const HandlersTuple & boundaryHandlers, const BoundaryUID & uid, const Config::BlockHandle & config ) const { - if( boundaryHandlers.get_head().containsBoundaryCondition(uid) ) - return boundaryHandlers.get_head().createBoundaryConfiguration( uid, config ); - return createBoundaryConfiguration( boundaryHandlers.get_tail(), uid, config ); + if( std::get<N>( boundaryHandlers ).containsBoundaryCondition(uid) ) + return std::get<N>( boundaryHandlers ).createBoundaryConfiguration( uid, config ); + return createBoundaryConfiguration< HandlersTuple, N-1 >( boundaryHandlers, uid, config ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline bool BoundaryHandlingCollection< FlagField_T, Tuple >::checkConsistency( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), bool>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::checkConsistency( const HandlersTuple & boundaryHandlers, const CellInterval & cells ) const { - return checkConsistency( boundaryHandlers.get_tail(), cells ) && boundaryHandlers.get_head().checkConsistency(cells); + return checkConsistency< HandlersTuple, N-1 >( boundaryHandlers, cells ) && std::get<N>( boundaryHandlers ).checkConsistency(cells); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::refresh( boost::tuples::cons<Head, Tail> & boundaryHandlers, const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::refresh( HandlersTuple & boundaryHandlers, const CellInterval & cells ) { - boundaryHandlers.get_head().refresh( cells ); - refresh( boundaryHandlers.get_tail(), cells ); + std::get<N>( boundaryHandlers ).refresh( cells ); + refresh< HandlersTuple, N-1 >( boundaryHandlers, cells ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::refreshOutermostLayer( boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::refreshOutermostLayer( HandlersTuple & boundaryHandlers, cell_idx_t thickness ) { - boundaryHandlers.get_head().refreshOutermostLayer( thickness ); - refreshOutermostLayer( boundaryHandlers.get_tail(), thickness ); + std::get<N>( boundaryHandlers ).refreshOutermostLayer( thickness ); + refreshOutermostLayer< HandlersTuple, N-1 >( boundaryHandlers, thickness ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( HandlersTuple & boundaryHandlers, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); - Head & handler = boundaryHandlers.get_head(); + auto & handler = std::get<N>( boundaryHandlers ); if( ( (handler.getBoundaryMask() | handler.getDomainMask()) & flag ) == flag ) { @@ -1463,13 +1475,14 @@ void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( boost::tuples::c handler.setFlag( flag, x, y, z, parameter ); } - setFlag( boundaryHandlers.get_tail(), flag, x, y, z, parameter ); + setFlag< HandlersTuple, N-1 >( boundaryHandlers, flag, x, y, z, parameter ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const boost::tuples::null_type & /*boundaryHandlers*/, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N==-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const HandlersTuple & /*boundaryHandlers*/, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & /*parameter*/ ) { @@ -1480,14 +1493,14 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const boo -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( HandlersTuple & boundaryHandlers, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( outerBB_.contains(cells) ); - Head & handler = boundaryHandlers.get_head(); + auto & handler = std::get<N>( boundaryHandlers ); if( ( (handler.getBoundaryMask() | handler.getDomainMask()) & flag ) == flag ) { @@ -1500,13 +1513,14 @@ void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( boost::tuples::c handler.setFlag( flag, cells, parameter ); } - setFlag( boundaryHandlers.get_tail(), flag, cells, parameter ); + setFlag< HandlersTuple, N-1 >( boundaryHandlers, flag, cells, parameter ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const boost::tuples::null_type & /*boundaryHandlers*/, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N==-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::setFlag( const HandlersTuple & /*boundaryHandlers*/, const flag_t flag, const CellInterval & cells, const BoundaryConfiguration & /*parameter*/ ) { WALBERLA_ASSERT( outerBB_.contains(cells) ); @@ -1517,8 +1531,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::setFlag( const boo -template< typename FlagField_T, typename Tuple > -void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlagHelper( const flag_t flag, const cell_idx_t x, const cell_idx_t y, +template< typename FlagField_T, typename... Handlers > +void BoundaryHandlingCollection< FlagField_T, Handlers... >::forceFlagHelper( const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const BoundaryConfiguration & parameter ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); @@ -1540,15 +1554,15 @@ void BoundaryHandlingCollection< FlagField_T, Tuple >::forceFlagHelper( const fl -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -typename BoundaryHandlingCollection< FlagField_T, Tuple >::flag_t -BoundaryHandlingCollection< FlagField_T, Tuple >::flagsToRemove( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), typename BoundaryHandlingCollection< FlagField_T, Handlers... >::flag_t>::type +BoundaryHandlingCollection< FlagField_T, Handlers... >::flagsToRemove( HandlersTuple & boundaryHandlers, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); - const Head & handler = boundaryHandlers.get_head(); + const auto & handler = std::get<N>( boundaryHandlers ); flag_t mask = numeric_cast<flag_t>( handler.getBoundaryMask() | handler.getDomainMask() ); if( ( mask & flag ) == flag ) @@ -1556,19 +1570,19 @@ BoundaryHandlingCollection< FlagField_T, Tuple >::flagsToRemove( boost::tuples:: else mask = numeric_cast<flag_t>(0); - return numeric_cast<flag_t>( mask | flagsToRemove( boundaryHandlers.get_tail(), flag, x, y, z ) ); + return numeric_cast<flag_t>( mask | flagsToRemove< HandlersTuple, N-1 >( boundaryHandlers, flag, x, y, z ) ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( boost::tuples::cons<Head, Tail> & boundaryHandlers, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( HandlersTuple & boundaryHandlers, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); - Head & handler = boundaryHandlers.get_head(); + auto & handler = std::get<N>( boundaryHandlers ); if( ( (handler.getBoundaryMask() | handler.getDomainMask()) & flag ) == flag ) { @@ -1576,13 +1590,14 @@ void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( boost::tuples handler.removeFlag( flag, x, y, z ); } - removeFlag( boundaryHandlers.get_tail(), flag, x, y, z ); + removeFlag< HandlersTuple, N-1 >( boundaryHandlers, flag, x, y, z ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const boost::tuples::null_type & /*boundaryHandlers*/, const flag_t flag, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N==-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::removeFlag( const HandlersTuple & /*boundaryHandlers*/, const flag_t flag, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); @@ -1592,132 +1607,132 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::removeFlag( const -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -typename BoundaryHandlingCollection< FlagField_T, Tuple >::flag_t -BoundaryHandlingCollection< FlagField_T, Tuple >::clear( boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), typename BoundaryHandlingCollection< FlagField_T, Handlers... >::flag_t>::type +BoundaryHandlingCollection< FlagField_T, Handlers... >::clear( HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); const flag_t before = flagField_->get(x,y,z); - boundaryHandlers.get_head().clear(x,y,z); + std::get<N>( boundaryHandlers ).clear(x,y,z); const flag_t removedFlags = numeric_cast< flag_t >( before ^ flagField_->get(x,y,z) ); flagField_->addMask( x, y, z, before ); - return numeric_cast< flag_t >( removedFlags | clear( boundaryHandlers.get_tail(), x, y, z ) ); + return numeric_cast< flag_t >( removedFlags | clear< HandlersTuple, N-1 >( boundaryHandlers, x, y, z ) ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::execute( HandlersTuple & boundaryHandlers, const uint_t numberOfGhostLayersToInclude ) { - boundaryHandlers.get_head()( numberOfGhostLayersToInclude ); - execute( boundaryHandlers.get_tail(), numberOfGhostLayersToInclude ); + std::get<N>( boundaryHandlers )( numberOfGhostLayersToInclude ); + execute< HandlersTuple, N-1 >( boundaryHandlers, numberOfGhostLayersToInclude ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::execute( HandlersTuple & boundaryHandlers, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { - boundaryHandlers.get_head()(x,y,z); - execute( boundaryHandlers.get_tail(), x, y, z ); + std::get<N>( boundaryHandlers )(x,y,z); + execute< HandlersTuple, N-1 >( boundaryHandlers, x, y, z ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, const CellInterval & cells ) +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::execute( HandlersTuple & boundaryHandlers, const CellInterval & cells ) { - boundaryHandlers.get_head()( cells ); - execute( boundaryHandlers.get_tail(), cells ); + std::get<N>( boundaryHandlers )( cells ); + execute< HandlersTuple, N-1 >( boundaryHandlers, cells ); } -template< typename FlagField_T, typename Tuple > -template< typename CellIterator, typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::execute( boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename CellIterator, typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::execute( HandlersTuple & boundaryHandlers, const CellIterator & begin, const CellIterator & end ) { - boundaryHandlers.get_head()( begin, end ); - execute( boundaryHandlers.get_tail(), begin, end ); + std::get<N>( boundaryHandlers )( begin, end ); + execute< CellIterator, HandlersTuple, N-1 >( boundaryHandlers, begin, end ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::beforeBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryHandlers ) +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::beforeBoundaryTreatment( HandlersTuple & boundaryHandlers ) { - boundaryHandlers.get_head().beforeBoundaryTreatment(); - beforeBoundaryTreatment( boundaryHandlers.get_tail() ); + std::get<N>( boundaryHandlers ).beforeBoundaryTreatment(); + beforeBoundaryTreatment< HandlersTuple, N-1 >( boundaryHandlers ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::afterBoundaryTreatment( boost::tuples::cons<Head, Tail> & boundaryHandlers ) +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::afterBoundaryTreatment( HandlersTuple & boundaryHandlers ) { - boundaryHandlers.get_head().afterBoundaryTreatment(); - afterBoundaryTreatment( boundaryHandlers.get_tail() ); + std::get<N>( boundaryHandlers ).afterBoundaryTreatment(); + afterBoundaryTreatment< HandlersTuple, N-1 >( boundaryHandlers ); } -template< typename FlagField_T, typename Tuple > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::translateMask( flag_t & mask, const std::vector< flag_t > & flagMapping ) const +template< typename FlagField_T, typename... Handlers > +inline void BoundaryHandlingCollection< FlagField_T, Handlers... >::translateMask( flag_t & mask, const std::vector< flag_t > & flagMapping ) const { - boundaryHandlers_.get_head().translateMask( mask, flagMapping ); + std::get<0>( boundaryHandlers_ ).translateMask( mask, flagMapping ); } -template< typename FlagField_T, typename Tuple > -inline CellInterval BoundaryHandlingCollection< FlagField_T, Tuple >::getPackingInterval( stencil::Direction direction, +template< typename FlagField_T, typename... Handlers > +inline CellInterval BoundaryHandlingCollection< FlagField_T, Handlers... >::getPackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const { - return boundaryHandlers_.get_head().getPackingInterval( direction, numberOfLayers ); + return std::get<0>( boundaryHandlers_ ).getPackingInterval( direction, numberOfLayers ); } -template< typename FlagField_T, typename Tuple > -inline CellInterval BoundaryHandlingCollection< FlagField_T, Tuple >::getUnpackingInterval( stencil::Direction direction, +template< typename FlagField_T, typename... Handlers > +inline CellInterval BoundaryHandlingCollection< FlagField_T, Handlers... >::getUnpackingInterval( stencil::Direction direction, const uint_t numberOfLayers ) const { - return boundaryHandlers_.get_head().getUnpackingInterval( direction, numberOfLayers ); + return std::get<0>( boundaryHandlers_ ).getUnpackingInterval( direction, numberOfLayers ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail, typename Buffer_T > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::pack( const boost::tuples::cons<Head, Tail> & boundaryHandlers, Buffer_T & buffer, +template< typename FlagField_T, typename... Handlers > +template< typename Buffer_T, typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::pack( const HandlersTuple & boundaryHandlers, Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) const { - boundaryHandlers_.get_head().pack( buffer, mask, x, y, z ); - pack( boundaryHandlers.get_tail(), buffer, mask, x, y, z ); + std::get<0>( boundaryHandlers_ ).pack( buffer, mask, x, y, z ); + pack< Buffer_T, HandlersTuple, N-1 >( boundaryHandlers, buffer, mask, x, y, z ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail, typename Buffer_T > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::unpack( boost::tuples::cons<Head, Tail> & boundaryHandlers, Buffer_T & buffer, +template< typename FlagField_T, typename... Handlers > +template< typename Buffer_T, typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::unpack( HandlersTuple & boundaryHandlers, Buffer_T & buffer, const flag_t mask, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { WALBERLA_ASSERT( outerBB_.contains(x,y,z) ); - Head & handler = boundaryHandlers.get_head(); + auto & handler = std::get<N>( boundaryHandlers ); flag_t flag = (handler.getBoundaryMask() | handler.getDomainMask()) & mask; if( flag ) @@ -1726,18 +1741,18 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::unpack( boost::tup handler.unpack( buffer, flag, x, y, z ); } - unpack( boundaryHandlers.get_tail(), buffer, mask, x, y, z ); + unpack< Buffer_T, HandlersTuple, N-1 >( boundaryHandlers, buffer, mask, x, y, z ); } -template< typename FlagField_T, typename Tuple > -template< typename Head, typename Tail > -inline void BoundaryHandlingCollection< FlagField_T, Tuple >::toStream( const boost::tuples::cons<Head, Tail> & boundaryHandlers, +template< typename FlagField_T, typename... Handlers > +template< typename HandlersTuple, int N > +inline typename std::enable_if<(N!=-1), void>::type BoundaryHandlingCollection< FlagField_T, Handlers... >::toStream( const HandlersTuple & boundaryHandlers, std::ostream & os ) const { - os << boundaryHandlers.get_head(); - toStream( boundaryHandlers.get_tail(), os ); + os << std::get<N>( boundaryHandlers ); + toStream< HandlersTuple, N-1 >( boundaryHandlers, os ); } @@ -1748,8 +1763,8 @@ inline void BoundaryHandlingCollection< FlagField_T, Tuple >::toStream( const bo using boundary::BoundaryHandlingCollection; -template< typename FlagField_T, typename Tuple > -inline std::ostream & operator<<( std::ostream & os, const BoundaryHandlingCollection< FlagField_T, Tuple > & bhc ) { +template< typename FlagField_T, typename... Handlers > +inline std::ostream & operator<<( std::ostream & os, const BoundaryHandlingCollection< FlagField_T, Handlers... > & bhc ) { bhc.toStream( os ); return os; diff --git a/src/core/config/ConfigToBoostPropertyTree.cpp b/src/core/config/ConfigToBoostPropertyTree.cpp index e3b5e6b40bc0ead8cd49fce3aba4c432f407d710..45a04fc47854faa9f5cda5f4b8538b7297abfa8a 100644 --- a/src/core/config/ConfigToBoostPropertyTree.cpp +++ b/src/core/config/ConfigToBoostPropertyTree.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "ConfigToBoostPropertyTree.h" #include <boost/property_tree/ptree.hpp> @@ -51,3 +54,5 @@ boost::property_tree::iptree configToBoostPropertyTree( const Config & config ) } // namespace config } // namespace walberla + +#endif diff --git a/src/core/config/all.h b/src/core/config/all.h index 0994ebc80709d4645ec9edc3e7057fe60f8fa3c6..43bbd4f687a4907e644fd4169fbee71893f6a899 100644 --- a/src/core/config/all.h +++ b/src/core/config/all.h @@ -23,5 +23,7 @@ #pragma once #include "Config.h" +#ifdef WALBERLA_BUILD_WITH_BOOST #include "ConfigToBoostPropertyTree.h" +#endif #include "Create.h" diff --git a/src/core/math/PhysicalCheck.cpp b/src/core/math/PhysicalCheck.cpp index 7c3342449e13ab888e8186c3e385f204b25ffa7b..4800f192929bbcd0d60aa353e8955fae0f38d7ad 100644 --- a/src/core/math/PhysicalCheck.cpp +++ b/src/core/math/PhysicalCheck.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "PhysicalCheck.h" #include "core/Abort.h" #include "core/logging/Logging.h" @@ -536,3 +539,5 @@ namespace math { } // namespace math } // namespace walberla + +#endif diff --git a/src/core/math/all.h b/src/core/math/all.h index 29295fc4f159d9540e7e21b4e54ccb9270c222ec..0d5c22ad7d8b0f11e5887e47712ee0e36dcc9fdb 100644 --- a/src/core/math/all.h +++ b/src/core/math/all.h @@ -36,7 +36,9 @@ #include "Matrix3.h" #include "Parser.h" #include "ParserOMP.h" +#ifdef WALBERLA_BUILD_WITH_BOOST #include "PhysicalCheck.h" +#endif #include "Plane.h" #include "Primes.h" #include "Random.h" diff --git a/src/core/math/equation_system/EquationParser.cpp b/src/core/math/equation_system/EquationParser.cpp index 5f064d79c073d1b9e85261018b7acd6c2ad3a835..4a3894268b19b4f4b88cd4248caffd42b32d4456 100644 --- a/src/core/math/equation_system/EquationParser.cpp +++ b/src/core/math/equation_system/EquationParser.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "Equation.h" #include "EquationParser.h" #include "Operator.h" @@ -340,3 +343,5 @@ EquationPtr EquationParser::parseEquation( const std::string& str, size_t& index } // namespace math } // namespace walberla + +#endif \ No newline at end of file diff --git a/src/core/math/equation_system/EquationSystem.cpp b/src/core/math/equation_system/EquationSystem.cpp index a1293082fb12e88cd47c42a6bd811faf28dfe443..433a1283c2f9e6350c80184ff36af6279f1ed611 100644 --- a/src/core/math/equation_system/EquationSystem.cpp +++ b/src/core/math/equation_system/EquationSystem.cpp @@ -19,6 +19,9 @@ // //====================================================================================================================== +#include "waLBerlaDefinitions.h" +#ifdef WALBERLA_BUILD_WITH_BOOST + #include "Equation.h" #include "EquationSystem.h" #include "Variable.h" @@ -198,3 +201,5 @@ std::ostream& operator<<( std::ostream& os, EquationSystem& es ) } // namespace math } // namespace walberla + +#endif diff --git a/src/core/math/equation_system/all.h b/src/core/math/equation_system/all.h index 7ab238733df8855abfb38a2bb9b674be987cf9d2..5c3cc61ed82ebd39c635b37d4f92bb51e5f19f3c 100644 --- a/src/core/math/equation_system/all.h +++ b/src/core/math/equation_system/all.h @@ -23,7 +23,9 @@ #pragma once #include "Equation.h" +#ifdef WALBERLA_BUILD_WITH_BOOST #include "EquationParser.h" #include "EquationSystem.h" +#endif #include "Operator.h" #include "Variable.h" \ No newline at end of file diff --git a/src/core/singleton/NullType.h b/src/core/singleton/NullType.h deleted file mode 100644 index cf92f32f9e38eaac3d3b2e7cc9e5ef5447c086ad..0000000000000000000000000000000000000000 --- a/src/core/singleton/NullType.h +++ /dev/null @@ -1,37 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file NullType.h -//! \ingroup core -//! \author Klaus Iglberger -//! \author Florian Schornbaum <florian.schornbaum@fau.de> -// -//====================================================================================================================== - -#pragma once - - - -///\cond internal -namespace walberla { -namespace singleton { - - -struct NullType{}; - - -} // namespace singleton -} // namespace walberla -///\endcond diff --git a/src/core/singleton/Singleton.h b/src/core/singleton/Singleton.h index 3522210b0d2c1b388c26b7d62ad26a08747851b8..36a7ea5f8149d37744020c0c94f3f427bad59d99 100644 --- a/src/core/singleton/Singleton.h +++ b/src/core/singleton/Singleton.h @@ -22,8 +22,6 @@ #pragma once -#include "NullType.h" -#include "TypeList.h" #include "core/DataTypes.h" #include "core/NonCopyable.h" @@ -37,376 +35,6 @@ namespace singleton { -#ifdef WALBERLA_CXX_COMPILER_IS_GNU -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#endif - -#ifdef WALBERLA_CXX_COMPILER_IS_CLANG -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-local-typedefs" -#endif - - - -//********************************************************************************************************************** -/*!\brief Helper macro for macro concatenation. -// -// The following code was borrowed from the Boost C++ framework (www.boost.org). This piece of -// macro magic joins the two arguments together, even when one of the arguments is itself a -// macro (see 16.3.1 in C++ standard). The key is that macro expansion of macro arguments does -// not occur in WALBERLA_DO_JOIN2 but does in WALBERLA_DO_JOIN. -*/ -#define WALBERLA_JOIN( X, Y ) WALBERLA_DO_JOIN( X, Y ) -#define WALBERLA_DO_JOIN( X, Y ) WALBERLA_DO_JOIN2(X,Y) -#define WALBERLA_DO_JOIN2( X, Y ) X##Y -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// NAMESPACE FORWARD DECLARATIONS -// -//====================================================================================================================== - -template< typename T, typename TL, bool C > struct HasCyclicDependency; - - - -//====================================================================================================================== -// -// CLASS HASCYCLICDEPENDENCYHELPER -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\brief Auxiliary helper struct for the HasCyclicDependency class template. -// -// -// Helper template class for the HasCyclicDependency template class to resolve all lifetime -// dependencies represented by means of a dependency type list. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D // Type list of lifetime dependencies to check - , size_t N = Length<D>::value > // Length of the dependency type list -struct HasCyclicDependencyHelper; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the given -// dependency type list is empty. In this case no cyclic lifetime dependency could be detected. - */ -template< typename TL // Type list of checked lifetime dependencies - , size_t N > // Length of the dependency type list -struct HasCyclicDependencyHelper<TL,NullType,N> -{ - enum { value = 0 }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 1. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,1> -{ - typedef typename TypeAt<D,0>::Result D1; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 2. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,2> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 3. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,3> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - typedef typename TypeAt<D,2>::Result D3; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value || - HasCyclicDependency<D3,TL,Contains<TL,D3>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 4. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,4> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - typedef typename TypeAt<D,2>::Result D3; - typedef typename TypeAt<D,3>::Result D4; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value || - HasCyclicDependency<D3,TL,Contains<TL,D3>::value>::value || - HasCyclicDependency<D4,TL,Contains<TL,D4>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 5. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,5> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - typedef typename TypeAt<D,2>::Result D3; - typedef typename TypeAt<D,3>::Result D4; - typedef typename TypeAt<D,4>::Result D5; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value || - HasCyclicDependency<D3,TL,Contains<TL,D3>::value>::value || - HasCyclicDependency<D4,TL,Contains<TL,D4>::value>::value || - HasCyclicDependency<D5,TL,Contains<TL,D5>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 6. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,6> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - typedef typename TypeAt<D,2>::Result D3; - typedef typename TypeAt<D,3>::Result D4; - typedef typename TypeAt<D,4>::Result D5; - typedef typename TypeAt<D,5>::Result D6; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value || - HasCyclicDependency<D3,TL,Contains<TL,D3>::value>::value || - HasCyclicDependency<D4,TL,Contains<TL,D4>::value>::value || - HasCyclicDependency<D5,TL,Contains<TL,D5>::value>::value || - HasCyclicDependency<D6,TL,Contains<TL,D6>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 7. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,7> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - typedef typename TypeAt<D,2>::Result D3; - typedef typename TypeAt<D,3>::Result D4; - typedef typename TypeAt<D,4>::Result D5; - typedef typename TypeAt<D,5>::Result D6; - typedef typename TypeAt<D,6>::Result D7; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value || - HasCyclicDependency<D3,TL,Contains<TL,D3>::value>::value || - HasCyclicDependency<D4,TL,Contains<TL,D4>::value>::value || - HasCyclicDependency<D5,TL,Contains<TL,D5>::value>::value || - HasCyclicDependency<D6,TL,Contains<TL,D6>::value>::value || - HasCyclicDependency<D7,TL,Contains<TL,D7>::value>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependencyHelper class template. -// -// This specialization of the HasCyclicDependencyHelper class is selected in case the length -// of the given type list is 8. - */ -template< typename TL // Type list of checked lifetime dependencies - , typename D > // Type list of lifetime dependencies to check -struct HasCyclicDependencyHelper<TL,D,8> -{ - typedef typename TypeAt<D,0>::Result D1; - typedef typename TypeAt<D,1>::Result D2; - typedef typename TypeAt<D,2>::Result D3; - typedef typename TypeAt<D,3>::Result D4; - typedef typename TypeAt<D,4>::Result D5; - typedef typename TypeAt<D,5>::Result D6; - typedef typename TypeAt<D,6>::Result D7; - typedef typename TypeAt<D,7>::Result D8; - - enum { value = HasCyclicDependency<D1,TL,Contains<TL,D1>::value>::value || - HasCyclicDependency<D2,TL,Contains<TL,D2>::value>::value || - HasCyclicDependency<D3,TL,Contains<TL,D3>::value>::value || - HasCyclicDependency<D4,TL,Contains<TL,D4>::value>::value || - HasCyclicDependency<D5,TL,Contains<TL,D5>::value>::value || - HasCyclicDependency<D6,TL,Contains<TL,D6>::value>::value || - HasCyclicDependency<D7,TL,Contains<TL,D7>::value>::value || - HasCyclicDependency<D8,TL,Contains<TL,D8>::value>::value }; -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// CLASS HASCYCLICDEPENDENCY -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\brief Class template for the detection of cyclic lifetime dependencies. -// -// This class template checks the given type \a T for cyclic lifetime dependencies. In case a -// cyclic lifetime dependency is detected, the \a value member enumeration is set to 1. Otherwise -// it is set to 0. - */ -template< typename T // The type to be checked for cyclic lifetime dependencies - , typename TL // Type list of checked lifetime dependencies - , bool C=Contains<TL,T>::value > // Flag to indicate whether T is contained in TL -struct HasCyclicDependency -{ - typedef typename Append<TL,T>::Result ETL; - enum { value = HasCyclicDependencyHelper<ETL,typename T::Dependencies>::value }; -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Specialization of the HasCyclicDependency class template. -// -// This specialization of the HasCyclicDependency class is selected in case the given type \a T -// is contained in the given lifetime dependency type list \a TL. In this case a cyclic lifetime -// dependency was detected and the \a value member enumeration is set to 1. - */ -template< typename T // The type to be checked for cyclic lifetime dependencies - , typename TL > // Type list of checked lifetime dependencies -struct HasCyclicDependency<T,TL,true> -{ - enum { value = 1 }; -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// CLASS CYCLIC_LIFETIME_DEPENDENCY_TEST -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\brief Compile time constraint wrapper class. -// -// Helper class for the pe::CYCLIC_LIFETIME_DEPENDENCY_DETECTED class template. This class is -// used as a wrapper for the instantiation of the pe::CYCLIC_LIFETIME_DEPENDENCY_DETECTED -// constraint class. It serves the purpose to force the instantiation of either the defined -// specialization or the undefined basic template during the compilation. In case the compile -// time condition is met, the type pe::CYCLIC_LIFETIME_DEPENDENCY_TEST<1> is defined. - */ -template< int > struct CYCLIC_LIFETIME_DEPENDENCY_TEST {}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// DETECT_CYCLIC_LIFETIME_DEPENDENCY CONSTRAINT -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\brief Compile time constraint. -// -// Helper template class for the compile time constraint enforcement. Based on the compile time -// constant expression used for the template instantiation, either the undefined basic template -// or the specialization is selected. If the undefined basic template is selected, a compilation -// error is created. - */ -template< bool > struct CYCLIC_LIFETIME_DEPENDENCY_DETECTED; -template<> struct CYCLIC_LIFETIME_DEPENDENCY_DETECTED<false> { enum { value = 1 }; }; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Constraint on the data type. -// -// In case the given data type \a T is not an integral data type, a compilation error is created. - */ -#define WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY(T) \ - typedef \ - walberla::singleton::CYCLIC_LIFETIME_DEPENDENCY_TEST< \ - walberla::singleton::CYCLIC_LIFETIME_DEPENDENCY_DETECTED< walberla::singleton::HasCyclicDependency<T,walberla::singleton::NullType>::value >::value > \ - WALBERLA_JOIN( DETECT_CYCLIC_LIFETIME_DEPENDENCY_TYPEDEF, __LINE__ ) -//********************************************************************************************************************** - - - //====================================================================================================================== // // BEFRIEND_SINGLETON MACRO @@ -420,11 +48,11 @@ template<> struct CYCLIC_LIFETIME_DEPENDENCY_DETECTED<false> { enum { value = 1 // class deriving from Singleton. */ #define WALBERLA_BEFRIEND_SINGLETON \ - template< typename, typename, typename, typename, typename, typename,typename, typename, typename > friend class walberla::singleton::Singleton; \ - template< typename, typename, bool > friend struct walberla::singleton::HasCyclicDependency + template< typename > friend class walberla::singleton::Singleton //********************************************************************************************************************** + //====================================================================================================================== // // CLASS SINGLETON @@ -432,24 +60,9 @@ template<> struct CYCLIC_LIFETIME_DEPENDENCY_DETECTED<false> { enum { value = 1 //====================================================================================================================== //********************************************************************************************************************** -/// Base class for all lifetime managed singletons. -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 = NullType // Type of the first lifetime dependency - , typename D2 = NullType // Type of the second lifetime dependency - , typename D3 = NullType // Type of the third lifetime dependency - , typename D4 = NullType // Type of the fourth lifetime dependency - , typename D5 = NullType // Type of the fifth lifetime dependency - , typename D6 = NullType // Type of the sixth lifetime dependency - , typename D7 = NullType // Type of the seventh lifetime dependency - , typename D8 = NullType > // Type of the eighth lifetime dependency +template< typename T > // Type of the singleton class Singleton : private NonCopyable { -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_8( D1, D2, D3, D4, D5, D6, D7, D8 ) Dependencies; - //******************************************************************************************************************* - protected: //**Constructor****************************************************************************************************** /*!\brief Constructor for the Singleton class. @@ -457,119 +70,9 @@ protected: // In case a cyclic lifetime dependency is detected, a compilation error is created. */ explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - , dependency3_( D3::instance() ) // Handle to the third lifetime dependency - , dependency4_( D4::instance() ) // Handle to the fourth lifetime dependency - , dependency5_( D5::instance() ) // Handle to the fifth lifetime dependency - , dependency6_( D6::instance() ) // Handle to the sixth lifetime dependency - , dependency7_( D7::instance() ) // Handle to the seventh lifetime dependency - , dependency8_( D8::instance() ) // Handle to the eighth lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D3 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D4 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D5 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D6 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D7 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D8 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() {} //******************************************************************************************************************* -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. - shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. - shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency. - shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency. - shared_ptr<D7> dependency7_; //!< Handle to the seventh lifetime dependency. - shared_ptr<D8> dependency8_; //!< Handle to the eighth lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (7 LIFETIME DEPENDENCIES) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 // Type of the first lifetime dependency - , typename D2 // Type of the second lifetime dependency - , typename D3 // Type of the third lifetime dependency - , typename D4 // Type of the fourth lifetime dependency - , typename D5 // Type of the fifth lifetime dependency - , typename D6 // Type of the sixth lifetime dependency - , typename D7 > // Type of the eighth lifetime dependency -class Singleton<T,D1,D2,D3,D4,D5,D6,D7,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_7( D1, D2, D3, D4, D5, D6, D7 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - , dependency3_( D3::instance() ) // Handle to the third lifetime dependency - , dependency4_( D4::instance() ) // Handle to the fourth lifetime dependency - , dependency5_( D5::instance() ) // Handle to the fifth lifetime dependency - , dependency6_( D6::instance() ) // Handle to the sixth lifetime dependency - , dependency7_( D7::instance() ) // Handle to the seventh lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D3 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D4 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D5 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D6 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D7 ); - } - //******************************************************************************************************************* - //**Destructor******************************************************************************************************* /*!\brief Destructor for the Singleton class. */ @@ -597,16 +100,8 @@ private: //**Member variables**************************************************************************** /*!\name Member variables */ //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. - shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. - shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency. - shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency. - shared_ptr<D7> dependency7_; //!< Handle to the seventh lifetime dependency. - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - + static bool isInstantiated_; //@} //******************************************************************************************************************* @@ -617,615 +112,17 @@ private: //====================================================================================================================== // -// SINGLETON SPECIALIZATION (6 LIFETIME DEPENDENCIES) +// DEFINITION AND INITIALIZATION OF THE STATIC MEMBER VARIABLES // //====================================================================================================================== -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 // Type of the first lifetime dependency - , typename D2 // Type of the second lifetime dependency - , typename D3 // Type of the third lifetime dependency - , typename D4 // Type of the fourth lifetime dependency - , typename D5 // Type of the fifth lifetime dependency - , typename D6 > // Type of the eighth lifetime dependency -class Singleton<T,D1,D2,D3,D4,D5,D6,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_6( D1, D2, D3, D4, D5, D6 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - , dependency3_( D3::instance() ) // Handle to the third lifetime dependency - , dependency4_( D4::instance() ) // Handle to the fourth lifetime dependency - , dependency5_( D5::instance() ) // Handle to the fifth lifetime dependency - , dependency6_( D6::instance() ) // Handle to the sixth lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D3 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D4 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D5 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D6 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. - shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. - shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency. - shared_ptr<D6> dependency6_; //!< Handle to the sixth lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (5 LIFETIME DEPENDENCIES) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 // Type of the first lifetime dependency - , typename D2 // Type of the second lifetime dependency - , typename D3 // Type of the third lifetime dependency - , typename D4 // Type of the fourth lifetime dependency - , typename D5 > // Type of the fifth lifetime dependency -class Singleton<T,D1,D2,D3,D4,D5,NullType,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_5( D1, D2, D3, D4, D5 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - , dependency3_( D3::instance() ) // Handle to the third lifetime dependency - , dependency4_( D4::instance() ) // Handle to the fourth lifetime dependency - , dependency5_( D5::instance() ) // Handle to the fifth lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D3 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D4 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D5 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. - shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. - shared_ptr<D5> dependency5_; //!< Handle to the fifth lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (4 LIFETIME DEPENDENCIES) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 // Type of the first lifetime dependency - , typename D2 // Type of the second lifetime dependency - , typename D3 // Type of the third lifetime dependency - , typename D4 > // Type of the fourth lifetime dependency -class Singleton<T,D1,D2,D3,D4,NullType,NullType,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_4( D1, D2, D3, D4 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - , dependency3_( D3::instance() ) // Handle to the third lifetime dependency - , dependency4_( D4::instance() ) // Handle to the fourth lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D3 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D4 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. - shared_ptr<D4> dependency4_; //!< Handle to the fourth lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (3 LIFETIME DEPENDENCIES) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 // Type of the first lifetime dependency - , typename D2 // Type of the second lifetime dependency - , typename D3 > // Type of the third lifetime dependency -class Singleton<T,D1,D2,D3,NullType,NullType,NullType,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_3( D1, D2, D3 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - , dependency3_( D3::instance() ) // Handle to the third lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D3 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - shared_ptr<D3> dependency3_; //!< Handle to the third lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (2 LIFETIME DEPENDENCIES) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 // Type of the first lifetime dependency - , typename D2 > // Type of the second lifetime dependency -class Singleton<T,D1,D2,NullType,NullType,NullType,NullType,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_2( D1, D2 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the first lifetime dependency - , dependency2_( D2::instance() ) // Handle to the second lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D2 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the first lifetime dependency. - shared_ptr<D2> dependency2_; //!< Handle to the second lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (1 LIFETIME DEPENDENCY) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T // Type of the singleton (CRTP pattern) - , typename D1 > // Type of the lifetime dependency -class Singleton<T,D1,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef WALBERLA_TYPELIST_1( D1 ) Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - : dependency1_( D1::instance() ) // Handle to the lifetime dependency - { - WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY( D1 ); - } - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - shared_ptr<D1> dependency1_; //!< Handle to the lifetime dependency. - - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - -#undef WALBERLA_DETECT_CYCLIC_LIFETIME_DEPENDENCY -#undef WALBERLA_JOIN -#undef WALBERLA_DO_JOIN -#undef WALBERLA_DO_JOIN2 - - -//====================================================================================================================== -// -// SINGLETON SPECIALIZATION (0 LIFETIME DEPENDENCIES) -// -//====================================================================================================================== - -//********************************************************************************************************************** -template< typename T > // Type of the singleton (CRTP pattern) -class Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType> : private NonCopyable -{ -public: - //**Type definitions**************************************************************************** - //! Type list of all lifetime dependencies. - typedef NullType Dependencies; - //******************************************************************************************************************* - -protected: - //**Constructor****************************************************************************************************** - /*!\brief Constructor for the Singleton class. - // - // In case a cyclic lifetime dependency is detected, a compilation error is created. - */ - explicit Singleton() - {} - //******************************************************************************************************************* - - //**Destructor******************************************************************************************************* - /*!\brief Destructor for the Singleton class. - */ - ~Singleton() - {} - //******************************************************************************************************************* - -public: - //**Instance function*************************************************************************** - /*!\name Instance function */ - //@{ - static const shared_ptr<T>& instance() - { - std::lock_guard<std::mutex> lock( instanceMutex_ ); - static shared_ptr<T> object( new T() ); - isInstantiated_ = true; - return object; - } - //@} - //******************************************************************************************************************* - - static bool isInstantiated() { return isInstantiated_; } - -private: - //**Member variables**************************************************************************** - /*!\name Member variables */ - //@{ - static std::mutex instanceMutex_; //!< Synchronization mutex for access to the singleton. - - static bool isInstantiated_; - //@} - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// DEFINITION AND INITIALIZATION OF THE STATIC MEMBER VARIABLES -// -//====================================================================================================================== - -template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > -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; - -template< typename T, typename A, typename B, typename C, typename D, typename E, typename F, typename G > -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; - -template< typename T, typename A, typename B, typename C, typename D, typename E, typename F > -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; - -template< typename T, typename A, typename B, typename C, typename D, typename E > -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; - -template< typename T, typename A, typename B, typename C, typename D > -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; - -template< typename T, typename A, typename B, typename C > -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; - -template< typename T, typename A, typename B > -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; - -template< typename T, typename A > -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; - -template< typename T > -std::mutex Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::instanceMutex_; +template< typename T > +std::mutex Singleton<T>::instanceMutex_; template< typename T > -bool Singleton<T,NullType,NullType,NullType,NullType,NullType,NullType,NullType,NullType>::isInstantiated_ = false; - - +bool Singleton<T>::isInstantiated_ = false; -#ifdef WALBERLA_CXX_COMPILER_IS_GNU -#pragma GCC diagnostic pop -#endif -#ifdef WALBERLA_CXX_COMPILER_IS_CLANG -#pragma clang diagnostic pop -#endif } // namespace singleton } // namespace walberla diff --git a/src/core/singleton/TypeList.h b/src/core/singleton/TypeList.h deleted file mode 100644 index 53dc703e67541b634b1579d92a9252b9a90aae77..0000000000000000000000000000000000000000 --- a/src/core/singleton/TypeList.h +++ /dev/null @@ -1,743 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file TypeList.h -//! \ingroup core -//! \author Klaus Iglberger -// -//====================================================================================================================== - -#pragma once - -#include "NullType.h" - -#include <cstdlib> - - -namespace walberla { -namespace singleton { - - - -//====================================================================================================================== -// -// CLASS TYPELIST -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\brief Implementation of a type list. -// -// Type lists provide the functionality to create lists of data types. In contrast to lists -// of data values (as for instance the std::list class template), type lists are created at -// compile time, not at run time. This type list implementation closely resembles the original -// implementation of Andrei Alexandrescu (taken from his book Modern C++, ISBN: 0201704315). -// The following example demonstrates, how type lists are created and manipulated: - -\code -// Creating a type list consisting of two fundamental floating point data types -typedef WALBERLA_TYPELIST_2( float, double ) Tmp; - -// Appending a type to the type list -typedef walberla::singleton::Append< Tmp, long double >::Result Floats; // Type list containing all floating point data types - -// Calculating the length of the type list (at compile time!) -const int length = Length< Floats >::value; // Value evaluates to 3 - -// Accessing a specific type of the type list via indexing -typedef walberla::singleton::TypeAt< Floats, 0 >::Result Index0; - -// Searching the type list for a specific type -const int index1 = walberla::singleton::Contains< Floats, double >::value; // Value evaluates to 1 -const int index2 = walberla::singleton::Contains< Floats, int >::value; // Value evaluates to 0 - -// Determining the index of a specific type in the type list -const int index3 = walberla::singleton::IndexOf< Floats, double >::value; // Value evaluates to 1 -const int index4 = walberla::singleton::IndexOf< Floats, int >::value; // Value evaluates to -1 -\endcode - -// The type list merely consists of the two data types \a Head and \a Tail. In order to create -// type lists of more data types, the TypeList class is used recursively: - -\code -// Type list containing the three fundamental floating point data types -TypeList< float, TypeList< double, TypeList< long double, NullType > > > -\endcode - -// The NullType data type is used to terminate a type list.\n -// In order to create a type list, one of the predefined setup macros should be used: - -\code -// Creating a type list consisting of the three fundamental data types -typedef WALBERLA_TYPELIST_3( float, double, long double ) Floats; -\endcode - */ -template< typename H // Head of the type list - , typename T > // Tail of the type list -struct TypeList -{ - //**Type definitions**************************************************************************** - typedef H Head; //!< Type of the head of the type list. - typedef T Tail; //!< Type of the tail of the type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// TYPE LIST GENERATION MACROS -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list only consisting of the type \a T1. The terminating type for -// the type list is the NullType. The following example demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of a single data type -typedef WALBERLA_TYPELIST_1( int ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_1( T1 ) \ -TypeList< T1, NullType > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the two types \a T1 and \a T2. The terminating -// type for the type list is the NullType. The following example demonstrates the use of this -// macro: - -\code -// Definition of a new type list consisting of two data types -typedef WALBERLA_TYPELIST_2( int, unsigned int ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_2( T1, T2 ) \ -TypeList< T1, WALBERLA_TYPELIST_1( T2 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the three types \a T1, \a T2 and \a T3. The -// terminating type for the type list is the NullType. The following example demonstrates -// the use of this macro: - -\code -// Definition of a new type list consisting of three data types -typedef WALBERLA_TYPELIST_3( float, double, long double ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_3( T1, T2, T3 ) \ -TypeList< T1, WALBERLA_TYPELIST_2( T2, T3 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the four types \a T1, \a T2, \a T3 and \a T4. -// The terminating type for the type list is the NullType. The following example demonstrates -// the use of this macro: - -\code -// Definition of a new type list consisting of four data types -typedef WALBERLA_TYPELIST_4( unsigned char, signed char, char, wchar_t ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_4( T1, T2, T3, T4 ) \ -TypeList< T1, WALBERLA_TYPELIST_3( T2, T3, T4 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the five types \a T1, \a T2, \a T3, \a T4 -// and \a T5. The terminating type for the type list is the NullType. The following example -// demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of five data types -typedef WALBERLA_TYPELIST_5( char, short, int, long, float ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_5( T1, T2, T3, T4, T5 ) \ -TypeList< T1, WALBERLA_TYPELIST_4( T2, T3, T4, T5 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the six types \a T1, \a T2, \a T3, \a T4, \a T5 -// and \a T6. The terminating type for the type list is the NullType. The following example -// demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of six data types -typedef WALBERLA_TYPELIST_6( char, short, int, long, float, double ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_6( T1, T2, T3, T4, T5, T6 ) \ -TypeList< T1, WALBERLA_TYPELIST_5( T2, T3, T4, T5, T6 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the seven types \a T1, \a T2, \a T3, \a T4, -// \a T5, \a T6 and \a T7. The terminating type for the type list is the NullType. The -// following example demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of seven data types -typedef WALBERLA_TYPELIST_7( char, short, int, long, float, double, long double ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_7( T1, T2, T3, T4, T5, T6, T7 ) \ -TypeList< T1, WALBERLA_TYPELIST_6( T2, T3, T4, T5, T6, T7 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the eight types \a T1, \a T2, \a T3, \a T4, -// \a T5, \a T6, \a T7 and \a T8. The terminating type for the type list is the NullType. -// The following example demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of eight data types -typedef WALBERLA_TYPELIST_8( char, wchar_t, short, int, long, float, double, long double ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_8( T1, T2, T3, T4, T5, T6, T7, T8 ) \ -TypeList< T1, WALBERLA_TYPELIST_7( T2, T3, T4, T5, T6, T7, T8 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the nine types \a T1, \a T2, \a T3, \a T4, -// \a T5, \a T6, \a T7, \a T8 and \a T9. The terminating type for the type list is the NullType. -// The following example demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of nine data types -typedef WALBERLA_TYPELIST_9( char, signed char, wchar_t, short, int, long, float, double, long double ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_9( T1, T2, T3, T4, T5, T6, T7, T8, T9 ) \ -TypeList< T1, WALBERLA_TYPELIST_8( T2, T3, T4, T5, T6, T7, T8, T9 ) > -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\brief Type list generation macro. -// -// This macro creates a type list consisting of the ten types \a T1, \a T2, \a T3, \a T4, -// \a T5, \a T6, \a T7, \a T8, \a T9 and \a T10. The terminating type for the type list is -// the NullType. The following example demonstrates the use of this macro: - -\code -// Definition of a new type list consisting of ten data types -typedef WALBERLA_TYPELIST_10( unsigned char, signed char, char, wchar_t, unsigned short, -short, unsigned int, int, unsigned long, long ) MyTypes; - -// Calculating the length of the type list -const int length = Length<MyTypes>::value; -\endcode - */ -#define WALBERLA_TYPELIST_10( T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 ) \ -TypeList< T1, WALBERLA_TYPELIST_9( T2, T3, T4, T5, T6, T7, T8, T9, T10 ) > -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// LENGTH OF A TYPE LIST -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\class Length -// \brief Calculating the length of a type list. -// -// The Length class can be used to obtain the length of a type list (i.e. the number -// contained types). In order to obtain the length of a type list, the Length class -// has to be instantiated for a particular type list. The length of the type list can -// be obtained using the member enumeration \a value. The following example gives an -// impression of the use of the Length class: - -\code -typedef WALBERLA_TYPELIST_3( float, double, long double ) Floats; // Defining a new type list -const int length = walberla::singleton::Length< Floats >::value; // The length of the type list -\endcode - */ -template< typename TList > // Type of the type list -struct Length; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the Length class for empty type lists. -template<> -struct Length< NullType > -{ - //**Member enumeration************************************************************************** - enum { value = 0 }; - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Specialization of the Length class for general type lists. -template< typename Head // Type of the head of the type list - , typename Tail > // Type of the tail of the type list -struct Length< TypeList<Head,Tail> > -{ - //**Member enumeration************************************************************************** - enum { value = 1 + Length<Tail>::value }; - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// INDEXED ACCESS -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\class TypeAt -// \brief Indexing a type list. -// -// The TypeAt class can be used to access a type list at a specified position to query the -// according type. In order to index a type list, the TypeAt class has to be instantiated -// for a particular type list and an index value. The indexed type is available via the -// member type definition \a Result. The following example gives an impression of the use -// of the TypeAt class: - -\code -typedef WALBERLA_TYPELIST_3( float, double, long double ) Floats; // Defining a new type list -typedef walberla::singleton::TypeAt< Floats, 0 >::Result Index0; // Indexing of the type list at index 0 -\endcode - -// \b Note: The access index is zero based! - */ -template< typename TList // Type of the type list - , size_t Index > // Type list access index -struct TypeAt; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Specialization of the TypeAt class for an index of 0. -template< typename Head // Type of the head of the type list - , typename Tail > // Type of the tail of the type list -struct TypeAt< TypeList<Head,Tail>, 0 > -{ - //**Member enumeration************************************************************************** - typedef Head Result; //!< Data type at index 0. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Specialization of the TypeAt class for a general index. -template< typename Head // Type of the head of the type list - , typename Tail // Type of the tail of the type list - , size_t Index > // Type list access index -struct TypeAt< TypeList<Head,Tail>, Index > -{ - //**Member enumeration************************************************************************** - typedef typename TypeAt< Tail, Index-1 >::Result Result; //!< Data type at indexed position. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// TYPE LIST SEARCH -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\class Contains -// \brief Searching a type list. -// -// The Contains class can be used to search the type list for a particular type \a Type. In -// contrast to the IndexOf class, the Contains class does not evaluate the index of the type -// but only checks whether or not the type is contained in the type list. Additionally, in -// contrast to the ContainsRelated class, the Contains class strictly searches for the given -// type \a Type and not for a related data type. In case the type is contained in the type -// list, the \a value member enumeration is set to 1, else it is set to 0. In order to check -// whether a type is part of a type list, the Contains class has to be instantiated for a -// particular type list and another type. The following example gives an impression of the -// use of the Contains class: - -\code -typedef WALBERLA_TYPELIST_3( float, double, long double ) Floats; // Defining a new type list -const int index1 = walberla::singleton::Contains< Floats, double >::value; // Value evaluates to 1 -const int index2 = walberla::singleton::Contains< Floats, int >::value; // Value evaluates to 0 -\endcode - */ -template< typename TList // Type of the type list - , typename Type > // The search type -struct Contains; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Specialization of the Contains class for the terminating NullType. -template< typename Type > // The search type -struct Contains< NullType, Type > -{ - //**Member enumeration************************************************************************** - enum { value = 0 }; //!< \a Type is not contained in the type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Specialization of the Contains class for a successful search. -template< typename Tail // Type of the tail of the type list - , typename Type > // The search type -struct Contains< TypeList<Type,Tail>, Type > -{ - //**Member enumeration************************************************************************** - enum { value = 1 }; //!< \a Type is the head of the type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Specialization of the Contains class for a general type list. -template< typename Head // Type of the head of the type list - , typename Tail // Type of the tail of the type list - , typename Type > // The search type -struct Contains< TypeList<Head,Tail>, Type > -{ - //**Member enumeration************************************************************************** - enum { value = Contains<Tail,Type>::value }; //!< Search result for type \a Type. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\class ContainsRelated -// \brief Searching a type list. -// -// The ContainsRelated class can be used to search the type list for a type related to \a Type. -// In contrast to the Contains class, the ContainsRelated class only searches for a type the -// given data type \a Type can be converted to. In case a related type is found in the type -// list, the \a value member enumeration is set to 1, else it is set to 0. In order to check -// whether a related type is contained in the type list, the ContainsRelated class has to be -// instantiated for a particular type list and another type. The following example gives an -// impression of the use of the ContainsRelated class: - -\code -class A {}; -class B : public A {}; -class C {}; -class D {}; - -// Defining a new type list -typedef WALBERLA_TYPELIST_2( A, C ) Types; - -// Searching for the type A in the type list -const int a = walberla::singleton::ContainsRelated< Types, A >::value; // Evaluates to 1, type A is found - -// Searching for the derived type B in the type list -const int b = walberla::singleton::ContainsRelated< Types, B >::value; // Evaluates to 1, base type A is found - -// Searching for the type C in the type list -const int c = walberla::singleton::ContainsRelated< Types, D >::value; // Evaluates to 0, no related type found -\endcode - */ -template< typename TList // Type of the type list - , typename Type > // The search type -struct ContainsRelated; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the ContainsRelated class for the terminating NullType. -template< typename Type > // The search type -struct ContainsRelated< NullType, Type > -{ - //**Member enumeration************************************************************************** - enum { value = 0 }; //!< No related type of \a Type is contained in the type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the ContainsRelated class for a general type list. -template< typename Head // Type of the head of the type list - , typename Tail // Type of the tail of the type list - , typename Type > // The search type -struct ContainsRelated< TypeList<Head,Tail>, Type > -{ -private: - //******************************************************************************************************************* - class No {}; - class Yes { No no[2]; }; - //******************************************************************************************************************* - - //******************************************************************************************************************* - static Yes test( Head ); - static No test( ... ); - static Type createType(); - //******************************************************************************************************************* - - //**Member enumeration************************************************************************** - enum { tmp = sizeof( test( createType() ) ) == sizeof( Yes ) ? 1 : 0 }; //!< Relationship evaluation. - //******************************************************************************************************************* - -public: - //**Member enumeration************************************************************************** - enum { value = tmp == 1 ? 1 : ( ContainsRelated<Tail,Type>::value ) }; //!< Search result for type \a Type. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/*!\class IndexOf -// \brief Searching a type list. -// -// The IndexOf class can be used to search the type list for a particular type \a Type. In -// contrast to the Contains and the ContainsRelated classes, the IndexOf class evaluates the -// index of the given type in the type list. In case the type is contained in the type list, -// the \a value member represents the index of the queried type. Otherwise the \a value member -// is set to -1. In order to search for a type, the IndexOf class has to be instantiated for -// a particular type list and a search type. The following example gives an impression of the -// use of the IndexOf class: - -\code -typedef WALBERLA_TYPELIST_3( float, double, long double ) Floats; // Defining a new type list -const int index1 = walberla::singleton::IndexOf< Floats, double >::value; // Value evaluates to 1 -const int index2 = walberla::singleton::IndexOf< Floats, int >::value; // Value evaluates to -1 -\endcode - */ -template< typename TList // Type of the type list - , typename Type > // The search type -struct IndexOf; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the IndexOf class for the terminating NullType. -template< typename Type > // The search type -struct IndexOf< NullType, Type > -{ - //**Member enumeration************************************************************************** - enum { value = -1 }; //!< \a Type is not contained in the type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the IndexOf class for a successful search. -template< typename Tail // Type of the tail of the type list - , typename Type > // The search type -struct IndexOf< TypeList<Type,Tail>, Type > -{ - //**Member enumeration************************************************************************** - enum { value = 0 }; //!< \a Type is the head of the type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the IndexOf class for a general type list. -template< typename Head // Type of the head of the type list - , typename Tail // Type of the tail of the type list - , typename Type > // The search type -struct IndexOf< TypeList<Head,Tail>, Type > -{ -private: - //**Member enumeration************************************************************************** - enum { tmp = IndexOf<Tail,Type>::value }; //!< Index of \a Type in the tail of the type list. - //******************************************************************************************************************* - -public: - //**Member enumeration************************************************************************** - enum { value = tmp == -1 ? -1 : 1 + tmp }; //!< Index of \a Type in the entire type list. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//====================================================================================================================== -// -// APPENDING TO TYPE LISTS -// -//====================================================================================================================== - -//********************************************************************************************************************** -/*!\class Append -// \brief Appending a type to a type list. -// -// The Append class can be used to append the data type \a Type to a type list \a TList. In -// order to append a data type, the Append class has to be instantiated for a particular type -// list and another type. The following example gives an impression of the use of the Append -// class: - -\code -typedef WALBERLA_TYPELIST_3( float, double ) Temp; // Defining a temporary type list -typedef walberla::singleton::Append<Temp,long double>::Result Floats; // Type list contained all floating point data types -\endcode - */ -template< typename TList // Type of the type list - , typename Type > // The type to be appended to the type list -struct Append; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the Append class for appending the NullType. -template<> -struct Append< NullType, NullType > -{ - //**Type definitions**************************************************************************** - typedef NullType Result; //!< The resulting data type. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the Append class for appending a general type to the NullType. -template< typename Type > // The type to be appended to the type list -struct Append< NullType, Type > -{ - //**Type definitions**************************************************************************** - typedef WALBERLA_TYPELIST_1( Type ) Result; //!< The resulting data type. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the Append class for appending a type list to the NullType. -template< typename Head // Type of the head of the type list - , typename Tail > // Type of the tail of the type list -struct Append< NullType, TypeList<Head,Tail> > -{ - //**Type definitions**************************************************************************** - typedef TypeList<Head,Tail> Result; //!< The resulting data type. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -//********************************************************************************************************************** -/// Spezialization of the Append class for appending a general type to a type list. -template< typename Head // Type of the head of the type list - , typename Tail // Type of the tail of the type list - , typename Type > // The type to be appended to the type list -struct Append< TypeList<Head,Tail>, Type > -{ - //**Type definitions**************************************************************************** - typedef TypeList< Head, typename Append<Tail,Type>::Result > Result; //!< The resulting data type. - //******************************************************************************************************************* -}; -//********************************************************************************************************************** - - - -} // namespace singleton -} // namespace walberla diff --git a/src/lbm/boundary/factories/DefaultBoundaryHandling.h b/src/lbm/boundary/factories/DefaultBoundaryHandling.h index 3036fa2acb40ca5ba0f4e188c8141fccb728eefa..1e196a12c07d697ec4fb68364011aa66057c01a7 100644 --- a/src/lbm/boundary/factories/DefaultBoundaryHandling.h +++ b/src/lbm/boundary/factories/DefaultBoundaryHandling.h @@ -32,8 +32,6 @@ #include "boundary/BoundaryHandling.h" #include "lbm/field/PdfField.h" -#include <boost/tuple/tuple.hpp> - namespace walberla { namespace lbm { @@ -82,8 +80,7 @@ public: typedef Vector3<real_t> Velocity; typedef PdfField< LatticeModel > PdfFieldLM; - typedef boost::tuple< BcNoSlip, BcFreeSlip, BcSimpleUBB, BcSimpleUBB, BcSimplePressure, BcSimplePressure> BoundaryConditions; - typedef walberla::boundary::BoundaryHandling< FlagFieldT, Stencil, BoundaryConditions > BoundaryHandling; + typedef walberla::boundary::BoundaryHandling< FlagFieldT, Stencil, BcNoSlip, BcFreeSlip, BcSimpleUBB, BcSimpleUBB, BcSimplePressure, BcSimplePressure > BoundaryHandling; static BlockDataID addBoundaryHandlingToStorage( const shared_ptr< StructuredBlockStorage > & bs, const std::string & identifier, BlockDataID flagFieldID, BlockDataID pdfFieldID, const Set< FlagUID > & flagUIDSet, @@ -165,14 +162,12 @@ DefaultBoundaryHandlingFactory<LatticeModel, FlagFieldT>::operator()( walberla:: mask = static_cast< flag_t >( mask | flagField->getOrRegisterFlag( *flag ) ); BoundaryHandling * handling = new BoundaryHandling( "default lbm boundary handling", flagField, mask, - boost::tuples::make_tuple( BcNoSlip ( getNoSlipBoundaryUID(), getNoSlip(), pdfField ), BcFreeSlip ( getFreeSlipBoundaryUID(), getFreeSlip(), pdfField, flagField, mask ), BcSimpleUBB ( getVelocity0BoundaryUID(), getVelocity0(), pdfField, velocity0_ ), BcSimpleUBB ( getVelocity1BoundaryUID(), getVelocity1(), pdfField, velocity1_ ), BcSimplePressure( getPressure0BoundaryUID(), getPressure0(), pdfField, pressure0_ ), BcSimplePressure( getPressure1BoundaryUID(), getPressure1(), pdfField, pressure1_ ) - ) ); return handling; diff --git a/src/lbm/boundary/factories/DefaultBoundaryHandlingCollection.h b/src/lbm/boundary/factories/DefaultBoundaryHandlingCollection.h index 4bee0c6c165d99ce6c57d746ddef667106e8056f..54aafd3345681bea2ea7776ae6decfd98a0361f3 100644 --- a/src/lbm/boundary/factories/DefaultBoundaryHandlingCollection.h +++ b/src/lbm/boundary/factories/DefaultBoundaryHandlingCollection.h @@ -40,11 +40,8 @@ private: typedef typename DefaultBoundaryHandlingFactory < LatticeModel_T, FlagField_T >::BoundaryHandling DefaultBoundaryHandling_T; typedef typename DefaultDiffusionBoundaryHandlingFactory< DiffusionLatticeModel_T, FlagField_T >::BoundaryHandling_T DefaultDiffusionBoundaryHandlingFactory_T; -private: - typedef boost::tuples::tuple< DefaultBoundaryHandling_T &, DefaultDiffusionBoundaryHandlingFactory_T & > BoundaryHandlings; - public: - typedef BoundaryHandlingCollection< FlagField_T, BoundaryHandlings > BoundaryHandlingCollection_T; + typedef BoundaryHandlingCollection< FlagField_T, DefaultBoundaryHandling_T &, DefaultDiffusionBoundaryHandlingFactory_T & > BoundaryHandlingCollection_T; private: @@ -62,7 +59,7 @@ private: DefaultBoundaryHandling_T & handling = * block->getData< DefaultBoundaryHandling_T >( handlingID ); DefaultDiffusionBoundaryHandlingFactory_T & diffusionHandling = * block->getData< DefaultDiffusionBoundaryHandlingFactory_T >( diffusionHandlingID ); - return new BoundaryHandlingCollection_T( " Diffusion Boundary Handling Collection", flagField, BoundaryHandlings( handling, diffusionHandling ) ); + return new BoundaryHandlingCollection_T( " Diffusion Boundary Handling Collection", flagField, handling, diffusionHandling ); } public: diff --git a/src/lbm/boundary/factories/DefaultDiffusionBoundaryHandling.h b/src/lbm/boundary/factories/DefaultDiffusionBoundaryHandling.h index 42e3c7536baaf15361049affebc016eb46f7664d..e32559776caa7bf309cb6d723ecf0d7be605d086 100644 --- a/src/lbm/boundary/factories/DefaultDiffusionBoundaryHandling.h +++ b/src/lbm/boundary/factories/DefaultDiffusionBoundaryHandling.h @@ -34,8 +34,6 @@ #include "field/FlagFunctions.h" -#include <boost/tuple/tuple.hpp> - #include <functional> @@ -56,12 +54,9 @@ public: typedef lbm::NoDiffusion < LatticeModel_T, flag_t > NoDiffusion_T; typedef lbm::FreeDiffusion < LatticeModel_T, FlagField_T > FreeDiffusion_T; -private: - typedef boost::tuples::tuple< DiffusionDirichlet_T, SimpleDiffusionDirichlet_T, NoDiffusion_T, FreeDiffusion_T, SimpleDiffusionDirichlet_T, SimpleDiffusionDirichlet_T > BoundaryConditions; - public: - typedef walberla::boundary::BoundaryHandling< FlagField_T, Stencil, BoundaryConditions > BoundaryHandling_T; - typedef walberla::boundary::BoundaryHandling< FlagField_T, Stencil, BoundaryConditions > BoundaryHandling; + typedef walberla::boundary::BoundaryHandling< FlagField_T, Stencil, DiffusionDirichlet_T, SimpleDiffusionDirichlet_T, NoDiffusion_T, FreeDiffusion_T, SimpleDiffusionDirichlet_T, SimpleDiffusionDirichlet_T > BoundaryHandling_T; + typedef BoundaryHandling_T BoundaryHandling; const static FlagUID& getDiffusionDirichletFlagUID() { static FlagUID uid( "DiffusionDirichlet" ); return uid; } const static FlagUID& getSimpleDiffusionDirichletFlagUID() { static FlagUID uid( "SimpleDiffusionDirichlet" ); return uid; } @@ -106,13 +101,13 @@ private: for( auto domainFlagUID = domainFlagUIDs.begin(); domainFlagUID != domainFlagUIDs.end(); ++domainFlagUID ) field::addMask( domainMask, flagField->getOrRegisterFlag( *domainFlagUID ) ); - BoundaryHandling_T * handling = new BoundaryHandling_T( "Diffusion Boundary Handling", flagField, domainMask, boost::tuples::make_tuple( + BoundaryHandling_T * handling = new BoundaryHandling_T( "Diffusion Boundary Handling", flagField, domainMask, DiffusionDirichlet_T ( getDiffusionDirichletBoundaryUID(), getDiffusionDirichletFlagUID(), pdfField, flagField ), SimpleDiffusionDirichlet_T( getSimpleDiffusionDirichletBoundaryUID(), getSimpleDiffusionDirichletFlagUID(), pdfField ), NoDiffusion_T ( getNoDiffusionBoundaryUID(), getNoDiffusionFlagUID(), pdfField ), FreeDiffusion_T ( getFreeDiffusionBoundaryUID(), getFreeDiffusionFlagUID(), pdfField, flagField, domainMask ), SimpleDiffusionDirichlet_T( getSimpleDiffusionDirichletBoundaryUID1(), getSimpleDiffusionDirichletFlagUID1(), pdfField ), - SimpleDiffusionDirichlet_T( getSimpleDiffusionDirichletBoundaryUID2(), getSimpleDiffusionDirichletFlagUID2(), pdfField )) ); + SimpleDiffusionDirichlet_T( getSimpleDiffusionDirichletBoundaryUID2(), getSimpleDiffusionDirichletFlagUID2(), pdfField ) ); if( initFlagUIDs.size() > size_t(0u) ) { diff --git a/src/lbm/boundary/factories/ExtendedBoundaryHandlingFactory.h b/src/lbm/boundary/factories/ExtendedBoundaryHandlingFactory.h index 11ae8af9d3ca08da723e218d37b90796a6e35e85..4c08292b5638039717c3a5f2fa0f6c6e0eee9c68 100644 --- a/src/lbm/boundary/factories/ExtendedBoundaryHandlingFactory.h +++ b/src/lbm/boundary/factories/ExtendedBoundaryHandlingFactory.h @@ -33,8 +33,6 @@ #include "boundary/BoundaryHandling.h" #include "lbm/field/PdfField.h" -#include <boost/tuple/tuple.hpp> - namespace walberla { namespace lbm { @@ -86,8 +84,7 @@ public: typedef Outlet<LatticeModel, FlagFieldT > BcOutlet; typedef Curved<LatticeModel, FlagFieldT > BcCurved; - typedef boost::tuple< BcNoSlip, BcFreeSlip, BcPressure, BcUBB, BcOutlet, BcCurved > BoundaryConditions; - typedef walberla::boundary::BoundaryHandling< FlagFieldT, Stencil, BoundaryConditions > BoundaryHandling; + typedef walberla::boundary::BoundaryHandling< FlagFieldT, Stencil, BcNoSlip, BcFreeSlip, BcPressure, BcUBB, BcOutlet, BcCurved > BoundaryHandling; static BlockDataID addBoundaryHandlingToStorage( const shared_ptr< StructuredBlockStorage > & bs, const std::string & identifier, BlockDataID flagFieldID, BlockDataID pdfFieldID, const Set< FlagUID > & flagUIDSet ) @@ -156,14 +153,12 @@ ExtendedBoundaryHandlingFactory<LatticeModel, FlagFieldT>::operator()( IBlock * BoundaryHandling * handling = new BoundaryHandling( "extended lbm boundary handling", flagField, mask, - boost::tuples::make_tuple( BcNoSlip ( getNoSlipBoundaryUID(), getNoSlip(), pdfField ), BcFreeSlip ( getFreeSlipBoundaryUID(), getFreeSlip(), pdfField, flagField, mask ), BcPressure ( getPressureBoundaryUID(), getPressure(), pdfField ), BcUBB ( getUBBBoundaryUID(), getUBB(), pdfField, flagField, storage->getLevel(*block), block->getAABB() ), BcOutlet ( getOutletBoundaryUID(), getOutlet(), pdfField, flagField, mask ), BcCurved ( getCurvedBoundaryUID(), getCurved(), pdfField, flagField, mask ) - ) ); return handling; diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index 3d3cfa15924a0fc0642a36db1a372b72760646f0..5f60e2cdf874372ddc837948c77ce7b076da24e5 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -1377,13 +1377,13 @@ void VTKOutput::writeVTUHeaderPiece( std::ostream& ofs, const uint_t numberOfCel { Base64Writer base64; for( auto vertex = vc.begin(); vertex != vc.end(); ++vertex ) - base64 << numeric_cast<float>( ( *vertex ).get<0>() ) << numeric_cast<float>( ( *vertex ).get<1>() ) - << numeric_cast<float>( ( *vertex ).get<2>() ); + base64 << numeric_cast<float>( std::get<0>( *vertex ) ) << numeric_cast<float>( std::get<1>( *vertex ) ) + << numeric_cast<float>( std::get<2>( *vertex ) ); ofs << " "; base64.toStream( ofs ); } else for( auto vertex = vc.begin(); vertex != vc.end(); ++vertex ) - ofs << " " << numeric_cast<float>( ( *vertex ).get<0>() ) << " " << numeric_cast<float>( ( *vertex ).get<1>() ) - << " " << numeric_cast<float>( ( *vertex ).get<2>() ) << "\n"; + ofs << " " << numeric_cast<float>( std::get<0>( *vertex ) ) << " " << numeric_cast<float>( std::get<1>( *vertex ) ) + << " " << numeric_cast<float>( std::get<2>( *vertex ) ) << "\n"; ofs << " </DataArray>\n" << " </Points>\n" diff --git a/src/vtk/VTKOutput.h b/src/vtk/VTKOutput.h index 8d635ab44da684fd992c4328362fa8ebd5a6e986..b563fb28493e9048e74a68d9eaf48118c3eec46b 100644 --- a/src/vtk/VTKOutput.h +++ b/src/vtk/VTKOutput.h @@ -35,7 +35,7 @@ #include "core/Filesystem.h" #include <functional> -#include <boost/tuple/tuple.hpp> +#include <tuple> #include <fstream> #include <string> @@ -55,16 +55,16 @@ private: typedef UID< VTKGEN > VTKUID; // types used during vertex-index mapping procedure when writing (P)VTU files - typedef boost::tuple< cell_idx_t, cell_idx_t, cell_idx_t > Vertex; - typedef boost::tuple< real_t, real_t, real_t > VertexCoord; + typedef std::tuple< cell_idx_t, cell_idx_t, cell_idx_t > Vertex; + typedef std::tuple< real_t, real_t, real_t > VertexCoord; typedef uint32_t Index; struct VertexCompare { bool operator()( const Vertex& lhs, const Vertex& rhs ) const { - if( lhs.get<0>() < rhs.get<0>() || - ( lhs.get<0>() == rhs.get<0>() && lhs.get<1>() < rhs.get<1>() ) || - ( lhs.get<0>() == rhs.get<0>() && lhs.get<1>() == rhs.get<1>() && lhs.get<2>() < rhs.get<2>() ) ) + if( std::get<0>(lhs) < std::get<0>(rhs) || + ( std::get<0>(lhs) == std::get<0>(rhs) && std::get<1>(lhs) < std::get<1>(rhs) ) || + ( std::get<0>(lhs) == std::get<0>(rhs) && std::get<1>(lhs) == std::get<1>(rhs) && std::get<2>(lhs) < std::get<2>(rhs) ) ) return true; return false; } diff --git a/src/waLBerlaDefinitions.in.h b/src/waLBerlaDefinitions.in.h index 610aea18d7e537ea82fbd70bca59eda88e3f55cc..82f38181f2388727934ded2e08f302e34369b7e1 100644 --- a/src/waLBerlaDefinitions.in.h +++ b/src/waLBerlaDefinitions.in.h @@ -19,6 +19,7 @@ // External libraries +#cmakedefine WALBERLA_BUILD_WITH_BOOST #cmakedefine WALBERLA_BUILD_WITH_MPI #cmakedefine WALBERLA_BUILD_WITH_OPENMP #cmakedefine WALBERLA_BUILD_WITH_METIS diff --git a/tests/boundary/BoundaryHandling.cpp b/tests/boundary/BoundaryHandling.cpp index dbc83e1fe2ed0137d412fdcb8e6f8a96f6020505..77213c33d6fb45e04d93644c8451c38e0cd2b09a 100644 --- a/tests/boundary/BoundaryHandling.cpp +++ b/tests/boundary/BoundaryHandling.cpp @@ -35,8 +35,6 @@ #include "stencil/D3Q27.h" -#include <boost/tuple/tuple.hpp> - namespace walberla { @@ -203,7 +201,7 @@ private: // TEST BOUNDARY HANDLING // //////////////////////////// -typedef BoundaryHandling< FlagField_T, stencil::D3Q27, boost::tuples::tuple< CopyBoundary, AddBoundary > > TestBoundaryHandling; +typedef BoundaryHandling< FlagField_T, stencil::D3Q27, CopyBoundary, AddBoundary > TestBoundaryHandling; @@ -368,7 +366,7 @@ static int main( int argc, char **argv ) FactorField_T factorField_Ref( xSize, ySize, zSize, gl, uint_c(0) ); TestBoundaryHandling handling( "test boundary handling", &flagField_BH, numeric_cast<flag_t>( domainFlag1 | domainFlag2 ), - boost::tuples::make_tuple( CopyBoundary( copy1, copy2, &workField_BH ), AddBoundary( add, &workField_BH ) ) ); + CopyBoundary( copy1, copy2, &workField_BH ), AddBoundary( add, &workField_BH ) ); // START TESTING / COMPARING diff --git a/tests/core/CMakeLists.txt b/tests/core/CMakeLists.txt index e0a417390ec64f72d69acdfc57e3bc5c508f8f43..0a2f5a3851424b89295222d15ff981c329f45723 100644 --- a/tests/core/CMakeLists.txt +++ b/tests/core/CMakeLists.txt @@ -21,12 +21,16 @@ waLBerla_execute_test( NAME CellIntervalTest ) waLBerla_compile_test( FILES config/ConfigTest.cpp ) waLBerla_execute_test( NAME ConfigTest COMMAND $<TARGET_FILE:ConfigTest> ${CMAKE_CURRENT_SOURCE_DIR}/config/ConfigTest.dat ) -waLBerla_compile_test( FILES config/PropertyTreeTest.cpp) -#waLBerla_execute_test(NAME PropertyTreeTest COMMAND $<TARGET_FILE:PropertyTreeTest> ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES config/PropertyTreeTest.cpp) + #waLBerla_execute_test(NAME PropertyTreeTest COMMAND $<TARGET_FILE:PropertyTreeTest> ) +endif( WALBERLA_BUILD_WITH_BOOST ) -waLBerla_compile_test( FILES config/MultiArrayIOTest.cpp ) -waLBerla_execute_test( NAME MultiArrayIOTest COMMAND $<TARGET_FILE:MultiArrayIOTest> ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES config/MultiArrayIOTest.cpp ) + waLBerla_execute_test( NAME MultiArrayIOTest COMMAND $<TARGET_FILE:MultiArrayIOTest> ) +endif( WALBERLA_BUILD_WITH_BOOST ) ######### @@ -84,9 +88,11 @@ waLBerla_execute_test( NAME Matrix3Test ) waLBerla_compile_test( FILES math/GenericAABBTest.cpp DEPENDS stencil domain_decomposition ) waLBerla_execute_test( NAME GenericAABBTest ) -waLBerla_compile_test( FILES math/PhysicalCheckTest.cpp DEPENDS stencil ) -waLBerla_execute_test( NAME PhysicalCheckTest - COMMAND $<TARGET_FILE:PhysicalCheckTest> ${CMAKE_CURRENT_SOURCE_DIR}/math/PhysicalCheckTestInput.prm ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES math/PhysicalCheckTest.cpp DEPENDS stencil ) + waLBerla_execute_test( NAME PhysicalCheckTest + COMMAND $<TARGET_FILE:PhysicalCheckTest> ${CMAKE_CURRENT_SOURCE_DIR}/math/PhysicalCheckTestInput.prm ) +endif( WALBERLA_BUILD_WITH_BOOST ) waLBerla_compile_test( FILES math/FastInvSqrtTest.cpp ) @@ -96,8 +102,10 @@ waLBerla_execute_test( NAME FastInvSqrtTest ) # math/equation_system # ######################## -waLBerla_compile_test( FILES math/equation_system/EquationSolverTest.cpp ) -waLBerla_execute_test( NAME EquationSolverTest ) +if( WALBERLA_BUILD_WITH_BOOST ) + waLBerla_compile_test( FILES math/equation_system/EquationSolverTest.cpp ) + waLBerla_execute_test( NAME EquationSolverTest ) +endif( WALBERLA_BUILD_WITH_BOOST ) ####### # mpi # diff --git a/tests/lbm/BoundaryHandlingCommunication.cpp b/tests/lbm/BoundaryHandlingCommunication.cpp index 781b7ca9cfe622768a27d0e9578981c2de7ce16a..6529e69134df4a6ea185864883f86ed4b7bfe9fb 100644 --- a/tests/lbm/BoundaryHandlingCommunication.cpp +++ b/tests/lbm/BoundaryHandlingCommunication.cpp @@ -85,9 +85,7 @@ public: typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::UBB< LatticeModel_T, flag_t > UBB_T; - typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; - - typedef BoundaryHandling< FlagField_T, typename LatticeModel_T::Stencil, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename LatticeModel_T::Stencil, NoSlip_T, UBB_T > BoundaryHandling_T; MyBoundaryHandling( const std::string & id, const BlockDataID & flagField, const BlockDataID & pdfField, const real_t velocity ) : id_( id ), flagField_( flagField ), pdfField_( pdfField ), velocity_( velocity ) {} @@ -119,8 +117,8 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const Stru const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * boundaryHandling = new BoundaryHandling_T( std::string("boundary handling ")+id_, flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField ) ); // closed no slip channel, periodic in x-direction @@ -403,4 +401,4 @@ int main( int argc, char ** argv ) int main( int argc, char ** argv ) { return walberla::main(argc, argv); -} \ No newline at end of file +} diff --git a/tests/lbm/SuViscoelasticityTest.cpp b/tests/lbm/SuViscoelasticityTest.cpp index 3952d7cb48a6faf2cc81c6d716c07bc5db54587a..b29b3678c712c2fe00578e4c310a463bba11dade 100644 --- a/tests/lbm/SuViscoelasticityTest.cpp +++ b/tests/lbm/SuViscoelasticityTest.cpp @@ -64,8 +64,7 @@ typedef FlagField< flag_t > FlagField_T; const uint_t FieldGhostLayers = 2; typedef lbm::NoSlip< LatticeModel_T, flag_t> NoSlip_T; -typedef boost::tuples::tuple< NoSlip_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T> BoundaryHandling_T; /////////// // FLAGS // @@ -105,7 +104,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ); const auto noSlip = flagField->getFlag(NoSlip_Flag); diff --git a/tests/lbm/SweepEquivalenceTest.cpp b/tests/lbm/SweepEquivalenceTest.cpp index e28a00ebbc8295e9716dbea9653141eb0c6f93f4..091033dabda9f72e8cde20c887b95efe48a5b68a 100644 --- a/tests/lbm/SweepEquivalenceTest.cpp +++ b/tests/lbm/SweepEquivalenceTest.cpp @@ -94,9 +94,7 @@ public: typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; - typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; - - typedef BoundaryHandling< FlagField_T, typename LatticeModel_T::Stencil, BoundaryConditions_T > BoundaryHandling_T; + typedef BoundaryHandling< FlagField_T, typename LatticeModel_T::Stencil, NoSlip_T, UBB_T > BoundaryHandling_T; MyBoundaryHandling( const std::string & id, const BlockDataID & flagField, const BlockDataID & pdfField, const real_t velocity ) : id_( id ), flagField_( flagField ), pdfField_( pdfField ), velocity_( velocity ) {} @@ -129,8 +127,8 @@ MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const Stru const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( std::string("boundary handling ")+id_, flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ) ); // Couette flow -> periodic in x- and y-direction! @@ -867,4 +865,4 @@ int main( int argc, char ** argv ) int main( int argc, char* argv[] ) { return walberla::main( argc, argv ); -} \ No newline at end of file +} diff --git a/tests/lbm/boundary/BoundaryForce.cpp b/tests/lbm/boundary/BoundaryForce.cpp index c36db2ec17579532697f6ea9897f372d5da1ecd0..cc1f9e63acf10569164968c64b55d24eb683c03c 100644 --- a/tests/lbm/boundary/BoundaryForce.cpp +++ b/tests/lbm/boundary/BoundaryForce.cpp @@ -68,8 +68,7 @@ using FlagField_T = FlagField<flag_t>; typedef lbm::SimpleUBB< LatticeModel_T, flag_t, false, true > UBB_Sphere_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_Wall_T; -typedef boost::tuples::tuple< UBB_Sphere_T, UBB_Wall_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, UBB_Sphere_T, UBB_Wall_T > BoundaryHandling_T; @@ -113,8 +112,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block ) cons const flag_t fluid = flagField->registerFlag( Fluid_Flag ); // register the fluid flag at the flag field return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( UBB_Sphere_T( "sphere", UBB_Sphere_Flag, pdfField, Vector3<real_t>() ), - UBB_Wall_T( "wall", UBB_Wall_Flag, pdfField, velocity_ ) ) ); + UBB_Sphere_T( "sphere", UBB_Sphere_Flag, pdfField, Vector3<real_t>() ), + UBB_Wall_T( "wall", UBB_Wall_Flag, pdfField, velocity_ ) ); } diff --git a/tests/lbm/boundary/BoundaryForceCouette.cpp b/tests/lbm/boundary/BoundaryForceCouette.cpp index 974015b9d5c0d64e705694f28cff9182b182d4e1..01b2038feb3826ad96fa1538a7a0ef0876ef8cb9 100644 --- a/tests/lbm/boundary/BoundaryForceCouette.cpp +++ b/tests/lbm/boundary/BoundaryForceCouette.cpp @@ -67,8 +67,7 @@ using FlagField_T = FlagField<flag_t>; typedef lbm::NoSlip< LatticeModel_T, flag_t, true > BottomWall_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t, false, true > TopWall_T; -typedef boost::tuples::tuple< BottomWall_T, TopWall_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, BottomWall_T, TopWall_T > BoundaryHandling_T; @@ -112,8 +111,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block ) cons const flag_t fluid = flagField->registerFlag( Fluid_Flag ); // register the fluid flag at the flag field return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( BottomWall_T( "bottom", BottomWall_Flag, pdfField ), - TopWall_T( "top", TopWall_Flag, pdfField, velocity_ ) ) ); + BottomWall_T( "bottom", BottomWall_Flag, pdfField ), + TopWall_T( "top", TopWall_Flag, pdfField, velocity_ ) ); } diff --git a/tests/lbm/boundary/SimplePABTest.cpp b/tests/lbm/boundary/SimplePABTest.cpp index 6d5b8c478e11b09873636ee68040b24b91b204a6..a1de4f92ff59a1c018ef7501bb5de55a2231dc2d 100644 --- a/tests/lbm/boundary/SimplePABTest.cpp +++ b/tests/lbm/boundary/SimplePABTest.cpp @@ -108,8 +108,7 @@ class BoundaryHandlingCreator public: typedef lbm::NoSlip<LatticeModel,flag_t> MyNoSlip; typedef lbm::SimplePAB<LatticeModel,MyFlagField> MySimplePAB; - typedef boost::tuples::tuple< MyNoSlip, MySimplePAB, MySimplePAB > BoundaryConditionsT; - typedef BoundaryHandling< MyFlagField, Stencil, BoundaryConditionsT > BoundaryHandlingT; + typedef BoundaryHandling< MyFlagField, Stencil, MyNoSlip, MySimplePAB, MySimplePAB > BoundaryHandlingT; BoundaryHandlingCreator( const BlockDataID& flagField, const BlockDataID& pdfField, const real_t leftLatticeDensity, const real_t rightLatticeDensity, @@ -148,11 +147,10 @@ BoundaryHandlingCreator::BoundaryHandlingT * BoundaryHandlingCreator::operator() */ BoundaryHandlingT * handling = new BoundaryHandlingT( "Boundary Handling", flagField, fluidFlag, - boost::tuples::make_tuple( MyNoSlip( "NoSlip", getNoSlipFlag(), block->getData< PDFField >( pdfField_ ) ), MySimplePAB( "SimplePABLeft", getSimplePABLeftFlag(), block->getData< PDFField >( pdfField_ ), block->getData< MyFlagField >( flagField_ ), leftLatticeDensity_, omega_, getFluidFlag(), getNoSlipFlag() ), MySimplePAB( "SimplePABRight", getSimplePABRightFlag(), block->getData< PDFField >( pdfField_ ), block->getData< MyFlagField >( flagField_ ), rightLatticeDensity_, omega_, getFluidFlag(), getNoSlipFlag() ) - ) ); + ); CellInterval channelBB(0, 0, 0, cell_idx_c(channelWidth_) - 1, cell_idx_c(channelWidth_) - 1, cell_idx_c(channelLength_) - 1 ); diff --git a/tests/lbm/refinement/CommunicationEquivalence.cpp b/tests/lbm/refinement/CommunicationEquivalence.cpp index 150f7894947f95347c820d30b348779303fd5790..7124f5baf8305bd2b59bb442e1215e67da1c681e 100644 --- a/tests/lbm/refinement/CommunicationEquivalence.cpp +++ b/tests/lbm/refinement/CommunicationEquivalence.cpp @@ -84,9 +84,7 @@ const uint_t FieldGhostLayers = 4; typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; -typedef boost::tuples::tuple< NoSlip_T, UBB_T > BoundaryConditions_T; - -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, UBB_T > BoundaryHandling_T; /////////// // FLAGS // @@ -239,8 +237,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block ) cons const flag_t fluid = flagField->registerFlag( Fluid_Flag ); return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ), - UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_c(0), real_c(0) ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ), + UBB_T( "velocity bounce back", UBB_Flag, pdfField, topVelocity_, real_c(0), real_c(0) ) ); } @@ -492,4 +490,4 @@ int main( int argc, char ** argv ) int main( int argc, char ** argv ) { return walberla::main(argc, argv); -} \ No newline at end of file +} diff --git a/tests/lbm/refinement/Uniformity.cpp b/tests/lbm/refinement/Uniformity.cpp index cd6eda7cd83f48dd72b8d8ab162e35668c3b451f..7ff59cbbb954c4444971e72ddcbfa1fae9162e9b 100644 --- a/tests/lbm/refinement/Uniformity.cpp +++ b/tests/lbm/refinement/Uniformity.cpp @@ -89,8 +89,7 @@ const uint_t FieldGhostLayers = 4; // dummy boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T > BoundaryHandling_T; /////////// // FLAGS // @@ -206,7 +205,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block ) cons flagField->setWithGhostLayer( fluid ); return new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "no slip", NoSlip_Flag, pdfField ) ) ); + NoSlip_T( "no slip", NoSlip_Flag, pdfField ) ); } diff --git a/tests/pde/BoundaryTest.cpp b/tests/pde/BoundaryTest.cpp index 226d597b84a9266d27e879255ef6d6397e587ad1..c232591ada427488f37cf8679e5949703396f5f1 100644 --- a/tests/pde/BoundaryTest.cpp +++ b/tests/pde/BoundaryTest.cpp @@ -62,9 +62,7 @@ typedef FlagField < flag_t > FlagField_T; typedef pde::Dirichlet< Stencil_T, flag_t > Dirichlet_T; typedef pde::Neumann< Stencil_T, flag_t > Neumann_T; -typedef boost::tuples::tuple< Dirichlet_T, Neumann_T > BoundaryConditions_T; - -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, Dirichlet_T, Neumann_T > BoundaryHandling_T; const FlagUID Domain_Flag( "domain" ); @@ -118,9 +116,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block ) cons // A new boundary handling instance that uses the just fetched flag field is created: // Additional, internal flags used by the boundary handling will be stored in this flag field. return new BoundaryHandling_T( "boundary handling", flagField, domain, - boost::tuples::make_tuple( Dirichlet_T( "dirichlet", Dirichlet_Flag, rhsField, stencilField, adaptStencilField, flagField ) , + Dirichlet_T( "dirichlet", Dirichlet_Flag, rhsField, stencilField, adaptStencilField, flagField ) , Neumann_T( "neumann", Neumann_Flag, rhsField, stencilField, adaptStencilField, flagField, blockStorage_ ) - ) ); } diff --git a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp index 512f650d9baa06ed758174667a501dd00f2ff225..29b3d0ccab8083d85aba0077b28df6ed7a8c0c22 100644 --- a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp @@ -88,8 +88,7 @@ using FlagField_T = FlagField<flag_t>; // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; -typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; +typedef BoundaryHandling<FlagField_T, Stencil_T, NoSlip_T> BoundaryHandling_T; typedef std::tuple<pe::Plane, pe::Sphere> BodyTypeTuple ; @@ -151,7 +150,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "Boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ); handling->fillWithDomain( FieldGhostLayers ); return handling; diff --git a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp index f1ae8d8c04f5b686129bfa5ade82c5d6bc50c85d..88b5950fdd88a6e0b34538507bb4a5b44cb8b2b5 100644 --- a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp @@ -87,8 +87,7 @@ using FlagField_T = FlagField<flag_t>; // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; -typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; +typedef BoundaryHandling<FlagField_T, Stencil_T, NoSlip_T> BoundaryHandling_T; typedef std::tuple<pe::Plane, pe::Sphere> BodyTypeTuple ; @@ -152,7 +151,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "Boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ); const auto noslip = flagField->getFlag( NoSlip_Flag ); diff --git a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp index e70fe7f8e89f00298930db57617612056feee2fb..cfacb7cd3b58d3af9a12f4ab46047177fc54d1df 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp @@ -92,8 +92,7 @@ typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; // boundary handling typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_T; -using BoundaryConditions_T = boost::tuples::tuple<MO_T>; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere> ; @@ -191,7 +190,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_T ( "MO_BB", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + MO_T ( "MO_BB", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp b/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp index 59a224fe3fb1de87fad8b71c5f4f5c04d91d3cb2..0edda5942185ca62efd9b8231be0e79db741a8bf 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp @@ -74,8 +74,7 @@ typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< NoSlip_T, MO_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, MO_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere> ; @@ -122,8 +121,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - MO_T ( "MO_BB", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + MO_T ( "MO_BB", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp index 3d07ede20cb85170b3d6fb3550b8bef909c18941..2f6ac710af30d329c4f6f1b1b4790c30b3a7f55b 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp @@ -92,8 +92,7 @@ typedef pe_coupling::SimpleBB < LatticeModel_T, FlagField_T > MO_BB_T; typedef pe_coupling::CurvedLinear < LatticeModel_T, FlagField_T > MO_CLI_T; typedef pe_coupling::CurvedQuadratic< LatticeModel_T, FlagField_T > MO_MR_T; -typedef boost::tuples::tuple< MO_BB_T, MO_CLI_T, MO_MR_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_BB_T, MO_CLI_T, MO_MR_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere> ; @@ -175,9 +174,9 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_MR_T ( "MO_MR", MO_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ) ); + MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), + MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), + MO_MR_T ( "MO_MR", MO_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp index ade3a8f05483ef4553125f1c1a91d08cea04f7fc..c60e11186ff6f378f71f73bcc0fbda8e64efdf3e 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp @@ -100,8 +100,7 @@ typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; typedef pe_coupling::SimpleBB < LatticeModel_T, FlagField_T > MO_BB_T; typedef pe_coupling::CurvedLinear < LatticeModel_T, FlagField_T > MO_CLI_T; -typedef boost::tuples::tuple< MO_BB_T, MO_CLI_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_BB_T, MO_CLI_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere> ; @@ -226,8 +225,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), + MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp index a2b9a31056d80ef08eff3fa157d917a380f988c4..c19452458880578dc384d808a921a9278e45f842 100644 --- a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp @@ -92,8 +92,7 @@ const uint_t FieldGhostLayers = 4; // boundary handling typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_SBB_T; -using BoundaryConditions_T = boost::tuples::tuple<MO_SBB_T>; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_SBB_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Plane>; @@ -224,7 +223,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_SBB_T( "MO_SBB", MO_SBB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + MO_SBB_T( "MO_SBB", MO_SBB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); // boundary conditions are set by mapping the (moving) planes into the domain diff --git a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp index db7d357fa7fe853213a3f21ac2d320ae2ba15a30..502cab1756749f734749c4e9b5de6cb00b22d711 100644 --- a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp @@ -95,9 +95,7 @@ typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; typedef lbm::FreeSlip< LatticeModel_T, FlagField_T> FreeSlip_T; typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< FreeSlip_T, MO_T > BoundaryConditions_T; - -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, FreeSlip_T, MO_T > BoundaryHandling_T; typedef std::tuple<pe::Sphere, pe::Plane> BodyTypeTuple ; @@ -461,8 +459,8 @@ BoundaryHandling_T * SphSphTestBoundaryHandling::operator()( IBlock * const bloc const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "cf boundary handling", flagField, fluid, - boost::tuples::make_tuple( FreeSlip_T( "FreeSlip", FreeSlip_Flag, pdfField, flagField, fluid ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + FreeSlip_T( "FreeSlip", FreeSlip_Flag, pdfField, flagField, fluid ), + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); const auto freeslip = flagField->getFlag( FreeSlip_Flag ); @@ -548,8 +546,8 @@ BoundaryHandling_T * SphWallTestBoundaryHandling::operator()( IBlock * const blo const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "cf boundary handling", flagField, fluid, - boost::tuples::make_tuple( FreeSlip_T( "FreeSlip", FreeSlip_Flag, pdfField, flagField, fluid ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + FreeSlip_T( "FreeSlip", FreeSlip_Flag, pdfField, flagField, fluid ), + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); const auto freeslip = flagField->getFlag( FreeSlip_Flag ); diff --git a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp index b130bb7d08f8abf6f26897b3928fd0f4a585894e..380a10f799e4e07c8be8bb8905ed2b7820091384 100644 --- a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp @@ -97,8 +97,7 @@ typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef lbm::SimpleUBB< LatticeModel_T, flag_t > UBB_T; typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< NoSlip_T, UBB_T, MO_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, UBB_T, MO_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -276,9 +275,9 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "cf boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), UBB_T( "UBB", UBB_Flag, pdfField, velocity_, real_c(0), real_c(0) ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); const auto ubb = flagField->getFlag( UBB_Flag ); diff --git a/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp index c074a75ee96925e4e083539e126b53f6c0b007d5..73a9d47cf29d4f9e34f6519330665ef5430cf5b1 100644 --- a/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp @@ -99,8 +99,7 @@ typedef pe_coupling::SimpleBB < LatticeModel_T, FlagField_T > MO_BB_T; typedef pe_coupling::CurvedLinear < LatticeModel_T, FlagField_T > MO_CLI_T; typedef pe_coupling::CurvedQuadratic< LatticeModel_T, FlagField_T > MO_MR_T; -typedef boost::tuples::tuple< NoSlip_T, MO_BB_T, MO_CLI_T, MO_MR_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, MO_BB_T, MO_CLI_T, MO_MR_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -189,10 +188,10 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), MO_CLI_T( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_MR_T ( "MO_MR", MO_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ) ); + MO_MR_T ( "MO_MR", MO_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ); const auto noslip = flagField->getFlag( NoSlip_Flag ); diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp index c1cc240d498ce6e3ed28d15646107043af8604ad..b8c0b6a0bc0db5bc736bcdc12243a738855169de 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp @@ -95,8 +95,7 @@ typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< NoSlip_T, MO_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, MO_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -142,8 +141,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); // boundary conditions (no-slip) are set by mapping the planes into the domain diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp index a8888df59ef3253447242070939982078bd70cef..9cecbe8b7b631be2c335a43b3a237f8209b0481b 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp @@ -101,8 +101,7 @@ typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< NoSlip_T, MO_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, MO_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -244,8 +243,8 @@ BoundaryHandling_T * MyBoundaryHandling::initialize( IBlock * const block ) WALBERLA_CHECK_NOT_NULLPTR( blocksPtr ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *blocksPtr, *block ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *blocksPtr, *block ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp index 9e1407c26709a32c455559c12b45bc645a866226..6ba596359a6934ec5292e8395bd644a704267455 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp @@ -97,8 +97,7 @@ typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< NoSlip_T, MO_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T, MO_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -230,8 +229,8 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "moving obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), - MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ), + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); // boundary conditions (no-slip) are set by mapping the planes into the domain diff --git a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp index 0c8a6ccac228d5ce94d4d9fff0eff338bd5432fc..c13ca3550252c24e951b65c2ba83e42161cb9c09 100644 --- a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp @@ -94,8 +94,7 @@ const uint_t FieldGhostLayers = 1; // boundary handling typedef pe_coupling::SimpleBB<LatticeModel_T, FlagField_T> MO_BB_T; -using BoundaryConditions_T = boost::tuples::tuple<MO_BB_T>; -typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; +typedef BoundaryHandling<FlagField_T, Stencil_T, MO_BB_T> BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Squirmer>; @@ -143,10 +142,8 @@ MyBoundaryHandling::operator()(IBlock *const block, const StructuredBlockStorage const auto fluid = flagField->flagExists(Fluid_Flag) ? flagField->getFlag(Fluid_Flag) : flagField->registerFlag( Fluid_Flag); - BoundaryHandling_T *handling = new BoundaryHandling_T("fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( - MO_BB_T("MO_BB", MO_BB_Flag, pdfField, flagField, - bodyField, fluid, *storage, *block))); + BoundaryHandling_T *handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, + MO_BB_T("MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); handling->fillWithDomain(FieldGhostLayers); @@ -491,4 +488,4 @@ int main(int argc, char **argv) { int main( int argc, char **argv ){ squirmer::main(argc, argv); -} \ No newline at end of file +} diff --git a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp index 7f6e659236f8b76053af10a1ea419677c2a96b2f..67ce8c233fcc0d50a0c579fcf7d76255f9f071b0 100644 --- a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp @@ -86,8 +86,7 @@ const uint_t FieldGhostLayers = 1; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_T; -using BoundaryConditions_T = boost::tuples::tuple<MO_T>; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_T > BoundaryHandling_T; typedef std::tuple< pe::Capsule, pe::CylindricalBoundary > BodyTypeTuple; @@ -200,7 +199,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "cf boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ) ); + MO_T( "MO", MO_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ) ); CellInterval domainBB = storage->getDomainCellBB(); domainBB.xMin() -= cell_idx_c( FieldGhostLayers ); diff --git a/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp index c76d112cd9020919f8f95b195c5d19146866c349..0b649234430aa2820acae8544694316445f0590a 100644 --- a/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp @@ -92,8 +92,7 @@ typedef pe_coupling::SimpleBB < LatticeModel_T, FlagField_T > MO_BB_T; typedef pe_coupling::CurvedLinear < LatticeModel_T, FlagField_T > MO_CLI_T; typedef pe_coupling::CurvedQuadratic< LatticeModel_T, FlagField_T > MO_MR_T; -typedef boost::tuples::tuple< MO_BB_T, MO_CLI_T, MO_MR_T > BoundaryConditions_T; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, MO_BB_T, MO_CLI_T, MO_MR_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere> ; @@ -158,9 +157,9 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), - MO_MR_T ( "MO_MR", MO_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ) ); + MO_BB_T ( "MO_BB", MO_BB_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), + MO_CLI_T ( "MO_CLI", MO_CLI_Flag, pdfField, flagField, bodyField, fluid, *storage, *block ), + MO_MR_T ( "MO_MR", MO_MR_Flag, pdfField, flagField, bodyField, fluid, *storage, *block, pdfFieldPreCol ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp index 092c0ea36edee47a9ec298c80c638f3a44e93694..b35c41db12a57bcea104e4b6fa81213ca0ca3f14 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp @@ -99,8 +99,7 @@ typedef std::pair< pe::BodyID, real_t > BodyAndVolu typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolumeFractionField_T; typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T > BoundaryHandling_T; using BodyTypeTuple = std::tuple<pe::Sphere> ; @@ -243,7 +242,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "fixed obstacle boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ); handling->fillWithDomain( FieldGhostLayers ); diff --git a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp index deb8f68963cca2bfa801bfa69e7456cf9aec3f16..fbec373004928d25d7b1d548417e32a2d58f221b 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp @@ -97,8 +97,7 @@ typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolu // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; -typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; +typedef BoundaryHandling< FlagField_T, Stencil_T, NoSlip_T > BoundaryHandling_T; typedef std::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -177,7 +176,7 @@ BoundaryHandling_T * MyBoundaryHandling::operator()( IBlock * const block, const const auto fluid = flagField->flagExists( Fluid_Flag ) ? flagField->getFlag( Fluid_Flag ) : flagField->registerFlag( Fluid_Flag ); BoundaryHandling_T * handling = new BoundaryHandling_T( "boundary handling", flagField, fluid, - boost::tuples::make_tuple( NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ) ); + NoSlip_T( "NoSlip", NoSlip_Flag, pdfField ) ); const auto noslip = flagField->getFlag( NoSlip_Flag );