diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000000000000000000000000000000000000..af07d7cf245290dd15d4dcc62de2a04756f9c483 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,68 @@ +--- +Checks: '-*,modernize-*,-modernize-use-auto,-modernize-loop-convert,-modernize-pass-by-value,-modernize-raw-string-literal,-modernize-use-using,-modernize-avoid-bind,-modernize-return-braced-init-list,-modernize-deprecated-headers,-modernize-use-transparent-functors,-modernize-redundant-void-arg' +WarningsAsErrors: '*' +HeaderFilterRegex: '' +AnalyzeTemporaryDtors: false +FormatStyle: none +User: si11fita +CheckOptions: + - key: modernize-loop-convert.MaxCopySize + value: '16' + - key: modernize-loop-convert.MinConfidence + value: reasonable + - key: modernize-loop-convert.NamingStyle + value: CamelCase + - key: modernize-make-shared.IgnoreMacros + value: '1' + - key: modernize-make-shared.IncludeStyle + value: '0' + - key: modernize-make-shared.MakeSmartPtrFunction + value: 'std::make_shared' + - key: modernize-make-shared.MakeSmartPtrFunctionHeader + value: memory + - key: modernize-make-unique.IgnoreMacros + value: '1' + - key: modernize-make-unique.IncludeStyle + value: '0' + - key: modernize-make-unique.MakeSmartPtrFunction + value: 'std::make_unique' + - key: modernize-make-unique.MakeSmartPtrFunctionHeader + value: memory + - key: modernize-pass-by-value.IncludeStyle + value: llvm + - key: modernize-pass-by-value.ValuesOnly + value: '0' + - key: modernize-raw-string-literal.ReplaceShorterLiterals + value: '0' + - key: modernize-replace-auto-ptr.IncludeStyle + value: llvm + - key: modernize-replace-random-shuffle.IncludeStyle + value: llvm + - key: modernize-use-auto.RemoveStars + value: '0' + - key: modernize-use-default-member-init.IgnoreMacros + value: '1' + - key: modernize-use-default-member-init.UseAssignment + value: '0' + - key: modernize-use-emplace.ContainersWithPushBack + value: '::std::vector;::std::list;::std::deque' + - key: modernize-use-emplace.SmartPointers + value: '::std::shared_ptr;::std::unique_ptr;::std::auto_ptr;::std::weak_ptr' + - key: modernize-use-emplace.TupleMakeFunctions + value: '::std::make_pair;::std::make_tuple' + - key: modernize-use-emplace.TupleTypes + value: '::std::pair;::std::tuple' + - key: modernize-use-equals-default.IgnoreMacros + value: '1' + - key: modernize-use-noexcept.ReplacementString + value: '' + - key: modernize-use-noexcept.UseNoexceptFalse + value: '1' + - key: modernize-use-nullptr.NullMacros + value: 'NULL' + - key: modernize-use-transparent-functors.SafeMode + value: '0' + - key: modernize-use-using.IgnoreMacros + value: '1' +... + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4cf439fe24bd22b024875be726aef1d0bc137b96..d78d00a12a9535420bf293c6bb2b4a4851a08cae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1142,6 +1142,23 @@ doc: ## ## ############################################################################### +clang-tidy: + image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:6.0 + script: + - $CXX --version + - cmake --version + - mkdir $CI_PROJECT_DIR/build + - cd $CI_PROJECT_DIR/build + - cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWALBERLA_BUFFER_DEBUG=ON -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_TOOLS=ON -DWALBERLA_BUILD_WITH_MPI=ON -DWALBERLA_BUILD_WITH_OPENMP=ON -DCMAKE_BUILD_TYPE=Debug -DWALBERLA_DOUBLE_ACCURACY=ON + - cmake . -LAH + - run-clang-tidy.py -quiet | tee clang-tidy-output.txt + artifacts: + paths: + - $CI_PROJECT_DIR/build/clang-tidy-output.txt + tags: + - docker + + cppcheck: image: walberla/cppcheck script: diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee1e578c7a963ec1f5f40c907fce8aa647b1b6b..08496e0736789d7c60e1d6be97fe66ecf7a44356 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1327,3 +1327,12 @@ add_subdirectory ( apps ) waLBerla_export() ############################################################################################################################ + +############################################################################################################################ +## +## clang-tidy +## +############################################################################################################################ + +waLBerla_link_files_to_builddir( .clang-tidy ) +waLBerla_link_files_to_builddir( run-clang-tidy.py ) diff --git a/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp b/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp index 52b02c6778457bdc1ae9b539c40c7cf8ba04867c..8a18cbccdbc2b9ae94280468cfd60349d85eff94 100644 --- a/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp +++ b/apps/benchmarks/ComplexGeometry/ComplexGeometry.cpp @@ -217,9 +217,9 @@ int main( int argc, char * argv[] ) typedef lbm::D3Q19<lbm::collision_model::SRT, false, lbm::force_model::SimpleConstant> LatticeModel_T; - typedef walberla::uint8_t flag_t; - typedef FlagField< flag_t > FlagField_T; - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using flag_t = walberla::uint8_t; + using FlagField_T = FlagField<flag_t>; + using PdfField_T = lbm::PdfField<LatticeModel_T>; LatticeModel_T latticeModel{ lbm::collision_model::SRT( omega ), lbm::force_model::SimpleConstant( bodyForce ) }; diff --git a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp index b28601c50d2ce89cb65425fd707588387a2e1053..a947b2a8ee6929e06c5cb0db7910180316fc1c84 100644 --- a/apps/benchmarks/CouetteFlow/CouetteFlow.cpp +++ b/apps/benchmarks/CouetteFlow/CouetteFlow.cpp @@ -100,6 +100,7 @@ #include <cstring> #include <functional> #include <iostream> +#include <memory> #include <utility> #include <vector> @@ -138,12 +139,12 @@ typedef lbm::D3Q27< lbm::collision_model::TRT, true > D3Q27_TRT_COMP; template< typename LatticeModel_T > struct Types { - typedef typename LatticeModel_T::Stencil Stencil_T; - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using Stencil_T = typename LatticeModel_T::Stencil; + using PdfField_T = lbm::PdfField<LatticeModel_T>; }; -typedef walberla::uint16_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint16_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = uint_t(4); @@ -334,9 +335,9 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co MPIManager::instance()->useWorldComm(); - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, setup.xCells, setup.yCells, setup.zCells ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, setup.xCells, setup.yCells, setup.zCells ); sbf->createCellBoundingBoxes(); return sbf; @@ -349,9 +350,9 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co memoryPerCell, processMemoryLimit, configBlock.getParameter< bool >( "outputSetupForest", false ) ); - auto bf = shared_ptr< blockforest::BlockForest >( new blockforest::BlockForest( uint_c( MPIManager::instance()->rank() ), *sforest, false ) ); + auto bf = std::make_shared< blockforest::BlockForest >( uint_c( MPIManager::instance()->rank() ), *sforest, false ); - auto sbf = shared_ptr< blockforest::StructuredBlockForest >( new blockforest::StructuredBlockForest( bf, setup.xCells, setup.yCells, setup.zCells ) ); + auto sbf = std::make_shared< blockforest::StructuredBlockForest >( bf, setup.xCells, setup.yCells, setup.zCells ); sbf->createCellBoundingBoxes(); return sbf; @@ -398,7 +399,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block ) const { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField_T; + using PdfField_T = typename Types< LatticeModel_T >::PdfField_T; FlagField_T * flagField = block->getData< FlagField_T >( flagFieldId_ ); PdfField_T * pdfField = block->getData< PdfField_T > ( pdfFieldId_ ); @@ -456,16 +457,16 @@ class ErrorVTKWriter : public vtk::BlockCellDataWriter< OutputType, 3 > { public: - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using PdfField_T = lbm::PdfField< LatticeModel_T >; ErrorVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id, const Setup & setup ) : - vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), setup_( setup ) {} + vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ), setup_( setup ) {} protected: - void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); } + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); } - OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { WALBERLA_ASSERT_NOT_NULLPTR( pdf_ ); @@ -588,7 +589,7 @@ void addRefinementTimeStep( SweepTimeloop & timeloop, shared_ptr< blockforest::S const bool syncComm, const bool fullComm, const bool linearExplosion, shared_ptr< Sweep_T > & sweep, const std::string & info ) { - typedef typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T BH_T; + using BH_T = typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T; auto ts = lbm::refinement::makeTimeStep< LatticeModel_T, BH_T >( blocks, sweep, pdfFieldId, boundaryHandlingId ); ts->asynchronousCommunication( !syncComm ); @@ -611,7 +612,7 @@ struct AddRefinementTimeStep { if( pure ) { - typedef lbm::SplitPureSweep< LatticeModel_T > Sweep_T; + using Sweep_T = lbm::SplitPureSweep< LatticeModel_T >; auto mySweep = make_shared< Sweep_T >( pdfFieldId ); addRefinementTimeStep< LatticeModel_T, Sweep_T >( timeloop, blocks, pdfFieldId, boundaryHandlingId, timingPool, levelwiseTimingPool, @@ -684,8 +685,8 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), FieldGhostLayers, field::zyxf ); - typedef typename lbm::Adaptor<LatticeModel_T>::VelocityVector VelocityAdaptor_T; - typedef typename lbm::Adaptor<LatticeModel_T>::Density DensityAdaptor_T; + using VelocityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::VelocityVector; + using DensityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::Density; BlockDataID velocityAdaptorId = field::addFieldAdaptor< VelocityAdaptor_T >( blocks, pdfFieldId, "velocity adaptor" ); BlockDataID densityAdaptorId = field::addFieldAdaptor< DensityAdaptor_T >( blocks, pdfFieldId, "density adaptor" ); @@ -994,7 +995,7 @@ int main( int argc, char **argv ) //WALBERLA_ROOT_SECTION() { logging::Logging::instance()->setLogLevel( logging::Logging::PROGRESS ); } #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the program that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); #endif diff --git a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp index 64bc164815b875e0bfeb4774bdae1ecef440e514..895ca85bc816c028af4458a8eff3bde69375dd63 100644 --- a/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp +++ b/apps/benchmarks/ForcesOnSphereNearPlaneInShearFlow/ForcesOnSphereNearPlaneInShearFlow.cpp @@ -80,11 +80,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 4; @@ -578,7 +578,7 @@ int main( int argc, char **argv ) // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies @@ -610,7 +610,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( MyBoundaryHandling( flagFieldID, pdfFieldID, bodyFieldID ), "boundary handling" ); diff --git a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp index 825af2b2ddf3214a788d4bda7bc80656599f30f7..f94561e7799a3219ff14beb13328a08a9456eb4e 100644 --- a/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp +++ b/apps/benchmarks/MotionSingleHeavySphere/MotionSingleHeavySphere.cpp @@ -78,11 +78,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; typedef std::pair< pe::BodyID, real_t > BodyAndVolumeFraction_T; @@ -101,7 +101,7 @@ 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 boost::tuple<pe::Sphere> BodyTypeTuple; +using BodyTypeTuple = boost::tuple<pe::Sphere>; /////////// // FLAGS // @@ -806,15 +806,15 @@ int main( int argc, char **argv ) // set up collision response, here DEM solver // in this test case, it is only used for the time integration - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; std::function<void(void)> syncCall; if( XBlocks <= uint_t(4) ) - syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); else - syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); real_t xParticle = real_t(0); @@ -832,7 +832,7 @@ int main( int argc, char **argv ) else if( int(Galileo) == 250 ) { // add random perturbance for chaotic regime - walberla::math::seedRandomGenerator( std::mt19937::result_type(std::time(0)) ); + walberla::math::seedRandomGenerator( std::mt19937::result_type(std::time(nullptr)) ); xParticle = real_c( xlength ) * real_t(0.5) + walberla::math::realRandom( real_t(-0.5), real_t(0.5) ); yParticle = real_c( ylength ) * real_t(0.5) + walberla::math::realRandom( real_t(-0.5), real_t(0.5) ); @@ -883,7 +883,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage< FlagField_T >( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add body and volume fraction field BlockDataID bodyAndVolumeFractionFieldID = field::addToStorage< BodyAndVolumeFractionField_T >( blocks, "body and volume fraction field", @@ -1204,7 +1204,7 @@ int main( int argc, char **argv ) // reconstruct missing PDFs - typedef pe_coupling::SphereNormalExtrapolationDirectionFinder ExtrapolationFinder_T; + using ExtrapolationFinder_T = pe_coupling::SphereNormalExtrapolationDirectionFinder; ExtrapolationFinder_T extrapolationFinder( blocks, bodyFieldID ); typedef pe_coupling::ExtrapolationReconstructor< LatticeModel_T, BoundaryHandling_T, ExtrapolationFinder_T > Reconstructor_T; Reconstructor_T reconstructor( blocks, boundaryHandlingID, pdfFieldID, bodyFieldID, extrapolationFinder, true ); diff --git a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp index 0602976bcbc2de7b99e78de14d9335d5bf8bbeb4..462bbeb41102cfc581fe7ba661fadc168753a00b 100644 --- a/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp +++ b/apps/benchmarks/NonUniformGrid/NonUniformGrid.cpp @@ -78,6 +78,7 @@ #include <cstdlib> #include <functional> #include <iostream> +#include <memory> @@ -104,12 +105,12 @@ typedef lbm::D3Q19< lbm::collision_model::D3Q19MRT, false > D3Q19_MRT_INCOMP; template< typename LatticeModel_T > struct Types { - typedef typename LatticeModel_T::Stencil Stencil_T; - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using Stencil_T = typename LatticeModel_T::Stencil; + using PdfField_T = lbm::PdfField< LatticeModel_T >; }; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = uint_t(4); const uint_t BlockForestLevels = uint_t(4); @@ -322,11 +323,11 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co MPIManager::instance()->useWorldComm(); - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, numberOfXCellsPerBlock, + auto sbf = std::make_shared< StructuredBlockForest >( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, - numberOfZCellsPerBlock ) ); + numberOfZCellsPerBlock ); sbf->createCellBoundingBoxes(); return sbf; @@ -337,11 +338,11 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co blockforest::SetupBlockForest sforest; createSetupBlockForest( sforest, configBlock, uint_c( MPIManager::instance()->numProcesses() ) ); - auto bf = shared_ptr< blockforest::BlockForest >( new blockforest::BlockForest( uint_c( MPIManager::instance()->rank() ), sforest, false ) ); + auto bf = std::make_shared< blockforest::BlockForest >( uint_c( MPIManager::instance()->rank() ), sforest, false ); - auto sbf = shared_ptr< blockforest::StructuredBlockForest >( new blockforest::StructuredBlockForest( bf, numberOfXCellsPerBlock, + auto sbf = std::make_shared< blockforest::StructuredBlockForest >( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, - numberOfZCellsPerBlock ) ); + numberOfZCellsPerBlock ); sbf->createCellBoundingBoxes(); return sbf; @@ -442,12 +443,12 @@ class MyBoundaryHandling : public blockforest::AlwaysInitializeBlockDataHandling { public: - typedef typename MyBoundaryTypes< LatticeModel_T >::NoSlip_T NoSlip_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::UBB_T UBB_T; + using NoSlip_T = typename MyBoundaryTypes< LatticeModel_T >::NoSlip_T; + using UBB_T = typename MyBoundaryTypes< LatticeModel_T >::UBB_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::BoundaryConditions_T BoundaryConditions_T; + using BoundaryConditions_T = typename MyBoundaryTypes< LatticeModel_T >::BoundaryConditions_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::BoundaryHandling_T BoundaryHandling_T; + using BoundaryHandling_T = typename MyBoundaryTypes< LatticeModel_T >::BoundaryHandling_T; @@ -455,7 +456,7 @@ public: const BlockDataID & flagField, const BlockDataID & pdfField, const real_t velocity ) : forest_( forest ), flagField_( flagField ), pdfField_( pdfField ), velocity_( velocity ) {} - BoundaryHandling_T * initialize( IBlock * const block ); + BoundaryHandling_T * initialize( IBlock * const block ) override; private: @@ -472,7 +473,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::initialize( IBlock * const block ) { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField_T; + using PdfField_T = typename Types<LatticeModel_T>::PdfField_T; WALBERLA_ASSERT_NOT_NULLPTR( block ); @@ -597,7 +598,7 @@ void addRefinementTimeStep( SweepTimeloop & timeloop, shared_ptr< blockforest::S const bool syncComm, const bool fullComm, const bool linearExplosion, shared_ptr< Sweep_T > & sweep, const std::string & info ) { - typedef typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T BH_T; + using BH_T = typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T; auto ts = lbm::refinement::makeTimeStep< LatticeModel_T, BH_T >( blocks, sweep, pdfFieldId, boundaryHandlingId ); ts->asynchronousCommunication( !syncComm ); @@ -620,7 +621,7 @@ struct AddRefinementTimeStep { if( pure ) { - typedef lbm::SplitPureSweep< LatticeModel_T > Sweep_T; + using Sweep_T = lbm::SplitPureSweep< LatticeModel_T >; auto mySweep = make_shared< Sweep_T >( pdfFieldId ); addRefinementTimeStep< LatticeModel_T, Sweep_T >( timeloop, blocks, pdfFieldId, boundaryHandlingId, timingPool, levelwiseTimingPool, @@ -783,7 +784,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod } else { - typedef blockforest::DynamicLevelwiseDiffusionBalance< blockforest::NoPhantomData > DLDB; + using DLDB = blockforest::DynamicLevelwiseDiffusionBalance<blockforest::NoPhantomData>; DLDB balancer( diffusionMaxIterations, diffusionFlowIterations ); if( diffusionMode == 0 ) balancer.setMode( DLDB::DIFFUSION_PUSH ); @@ -1152,7 +1153,7 @@ int main( int argc, char **argv ) logging::Logging::printHeaderOnStream(); #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the benchmark that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); #endif diff --git a/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp b/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp index c25adf479425be4ee7625c98cab2a3bf7557ce03..db8edbea79740be6c6a033ffd74d880778f815ad 100644 --- a/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp +++ b/apps/benchmarks/PeriodicGranularGas/PeriodicGranularGas.cpp @@ -35,7 +35,7 @@ namespace walberla { using namespace walberla::pe; using namespace walberla::timing; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; int main( int argc, char ** argv ) { @@ -77,7 +77,7 @@ int main( int argc, char ** argv ) WALBERLA_LOG_INFO_ON_ROOT("*** READING CONFIG FILE ***"); auto cfg = env.config(); - if (cfg == NULL) WALBERLA_ABORT("No config specified!"); + if (cfg == nullptr) WALBERLA_ABORT("No config specified!"); const Config::BlockHandle mainConf = cfg->getBlock( "PeriodicGranularGas" ); int simulationSteps = mainConf.getParameter<int>("simulationSteps", 10 ); @@ -160,11 +160,11 @@ int main( int argc, char ** argv ) std::function<void(void)> syncCallWithoutTT; if (bNN) { - syncCallWithoutTT = std::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.1), false ); + syncCallWithoutTT = std::bind( pe::syncNextNeighbors<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.1), false ); WALBERLA_LOG_INFO_ON_ROOT("Using NextNeighbor sync!"); } else if (bSO) { - syncCallWithoutTT = std::bind( pe::syncShadowOwners<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.1), false ); + syncCallWithoutTT = std::bind( pe::syncShadowOwners<BodyTuple>, boost::ref(*forest), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.1), false ); WALBERLA_LOG_INFO_ON_ROOT("Using ShadowOwner sync!"); } else { @@ -193,7 +193,7 @@ int main( int argc, char ** argv ) for (auto it = grid_generator::SCIterator(currentBlock.getAABB().getIntersection(generationDomain), Vector3<real_t>(spacing, spacing, spacing) * real_c(0.5), spacing); it != grid_generator::SCIterator(); ++it) { SphereID sp = pe::createSphere( *globalBodyStorage, *forest, storageID, 0, *it, radius, material); - if (sp != NULL) ++numParticles; + if (sp != nullptr) ++numParticles; } } mpi::reduceInplace(numParticles, mpi::SUM); diff --git a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp index bba9184c57e791c44511ff9ca7895325c086f77e..165f81f286ca12814ea4b616d3f3b64cff687999 100644 --- a/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp +++ b/apps/benchmarks/PoiseuilleChannel/PoiseuilleChannel.cpp @@ -94,6 +94,7 @@ #include <cstring> #include <functional> #include <iostream> +#include <memory> #include <utility> #include <vector> @@ -126,12 +127,12 @@ typedef lbm::D3Q27< lbm::collision_model::TRT, true, lbm::force_model::SimpleCo template< typename LatticeModel_T > struct Types { - typedef typename LatticeModel_T::Stencil Stencil_T; - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using Stencil_T = typename LatticeModel_T::Stencil; + using PdfField_T = lbm::PdfField<LatticeModel_T>; }; -typedef walberla::uint16_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint16_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = uint_t(4); @@ -342,9 +343,9 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co MPIManager::instance()->useWorldComm(); - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, setup.xCells, setup.yCells, setup.zCells ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, setup.xCells, setup.yCells, setup.zCells ); sbf->createCellBoundingBoxes(); return sbf; @@ -357,9 +358,9 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co memoryPerCell, processMemoryLimit, configBlock.getParameter< bool >( "outputSetupForest", false ) ); - auto bf = shared_ptr< blockforest::BlockForest >( new blockforest::BlockForest( uint_c( MPIManager::instance()->rank() ), *sforest, false ) ); + auto bf = std::make_shared< blockforest::BlockForest >( uint_c( MPIManager::instance()->rank() ), *sforest, false ); - auto sbf = shared_ptr< blockforest::StructuredBlockForest >( new blockforest::StructuredBlockForest( bf, setup.xCells, setup.yCells, setup.zCells ) ); + auto sbf = std::make_shared< blockforest::StructuredBlockForest >( bf, setup.xCells, setup.yCells, setup.zCells ); sbf->createCellBoundingBoxes(); return sbf; @@ -477,7 +478,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block ) const { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField_T; + using PdfField_T = typename Types< LatticeModel_T >::PdfField_T; FlagField_T * flagField = block->getData< FlagField_T >( flagFieldId_ ); PdfField_T * pdfField = block->getData< PdfField_T > ( pdfFieldId_ ); @@ -496,7 +497,7 @@ class CurvedDeltaValueCalculation { public: - typedef typename LatticeModel_T::Stencil Stencil; + using Stencil = typename LatticeModel_T::Stencil; CurvedDeltaValueCalculation( const shared_ptr< StructuredBlockForest > & blocks, const IBlock & block, const Channel & channel ) : blocks_( blocks ), block_( block ), channel_( channel ) {} @@ -586,16 +587,16 @@ class ErrorVTKWriter : public vtk::BlockCellDataWriter< OutputType, 3 > { public: - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using PdfField_T = lbm::PdfField< LatticeModel_T >; ErrorVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id, const Setup & setup ) : - vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), setup_( setup ) {} + vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ), setup_( setup ) {} protected: - void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); } + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); pdf_ = this->block_->template getData< PdfField_T >( bdid_ ); } - OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + OutputType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { WALBERLA_ASSERT_NOT_NULLPTR( pdf_ ); @@ -785,8 +786,8 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod Vector3< real_t >( initVelocity, real_c(0), real_c(0) ), real_t(1), FieldGhostLayers, field::zyxf ); - typedef typename lbm::Adaptor<LatticeModel_T>::VelocityVector VelocityAdaptor_T; - typedef typename lbm::Adaptor<LatticeModel_T>::Density DensityAdaptor_T; + using VelocityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::VelocityVector; + using DensityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::Density; BlockDataID velocityAdaptorId = field::addFieldAdaptor< VelocityAdaptor_T >( blocks, pdfFieldId, "velocity adaptor" ); BlockDataID densityAdaptorId = field::addFieldAdaptor< DensityAdaptor_T >( blocks, pdfFieldId, "density adaptor" ); @@ -833,7 +834,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod shared_ptr<WcTimingPool> refinementTimeStepTiming = make_shared<WcTimingPool>(); shared_ptr<WcTimingPool> refinementTimeStepLevelwiseTiming = make_shared<WcTimingPool>(); - typedef typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T BH_T; + using BH_T = typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T; auto mySweep = lbm::makeCellwiseSweep< LatticeModel_T, FlagField_T >( pdfFieldId, flagFieldId, Fluid_Flag ); auto ts = lbm::refinement::makeTimeStep< LatticeModel_T, BH_T >( blocks, mySweep, pdfFieldId, boundaryHandlingId ); @@ -1106,7 +1107,7 @@ int main( int argc, char **argv ) //WALBERLA_ROOT_SECTION() { logging::Logging::instance()->setLogLevel( logging::Logging::PROGRESS ); } #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the program that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); #endif diff --git a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp index b7f9d2997a06c2fb7acca0d2c685fade0cdc4fd5..6dfb5a2a8020117e40edd7e984147776d58732ec 100644 --- a/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp +++ b/apps/benchmarks/SchaeferTurek/SchaeferTurek.cpp @@ -113,6 +113,7 @@ #include <cstring> #include <functional> #include <iostream> +#include <memory> #include <utility> #include <vector> @@ -157,12 +158,12 @@ typedef lbm::D3Q27< lbm::collision_model::TRT, true > D3Q27_TRT_COMP; template< typename LatticeModel_T > struct Types { - typedef typename LatticeModel_T::Stencil Stencil_T; - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using Stencil_T = typename LatticeModel_T::Stencil; + using PdfField_T = lbm::PdfField< LatticeModel_T >; }; -typedef walberla::uint16_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint16_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = uint_t(4); @@ -695,9 +696,9 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co MPIManager::instance()->useWorldComm(); - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, setup.xCells, setup.yzCells, setup.pseudo2D ? uint_t(1) : setup.yzCells ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, setup.xCells, setup.yzCells, setup.pseudo2D ? uint_t(1) : setup.yzCells ); sbf->createCellBoundingBoxes(); return sbf; @@ -710,9 +711,9 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co memoryPerCell, processMemoryLimit, configBlock.getParameter< bool >( "outputSetupForest", false ) ); - auto bf = shared_ptr< blockforest::BlockForest >( new blockforest::BlockForest( uint_c( MPIManager::instance()->rank() ), *sforest, false ) ); + auto bf = std::make_shared< blockforest::BlockForest >( uint_c( MPIManager::instance()->rank() ), *sforest, false ); - auto sbf = shared_ptr< blockforest::StructuredBlockForest >( new blockforest::StructuredBlockForest( bf, setup.xCells, setup.yzCells, setup.pseudo2D ? uint_t(1) : setup.yzCells ) ); + auto sbf = std::make_shared< blockforest::StructuredBlockForest >( bf, setup.xCells, setup.yzCells, setup.pseudo2D ? uint_t(1) : setup.yzCells ); sbf->createCellBoundingBoxes(); return sbf; @@ -798,17 +799,17 @@ class MyBoundaryHandling : public blockforest::AlwaysInitializeBlockDataHandling { public: - typedef typename MyBoundaryTypes< LatticeModel_T >::NoSlip_T NoSlip_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::Obstacle_T Obstacle_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::Curved_T Curved_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::DynamicUBB_T DynamicUBB_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::Outlet21_T Outlet21_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::Outlet43_T Outlet43_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::PressureOutlet_T PressureOutlet_T; + using NoSlip_T = typename MyBoundaryTypes<LatticeModel_T>::NoSlip_T; + using Obstacle_T = typename MyBoundaryTypes<LatticeModel_T>::Obstacle_T; + using Curved_T = typename MyBoundaryTypes<LatticeModel_T>::Curved_T; + using DynamicUBB_T = typename MyBoundaryTypes<LatticeModel_T>::DynamicUBB_T; + using Outlet21_T = typename MyBoundaryTypes<LatticeModel_T>::Outlet21_T; + using Outlet43_T = typename MyBoundaryTypes<LatticeModel_T>::Outlet43_T; + using PressureOutlet_T = typename MyBoundaryTypes<LatticeModel_T>::PressureOutlet_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::BoundaryConditions_T BoundaryConditions_T; + using BoundaryConditions_T = typename MyBoundaryTypes<LatticeModel_T>::BoundaryConditions_T; - typedef typename MyBoundaryTypes< LatticeModel_T >::BoundaryHandling_T BoundaryHandling_T; + using BoundaryHandling_T = typename MyBoundaryTypes<LatticeModel_T>::BoundaryHandling_T; @@ -818,7 +819,7 @@ public: flagFieldId_( flagFieldId ), pdfFieldId_( pdfFieldId ), blocks_( blocks ), setup_( setup ), timeTracker_( timeTracker ) {} - BoundaryHandling_T * initialize( IBlock * const block ); + BoundaryHandling_T * initialize( IBlock * const block ) override; private: @@ -836,7 +837,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::initialize( IBlock * const block ) { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField_T; + using PdfField_T = typename Types< LatticeModel_T >::PdfField_T; FlagField_T * flagField = block->getData< FlagField_T >( flagFieldId_ ); PdfField_T * pdfField = block->getData< PdfField_T > ( pdfFieldId_ ); @@ -865,7 +866,7 @@ class CurvedDeltaValueCalculation { public: - typedef typename LatticeModel_T::Stencil Stencil; + using Stencil = typename LatticeModel_T::Stencil; CurvedDeltaValueCalculation( const shared_ptr< StructuredBlockForest > & blocks, const IBlock & block, const Cylinder & cylinder ) : blocks_( blocks ), block_( block ), cylinder_( cylinder ) {} @@ -908,7 +909,7 @@ class BoundarySetter { public: - typedef typename MyBoundaryTypes< LatticeModel_T >::BoundaryHandling_T BoundaryHandling_T; + using BoundaryHandling_T = typename MyBoundaryTypes< LatticeModel_T >::BoundaryHandling_T; BoundarySetter( const weak_ptr<StructuredBlockForest> & blockForest, const BlockDataID & boundaryHandlingId, const Setup & setup, const int obstacleBoundary, const int outletType, @@ -1101,7 +1102,7 @@ void VorticityRefinement< VectorField_T, Filter_T, Pseudo2D >::operator()( std:: const Block * const block = it->first; const VectorField_T * u = block->template getData< VectorField_T >( fieldId_ ); - if( u == NULL ) + if( u == nullptr ) { it->second = uint_t(0); continue; @@ -1266,7 +1267,7 @@ class Pseudo2DPhantomWeight // used as a 'PhantomBlockForest::PhantomBlockDataAs { public: - typedef uint8_t weight_t; + using weight_t = uint8_t; Pseudo2DPhantomWeight( const weight_t _weight ) : weight_( _weight ) {} @@ -1398,8 +1399,8 @@ class Evaluation { public: - typedef typename Types<LatticeModel_T>::PdfField_T PdfField_T; - typedef typename LatticeModel_T::Stencil Stencil_T; + using PdfField_T = typename Types< LatticeModel_T >::PdfField_T; + using Stencil_T = typename LatticeModel_T::Stencil; Evaluation( const weak_ptr< StructuredBlockStorage > & blocks, const uint_t checkFrequency, const BlockDataID & pdfFieldId, const BlockDataID & flagFieldId, const FlagUID & fluid, const FlagUID & obstacle, @@ -1532,7 +1533,7 @@ void Evaluation< LatticeModel_T >::operator()() if( setup_.evaluateStrouhal ) { auto block = blocks->getBlock( setup_.pStrouhal ); - if( block != NULL ) + if( block != nullptr ) { const PdfField_T * const pdfField = block->template getData< PdfField_T >( pdfFieldId_ ); const auto cell = blocks->getBlockLocalCell( *block, setup_.pStrouhal ); @@ -2012,7 +2013,7 @@ void Evaluation< LatticeModel_T >::refresh() int omega( 0 ); auto block = blocks->getBlock( setup_.pAlpha ); - if( block != NULL ) + if( block != nullptr ) { const FlagField_T * const flagField = block->template getData< FlagField_T >( flagFieldId_ ); @@ -2036,7 +2037,7 @@ void Evaluation< LatticeModel_T >::refresh() } block = blocks->getBlock( setup_.pOmega ); - if( block != NULL ) + if( block != nullptr ) { const FlagField_T * const flagField = block->template getData< FlagField_T >( flagFieldId_ ); @@ -2065,7 +2066,7 @@ void Evaluation< LatticeModel_T >::refresh() if( alpha == 0 ) { block = blocks->getBlock( setup_.pAlpha ); - if( block != NULL ) + if( block != nullptr ) { const FlagField_T * const flagField = block->template getData< FlagField_T >( flagFieldId_ ); @@ -2085,7 +2086,7 @@ void Evaluation< LatticeModel_T >::refresh() if( omega == 0 ) { block = blocks->getBlock( setup_.pOmega ); - if( block != NULL ) + if( block != nullptr ) { const FlagField_T * const flagField = block->template getData< FlagField_T >( flagFieldId_ ); @@ -2121,7 +2122,7 @@ void Evaluation< LatticeModel_T >::refresh() int strouhal( 0 ); auto block = blocks->getBlock( setup_.pStrouhal ); - if( block != NULL ) + if( block != nullptr ) { const FlagField_T * const flagField = block->template getData< FlagField_T >( flagFieldId_ ); @@ -2181,7 +2182,7 @@ void Evaluation< LatticeModel_T >::evaluate( real_t & cDRealArea, real_t & cLRea if( setup_.evaluatePressure ) { auto block = blocks->getBlock( setup_.pAlpha ); - if( block != NULL ) + if( block != nullptr ) { const PdfField_T * const pdfField = block->template getData< PdfField_T >( pdfFieldId_ ); const auto cell = blocks->getBlockLocalCell( *block, setup_.pAlpha ); @@ -2190,7 +2191,7 @@ void Evaluation< LatticeModel_T >::evaluate( real_t & cDRealArea, real_t & cLRea } block = blocks->getBlock( setup_.pOmega ); - if( block != NULL ) + if( block != nullptr ) { const PdfField_T * const pdfField = block->template getData< PdfField_T >( pdfFieldId_ ); const auto cell = blocks->getBlockLocalCell( *block, setup_.pOmega ); @@ -2356,7 +2357,7 @@ void addRefinementTimeStep( SweepTimeloop & timeloop, shared_ptr< blockforest::S const shared_ptr< Evaluation< LatticeModel_T > > & evaluation, const shared_ptr< lbm::TimeTracker > & timeTracker ) { - typedef typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T BH_T; + using BH_T = typename MyBoundaryHandling< LatticeModel_T >::BoundaryHandling_T; auto ts = lbm::refinement::makeTimeStep< LatticeModel_T, BH_T >( blocks, sweep, pdfFieldId, boundaryHandlingId, None, Empty ); ts->asynchronousCommunication( !syncComm ); @@ -2385,7 +2386,7 @@ struct AddRefinementTimeStep { if( pure ) { - typedef lbm::SplitPureSweep< LatticeModel_T > Sweep_T; + using Sweep_T = lbm::SplitPureSweep< LatticeModel_T >; auto mySweep = make_shared< Sweep_T >( pdfFieldId ); addRefinementTimeStep< LatticeModel_T, Sweep_T >( timeloop, blocks, pdfFieldId, boundaryHandlingId, timingPool, levelwiseTimingPool, @@ -2469,7 +2470,7 @@ void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeMod // add density adaptor - typedef typename lbm::Adaptor<LatticeModel_T>::Density DensityAdaptor_T; + using DensityAdaptor_T = typename lbm::Adaptor< LatticeModel_T >::Density; BlockDataID densityAdaptorId = field::addFieldAdaptor< DensityAdaptor_T >( blocks, pdfFieldId, "density adaptor", None, Empty ); // add velocity field + initialize velocity field writer (only used for simulations with an adaptive block structure) @@ -3007,7 +3008,7 @@ int main( int argc, char **argv ) //WALBERLA_ROOT_SECTION() { logging::Logging::instance()->setLogLevel( logging::Logging::PROGRESS ); } #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the program that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); #endif diff --git a/apps/benchmarks/UniformGrid/UniformGrid.cpp b/apps/benchmarks/UniformGrid/UniformGrid.cpp index 396faa8300a9e4a54b47c7f909bf40a929e6a7f6..b08a506b49f25aa42e494ebb39a899fbcee3372a 100644 --- a/apps/benchmarks/UniformGrid/UniformGrid.cpp +++ b/apps/benchmarks/UniformGrid/UniformGrid.cpp @@ -83,6 +83,7 @@ #include <cstdlib> #include <iostream> +#include <memory> @@ -111,13 +112,13 @@ typedef lbm::D3Q27< lbm::collision_model::D3Q27Cumulant, true > D3Q27_CUMULANT_ template< typename LatticeModel_T > struct Types { - typedef typename LatticeModel_T::Stencil Stencil_T; - typedef typename LatticeModel_T::CommunicationStencil CommunicationStencil_T; - typedef lbm::PdfField< LatticeModel_T > PdfField_T; + using Stencil_T = typename LatticeModel_T::Stencil; + using CommunicationStencil_T = typename LatticeModel_T::CommunicationStencil; + using PdfField_T = lbm::PdfField< LatticeModel_T >; }; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = 1; @@ -286,7 +287,7 @@ void createSetupBlockForest( blockforest::SetupBlockForest & sforest, const Conf { MPIManager::instance()->useWorldComm(); - sforest.balanceLoad( blockforest::CartesianDistribution( numberOfXProcesses, numberOfYProcesses, numberOfZProcesses, NULL ), + sforest.balanceLoad( blockforest::CartesianDistribution( numberOfXProcesses, numberOfYProcesses, numberOfZProcesses, nullptr ), numberOfXProcesses * numberOfYProcesses * numberOfZProcesses, real_t(0), 0, true ); } @@ -316,11 +317,11 @@ shared_ptr< blockforest::StructuredBlockForest > createStructuredBlockForest( co blockforest::SetupBlockForest sforest; createSetupBlockForest( sforest, configBlock, uint_c( MPIManager::instance()->numProcesses() ), blocksPerProcess ); - auto bf = shared_ptr< blockforest::BlockForest >( new blockforest::BlockForest( uint_c( MPIManager::instance()->rank() ), sforest, false ) ); + auto bf = std::make_shared< blockforest::BlockForest >( uint_c( MPIManager::instance()->rank() ), sforest, false ); - auto sbf = shared_ptr< blockforest::StructuredBlockForest >( new blockforest::StructuredBlockForest( bf, numberOfXCellsPerBlock, + auto sbf = std::make_shared< blockforest::StructuredBlockForest >( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, - numberOfZCellsPerBlock ) ); + numberOfZCellsPerBlock ); sbf->createCellBoundingBoxes(); return sbf; @@ -367,7 +368,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const StructuredBlockStorage * const storage ) const { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField_T; + using PdfField_T = typename Types< LatticeModel_T >::PdfField_T; WALBERLA_ASSERT_NOT_NULLPTR( block ); WALBERLA_ASSERT_NOT_NULLPTR( storage ); @@ -486,8 +487,8 @@ void MyVTKOutput<LatticeModel_T>::operator()( std::vector< shared_ptr<vtk::Block template< typename LatticeModel_T, class Enable = void > struct AddLB { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField; - typedef typename Types<LatticeModel_T>::CommunicationStencil_T CommunicationStencil; + using PdfField = typename Types< LatticeModel_T >::PdfField_T; + using CommunicationStencil = typename Types< LatticeModel_T >::CommunicationStencil_T; static void add( shared_ptr< blockforest::StructuredBlockForest > & blocks, SweepTimeloop & timeloop, const BlockDataID & pdfFieldId, const BlockDataID & flagFieldId, const BlockDataID & boundaryHandlingId, @@ -550,7 +551,7 @@ struct AddLB { if( pure ) { - typedef lbm::SplitPureSweep< LatticeModel_T > Sweep_T; + using Sweep_T = lbm::SplitPureSweep< LatticeModel_T >; auto sweep = make_shared< Sweep_T >( pdfFieldId ); timeloop.add() << Sweep( lbm::CollideSweep< Sweep_T >( sweep ), "split pure LB sweep (collide)" ); @@ -590,8 +591,8 @@ struct AddLB< LatticeModel_T, typename boost::enable_if_c< boost::mpl::or_< lbm::collision_model::Cumulant_tag > >::value >::type > { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField; - typedef typename Types<LatticeModel_T>::CommunicationStencil_T CommunicationStencil; + using PdfField = typename Types< LatticeModel_T >::PdfField_T; + using CommunicationStencil = typename Types< LatticeModel_T >::CommunicationStencil_T; static void add( shared_ptr< blockforest::StructuredBlockForest > & blocks, SweepTimeloop & timeloop, const BlockDataID & pdfFieldId, const BlockDataID & flagFieldId, const BlockDataID & boundaryHandlingId, @@ -658,7 +659,7 @@ template< typename LatticeModel_T > void run( const shared_ptr< Config > & config, const LatticeModel_T & latticeModel, const bool split, const bool pure, const bool fzyx, const bool fullComm, const bool fused, const bool directComm ) { - typedef typename Types<LatticeModel_T>::PdfField_T PdfField; + using PdfField = typename Types<LatticeModel_T>::PdfField_T; Config::BlockHandle configBlock = config->getBlock( "UniformGrid" ); @@ -847,7 +848,7 @@ int main( int argc, char **argv ) //WALBERLA_ROOT_SECTION() { logging::Logging::instance()->setLogLevel( logging::Logging::PROGRESS ); } #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the benchmark that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); #endif diff --git a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp index b175c7c1d1810a0a6bd484949f745c7358b28201..16fc1b8869dcd8ec2b4bfd3d5e9eefca3dd83c5d 100644 --- a/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp +++ b/apps/showcases/BidisperseFluidizedBed/BidisperseFluidizedBedDPM.cpp @@ -77,14 +77,14 @@ const uint_t FieldGhostLayers( 1 ); typedef GhostLayerField< Matrix3<real_t>, 1 > TensorField_T; typedef GhostLayerField< Vector3<real_t>, 1 > Vec3Field_T; typedef GhostLayerField< real_t, 1 > ScalarField_T; -typedef lbm::force_model::GuoField< Vec3Field_T > ForceModel_T; +using ForceModel_T = lbm::force_model::GuoField<Vec3Field_T>; typedef lbm::D3Q19< lbm::collision_model::SRTField<ScalarField_T>, false, ForceModel_T > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; @@ -610,7 +610,7 @@ class DummySweep { public: DummySweep( ) - {} + = default; void operator()(IBlock * const /*block*/) {} @@ -890,7 +890,7 @@ int main( int argc, char **argv ) { // connect to pe const real_t overlap = real_t(1.5) * dx; auto syncCall = std::bind(pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), - bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); shared_ptr<CollisionPropertiesEvaluator> collisionPropertiesEvaluator = walberla::make_shared<CollisionPropertiesEvaluator>(*cr); // create the spheres @@ -1374,7 +1374,7 @@ int main( int argc, char **argv ) { std::function<void(void)> lubricationEvaluationFunction; if( lubricationCutOffDistance > real_t(0) ) { - typedef pe_coupling::discrete_particle_methods::LubricationForceEvaluator LE_T; + using LE_T = pe_coupling::discrete_particle_methods::LubricationForceEvaluator; shared_ptr<LE_T> lubEval = make_shared<LE_T>( blocks, globalBodyStorage, bodyStorageID, viscosity, lubricationCutOffDistance ); lubricationEvaluationFunction = std::bind(&LE_T::operator(), lubEval); } diff --git a/apps/tutorials/lbm/01_BasicLBM.cpp b/apps/tutorials/lbm/01_BasicLBM.cpp index 0633ec00126f66ecc8ab4d6bbce258b8757d63e5..1380a1f10e052d8f09032cda1e943698a193d668 100644 --- a/apps/tutorials/lbm/01_BasicLBM.cpp +++ b/apps/tutorials/lbm/01_BasicLBM.cpp @@ -33,14 +33,14 @@ namespace walberla { -typedef lbm::D2Q9< lbm::collision_model::SRT > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef LatticeModel_T::CommunicationStencil CommunicationStencil_T; +using LatticeModel_T = lbm::D2Q9<lbm::collision_model::SRT>; +using Stencil_T = LatticeModel_T::Stencil; +using CommunicationStencil_T = LatticeModel_T::CommunicationStencil; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; diff --git a/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp b/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp index 8478a086a52b3b22e2b8ea52ee179d8e84ee91af..77aea9d87a6153927b76bf7dedb4c92c51442784 100644 --- a/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp +++ b/apps/tutorials/lbm/02_BasicLBM_ExemplaryExtensions.cpp @@ -34,13 +34,13 @@ namespace walberla { typedef lbm::D2Q9< lbm::collision_model::SRT, false, lbm::force_model::SimpleConstant > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef LatticeModel_T::CommunicationStencil CommunicationStencil_T; +using Stencil_T = LatticeModel_T::Stencil; +using CommunicationStencil_T = LatticeModel_T::CommunicationStencil; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; diff --git a/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp b/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp index 6327603fbddaaecb8e7ae71f277f645ee3cfa870..e28259f8d46d35eb081635ec455fa71be16b8caf 100644 --- a/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp +++ b/apps/tutorials/lbm/03_LBLidDrivenCavity.cpp @@ -63,15 +63,15 @@ namespace walberla { // TYPEDEFS // ////////////// -typedef lbm::D3Q19< lbm::collision_model::SRT > LatticeModel_T; // the LB lattice model - here: D3Q19, SRT, incompressible, no additional forces -typedef LatticeModel_T::Stencil Stencil_T; // just the D3Q19 stencil without LB specific information -typedef LatticeModel_T::CommunicationStencil CommunicationStencil_T; // the stencil that is needed for the communication: This stencil determines which +using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; // the LB lattice model - here: D3Q19, SRT, incompressible, no additional forces +using Stencil_T = LatticeModel_T::Stencil; // just the D3Q19 stencil without LB specific information +using CommunicationStencil_T = LatticeModel_T::CommunicationStencil; // the stencil that is needed for the communication: This stencil determines which // neighbor blocks are involved during the communication. -typedef lbm::PdfField< LatticeModel_T > PdfField_T; // type of the PDF field that stores the 19 distribution functions +using PdfField_T = lbm::PdfField<LatticeModel_T>; // type of the PDF field that stores the 19 distribution functions -typedef walberla::uint8_t flag_t; // each flag consists of an 8 bit value and therefore can distinguish between 8 different markers/flags -typedef FlagField< flag_t > FlagField_T; // the flag field: used for marking cells as fluid or obstacle cells +using flag_t = walberla::uint8_t; // each flag consists of an 8 bit value and therefore can distinguish between 8 different markers/flags +using FlagField_T = FlagField<flag_t>; // the flag field: used for marking cells as fluid or obstacle cells // (also used for distinguishing between different boundary conditions // -> every boundary condition possesses its own, unique flag) diff --git a/apps/tutorials/pde/01_SolvingPDE.cpp b/apps/tutorials/pde/01_SolvingPDE.cpp index 261a44b4d01583cb0c548483b51e63b6a9dc8a6b..55eb90fb22a099a27fefaf27d82c57307f76d0c3 100644 --- a/apps/tutorials/pde/01_SolvingPDE.cpp +++ b/apps/tutorials/pde/01_SolvingPDE.cpp @@ -39,7 +39,7 @@ namespace walberla { typedef GhostLayerField<real_t,1> ScalarField; -typedef stencil::D2Q5 Stencil_T; +using Stencil_T = stencil::D2Q5; // function to initialize the boundaries of the source and destination fields diff --git a/apps/tutorials/pde/02_HeatEquation.cpp b/apps/tutorials/pde/02_HeatEquation.cpp index 0f4e00285c1ce5c13149fea3199240d0096d4c72..931644c344b2770deec2a63ce653c7cc82c6d481 100644 --- a/apps/tutorials/pde/02_HeatEquation.cpp +++ b/apps/tutorials/pde/02_HeatEquation.cpp @@ -43,7 +43,7 @@ namespace walberla { typedef GhostLayerField<real_t,1> ScalarField; -typedef stencil::D2Q5 Stencil_T; +using Stencil_T = stencil::D2Q5; diff --git a/apps/tutorials/pde/03_HeatEquation_Extensions.cpp b/apps/tutorials/pde/03_HeatEquation_Extensions.cpp index 40e60a05162b0201794ed4adad1ed67fcbf309f5..15d8859c1997fb064f0f9715ea7171f1b248fed8 100644 --- a/apps/tutorials/pde/03_HeatEquation_Extensions.cpp +++ b/apps/tutorials/pde/03_HeatEquation_Extensions.cpp @@ -44,7 +44,7 @@ namespace walberla { typedef GhostLayerField<real_t,1> ScalarField; -typedef stencil::D2Q5 Stencil_T; +using Stencil_T = stencil::D2Q5; diff --git a/apps/tutorials/pe/01_ConfinedGas.cpp b/apps/tutorials/pe/01_ConfinedGas.cpp index 27507f9ed18df19943c08a350254ac7feb47f7dc..ad29563e67beff23a7b46d116aaec650a7a9e8f9 100644 --- a/apps/tutorials/pe/01_ConfinedGas.cpp +++ b/apps/tutorials/pe/01_ConfinedGas.cpp @@ -120,8 +120,8 @@ int main( int argc, char ** argv ) { SphereID sp = createSphere( *globalBodyStorage, *forest, storageID, 0, *it, radius, material); Vec3 rndVel(math::realRandom<real_t>(-vMax, vMax), math::realRandom<real_t>(-vMax, vMax), math::realRandom<real_t>(-vMax, vMax)); - if (sp != NULL) sp->setLinearVel(rndVel); - if (sp != NULL) ++numParticles; + if (sp != nullptr) sp->setLinearVel(rndVel); + if (sp != nullptr) ++numParticles; } } WALBERLA_LOG_INFO_ON_ROOT("#particles created: " << numParticles); diff --git a/apps/tutorials/pe/02_ConfinedGasExtended.cpp b/apps/tutorials/pe/02_ConfinedGasExtended.cpp index 2e0ed571fb831be83584b7ff6b6e2d6c9aa70923..014bda1a8714523c5a5c03d74aa3acd59470e7b5 100644 --- a/apps/tutorials/pe/02_ConfinedGasExtended.cpp +++ b/apps/tutorials/pe/02_ConfinedGasExtended.cpp @@ -66,7 +66,7 @@ int main( int argc, char ** argv ) WALBERLA_LOG_INFO_ON_ROOT("*** READING CONFIG FILE ***"); auto cfg = env.config(); - if (cfg == NULL) WALBERLA_ABORT("No config specified!"); + if (cfg == nullptr) WALBERLA_ABORT("No config specified!"); const Config::BlockHandle mainConf = cfg->getBlock( "ConfinedGasExtended" ); const std::string sqlFile = mainConf.getParameter< std::string >( "sqlFile", "ConfinedGas.sqlite" ); @@ -164,10 +164,10 @@ int main( int argc, char ** argv ) std::function<void(void)> syncCallWithoutTT; if (!syncShadowOwners) { - syncCallWithoutTT = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + syncCallWithoutTT = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); } else { - syncCallWithoutTT = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + syncCallWithoutTT = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); } //! [Bind Sync Call] @@ -216,8 +216,8 @@ int main( int argc, char ** argv ) { SphereID sp = pe::createSphere( *globalBodyStorage, *forest, storageID, 0, *it, radius, material); Vec3 rndVel(math::realRandom<real_t>(-vMax, vMax), math::realRandom<real_t>(-vMax, vMax), math::realRandom<real_t>(-vMax, vMax)); - if (sp != NULL) sp->setLinearVel(rndVel); - if (sp != NULL) ++numParticles; + if (sp != nullptr) sp->setLinearVel(rndVel); + if (sp != nullptr) ++numParticles; } } mpi::reduceInplace(numParticles, mpi::SUM); diff --git a/src/blockforest/Block.cpp b/src/blockforest/Block.cpp index d13ba9de7b7057dda04927ad9bb9240d98637f2b..f366f8d3d047e2a7a1c91b6b00bc5dfce07cad6f 100644 --- a/src/blockforest/Block.cpp +++ b/src/blockforest/Block.cpp @@ -52,7 +52,7 @@ Block::Block( BlockForest & forest, const SetupBlock * const block ) : for( uint_t i = 0; i != block->getNeighborhoodSize(); ++i ) { - neighborhood_.push_back( Block::NeighborBlock( forest, block->getNeighborId(i), block->getNeighborProcess(i), block->getNeighborState(i) ) ); + neighborhood_.emplace_back( forest, block->getNeighborId(i), block->getNeighborProcess(i), block->getNeighborState(i) ); neighborhoodMapping[ block->getNeighborId(i) ] = i; } @@ -222,7 +222,7 @@ void Block::resetNeighborhood( const PhantomBlock & phantom ) neighborhood_.clear(); for( uint_t i = 0; i != phantom.getNeighborhoodSize(); ++i ) { - neighborhood_.push_back( Block::NeighborBlock( forest_, phantom.getNeighborId(i), phantom.getNeighborProcess(i), phantom.getNeighborState(i) ) ); + neighborhood_.emplace_back( forest_, phantom.getNeighborId(i), phantom.getNeighborProcess(i), phantom.getNeighborState(i) ); neighborhoodMapping[ phantom.getNeighborId(i) ] = i; } diff --git a/src/blockforest/BlockForest.cpp b/src/blockforest/BlockForest.cpp index e6c19cbc1fe9341bc297f73606a926549659355a..2fee938bc7fecf5fa61b9478f515ace38dfdffb7 100644 --- a/src/blockforest/BlockForest.cpp +++ b/src/blockforest/BlockForest.cpp @@ -33,6 +33,7 @@ #include "core/mpi/MPIManager.h" #include <fstream> +#include <memory> #include <set> #include <stack> #include <utility> @@ -164,7 +165,7 @@ bool BlockForest::BlockInformation::getId( BlockID & id, const real_t x, const r const BlockForest::BlockInformation::Node * BlockForest::BlockInformation::getNode( const BlockID & id ) const { if( nodes_.empty() ) - return NULL; + return nullptr; const uint_t treeIdDigits = forest_.getTreeIdDigits(); @@ -185,13 +186,13 @@ const BlockForest::BlockInformation::Node * BlockForest::BlockInformation::getNo const uint_t index = blockId.getTreeIndex(); if( index >= nodes_.size() || !(nodes_[index]) ) - return NULL; + return nullptr; auto node = nodes_[index]; for( uint_t i = 0; i != levels; ++i ) { if( node->children_.empty() ) - return NULL; + return nullptr; WALBERLA_ASSERT_NOT_NULLPTR( node->children_[ branchId[i] ] ); node = node->children_[ branchId[i] ]; } @@ -206,7 +207,7 @@ const BlockForest::BlockInformation::Node * BlockForest::BlockInformation::getNo const AABB & domain = forest_.getDomain(); if( nodes_.empty() || !domain.contains(x,y,z) ) - return NULL; + return nullptr; const real_t rootBlockXSize = forest_.getRootBlockXSize(); const real_t rootBlockYSize = forest_.getRootBlockYSize(); @@ -225,7 +226,7 @@ const BlockForest::BlockInformation::Node * BlockForest::BlockInformation::getNo auto node = nodes_[index]; if( !node ) - return NULL; + return nullptr; AABB aabb = AABB::createFromMinMaxCorner( domain.xMin() + static_cast< real_t >( xi ) * rootBlockXSize, domain.yMin() + static_cast< real_t >( yi ) * rootBlockYSize, @@ -296,7 +297,7 @@ BlockForest::BlockForest( const uint_t process, const SetupBlockForest& forest, WALBERLA_ASSERT( blocks_.find( blocks[i]->getId() ) == blocks_.end() ); - blocks_[ blocks[i]->getId() ] = shared_ptr< Block >( new Block( *this, blocks[i] ) ); + blocks_[ blocks[i]->getId() ] = std::make_shared< Block >( *this, blocks[i] ); for( uint_t j = 0; j != blocks[i]->getNeighborhoodSize(); ++j ) if( blocks[i]->getNeighbor(j)->getProcess() != process ) @@ -544,7 +545,7 @@ BlockForest::BlockForest( const uint_t process, const char* const filename, cons state += suidMap[j]; } - neighbors.push_back( BlockReconstruction::NeighborhoodReconstructionBlock( id, process_, state, aabbReconstruction ) ); + neighbors.emplace_back( id, process_, state, aabbReconstruction ); } for( uint_t i = 0; i != numberOfNeighbors; ++i ) { @@ -566,7 +567,7 @@ BlockForest::BlockForest( const uint_t process, const char* const filename, cons state += suidMap[k]; } - neighbors.push_back( BlockReconstruction::NeighborhoodReconstructionBlock( id, neighborProcess, state, aabbReconstruction ) ); + neighbors.emplace_back( id, neighborProcess, state, aabbReconstruction ); } } @@ -595,7 +596,7 @@ BlockForest::BlockForest( const uint_t process, const char* const filename, cons AABB aabb; const uint_t level = aabbReconstruction( aabb, id ); - auto block = shared_ptr< Block >( new Block( *this, id, aabb, state, level, neighborhoodReconstruction, neighbors ) ); + auto block = std::make_shared< Block >( *this, id, aabb, state, level, neighborhoodReconstruction, neighbors ); blocks_[ id ] = block; } @@ -614,7 +615,7 @@ BlockForest::BlockForest( const uint_t process, const char* const filename, cons offset = offsetBlocks[ i ] + 2 + j * ( blockIdBytes + suidBytes ); - ids.push_back( BlockID( buffer, offset, blockIdBytes ) ); + ids.emplace_back( buffer, offset, blockIdBytes ); Set<SUID> state; boost::dynamic_bitset< uint8_t > suidBitset = byteArrayToBitset( buffer, offset + blockIdBytes, suidBytes ); @@ -647,7 +648,7 @@ void BlockForest::getBlockID( IBlockID& id, const real_t x, const real_t y, cons } else { const Block* const block = getBlock(x,y,z); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting block ID failed: Locally, there exists no block at global location (" << x << "," << y << "," << z <<")!\n" " (for simulation global information you have to explicitly construct the block forest to " "contain global knowledge)"); @@ -671,7 +672,7 @@ void BlockForest::getAABB( AABB& aabb, const IBlockID& id ) const { } else { const Block* const block = getBlock( id ); - if( block == NULL ) + if( block == nullptr ) { const BlockID& bid = *static_cast< const BlockID* >( &id ); aabb = getAABBFromBlockId( bid ); @@ -696,7 +697,7 @@ void BlockForest::getState( Set<SUID>& state, const IBlockID& id ) const { } else { const Block* const block = getBlock( id ); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting block state failed: Locally, there exists no block with block ID \'" << id << "\'\n" " (for simulation global information you have to explicitly construct " "the block forest to contain global knowledge)" ); @@ -718,7 +719,7 @@ void BlockForest::getProcessRank( uint_t& rank, const IBlockID& id ) const { } else { const Block* const block = getBlock( id ); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting block process rank failed: Locally, there exists no block with block ID \'" << id << "\'\n" " (for simulation global information you have to explicitly construct " "the block forest to contain global knowledge)" ); @@ -750,7 +751,7 @@ void BlockForest::getRootBlockAABB( AABB& aabb, const uint_t x, const uint_t y, } else { const Block* const block = getRootBlock(x,y,z); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting root block AABB failed: Locally, there exists no root block [" << x << "," << y << "," << z <<"]!\n" " (for simulation global information you have to explicitly construct " "the block forest to contain global knowledge)" ); @@ -770,7 +771,7 @@ void BlockForest::getRootBlockState( Set<SUID>& state, const uint_t x, const uin } else { const Block* const block = getRootBlock(x,y,z); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting root block state failed: Locally, there exists no root block [" << x << "," << y << "," << z <<"]!\n" " (for simulation global information you have to explicitly construct " "the block forest to contain global knowledge)" ); @@ -790,7 +791,7 @@ void BlockForest::getRootBlockProcessRank( uint_t& rank, const uint_t x, const u } else { const Block* const block = getRootBlock(x,y,z); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting root block process rank failed: Locally, there exists no root block [" << x << "," << y << "," << z <<"]!\n" " (for simulation global information you have to explicitly construct " "the block forest to contain global knowledge)" ); @@ -1195,7 +1196,7 @@ void BlockForest::restoreSnapshot( const SnapshotRestorenFunction & processMappi const uint_t level = getAABBFromBlockId( aabb, id ); WALBERLA_ASSERT( blocks_.find( id ) == blocks_.end() ); - blocks_[ id ] = shared_ptr< Block >( new Block( *this, id, aabb, level, buffer, processMapping ) ); + blocks_[ id ] = std::make_shared< Block >( *this, id, aabb, level, buffer, processMapping ); Block * block = blocks_[ id ].get(); for( auto dataItem = blockDataItem_.begin(); dataItem != blockDataItem_.end(); ++dataItem ) @@ -1208,7 +1209,7 @@ void BlockForest::restoreSnapshot( const SnapshotRestorenFunction & processMappi } else { - addBlockData( block, dataItem->getId(), NULL ); + addBlockData( block, dataItem->getId(), nullptr ); } } } @@ -1419,7 +1420,7 @@ void BlockForest::constructBlockInformation( const SetupBlockForest & forest ) if( index.size() == 1 ) { node->setChild( index.top(), make_shared< BlockInformation::Node >( block->getProcess(), block->getState() ) ); } - else if( index.top() >= node->children_.size() || node->children_[ index.top() ] == NULL ) { + else if( index.top() >= node->children_.size() || node->children_[ index.top() ] == nullptr ) { node->setChild( index.top(), make_shared< BlockInformation::Node >() ); } @@ -1475,7 +1476,7 @@ void BlockForest::constructBlockInformation( const std::vector< BlockID > & ids, if( index.size() == 1 ) { node->setChild( index.top(), nodes[i] ); } - else if( index.top() >= node->children_.size() || node->children_[ index.top() ] == NULL ) { + else if( index.top() >= node->children_.size() || node->children_[ index.top() ] == nullptr ) { node->setChild( index.top(), make_shared< BlockInformation::Node >() ); } @@ -1494,7 +1495,7 @@ void BlockForest::constructBlockInformation() std::vector< std::pair< BlockID, std::pair< uint_t, Set<SUID> > > > data; for( auto it = blocks_.begin(); it != blocks_.end(); ++it ) { - data.push_back( std::make_pair( it->first, std::make_pair( process_, it->second->getState() ) ) ); + data.emplace_back( it->first, std::make_pair( process_, it->second->getState() ) ); } mpi::SendBuffer sBuffer; @@ -1570,7 +1571,7 @@ bool BlockForest::determineBlockTargetLevels( bool & additionalRefreshCycleRequi { WALBERLA_ASSERT( it->second->getTargetLevel() == it->second->getLevel() || ( it->second->getTargetLevel() + uint_t(1) ) == it->second->getLevel() ); - minTargetLevelsCallback.push_back( std::make_pair( it->second.get(), it->second->getTargetLevel() ) ); + minTargetLevelsCallback.emplace_back( it->second.get(), it->second->getTargetLevel() ); mapping.push_back(0); } } @@ -1599,7 +1600,7 @@ bool BlockForest::determineBlockTargetLevels( bool & additionalRefreshCycleRequi WALBERLA_CHECK( it1 != blocksAlreadyMarkedForRefinement.end() ); WALBERLA_CHECK_NOT_NULLPTR( *it1 ); WALBERLA_CHECK_EQUAL( (*it1)->getTargetLevel(), (*it1)->getLevel() + uint_t(1) ); - minTargetLevelsAllBlocks.push_back( std::make_pair( *it1, (*it1)->getTargetLevel() ) ); + minTargetLevelsAllBlocks.emplace_back( *it1, (*it1)->getTargetLevel() ); it1++; } } @@ -2164,7 +2165,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) if( block->getTargetLevel() != block->getLevel() || targetProcesses[0] != process_ ) { WALBERLA_ASSERT( targetProcesses.size() == uint_t(1) || targetProcesses.size() == uint_t(8) ); - blocksToPack.push_back( std::make_pair( block.get(), std::vector< mpi::SendBuffer >( targetProcesses.size() ) ) ); + blocksToPack.emplace_back( block.get(), std::vector< mpi::SendBuffer >( targetProcesses.size() ) ); } } @@ -2390,7 +2391,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) if( pBlock->getSourceLevel() != pBlock->getLevel() || pBlock->getSourceProcess()[0] != process_ ) { WALBERLA_ASSERT( blocks_.find( pBlock->getId() ) == blocks_.end() ); - blocks_[ pBlock->getId() ] = shared_ptr< Block >( new Block( *this, *pBlock ) ); + blocks_[ pBlock->getId() ] = std::make_shared< Block >( *this, *pBlock ); } else // update neighborhood of existing blocks { @@ -2469,7 +2470,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) WALBERLA_LOG_PROGRESS( "BlockForest refresh: - perform local data transfer" ); for( auto buffer = localBlocks.begin(); buffer != localBlocks.end(); ++buffer ) - recvLocalBlocks.push_back( mpi::RecvBuffer( **buffer ) ); + recvLocalBlocks.emplace_back( **buffer ); //////////////////////////////////// // WAIT FOR RECV's FOR BLOCK DATA // @@ -2545,7 +2546,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) { auto & bufferPtrs = blocksToUnpack[ block ]; if( bufferPtrs.empty() ) - bufferPtrs.resize( uint_t(8), std::make_pair( Set<SUID>::emptySet(), static_cast< mpi::RecvBuffer * >(NULL) ) ); + bufferPtrs.resize( uint_t(8), std::make_pair( Set<SUID>::emptySet(), static_cast< mpi::RecvBuffer * >(nullptr) ) ); WALBERLA_ASSERT_EQUAL( sId.getUsedBits(), rId.getUsedBits() + uint_t(3) ); bufferPtrs[ sId.getBranchId() ] = std::make_pair( state, &(*buffer) ); } @@ -2600,7 +2601,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) std::vector< std::pair< Block *, std::vector< std::pair< Set<SUID>, mpi::RecvBuffer * > > > > dataToUnpack; for( auto it = blocksToUnpack.begin(); it != blocksToUnpack.end(); ++it ) - dataToUnpack.push_back( std::make_pair( it->first, it->second ) ); + dataToUnpack.emplace_back( it->first, it->second ); //#ifdef _OPENMP //#pragma omp parallel for schedule(dynamic) @@ -2627,7 +2628,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) if( blockDataHandlingWrapper ) addBlockData( block, dataItem->getId(), blockDataHandlingWrapper->deserialize( block ) ); else - addBlockData( block, dataItem->getId(), NULL ); + addBlockData( block, dataItem->getId(), nullptr ); } // fill with sent data { @@ -2664,7 +2665,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) addBlockData( block, dataItem->getId(), downcastBlockDataHandlingWrapper->deserializeCoarseToFine( block ) ); } else - addBlockData( block, dataItem->getId(), NULL ); + addBlockData( block, dataItem->getId(), nullptr ); } // fill with sent data { @@ -2712,7 +2713,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) addBlockData( block, dataItem->getId(), downcastBlockDataHandlingWrapper->deserializeFineToCoarse( block ) ); } else - addBlockData( block, dataItem->getId(), NULL ); + addBlockData( block, dataItem->getId(), nullptr ); } // fill with sent data for( uint_t c = uint_t(0); c != uint_t(8); ++c ) diff --git a/src/blockforest/Initialization.cpp b/src/blockforest/Initialization.cpp index dea96fed6a823ed0a910c4d12b30b18a736fe63a..acb638accd0ea043a8db2f249eb98a5ea3084e22 100644 --- a/src/blockforest/Initialization.cpp +++ b/src/blockforest/Initialization.cpp @@ -32,6 +32,7 @@ #include "stencil/D3Q19.h" #include <functional> +#include <memory> namespace walberla { namespace blockforest { @@ -220,7 +221,7 @@ createBlockForest( const AABB& domainAABB, // if possible, create Cartesian MPI communicator - std::vector< uint_t >* processIdMap = NULL; + std::vector< uint_t >* processIdMap = nullptr; WALBERLA_MPI_SECTION() { @@ -249,11 +250,11 @@ createBlockForest( const AABB& domainAABB, sforest.balanceLoad( blockforest::CartesianDistribution( numberOfXProcesses, numberOfYProcesses, numberOfZProcesses, processIdMap ), numberOfXProcesses * numberOfYProcesses * numberOfZProcesses ); - if( processIdMap != NULL ) delete processIdMap; + if( processIdMap != nullptr ) delete processIdMap; // create StructuredBlockForest (encapsulates a newly created BlockForest) - return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sforest, keepGlobalBlockInformation ) ); + return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sforest, keepGlobalBlockInformation ); } @@ -306,7 +307,7 @@ createUniformBlockGrid( const AABB& domainAABB, zPeriodic, keepGlobalBlockInformation); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock ); sbf->createCellBoundingBoxes(); return sbf; @@ -514,9 +515,9 @@ createUniformBlockGrid( const AABB& domainAABB, // create StructuredBlockForest (encapsulates a newly created BlockForest) - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sforest, keepGlobalBlockInformation ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sforest, keepGlobalBlockInformation ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock ); sbf->createCellBoundingBoxes(); return sbf; @@ -600,12 +601,12 @@ createUniformBlockGrid( const std::string& filename, if( !MPIManager::instance()->rankValid() ) MPIManager::instance()->useWorldComm(); - auto bf = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), filename.c_str(), true, keepGlobalBlockInformation ) ); + auto bf = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), filename.c_str(), true, keepGlobalBlockInformation ); if( !bf->storesUniformBlockGrid() ) WALBERLA_ABORT( "The block forest loaded from file \'" << filename << "\' does not contain a uniform block grid!" ); - auto sbf = shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock ) ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, numberOfXCellsPerBlock, numberOfYCellsPerBlock, numberOfZCellsPerBlock ); sbf->createCellBoundingBoxes(); return sbf; diff --git a/src/blockforest/PhantomBlockForest.cpp b/src/blockforest/PhantomBlockForest.cpp index 196ba5529e2b24b8825ea8a5903d9191cc83814f..accf55746fc00d807621103f3d244fb63a9c33e3 100644 --- a/src/blockforest/PhantomBlockForest.cpp +++ b/src/blockforest/PhantomBlockForest.cpp @@ -31,6 +31,7 @@ #include "core/mpi/MPIManager.h" #include "core/mpi/Reduce.h" +#include <memory> #include <set> @@ -77,8 +78,8 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun { auto cstate = function ? function( std::vector< std::pair< BlockID, Set<SUID> > >( 1, std::make_pair( id, state ) ), id ) : state; - auto phantom = shared_ptr< PhantomBlock >( new PhantomBlock( *this, id, cstate, aabb, targetLevel, level, - std::vector< uint_t >( uint_t(1), process ), process ) ); + auto phantom = std::make_shared< PhantomBlock >( *this, id, cstate, aabb, targetLevel, level, + std::vector< uint_t >( uint_t(1), process ), process ); blocks_[ phantom->getId() ] = phantom; block->addTargetProcess( process ); @@ -106,8 +107,8 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun ( ( c & 2 ) ? aabb.yMax() : yMid ), ( ( c & 4 ) ? aabb.zMax() : zMid ) ); - auto phantom = shared_ptr< PhantomBlock >( new PhantomBlock( *this, cid, cstate, caabb, targetLevel, level, - std::vector< uint_t >( uint_t(1), process ), process ) ); + auto phantom = std::make_shared< PhantomBlock >( *this, cid, cstate, caabb, targetLevel, level, + std::vector< uint_t >( uint_t(1), process ), process ); blocks_[ phantom->getId() ] = phantom; block->addTargetProcess( process ); @@ -146,7 +147,7 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun sourceStates[3].second + sourceStates[4].second + sourceStates[5].second + sourceStates[6].second + sourceStates[7].second ); - auto phantom = shared_ptr< PhantomBlock >( new PhantomBlock( *this, fid, cstate, faabb, targetLevel, level, sourceProcesses, process ) ); + auto phantom = std::make_shared< PhantomBlock >( *this, fid, cstate, faabb, targetLevel, level, sourceProcesses, process ); blocks_[ phantom->getId() ] = phantom; block->addTargetProcess( process ); @@ -237,7 +238,7 @@ void PhantomBlockForest::initialize( const BlockStateDeterminationFunction & fun std::map< BlockID, std::pair< uint_t, Set<SUID> > > & localMap = blockNeighborhood[ process ]; for( auto it = localMap.begin(); it != localMap.end(); ++it ) - neighbors.push_back( BlockReconstruction::NeighborhoodReconstructionBlock( it->first, it->second.first, it->second.second, aabbReconstruction ) ); + neighbors.emplace_back( it->first, it->second.first, it->second.second, aabbReconstruction ); BlockReconstruction::NeighborhoodReconstruction< PhantomBlock > neighborhoodReconstruction( blockforest_.getDomain(), blockforest_.isXPeriodic(), @@ -262,7 +263,7 @@ void PhantomBlockForest::assignBlockData( const PhantomBlockDataAssignmentFuncti { auto & block = it->second; WALBERLA_ASSERT_NOT_NULLPTR( block.get() ); - blockData.push_back( std::make_pair( block.get(), walberla::any() ) ); + blockData.emplace_back( block.get(), walberla::any() ); } function( blockData, *this ); @@ -296,7 +297,7 @@ bool PhantomBlockForest::calculateMigrationInformation( const MigrationPreparati { auto & block = it->second; WALBERLA_ASSERT_NOT_NULLPTR( block.get() ); - targetProcess.push_back( std::make_pair( block.get(), block->getTargetProcess() ) ); + targetProcess.emplace_back( block.get(), block->getTargetProcess() ); } bool runAgain = function( targetProcess, processesToRecvFrom_, *this, iteration ); @@ -465,7 +466,7 @@ void PhantomBlockForest::migrate( const PhantomBlockDataPackFunction & packBlock ++sourceLevel; } - auto phantom = shared_ptr< PhantomBlock >( new PhantomBlock( *this, id, state, aabb, level, sourceLevel, sp, process ) ); + auto phantom = std::make_shared< PhantomBlock >( *this, id, state, aabb, level, sourceLevel, sp, process ); blocks_[ id ] = phantom; phantom->clearNeighborhood(); diff --git a/src/blockforest/SetupBlockForest.cpp b/src/blockforest/SetupBlockForest.cpp index 3c4b40652e59ffcba3e0a383a3178aff509aba8a..21876b83d7d808cb61bba99bde5f01677bd358c3 100644 --- a/src/blockforest/SetupBlockForest.cpp +++ b/src/blockforest/SetupBlockForest.cpp @@ -73,7 +73,7 @@ uint_t SetupBlockForest::getNumberOfBlocks( const uint_t level ) const for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] == NULL ) + if( forest_[i] == nullptr ) continue; std::stack< SetupBlock* > stack; @@ -103,12 +103,12 @@ uint_t SetupBlockForest::getNumberOfBlocks( const uint_t level ) const const SetupBlock* SetupBlockForest::getFirstBlock() const { - SetupBlock* block = NULL; - for( uint_t i = 0; i != forest_.size() && block == NULL; ++i ) + SetupBlock* block = nullptr; + for( uint_t i = 0; i != forest_.size() && block == nullptr; ++i ) block = forest_[i]; - if( block == NULL ) - return NULL; + if( block == nullptr ) + return nullptr; while( block->hasChildren() ) block = block->getChild(0); @@ -120,12 +120,12 @@ const SetupBlock* SetupBlockForest::getFirstBlock() const { SetupBlock* SetupBlockForest::getFirstBlock() { - SetupBlock* block = NULL; - for( uint_t i = 0; i != forest_.size() && block == NULL; ++i ) + SetupBlock* block = nullptr; + for( uint_t i = 0; i != forest_.size() && block == nullptr; ++i ) block = forest_[i]; - if( block == NULL ) - return NULL; + if( block == nullptr ) + return nullptr; while( block->hasChildren() ) block = block->getChild(0); @@ -137,8 +137,8 @@ SetupBlock* SetupBlockForest::getFirstBlock() { const SetupBlock* SetupBlockForest::getNextBlock( const SetupBlock* block ) const { - if( block == NULL ) - return NULL; + if( block == nullptr ) + return nullptr; // ASCEND @@ -162,10 +162,10 @@ const SetupBlock* SetupBlockForest::getNextBlock( const SetupBlock* block ) cons WALBERLA_ASSERT_LESS( treeIndex-1 ,forest_.size() ); WALBERLA_ASSERT_EQUAL( block, forest_[ treeIndex-1 ] ); - while( treeIndex < forest_.size() && forest_[ treeIndex ] == NULL ) ++treeIndex; + while( treeIndex < forest_.size() && forest_[ treeIndex ] == nullptr ) ++treeIndex; if( treeIndex == forest_.size() ) - return NULL; + return nullptr; block = forest_[ treeIndex ]; } @@ -184,8 +184,8 @@ const SetupBlock* SetupBlockForest::getNextBlock( const SetupBlock* block ) cons SetupBlock* SetupBlockForest::getNextBlock( const SetupBlock* block ) { - if( block == NULL ) - return NULL; + if( block == nullptr ) + return nullptr; // ASCEND @@ -209,10 +209,10 @@ SetupBlock* SetupBlockForest::getNextBlock( const SetupBlock* block ) { WALBERLA_ASSERT_LESS( treeIndex-1, forest_.size() ); WALBERLA_ASSERT_EQUAL( block, forest_[ treeIndex-1 ] ); - while( treeIndex < forest_.size() && forest_[ treeIndex ] == NULL ) ++treeIndex; + while( treeIndex < forest_.size() && forest_[ treeIndex ] == nullptr ) ++treeIndex; if( treeIndex == forest_.size() ) - return NULL; + return nullptr; block = forest_[ treeIndex ]; } @@ -269,7 +269,7 @@ void SetupBlockForest::getBlocks( std::vector< const SetupBlock* >& blocks ) con for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] == NULL ) + if( forest_[i] == nullptr ) continue; // depth-first search @@ -302,7 +302,7 @@ void SetupBlockForest::getBlocks( std::vector< SetupBlock* >& blocks ) { for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] == NULL ) + if( forest_[i] == nullptr ) continue; // depth-first search @@ -335,7 +335,7 @@ void SetupBlockForest::getBlocks( std::vector< const SetupBlock* >& blocks, cons for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] == NULL ) + if( forest_[i] == nullptr ) continue; std::stack< SetupBlock* > stack; @@ -367,7 +367,7 @@ void SetupBlockForest::getBlocks( std::vector< SetupBlock* >& blocks, const uint for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] == NULL ) + if( forest_[i] == nullptr ) continue; std::stack< SetupBlock* > stack; @@ -413,7 +413,7 @@ void SetupBlockForest::getHilbertOrder( std::vector< SetupBlock* >& blocks ) { SetupBlock* root = forest_[ z*size_[0]*size_[1] + y*size_[0] + x ]; - if( root != NULL ) { + if( root != nullptr ) { std::stack< SetupBlock* > stack; std::stack< uint_t > orientation; @@ -486,7 +486,7 @@ void SetupBlockForest::getBlocksOverlappedByAABB( std::vector< SetupBlock* >& bl for( uint_t y = max[1]; y-- != min[1]; ) { for( uint_t x = max[0]; x-- != min[0]; ) { SetupBlock* const block = forest_[ mapForestCoordinatesToTreeIndex(x,y,z) ]; - if( block != NULL && block->getAABB().intersects( aabb ) ) + if( block != nullptr && block->getAABB().intersects( aabb ) ) stack.push( block ); } } @@ -524,7 +524,7 @@ void SetupBlockForest::getBlocks( std::vector< SetupBlock* >& blocks, const uint for( uint_t y = ymax; y-- != ymin; ) { for( uint_t x = xmax; x-- != xmin; ) { SetupBlock* const block = forest_[ mapForestCoordinatesToTreeIndex(x,y,z) ]; - if( block != NULL ) stack.push( block ); + if( block != nullptr ) stack.push( block ); } } } @@ -596,7 +596,7 @@ void SetupBlockForest::mapAABBToBoundingForestCoordinates( const AABB& aabb, uin // shouldn't happen, but might happen due to floating point inaccuracy? SetupBlock* block = forest_[ mapForestCoordinatesToTreeIndex( min[0], min[1], min[2] ) ]; - if( block != NULL ) { + if( block != nullptr ) { const AABB& tree = block->getAABB(); if( aabb.min(i) < tree.min(i) ) --min[i]; else if( aabb.min(i) >= tree.max(i) ) ++min[i]; @@ -611,7 +611,7 @@ void SetupBlockForest::mapAABBToBoundingForestCoordinates( const AABB& aabb, uin // shouldn't happen, but might happen due to floating point inaccuracy? SetupBlock* block = forest_[ mapForestCoordinatesToTreeIndex( max[0], max[1], max[2] ) ]; - if( block != NULL ) { + if( block != nullptr ) { const AABB& tree = block->getAABB(); if( aabb.max(i) <= tree.min(i) ) --max[i]; else if( aabb.max(i) > tree.max(i) ) ++max[i]; @@ -673,7 +673,7 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_ if( !forest_.empty() ) { for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] != NULL ) delete forest_[i]; + if( forest_[i] != nullptr ) delete forest_[i]; } forest_.clear(); } @@ -725,7 +725,7 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_ WALBERLA_LOG_PROGRESS( "Initializing SetupBlockForest: Allocating root blocks ..." ); - forest_.resize( size, NULL ); + forest_.resize( size, nullptr ); numberOfRootBlocks_ = uint_c(0); AABB aabb; @@ -740,7 +740,7 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_ { getRootBlockAABB( aabb, x, y, z ); - forest_[ treeIndex ] = new SetupBlock( NULL, BlockID( treeIndex, treeIdMarker ), + forest_[ treeIndex ] = new SetupBlock( nullptr, BlockID( treeIndex, treeIdMarker ), aabb.xMin(), aabb.yMin(), aabb.zMin(), aabb.xMax(), aabb.yMax(), aabb.zMax(), 0 ); ++numberOfRootBlocks_; } @@ -769,7 +769,7 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_ WALBERLA_ASSERT_LESS( treeIndex, forest_.size() ); - if( forest_[ treeIndex ] != NULL ) { + if( forest_[ treeIndex ] != nullptr ) { for( uint_t w = 0; w != 3; ++w ) { for( uint_t v = 0; v != 3; ++v ) { @@ -797,7 +797,7 @@ void SetupBlockForest::init( const AABB& domain, const uint_t xSize, const uint_ WALBERLA_ASSERT_LESS( n, 26 ); WALBERLA_ASSERT_LESS( nIndex, forest_.size() ); - if( forest_[ nIndex ] != NULL ) + if( forest_[ nIndex ] != nullptr ) forest_[ treeIndex ]->addNeighbor( n, forest_[ nIndex ] ); } } @@ -987,13 +987,13 @@ void SetupBlockForest::updateNeighborhood( std::vector< SetupBlock* >& blocks ) if( z < domain_.zMin() && periodic_[2] ) z = domain_.zMax() - domain_.zMin() + z; if( z >= domain_.zMax() && periodic_[2] ) z = domain_.zMin() - domain_.zMax() + z; - SetupBlock* neighbor = NULL; + SetupBlock* neighbor = nullptr; - for( uint_t j = 0; j != neighborhood.size() && neighbor == NULL; ++j ) { + for( uint_t j = 0; j != neighborhood.size() && neighbor == nullptr; ++j ) { if( neighborhood[j]->getAABB().contains( x, y, z ) ) neighbor = mapPointToBlock( neighborhood[j], x, y, z ); } - if( neighbor == NULL && block->hasFather() && block->getFather()->getAABB().contains( x, y, z ) ) + if( neighbor == nullptr && block->hasFather() && block->getFather()->getAABB().contains( x, y, z ) ) neighbor = mapPointToBlock( block->getFather(), x, y, z ); if( neighborhoodSectionBlocks.empty() || neighborhoodSectionBlocks.back() != neighbor ) @@ -1008,7 +1008,7 @@ void SetupBlockForest::updateNeighborhood( std::vector< SetupBlock* >& blocks ) #endif block->clearNeighborhoodSection(n); - if( neighborhoodSectionBlocks.back() != NULL ) { + if( neighborhoodSectionBlocks.back() != nullptr ) { #ifndef NDEBUG if( neighborhoodSectionBlocks.back()->getLevel() > block->getLevel() ) @@ -1082,7 +1082,7 @@ void SetupBlockForest::createNeighborhood() { #endif block->clearNeighborhoodSection(n); - if( neighborhoodSectionBlocks.back() != NULL ) { + if( neighborhoodSectionBlocks.back() != nullptr ) { #ifndef NDEBUG if( neighborhoodSectionBlocks.back()->getLevel() > block->getLevel() ) diff --git a/src/blockforest/StructuredBlockForest.cpp b/src/blockforest/StructuredBlockForest.cpp index ca37814fd44b9245196d0c44ea0e517be7185e2c..034feb8277a32c4554c94bac90ae6a29b383c41a 100644 --- a/src/blockforest/StructuredBlockForest.cpp +++ b/src/blockforest/StructuredBlockForest.cpp @@ -43,7 +43,7 @@ bool StructuredBlockForest::blockExists( const Cell& cell, const uint_t level ) } const IBlock* block = getBlock(x,y,z); - if( block == NULL ) + if( block == nullptr ) return false; WALBERLA_ASSERT_EQUAL( dynamic_cast< const Block* >( block ), block ); @@ -68,7 +68,7 @@ void StructuredBlockForest::getBlockID( IBlockID& id, const Cell& cell, const ui } else { const IBlock* const block = getBlock(x,y,z); - if( block == NULL ) { + if( block == nullptr ) { WALBERLA_ABORT( "Getting block ID failed: Locally, there exists no block at global cell " << cell << " on level " << level << "!\n" " (for simulation global information you have to explicitly construct the block forest to " "contain global knowledge)"); diff --git a/src/blockforest/loadbalancing/Cartesian.cpp b/src/blockforest/loadbalancing/Cartesian.cpp index 780461adfc81872ed1bcac10d72390e9da59ccfc..13dbf50b7dba2147d7988683f58a0f45088b9fd4 100644 --- a/src/blockforest/loadbalancing/Cartesian.cpp +++ b/src/blockforest/loadbalancing/Cartesian.cpp @@ -48,7 +48,7 @@ uint_t CartesianDistribution::operator()( SetupBlockForest & forest, const uint_ WALBERLA_ABORT( "Load balancing failed: \'Number of processes in z-direction\' must be in (0," << forest.getZSize() << "]. " "You specified \'" << numberOfZProcesses_ << "\'." ); - if( processIdMap_ != NULL ) + if( processIdMap_ != nullptr ) WALBERLA_CHECK_EQUAL( processIdMap_->size(), numberOfProcesses ); uint_t partitions[3]; @@ -84,7 +84,7 @@ uint_t CartesianDistribution::operator()( SetupBlockForest & forest, const uint_ { const uint_t index = z * partitions[0] * partitions[1] + y * partitions[0] + x; - (*block)->assignTargetProcess( ( processIdMap_ != NULL ) ? (*processIdMap_)[ index ] : index ); + (*block)->assignTargetProcess( ( processIdMap_ != nullptr ) ? (*processIdMap_)[ index ] : index ); } } } diff --git a/src/blockforest/loadbalancing/StaticParMetis.cpp b/src/blockforest/loadbalancing/StaticParMetis.cpp index 0ab96201356cddb08a39907f90b87ff3b20e963d..5853cdf1ee62f3eefaff557847f2aea4095ebd83 100644 --- a/src/blockforest/loadbalancing/StaticParMetis.cpp +++ b/src/blockforest/loadbalancing/StaticParMetis.cpp @@ -43,12 +43,12 @@ template< typename T > T * ptr( std::vector<T> & v ) { if( v.empty() ) - return NULL; + return nullptr; else return &( v.front() ); } -typedef uint_t idx_t; +using idx_t = uint_t; uint_t StaticLevelwiseParMetis::operator()( SetupBlockForest & forest, const uint_t numberOfProcesses, const memory_t /*perProcessMemoryLimit*/ ) const @@ -114,7 +114,7 @@ uint_t StaticLevelwiseParMetis::operator()( SetupBlockForest & forest, const uin if(weightsToUse_ == PARMETIS_EDGE_WEIGHTS || weightsToUse_ == PARMETIS_BOTH_WEIGHTS) { - blockPairs.push_back( BlockPair( blocks[i], *nit ) ); + blockPairs.emplace_back( blocks[i], *nit ); } } diff --git a/src/core/config/Config.cpp b/src/core/config/Config.cpp index 48277f3bc6336d225909ff0172e98da0a76233bf..54c147b00caf44ca3f616d0f6ac74661fc51dc2f 100644 --- a/src/core/config/Config.cpp +++ b/src/core/config/Config.cpp @@ -64,7 +64,7 @@ Config::Config() // \brief Destructor for the Config class. */ Config::~Config() -{} += default; //********************************************************************************************************************** @@ -473,16 +473,6 @@ Config::Block::Block( const std::string& key ) //********************************************************************************************************************** -//********************************************************************************************************************** -/*!\fn Config::Block::Block( const Block& b ) -// \brief The copy constructor for the Block class. - */ -Config::Block::Block( const Block& b ) - :key_(b.key_),blocks_(b.blocks_),params_(b.params_) -{} -//********************************************************************************************************************** - - //********************************************************************************************************************** /*!\fn Config::Block& Config::Block::operator=( const Block& b ) // \brief The copy assignment operator for the Block class. @@ -508,7 +498,7 @@ Config::Block& Config::Block::operator=( const Block& b ) // \brief Default destructor of the Block class. */ Config::Block::~Block() -{} += default; //********************************************************************************************************************** diff --git a/src/core/config/Config.h b/src/core/config/Config.h index 9ed1ce81984b627e25cb4c4b7ef014a9e786dacc..c915a2e4cbb76bf37e7baa0d31af3e483239c6d0 100644 --- a/src/core/config/Config.h +++ b/src/core/config/Config.h @@ -172,7 +172,7 @@ public: public: //**Constructors************************************************************************************************** Block( const std::string& key="" ); - Block( const Block& b ); + Block( const Block& b ) = default; //**************************************************************************************************************** //**Destructor**************************************************************************************************** diff --git a/src/core/config/Create.cpp b/src/core/config/Create.cpp index 1886a5be4ffde22a6084544a2093e6ef26f49b50..7e945cfd8ccaf98ffae168d5d6bde592df24641d 100644 --- a/src/core/config/Create.cpp +++ b/src/core/config/Create.cpp @@ -154,7 +154,7 @@ namespace config { if ( blockName.empty() ) { - currentBlock = NULL; + currentBlock = nullptr; WALBERLA_LOG_WARNING("Ignoring Parameter '" << *param << "' empty block name"); break; } @@ -162,7 +162,7 @@ namespace config { currentBlock->getWritableBlocks( blockName, possibleBlocks ); if ( possibleBlocks.size() > 1 ) { - currentBlock = NULL; + currentBlock = nullptr; WALBERLA_LOG_WARNING("Ignoring Parameter '" << *param << "' since block is ambiguous: " << blockName ); break; } @@ -205,7 +205,7 @@ namespace config { public: SingleConfigGenerator( const shared_ptr<Config> & config ): config_ ( config ) {} - virtual shared_ptr<Config> next() + shared_ptr<Config> next() override { auto res = config_; config_.reset(); @@ -223,7 +223,7 @@ namespace config { MultipleConfigGenerator( const std::string & baseName, const std::string & extension, int numberOfDigits ) : baseName_( baseName ), extension_( extension ), numberOfDigits_( numberOfDigits), counter_(-1) {} - virtual shared_ptr<Config> next() + shared_ptr<Config> next() override { ++counter_; std::stringstream ss; diff --git a/src/core/math/Parser.cpp b/src/core/math/Parser.cpp index 523048e20eb445026ce458e44f4d7aec28a40846..a2d48044392490a797629e47ade6a4fc32ccc760 100644 --- a/src/core/math/Parser.cpp +++ b/src/core/math/Parser.cpp @@ -66,8 +66,8 @@ namespace math { FunctionParser::FunctionParser() - : expression_ ( 0 ), - symbolTable_( 0 ), + : expression_ ( nullptr ), + symbolTable_( nullptr ), isConstant_(false), isZero_(false) { @@ -125,7 +125,7 @@ void FunctionParser::parse( const std::string & eq ) double FunctionParser::evaluate( const std::map<std::string,double> & symbolTable) const { - if( expression_ == 0 ) + if( expression_ == nullptr ) { WALBERLA_ASSERT_NULLPTR( symbolTable_ ); WALBERLA_ABORT( "Error: You are trying to evaluate an expression which you never have parsed!" ); @@ -149,7 +149,7 @@ double FunctionParser::evaluate( const std::map<std::string,double> & symbolTabl bool FunctionParser::symbolExists(const std::string & symbol) const { - if( expression_ == 0 ) + if( expression_ == nullptr ) { WALBERLA_ASSERT_NULLPTR( symbolTable_ ); WALBERLA_ABORT( "Error: You are trying to evaluate an expression which you never have parsed!" ); diff --git a/src/core/math/PhysicalCheck.cpp b/src/core/math/PhysicalCheck.cpp index 321890603a9e7d0306858a94e489dad95b02cf4d..d87a0ad18b8abd855a340a03e748c1743e8c1ae3 100644 --- a/src/core/math/PhysicalCheck.cpp +++ b/src/core/math/PhysicalCheck.cpp @@ -318,7 +318,7 @@ namespace math { if( !isDefined(varName) ) { WALBERLA_ABORT( "Error in PhysicalCheck::getVarUnit(). Variable not found: " << varName ); - return 0; + return nullptr; } std::stringstream num, denom; diff --git a/src/core/math/equation_system/Equation.cpp b/src/core/math/equation_system/Equation.cpp index 53bef41aa50ae3e29425ab947390380e891cf372..cad85e10e07da7542f4938fc81316fdd49d64068 100644 --- a/src/core/math/equation_system/Equation.cpp +++ b/src/core/math/equation_system/Equation.cpp @@ -25,6 +25,7 @@ #include <cmath> #include <algorithm> +#include <memory> namespace walberla { @@ -201,7 +202,7 @@ namespace math { void Equation::rotate(bool flip, OpType& leftOp, OpType& rightOp){ NodePtr newNode; if ( root_->left_->nodeDir_ == ND_LEFT ){ - newNode = NodePtr( new Node( leftOp ) ); + newNode = std::make_shared<Node>( leftOp ); if (flip){ newNode->left_ = root_->left_->right_; newNode->right_ = root_->right_; @@ -211,7 +212,7 @@ namespace math { } root_->left_ = root_->left_->left_; } else { - newNode = NodePtr( new Node( rightOp ) ); + newNode = std::make_shared<Node>( rightOp ); if (flip){ newNode->right_ = root_->left_->left_; newNode->left_ = root_->right_; diff --git a/src/core/math/equation_system/EquationParser.cpp b/src/core/math/equation_system/EquationParser.cpp index 6f4b379b6b54d4b1f5fef5b690ab0cb13cf6a7d2..9f03f55e7a1caead357aeb49538918d18c7ca8ac 100644 --- a/src/core/math/equation_system/EquationParser.cpp +++ b/src/core/math/equation_system/EquationParser.cpp @@ -26,6 +26,7 @@ #include <boost/algorithm/string/trim.hpp> #include <boost/lexical_cast.hpp> +#include <memory> #define E_VAL 2.71828182845904523536 @@ -75,7 +76,7 @@ NodePtr EquationParser::parseNumber( const std::string& str, size_t& index ) con value = boost::lexical_cast< double >( str.substr(start, index-start) ); } - return NodePtr ( new Node(value) ); + return std::make_shared<Node>( value ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -127,7 +128,7 @@ NodePtr EquationParser::parseVariable( const std::string& str, size_t& index ) c if ( es_.varMap_.find(name) != es_.varMap_.end() ){ varPtr = es_.varMap_[name]; } else { - varPtr = VarPtr( new Var ( name ) ); + varPtr = std::make_shared<Var>( name ); es_.varMap_[name] = varPtr; } @@ -177,19 +178,19 @@ NodePtr EquationParser::parseFunction( const std::string& str, size_t& index ) c switch(opFunc) { case OP_FUNC_EXP: - funcPtr = NodePtr( new Node( OP_PROD ) ); - funcPtr->left() = NodePtr( new Node( E_VAL ) ); + funcPtr = std::make_shared<Node>( OP_PROD ); + funcPtr->left() = std::make_shared<Node>( E_VAL ); funcPtr->right() = nodePtr; return funcPtr; case OP_FUNC_LN: - funcPtr = NodePtr( new Node( OP_LOG ) ); - funcPtr->right() = NodePtr( new Node( E_VAL ) ); + funcPtr = std::make_shared<Node>( OP_LOG ); + funcPtr->right() = std::make_shared<Node>( E_VAL ); funcPtr->left() = nodePtr; return funcPtr; case OP_FUNC_SQRT: - funcPtr = NodePtr( new Node( OP_PROD ) ); + funcPtr = std::make_shared<Node>( OP_PROD ); funcPtr->left() = nodePtr; - funcPtr->right() = NodePtr( new Node( 0.5 ) ); + funcPtr->right() = std::make_shared<Node>( 0.5 ); return funcPtr; default: WALBERLA_ABORT( "Function not yet defined" ); @@ -327,7 +328,7 @@ EquationPtr EquationParser::parseEquation( const std::string& str, size_t& index nodePtr->left() = leftPtr; nodePtr->right() = rightPtr; - return EquationPtr ( new Equation(nodePtr) ); + return std::make_shared<Equation>( nodePtr ); } } // namespace math diff --git a/src/core/mpi/BufferSystem.cpp b/src/core/mpi/BufferSystem.cpp index 1cabacc1d1dd8742067cf2bab3c134c3c316988a..551fce3e60dae2355ff448ab71e380fc9ca77437 100644 --- a/src/core/mpi/BufferSystem.cpp +++ b/src/core/mpi/BufferSystem.cpp @@ -41,7 +41,7 @@ std::set<int> BufferSystem::activeTags_; BufferSystem::iterator::iterator( BufferSystem & bufferSystem, bool begin ) - : bufferSystem_( bufferSystem), currentRecvBuffer_( NULL ), currentSenderRank_( -1 ) + : bufferSystem_( bufferSystem), currentRecvBuffer_( nullptr ), currentSenderRank_( -1 ) { if ( begin ) // init iterator ++(*this); @@ -86,7 +86,7 @@ BufferSystem::BufferSystem( const MPI_Comm & communicator, int tag ) : knownSizeComm_ ( communicator, tag ), unknownSizeComm_( communicator, tag ), noMPIComm_( communicator, tag ), - currentComm_ ( NULL ), + currentComm_ ( nullptr ), sizeChangesEverytime_( true ), communicationRunning_( false ) { @@ -97,7 +97,7 @@ BufferSystem::BufferSystem( const BufferSystem &other ) : knownSizeComm_ ( other.knownSizeComm_.getCommunicator(), other.knownSizeComm_.getTag() ), unknownSizeComm_( other.knownSizeComm_.getCommunicator(), other.knownSizeComm_.getTag() ), noMPIComm_ ( other.knownSizeComm_.getCommunicator(), other.knownSizeComm_.getTag() ), - currentComm_ ( NULL ), + currentComm_ ( nullptr ), sizeChangesEverytime_( other.sizeChangesEverytime_ ), communicationRunning_( other.communicationRunning_ ), recvInfos_( other.recvInfos_ ), @@ -111,7 +111,7 @@ BufferSystem::BufferSystem( const BufferSystem &other ) else if ( other.currentComm_ == &other.noMPIComm_ ) currentComm_ = &noMPIComm_; else - currentComm_ = NULL; // receiver information not yet set + currentComm_ = nullptr; // receiver information not yet set } @@ -131,7 +131,7 @@ BufferSystem & BufferSystem::operator=( const BufferSystem & other ) else if ( other.currentComm_ == &other.noMPIComm_ ) currentComm_ = &noMPIComm_; else - currentComm_ = NULL; // receiver information not yet set + currentComm_ = nullptr; // receiver information not yet set return *this; } @@ -419,7 +419,7 @@ RecvBuffer * BufferSystem::waitForNext( MPIRank & fromRank ) else { endCommunication(); - return NULL; + return nullptr; } } diff --git a/src/core/mpi/Gatherv.cpp b/src/core/mpi/Gatherv.cpp index d2576987d0232cb4de3e2d5fcb64e82fc9406b1f..af9aea36cf657f8c17dc977d6484c3b4a2d1eb4f 100644 --- a/src/core/mpi/Gatherv.cpp +++ b/src/core/mpi/Gatherv.cpp @@ -112,7 +112,7 @@ void gathervBuffer( const mpi::SendBuffer & sendBuffer, mpi::RecvBuffer & recvBu // Gather the message sizes on root process MPI_Gather( &sendBufferSize, 1, MPITrait<int>::type(), - isGatherProcess? &sizes[0] : NULL, 1, MPITrait<int>::type(), + isGatherProcess? &sizes[0] : nullptr, 1, MPITrait<int>::type(), targetRank, comm ); int totalSize = 0; @@ -128,8 +128,8 @@ void gathervBuffer( const mpi::SendBuffer & sendBuffer, mpi::RecvBuffer & recvBu MPI_Gatherv( sendBuffer.ptr(), int_c( sendBuffer.size() ), MPITrait< mpi::SendBuffer::ElementType >::type(), recvBuffer.ptr(), - isGatherProcess? &sizes[0] : NULL, - isGatherProcess? &displacements[0] : NULL, + isGatherProcess? &sizes[0] : nullptr, + isGatherProcess? &displacements[0] : nullptr, MPITrait< mpi::RecvBuffer::ElementType >::type(), targetRank, comm ); } diff --git a/src/core/mpi/OpenMPBufferSystem.cpp b/src/core/mpi/OpenMPBufferSystem.cpp index 54471ccf415c82cd2403d0a4db3c122de9ced943..417d74a395be79894d1a89e20c9a0fb570885aea 100644 --- a/src/core/mpi/OpenMPBufferSystem.cpp +++ b/src/core/mpi/OpenMPBufferSystem.cpp @@ -184,7 +184,7 @@ void OpenMPBufferSystem::waitOpenMP() for( int i = 0; i < numReceives; ++i ) { MPIRank recvRank = INVALID_RANK; - RecvBuffer * recvBuffer = NULL; + RecvBuffer * recvBuffer = nullptr; #ifdef _OPENMP #pragma omp critical diff --git a/src/core/timing/TimingPool.cpp b/src/core/timing/TimingPool.cpp index 97dfc1a893567ae2b9c6a2be6e5af41a383fb999..372a81b6ad4cd84a3880ecdc15d348498d845e24 100644 --- a/src/core/timing/TimingPool.cpp +++ b/src/core/timing/TimingPool.cpp @@ -163,11 +163,11 @@ void TimingPool<TP>::mpiReduce( std::vector<double> & min, if( targetRank >= 0 ) { - void * minTarget = targetRank == rank ? &minRed.front() : NULL; - void * maxTarget = targetRank == rank ? &maxRed.front() : NULL; - void * sumTarget = targetRank == rank ? &sumRed.front() : NULL; - void * sumSqTarget = targetRank == rank ? &sumSqRed.front() : NULL; - void * countTarget = targetRank == rank ? &countRed.front() : NULL; + void * minTarget = targetRank == rank ? &minRed.front() : nullptr; + void * maxTarget = targetRank == rank ? &maxRed.front() : nullptr; + void * sumTarget = targetRank == rank ? &sumRed.front() : nullptr; + void * sumSqTarget = targetRank == rank ? &sumSqRed.front() : nullptr; + void * countTarget = targetRank == rank ? &countRed.front() : nullptr; MPI_Reduce( &min.front(), minTarget, int_c(min.size()), MPITrait<double>::type(), MPI_MIN, targetRank,MPI_COMM_WORLD ); diff --git a/src/domain_decomposition/BlockStorage.cpp b/src/domain_decomposition/BlockStorage.cpp index 9ee33473a1b8100cf8f88d162093502812334fe6..4077562951e5662c466e8e6f009abf0293f8f402 100644 --- a/src/domain_decomposition/BlockStorage.cpp +++ b/src/domain_decomposition/BlockStorage.cpp @@ -109,7 +109,7 @@ BlockDataID BlockStorage::addBlockData( const internal::SelectableBlockDataHandl if( dh ) block->addData( id, dh->initialize( block.get() ) ); else - block->addData( id, NULL ); + block->addData( id, nullptr ); } return id; @@ -229,7 +229,7 @@ BlockDataID BlockStorage::loadBlockData( const std::string & file, const interna dh->deserialize( block, id, buffer ); } else - block->addData( id, NULL ); + block->addData( id, nullptr ); } return id; diff --git a/src/domain_decomposition/StructuredBlockStorage.cpp b/src/domain_decomposition/StructuredBlockStorage.cpp index 6cdafd357e306aa28fa335e6000eb994295249bd..1c4351735d963adc90229ba1de4a8e4e44a0d6b9 100644 --- a/src/domain_decomposition/StructuredBlockStorage.cpp +++ b/src/domain_decomposition/StructuredBlockStorage.cpp @@ -194,7 +194,7 @@ void StructuredBlockStorage::resetCellDecomposition( const std::vector< uint_t > WALBERLA_ASSERT_GREATER( yCells[i], 0 ); WALBERLA_ASSERT_GREATER( zCells[i], 0 ); - domainCellBB_.push_back( CellInterval( 0, 0, 0, cell_idx_c( xCells[i]-1 ), cell_idx_c( yCells[i]-1 ), cell_idx_c( zCells[i]-1 ) ) ); + domainCellBB_.emplace_back( 0, 0, 0, cell_idx_c( xCells[i]-1 ), cell_idx_c( yCells[i]-1 ), cell_idx_c( zCells[i]-1 ) ); dx_.push_back( xWidth / real_c( xCells[i] ) ); dy_.push_back( yWidth / real_c( yCells[i] ) ); diff --git a/src/field/allocation/AlignedMalloc.cpp b/src/field/allocation/AlignedMalloc.cpp index 1e14ff21e29f4555ca42097e35ce77cbca80d7cf..578bcfd9f456c41cf6e01066ca5a780ac2e985dd 100644 --- a/src/field/allocation/AlignedMalloc.cpp +++ b/src/field/allocation/AlignedMalloc.cpp @@ -43,7 +43,7 @@ namespace field { pa=std::malloc((size+alignment-1)+sizeof(void *)); if(!pa) - return 0; + return nullptr; // Find next aligned position, starting at pa+sizeof(void*)-1 ptr=(void*)( ((size_t)pa+sizeof(void *)+alignment-1) & ~(alignment-1)); @@ -75,7 +75,7 @@ namespace field { pa=std::malloc( (size+2*alignment-1 )+sizeof(void *)); if(!pa) - return 0; + return nullptr; // Find next aligned position, starting at pa+sizeof(void*)-1 ptr=(void*)( ((size_t)pa+sizeof(void *)+alignment-1) & ~(alignment-1)); diff --git a/src/gather/MPIGatherScheme.cpp b/src/gather/MPIGatherScheme.cpp index 9775cce2b0f639b76a07d0e94628d45cb1ef846a..c40a63c691255072678aa70c9621fc38583e08f9 100644 --- a/src/gather/MPIGatherScheme.cpp +++ b/src/gather/MPIGatherScheme.cpp @@ -137,7 +137,7 @@ void MPIGatherScheme::runSetupPhase() recvBuffer.resize( uint_c( nrOfGatherProcesses ) ); MPI_Gather( & bytesToSend_, 1, MPITrait<decltype(bytesToSend_)>::type(), - recvBuffer.empty()? NULL : & recvBuffer[0], 1, MPITrait<decltype(bytesToSend_)>::type(), + recvBuffer.empty()? nullptr : & recvBuffer[0], 1, MPITrait<decltype(bytesToSend_)>::type(), gatherRank_, gatherCommunicator_ ); WALBERLA_ASSERT_EQUAL( displacementVector_.size(), 0 ); @@ -193,8 +193,8 @@ void MPIGatherScheme::communicate() mpi::GenericRecvBuffer<unsigned char> recvBuffer; - int * displacementVectorPtr = NULL; - int * sendBytesPerProcessPtr = NULL; + int * displacementVectorPtr = nullptr; + int * sendBytesPerProcessPtr = nullptr; if ( mpiManager->rank() == gatherRankInGlobalComm_ ) { recvBuffer.resize( uint_c( gatherMsgSize_ ) ); displacementVectorPtr = &displacementVector_[0]; diff --git a/src/geometry/bodies/BodyFromConfig.cpp b/src/geometry/bodies/BodyFromConfig.cpp index 6ad56cfa85835ade19d22702541cc78619671f15..0b9d1947c67ac5d85312be760139b75038f47733 100644 --- a/src/geometry/bodies/BodyFromConfig.cpp +++ b/src/geometry/bodies/BodyFromConfig.cpp @@ -20,6 +20,8 @@ //====================================================================================================================== #include "BodyFromConfig.h" + +#include <memory> #include "core/Abort.h" @@ -107,8 +109,8 @@ BodyLogicalAND<Sphere,AABB> sphereSliceFromConfig ( const Config::BlockHandle & { Sphere sphere = sphereFromConfig(block.getOneBlock("Sphere")); AABB box = AABBFromConfig (block.getOneBlock("Box")); - auto spherePtr = shared_ptr<Sphere>( new Sphere(sphere) ); - auto boxPtr = shared_ptr<AABB> ( new AABB(box) ); + auto spherePtr = std::make_shared<Sphere>( sphere ); + auto boxPtr = std::make_shared<AABB> ( box ); return BodyLogicalAND<Sphere,AABB>(spherePtr, boxPtr); } @@ -122,10 +124,10 @@ BodyLogicalAND<Sphere,BodyLogicalNOT<Sphere> > hollowSphereFromConfig ( const Co if ( ! block.isDefined( "outer_radius" ) ) WALBERLA_ABORT( "Missing parameter 'outer_radius' for sphere defined in block " << block.getKey() ); - auto inner = shared_ptr<Sphere>( new Sphere( block.getParameter<Vector3<real_t> > ( "midpoint" ), - block.getParameter<real_t > ( "inner_radius" ) ) ); - auto outer = shared_ptr<Sphere>( new Sphere ( block.getParameter<Vector3<real_t> > ( "midpoint" ), - block.getParameter<real_t > ( "outer_radius" ) ) ); + auto inner = std::make_shared<Sphere>( block.getParameter<Vector3<real_t> > ( "midpoint" ), + block.getParameter<real_t > ( "inner_radius" ) ); + auto outer = std::make_shared<Sphere>( block.getParameter<Vector3<real_t> > ( "midpoint" ), + block.getParameter<real_t > ( "outer_radius" ) ); auto not_inner = make_shared<BodyLogicalNOT<Sphere> >(inner); diff --git a/src/geometry/bodies/Sphere.cpp b/src/geometry/bodies/Sphere.cpp index f49cae94d354ec9628c4669f5229f8c022c59ce3..f7fc0dce0f1bc57ca1da2e0d686c832552ebb8dd 100644 --- a/src/geometry/bodies/Sphere.cpp +++ b/src/geometry/bodies/Sphere.cpp @@ -32,13 +32,6 @@ namespace geometry { updateBoxes(); } - Sphere::Sphere( const Sphere & o ) - : midpoint_( o.midpoint_ ), - radius_( o.radius_ ), - boundingBox_ ( o.boundingBox_ ), - innerBox_ ( o.innerBox_ ) - {} - void Sphere::updateBoxes() { static const real_t oneOverSqrt3 = real_t(1) / std::sqrt( real_t(3) ); diff --git a/src/geometry/bodies/Sphere.h b/src/geometry/bodies/Sphere.h index 67330978a7d6bd51aece8489b1a3a9f574bcb9fe..f4050d044b242e7c874fc796674093fbf4e6b02e 100644 --- a/src/geometry/bodies/Sphere.h +++ b/src/geometry/bodies/Sphere.h @@ -48,7 +48,7 @@ namespace geometry { public: explicit Sphere( const Vector3<real_t> & midp, real_t rad ); - Sphere( const Sphere & o ); + Sphere( const Sphere & o ) = default; void setMidpoint( const Vector3<real_t> & point ) { midpoint_ = point; updateBoxes(); } void setMidpoint( real_t newVal, uint_t coord ) { midpoint_[coord] = newVal; updateBoxes(); } diff --git a/src/geometry/structured/extern/lodepng.cpp b/src/geometry/structured/extern/lodepng.cpp index 2191deaa100ec04c2cf401625700ef89e51a1880..7bc8455778b4e6dd62e29c0ab0e3410d490efcfb 100644 --- a/src/geometry/structured/extern/lodepng.cpp +++ b/src/geometry/structured/extern/lodepng.cpp @@ -156,7 +156,7 @@ static void uivector_cleanup(void* p) { ((uivector*)p)->size = ((uivector*)p)->allocsize = 0; lodepng_free(((uivector*)p)->data); - ((uivector*)p)->data = NULL; + ((uivector*)p)->data = nullptr; } /*returns 1 if success, 0 if failure ==> nothing done*/ @@ -189,7 +189,7 @@ static unsigned uivector_resizev(uivector* p, size_t size, unsigned value) static void uivector_init(uivector* p) { - p->data = NULL; + p->data = nullptr; p->size = p->allocsize = 0; } @@ -257,12 +257,12 @@ static void ucvector_cleanup(void* p) { ((ucvector*)p)->size = ((ucvector*)p)->allocsize = 0; lodepng_free(((ucvector*)p)->data); - ((ucvector*)p)->data = NULL; + ((ucvector*)p)->data = nullptr; } static void ucvector_init(ucvector* p) { - p->data = NULL; + p->data = nullptr; p->size = p->allocsize = 0; } @@ -312,13 +312,13 @@ static unsigned string_resize(char** out, size_t size) data[size] = 0; /*null termination char*/ *out = data; } - return data != 0; + return data != nullptr; } /*init a {char*, size_t} pair for use as string*/ static void string_init(char** out) { - *out = NULL; + *out = nullptr; string_resize(out, 0); } @@ -326,7 +326,7 @@ static void string_init(char** out) static void string_cleanup(char** out) { lodepng_free(*out); - *out = NULL; + *out = nullptr; } static void string_set(char** out, const char* in) @@ -381,7 +381,7 @@ unsigned lodepng_load_file(unsigned char** out, size_t* outsize, const char* fil long size; /*provide some proper output values if error will happen*/ - *out = 0; + *out = nullptr; *outsize = 0; file = fopen(filename, "rb"); @@ -536,9 +536,9 @@ static void HuffmanTree_draw(HuffmanTree* tree) static void HuffmanTree_init(HuffmanTree* tree) { - tree->tree2d = 0; - tree->tree1d = 0; - tree->lengths = 0; + tree->tree2d = nullptr; + tree->tree1d = nullptr; + tree->lengths = nullptr; } static void HuffmanTree_cleanup(HuffmanTree* tree) @@ -990,10 +990,10 @@ static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d, size_t inbitlength = inlength * 8; /*see comments in deflateDynamic for explanation of the context and these variables, it is analogous*/ - unsigned* bitlen_ll = 0; /*lit,len code lengths*/ - unsigned* bitlen_d = 0; /*dist code lengths*/ + unsigned* bitlen_ll = nullptr; /*lit,len code lengths*/ + unsigned* bitlen_d = nullptr; /*dist code lengths*/ /*code length code lengths ("clcl"), the bit lengths of the huffman tree used to compress bitlen_ll and bitlen_d*/ - unsigned* bitlen_cl = 0; + unsigned* bitlen_cl = nullptr; HuffmanTree tree_cl; /*the code tree for code length codes (the huffman tree for compressed huffman trees)*/ if((*bp) >> 3 >= inlength - 2) return 49; /*error: the bit pointer is or will go past the memory*/ @@ -2162,7 +2162,7 @@ unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize, const unsig ucvector outv; size_t i; unsigned error; - unsigned char* deflatedata = 0; + unsigned char* deflatedata = nullptr; size_t deflatesize = 0; unsigned ADLER32; @@ -2250,12 +2250,12 @@ void lodepng_compress_settings_init(LodePNGCompressSettings* settings) settings->nicematch = 128; settings->lazymatching = 1; - settings->custom_zlib = 0; - settings->custom_deflate = 0; - settings->custom_context = 0; + settings->custom_zlib = nullptr; + settings->custom_deflate = nullptr; + settings->custom_context = nullptr; } -const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, 0, 0, 0}; +const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, nullptr, nullptr, nullptr}; #endif /*LODEPNG_COMPILE_ENCODER*/ @@ -2266,12 +2266,12 @@ void lodepng_decompress_settings_init(LodePNGDecompressSettings* settings) { settings->ignore_adler32 = 0; - settings->custom_zlib = 0; - settings->custom_inflate = 0; - settings->custom_context = 0; + settings->custom_zlib = nullptr; + settings->custom_inflate = nullptr; + settings->custom_context = nullptr; } -const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, 0}; +const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, nullptr, nullptr, nullptr}; #endif /*LODEPNG_COMPILE_DECODER*/ @@ -2544,7 +2544,7 @@ void lodepng_color_mode_init(LodePNGColorMode* info) info->key_r = info->key_g = info->key_b = 0; info->colortype = LCT_RGBA; info->bitdepth = 8; - info->palette = 0; + info->palette = nullptr; info->palettesize = 0; } @@ -2590,7 +2590,7 @@ static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColo void lodepng_palette_clear(LodePNGColorMode* info) { if(info->palette) lodepng_free(info->palette); - info->palette = 0; + info->palette = nullptr; info->palettesize = 0; } @@ -2673,7 +2673,7 @@ size_t lodepng_get_raw_size_lct(unsigned w, unsigned h, LodePNGColorType colorty static void LodePNGUnknownChunks_init(LodePNGInfo* info) { unsigned i; - for(i = 0; i < 3; i++) info->unknown_chunks_data[i] = 0; + for(i = 0; i < 3; i++) info->unknown_chunks_data[i] = nullptr; for(i = 0; i < 3; i++) info->unknown_chunks_size[i] = 0; } @@ -2709,8 +2709,8 @@ static unsigned LodePNGUnknownChunks_copy(LodePNGInfo* dest, const LodePNGInfo* static void LodePNGText_init(LodePNGInfo* info) { info->text_num = 0; - info->text_keys = NULL; - info->text_strings = NULL; + info->text_keys = nullptr; + info->text_strings = nullptr; } static void LodePNGText_cleanup(LodePNGInfo* info) @@ -2728,8 +2728,8 @@ static void LodePNGText_cleanup(LodePNGInfo* info) static unsigned LodePNGText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; - dest->text_keys = 0; - dest->text_strings = 0; + dest->text_keys = nullptr; + dest->text_strings = nullptr; dest->text_num = 0; for(i = 0; i < source->text_num; i++) { @@ -2772,10 +2772,10 @@ unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str) static void LodePNGIText_init(LodePNGInfo* info) { info->itext_num = 0; - info->itext_keys = NULL; - info->itext_langtags = NULL; - info->itext_transkeys = NULL; - info->itext_strings = NULL; + info->itext_keys = nullptr; + info->itext_langtags = nullptr; + info->itext_transkeys = nullptr; + info->itext_strings = nullptr; } static void LodePNGIText_cleanup(LodePNGInfo* info) @@ -2797,10 +2797,10 @@ static void LodePNGIText_cleanup(LodePNGInfo* info) static unsigned LodePNGIText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; - dest->itext_keys = 0; - dest->itext_langtags = 0; - dest->itext_transkeys = 0; - dest->itext_strings = 0; + dest->itext_keys = nullptr; + dest->itext_langtags = nullptr; + dest->itext_transkeys = nullptr; + dest->itext_strings = nullptr; dest->itext_num = 0; for(i = 0; i < source->itext_num; i++) { @@ -2921,7 +2921,7 @@ static void addColorBits(unsigned char* out, size_t index, unsigned bits, unsign else out[index * bits / 8] |= in; } -typedef struct ColorTree ColorTree; +using ColorTree = struct ColorTree; /* One node of a color tree @@ -2938,7 +2938,7 @@ struct ColorTree static void color_tree_init(ColorTree* tree) { int i; - for(i = 0; i < 16; i++) tree->children[i] = 0; + for(i = 0; i < 16; i++) tree->children[i] = nullptr; tree->index = -1; } @@ -3965,7 +3965,7 @@ unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize) { LodePNGInfo* info = &state->info_png; - if(insize == 0 || in == 0) + if(insize == 0 || in == nullptr) { CERROR_RETURN_ERROR(state->error, 48); /*error: the given data is empty*/ } @@ -4103,7 +4103,7 @@ static unsigned unfilter(unsigned char* out, const unsigned char* in, unsigned w */ unsigned y; - unsigned char* prevline = 0; + unsigned char* prevline = nullptr; /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ size_t bytewidth = (bpp + 7) / 8; @@ -4361,7 +4361,7 @@ static unsigned readChunk_bKGD(LodePNGInfo* info, const unsigned char* data, siz static unsigned readChunk_tEXt(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) { unsigned error = 0; - char *key = 0, *str = 0; + char *key = nullptr, *str = nullptr; unsigned i; while(!error) /*not really a while loop, only used to break on error*/ @@ -4408,7 +4408,7 @@ static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecompressSetting unsigned i; unsigned length, string2_begin; - char *key = 0; + char *key = nullptr; ucvector decoded; ucvector_init(&decoded); @@ -4457,7 +4457,7 @@ static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecompressSetting unsigned i; unsigned length, begin, compressed; - char *key = 0, *langtag = 0, *transkey = 0; + char *key = nullptr, *langtag = nullptr, *transkey = nullptr; ucvector decoded; ucvector_init(&decoded); @@ -4588,7 +4588,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, #endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ /*provide some proper output values if error will happen*/ - *out = 0; + *out = nullptr; state->error = lodepng_inspect(w, h, state, in, insize); /*reads header and resets other parameters in state->info_png*/ if(state->error) return; @@ -4753,7 +4753,7 @@ unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize) { - *out = 0; + *out = nullptr; decodeGeneric(out, w, h, state, in, insize); if(state->error) return state->error; if(!state->decoder.color_convert || lodepng_color_mode_equal(&state->info_raw, &state->info_png.color)) @@ -5015,7 +5015,7 @@ static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t d static unsigned addChunk_IEND(ucvector* out) { unsigned error = 0; - error = addChunk(out, "IEND", 0, 0); + error = addChunk(out, "IEND", nullptr, 0); return error; } @@ -5257,7 +5257,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, size_t linebytes = (w * bpp + 7) / 8; /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ size_t bytewidth = (bpp + 7) / 8; - const unsigned char* prevline = 0; + const unsigned char* prevline = nullptr; unsigned x, y; unsigned error = 0; LodePNGFilterStrategy strategy = settings->filter_strategy; @@ -5426,8 +5426,8 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, zlibsettings.btype = 1; /*a custom encoder likely doesn't read the btype setting and is optimized for complete PNG images only, so disable it*/ - zlibsettings.custom_zlib = 0; - zlibsettings.custom_deflate = 0; + zlibsettings.custom_zlib = nullptr; + zlibsettings.custom_deflate = nullptr; for(type = 0; type < 5; type++) { ucvector_init(&attempt[type]); @@ -5442,7 +5442,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, filterScanline(attempt[type].data, &in[y * linebytes], prevline, linebytes, bytewidth, type); size[type] = 0; - dummy = 0; + dummy = nullptr; zlib_compress(&dummy, &size[type], attempt[type].data, testsize, &zlibsettings); lodepng_free(dummy); /*check if this is smallest size (or if type == 0 it's the first case so always store the values)*/ @@ -5679,11 +5679,11 @@ unsigned lodepng_encode(unsigned char** out, size_t* outsize, { LodePNGInfo info; ucvector outv; - unsigned char* data = 0; /*uncompressed version of the IDAT chunk data*/ + unsigned char* data = nullptr; /*uncompressed version of the IDAT chunk data*/ size_t datasize = 0; /*provide some proper output values if error will happen*/ - *out = 0; + *out = nullptr; *outsize = 0; state->error = 0; @@ -5922,7 +5922,7 @@ void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings) settings->filter_strategy = LFS_MINSUM; settings->auto_convert = LAC_AUTO; settings->force_palette = 0; - settings->predefined_filters = 0; + settings->predefined_filters = nullptr; #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS settings->add_id = 0; settings->text_compression = 1; @@ -6069,7 +6069,7 @@ void load_file(std::vector<unsigned char>& buffer, const std::string& filename) void save_file(const std::vector<unsigned char>& buffer, const std::string& filename) { std::ofstream file(filename.c_str(), std::ios::out|std::ios::binary); - file.write(buffer.empty() ? 0 : (char*)&buffer[0], std::streamsize(buffer.size())); + file.write(buffer.empty() ? nullptr : (char*)&buffer[0], std::streamsize(buffer.size())); } #endif //LODEPNG_COMPILE_DISK @@ -6078,7 +6078,7 @@ void save_file(const std::vector<unsigned char>& buffer, const std::string& file unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize, const LodePNGDecompressSettings& settings) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize = 0; unsigned error = zlib_decompress(&buffer, &buffersize, in, insize, &settings); if(buffer) @@ -6092,7 +6092,7 @@ unsigned decompress(std::vector<unsigned char>& out, const unsigned char* in, si unsigned decompress(std::vector<unsigned char>& out, const std::vector<unsigned char>& in, const LodePNGDecompressSettings& settings) { - return decompress(out, in.empty() ? 0 : &in[0], in.size(), settings); + return decompress(out, in.empty() ? nullptr : &in[0], in.size(), settings); } #endif //LODEPNG_COMPILE_DECODER @@ -6100,7 +6100,7 @@ unsigned decompress(std::vector<unsigned char>& out, const std::vector<unsigned unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size_t insize, const LodePNGCompressSettings& settings) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize = 0; unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings); if(buffer) @@ -6114,7 +6114,7 @@ unsigned compress(std::vector<unsigned char>& out, const unsigned char* in, size unsigned compress(std::vector<unsigned char>& out, const std::vector<unsigned char>& in, const LodePNGCompressSettings& settings) { - return compress(out, in.empty() ? 0 : &in[0], in.size(), settings); + return compress(out, in.empty() ? nullptr : &in[0], in.size(), settings); } #endif //LODEPNG_COMPILE_ENCODER #endif //LODEPNG_COMPILE_ZLIB @@ -6166,7 +6166,7 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, const std::vector<unsigned char>& in, LodePNGColorType colortype, unsigned bitdepth) { - return decode(out, w, h, in.empty() ? 0 : &in[0], (unsigned)in.size(), colortype, bitdepth); + return decode(out, w, h, in.empty() ? nullptr : &in[0], (unsigned)in.size(), colortype, bitdepth); } unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, @@ -6188,7 +6188,7 @@ unsigned decode(std::vector<unsigned char>& out, unsigned& w, unsigned& h, State& state, const std::vector<unsigned char>& in) { - return decode(out, w, h, state, in.empty() ? 0 : &in[0], in.size()); + return decode(out, w, h, state, in.empty() ? nullptr : &in[0], in.size()); } #ifdef LODEPNG_COMPILE_DISK @@ -6222,7 +6222,7 @@ unsigned encode(std::vector<unsigned char>& out, LodePNGColorType colortype, unsigned bitdepth) { if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode(out, in.empty() ? nullptr : &in[0], w, h, colortype, bitdepth); } unsigned encode(std::vector<unsigned char>& out, @@ -6245,7 +6245,7 @@ unsigned encode(std::vector<unsigned char>& out, State& state) { if(lodepng_get_raw_size(w, h, &state.info_raw) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, state); + return encode(out, in.empty() ? nullptr : &in[0], w, h, state); } #ifdef LODEPNG_COMPILE_DISK @@ -6264,7 +6264,7 @@ unsigned encode(const std::string& filename, LodePNGColorType colortype, unsigned bitdepth) { if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(filename, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode(filename, in.empty() ? nullptr : &in[0], w, h, colortype, bitdepth); } #endif //LODEPNG_COMPILE_DISK #endif //LODEPNG_COMPILE_ENCODER diff --git a/src/gui/Gui.cpp b/src/gui/Gui.cpp index 57650f2d54ae1432ca589652ee7b9c753e69f47d..e23df588e124890272dde64456637f49add5cd38 100644 --- a/src/gui/Gui.cpp +++ b/src/gui/Gui.cpp @@ -212,7 +212,7 @@ void GUI::breakpoint( const std::string & comment, const std::string & file, int namespace walberla { namespace gui { -GUI * GUI::lastInstance_ = NULL; +GUI * GUI::lastInstance_ = nullptr; GUI::GUI(timeloop::ITimeloop & timeloop, const shared_ptr<StructuredBlockForest> & blockForest, int& , char ** ) : timeloop_(timeloop), @@ -220,7 +220,7 @@ GUI::GUI(timeloop::ITimeloop & timeloop, const shared_ptr<StructuredBlockForest> { } -GUI::~GUI() {} +GUI::~GUI() = default; void GUI::run() { timeloop_.run(); diff --git a/src/gui/PropertyTree.cpp b/src/gui/PropertyTree.cpp index 562c73f7ed72db038dda872db422a388c0d77b9d..a6dd79d5c01650e95c2c7803edb1ff3a79203ad4 100644 --- a/src/gui/PropertyTree.cpp +++ b/src/gui/PropertyTree.cpp @@ -118,12 +118,12 @@ namespace gui { namespace walberla { namespace gui { PropertyTree::PropertyTree() - : model_(0), lastBlock_(0) + : model_(nullptr), lastBlock_(nullptr) {} PropertyTree::~PropertyTree() - {} + = default; void PropertyTree::setBlock( IBlock * a) @@ -138,7 +138,7 @@ namespace gui { PropertyTree::ItemID PropertyTree::addItem(const std::string & , ItemID ) { - return 0; + return nullptr; } } // namespace gui } // namespace walberla diff --git a/src/pe/Materials.cpp b/src/pe/Materials.cpp index b66e115f041b49c74f9fdfc9356f37d16062e2b6..1f82e7fa6485d3812f887d5d6fe574602033b958 100644 --- a/src/pe/Materials.cpp +++ b/src/pe/Materials.cpp @@ -162,7 +162,7 @@ MaterialID createMaterial( const std::string& name, real_t density, real_t cor, real_t csf, real_t cdf, real_t poisson, real_t young, real_t stiffness, real_t dampingN, real_t dampingT ) { - typedef Material M; + using M = Material; // Checking the material name Materials::const_iterator begin( M::materials_.begin() ); diff --git a/src/pe/ccd/HashGrids.cpp b/src/pe/ccd/HashGrids.cpp index 3eee9158b6fb6ce554e507fa3d2ce316295049eb..b73a25548efae620d69f6310df736e3900d922e0 100644 --- a/src/pe/ccd/HashGrids.cpp +++ b/src/pe/ccd/HashGrids.cpp @@ -65,7 +65,7 @@ HashGrids::HashGrid::HashGrid( real_t cellSpan ) // Initialization of each cell - i.e., initially setting the pointer to the body container to // NULL (=> no bodies are assigned to this hash grid yet!) and ... for( Cell* c = cell_; c < cell_ + xyzCellCount_; ++c ) { - c->bodies_ = NULL; + c->bodies_ = nullptr; } // ... setting up the neighborhood relationship (using the offset array). initializeNeighborOffsets(); @@ -215,7 +215,7 @@ void HashGrids::HashGrid::clear() { for( auto cellIt = occupiedCells_.begin(); cellIt < occupiedCells_.end(); ++cellIt ) { delete (*cellIt)->bodies_; - (*cellIt)->bodies_ = NULL; + (*cellIt)->bodies_ = nullptr; } occupiedCells_.clear(); bodyCount_ = 0; @@ -392,7 +392,7 @@ void HashGrids::HashGrid::add( BodyID body, Cell* cell ) // (i.e., allocated) and properly initialized (i.e., sufficient initial storage capacity must be // reserved). Furthermore, the cell must be inserted into the grid-global vector 'occupiedCells_' // in which all cells that are currently occupied by bodies are recorded. - if( cell->bodies_ == NULL ) + if( cell->bodies_ == nullptr ) { cell->bodies_ = new BodyVector; cell->bodies_->reserve( cellVectorSize ); @@ -436,7 +436,7 @@ void HashGrids::HashGrid::remove( BodyID body, Cell* cell ) // ... the cell's body container is destroyed and ... delete cell->bodies_; - cell->bodies_ = NULL; + cell->bodies_ = nullptr; cell->lastNonFixedBody_ = -1; // ... the cell is removed from the grid-global vector 'occupiedCells_' that records all @@ -542,7 +542,7 @@ void HashGrids::HashGrid::enlarge() // ... initialized, and finally ... for( Cell* c = cell_; c < cell_ + xyzCellCount_; ++c ) { - c->bodies_ = NULL; + c->bodies_ = nullptr; c->lastNonFixedBody_ = -1; } initializeNeighborOffsets(); @@ -673,7 +673,7 @@ void HashGrids::add( BodyID body ) // The body is marked as being added to 'bodiesToAdd_' by setting the grid pointer to NULL and // setting the cell-ID to '0'. Additionally, the hash value is used to memorize the body's // index position in the 'bodiesToAdd_' vector. - body->setGrid ( NULL ); + body->setGrid ( nullptr ); body->setHash ( bodiesToAdd_.size() ); body->setCellId( 0 ); @@ -700,7 +700,7 @@ void HashGrids::remove( BodyID body ) HashGrid* grid = static_cast<HashGrid*>( body->getGrid() ); // The body is stored in a hash grid from which it must be removed. - if( grid != NULL ) { + if( grid != nullptr ) { grid->remove( body ); } // The body's grid pointer is equal to NULL. @@ -786,7 +786,7 @@ void HashGrids::update(WcTimingTree* tt) { // ----- UPDATE PHASE ----- // - if (tt != NULL) tt->start("AddNewBodies"); + if (tt != nullptr) tt->start("AddNewBodies"); // Finally add all bodies that were temporarily stored in 'bodiesToAdd_' to the data structure. if( bodiesToAdd_.size() > 0 ) { @@ -797,9 +797,9 @@ void HashGrids::update(WcTimingTree* tt) } bodiesToAdd_.clear(); } - if (tt != NULL) tt->stop("AddNewBodies"); + if (tt != nullptr) tt->stop("AddNewBodies"); - if (tt != NULL) tt->start("Update"); + if (tt != nullptr) tt->start("Update"); // Update the data structure (=> adapt to the current body distribution) by taking care of // moved, rotated and/or deformed bodies. if( gridActive_ ) @@ -876,7 +876,7 @@ void HashGrids::update(WcTimingTree* tt) { HashGrid* grid = static_cast<HashGrid*>( body.getGrid() ); - if( grid != NULL ) + if( grid != nullptr ) { real_t size = body.getAABBSize(); real_t cellSpan = grid->getCellSpan(); @@ -897,7 +897,7 @@ void HashGrids::update(WcTimingTree* tt) { HashGrid* grid = static_cast<HashGrid*>( body.getGrid() ); - if( grid != NULL ) + if( grid != nullptr ) { real_t size = body.getAABBSize(); real_t cellSpan = grid->getCellSpan(); @@ -913,7 +913,7 @@ void HashGrids::update(WcTimingTree* tt) } } } - if (tt != NULL) tt->stop("Update"); + if (tt != nullptr) tt->stop("Update"); } //**Implementation of ICCD interface ******************************************************** @@ -927,7 +927,7 @@ void HashGrids::update(WcTimingTree* tt) */ PossibleContacts& HashGrids::generatePossibleContacts( WcTimingTree* tt ) { - if (tt != NULL) tt->start("CCD"); + if (tt != nullptr) tt->start("CCD"); contacts_.clear(); @@ -935,7 +935,7 @@ PossibleContacts& HashGrids::generatePossibleContacts( WcTimingTree* tt ) update(tt); - if (tt != NULL) tt->start("Detection"); + if (tt != nullptr) tt->start("Detection"); // ----- DETECTION STEP ----- // // Contact generation by traversing through all hash grids (which are sorted in ascending order @@ -943,7 +943,7 @@ PossibleContacts& HashGrids::generatePossibleContacts( WcTimingTree* tt ) for( auto gridIt = gridList_.begin(); gridIt != gridList_.end(); ++gridIt ) { // Contact generation for all bodies stored in the currently processed grid 'grid'. - BodyID* bodies = NULL; + BodyID* bodies = nullptr; size_t bodyCount = (*gridIt)->process( &bodies, contacts_ ); if( bodyCount > 0 ) { @@ -981,7 +981,7 @@ PossibleContacts& HashGrids::generatePossibleContacts( WcTimingTree* tt ) collide( *aIt, &(*bIt), contacts_ ); } } - if (tt != NULL) tt->stop("Detection"); + if (tt != nullptr) tt->stop("Detection"); WALBERLA_LOG_DETAIL_SECTION() { @@ -997,7 +997,7 @@ PossibleContacts& HashGrids::generatePossibleContacts( WcTimingTree* tt ) WALBERLA_LOG_DETAIL( log.str() ); } - if (tt != NULL) tt->stop("CCD"); + if (tt != nullptr) tt->stop("CCD"); return contacts_; } @@ -1025,7 +1025,7 @@ void HashGrids::addGrid( BodyID body ) // If the body is finite in size, it must be assigned to a grid with suitably sized cells. if( size > 0 ) { - HashGrid* grid = NULL; + HashGrid* grid = nullptr; if( gridList_.empty() ) { @@ -1077,7 +1077,7 @@ void HashGrids::addGrid( BodyID body ) // the grid pointer to NULL and setting the cell-ID to '1'. Additionally, the hash value is used // to memorize the body's index position in the 'nonGridBodies_' vector. - body->setGrid ( NULL ); + body->setGrid ( nullptr ); body->setHash ( nonGridBodies_.size() ); body->setCellId( 1 ); @@ -1142,7 +1142,7 @@ void HashGrids::addList( BodyID body ) // setting the cell-ID to '1'. Additionally, the hash value is used to memorize the body's index // position in the 'nonGridBodies_' vector. - body->setGrid ( NULL ); + body->setGrid ( nullptr ); body->setHash ( nonGridBodies_.size() ); body->setCellId( 1 ); diff --git a/src/pe/ccd/SimpleCCD.cpp b/src/pe/ccd/SimpleCCD.cpp index 2fcb2b9e6506767a21ae77c7d0903e10ac0c0b0e..9c992738a459d3731cc2e4c7d537fa4ac099dfc2 100644 --- a/src/pe/ccd/SimpleCCD.cpp +++ b/src/pe/ccd/SimpleCCD.cpp @@ -55,7 +55,7 @@ SimpleCCD::~SimpleCCD() PossibleContacts& SimpleCCD::generatePossibleContacts( WcTimingTree* tt ){ contacts_.clear(); - if (tt != NULL) tt->start("SimpleCCD"); + if (tt != nullptr) tt->start("SimpleCCD"); for (auto it1 = bodies_.begin(); it1 != bodies_.end(); ++it1){ for (auto it2 = it1 + 1; it2 !=bodies_.end(); ++it2) { @@ -79,7 +79,7 @@ PossibleContacts& SimpleCCD::generatePossibleContacts( WcTimingTree* tt ){ } } } - if (tt != NULL) tt->stop("SimpleCCD"); + if (tt != nullptr) tt->stop("SimpleCCD"); return contacts_; } diff --git a/src/pe/collision/EPA.cpp b/src/pe/collision/EPA.cpp index 415ef46d5f9b51f42f9d5c5b5e9480bf1401c72a..e8a2000482e1d73b92445bd01bfec613ed956c45 100644 --- a/src/pe/collision/EPA.cpp +++ b/src/pe/collision/EPA.cpp @@ -93,7 +93,7 @@ inline EPA::EPA_Triangle::EPA_Triangle( size_t a, size_t b, size_t c, sqrDist_ = closest_.sqrLength(); //adjoined triangles not set yet - adjTriangle_[0] = adjTriangle_[1] = adjTriangle_[2] = NULL; + adjTriangle_[0] = adjTriangle_[1] = adjTriangle_[2] = nullptr; adjEdges_[0] = adjEdges_[1] = adjEdges_[2] = 4; obsolete_ = false; @@ -269,7 +269,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec } std::make_heap(entryHeap.begin(), entryHeap.end(), EPA::EPA_TriangleComp()); - EPA_Triangle* current = NULL; + EPA_Triangle* current = nullptr; numIterations_ = 0; //EPA Main-Loop diff --git a/src/pe/contact/Contact.cpp b/src/pe/contact/Contact.cpp index 7bc7dc04127ff734e3153201f3037fb3663cf72e..ce7c59ebeb4662606397cde1e3ea0cb72ef54123 100644 --- a/src/pe/contact/Contact.cpp +++ b/src/pe/contact/Contact.cpp @@ -77,7 +77,7 @@ Contact::Contact( GeomID g1, GeomID g2, const Vec3& gpos, const Vec3& normal, re /*!\brief Destructor for the Contact class. */ Contact::~Contact() -{} += default; //************************************************************************************************* //================================================================================================= diff --git a/src/pe/debug/BodyData.cpp b/src/pe/debug/BodyData.cpp index 881b65a0b03128adf8b6669ce9d03f43a6a57cfa..05e32e67815dab1e9fd5021964c38d5768bad560 100644 --- a/src/pe/debug/BodyData.cpp +++ b/src/pe/debug/BodyData.cpp @@ -37,7 +37,7 @@ namespace debug { // //================================================================================================= -BodyData::BodyData() {} +BodyData::BodyData() = default; BodyData::BodyData(ConstBodyID rb) : uid(rb->getID()) diff --git a/src/pe/raytracing/Raytracer.cpp b/src/pe/raytracing/Raytracer.cpp index 59320cc4abcb15f6217b53b0e4c1faa03b371dc4..1f88525b36b9def1867f9178f31cde807a349822 100644 --- a/src/pe/raytracing/Raytracer.cpp +++ b/src/pe/raytracing/Raytracer.cpp @@ -338,7 +338,7 @@ void Raytracer::syncImageUsingMPIReduce(std::vector<BodyIntersectionInfo>& inter } WALBERLA_MPI_BARRIER(); - if (tt != NULL) tt->start("Reduction"); + if (tt != nullptr) tt->start("Reduction"); int rank = mpi::MPIManager::instance()->rank(); const int recvRank = 0; @@ -348,13 +348,13 @@ void Raytracer::syncImageUsingMPIReduce(std::vector<BodyIntersectionInfo>& inter bodyIntersectionInfo_mpi_type, bodyIntersectionInfo_reduction_op, recvRank, MPI_COMM_WORLD); } else { - MPI_Reduce(&intersectionsBuffer[0], 0, int_c(intersectionsBuffer.size()), + MPI_Reduce(&intersectionsBuffer[0], nullptr, int_c(intersectionsBuffer.size()), bodyIntersectionInfo_mpi_type, bodyIntersectionInfo_reduction_op, recvRank, MPI_COMM_WORLD); } WALBERLA_MPI_BARRIER(); - if (tt != NULL) tt->stop("Reduction"); + if (tt != nullptr) tt->stop("Reduction"); } /*!\brief Conflate the intersectionsBuffer of each process onto the root process using MPI_Gather. @@ -366,7 +366,7 @@ void Raytracer::syncImageUsingMPIReduce(std::vector<BodyIntersectionInfo>& inter */ void Raytracer::syncImageUsingMPIGather(std::vector<BodyIntersectionInfo>& intersections, std::vector<BodyIntersectionInfo>& intersectionsBuffer, WcTimingTree* tt) { WALBERLA_MPI_BARRIER(); - if (tt != NULL) tt->start("Reduction"); + if (tt != nullptr) tt->start("Reduction"); mpi::SendBuffer sendBuffer; for (auto& info: intersections) { @@ -398,27 +398,27 @@ void Raytracer::syncImageUsingMPIGather(std::vector<BodyIntersectionInfo>& inter } WALBERLA_MPI_BARRIER(); - if (tt != NULL) tt->stop("Reduction"); + if (tt != nullptr) tt->stop("Reduction"); } void Raytracer::localOutput(const std::vector<BodyIntersectionInfo>& intersectionsBuffer, size_t timestep, WcTimingTree* tt) { if (getImageOutputEnabled()) { if (getLocalImageOutputEnabled()) { - if (tt != NULL) tt->start("Local Output"); + if (tt != nullptr) tt->start("Local Output"); writeImageToFile(intersectionsBuffer, timestep); - if (tt != NULL) tt->stop("Local Output"); + if (tt != nullptr) tt->stop("Local Output"); } } } void Raytracer::output(const std::vector<BodyIntersectionInfo>& intersectionsBuffer, size_t timestep, WcTimingTree* tt) { - if (tt != NULL) tt->start("Output"); + if (tt != nullptr) tt->start("Output"); WALBERLA_ROOT_SECTION() { if (getImageOutputEnabled()) { writeImageToFile(intersectionsBuffer, timestep, true); } } - if (tt != NULL) tt->stop("Output"); + if (tt != nullptr) tt->stop("Output"); } } //namespace raytracing diff --git a/src/pe/rigidbody/EllipsoidFactory.cpp b/src/pe/rigidbody/EllipsoidFactory.cpp index 8e8835b23d2507e053026d6cd081a95907436ddb..a5e46b3506115d67c011917c9109eab6f5556bf5 100644 --- a/src/pe/rigidbody/EllipsoidFactory.cpp +++ b/src/pe/rigidbody/EllipsoidFactory.cpp @@ -65,7 +65,7 @@ EllipsoidID createEllipsoid( BodyStorage& globalStorage, BlockStorage& blocks, B } } - if (ellipsoid != NULL) + if (ellipsoid != nullptr) { // Logging the successful creation of the Ellipsoid WALBERLA_LOG_DETAIL( diff --git a/src/pe/rigidbody/GeomPrimitive.cpp b/src/pe/rigidbody/GeomPrimitive.cpp index ce6d2d8113c69fde7724259fde28cbc46c5247ee..0594e19a3a6b91331d424a5d414b78fbdc7c7712 100644 --- a/src/pe/rigidbody/GeomPrimitive.cpp +++ b/src/pe/rigidbody/GeomPrimitive.cpp @@ -64,7 +64,7 @@ GeomPrimitive::GeomPrimitive( id_t const typeID, id_t sid, id_t uid, MaterialID /*!\brief Destructor for the Primitive class. */ GeomPrimitive::~GeomPrimitive() -{} += default; //************************************************************************************************* } // namespace pe diff --git a/src/pe/rigidbody/RigidBody.cpp b/src/pe/rigidbody/RigidBody.cpp index f23bde4e08d0e5c320a89a356cfdb3cdc2988e18..f30f35ce6c244393433217aafb54e914a2f79223 100644 --- a/src/pe/rigidbody/RigidBody.cpp +++ b/src/pe/rigidbody/RigidBody.cpp @@ -47,7 +47,7 @@ RigidBody::RigidBody( id_t const typeID, id_t sid, id_t uid ) , Iinv_( real_c(0) ) // Inverse moment of inertia , q_() // Orientation of the body frame , R_() // Rigid body rotation - , manager_(0) // The rigid body manager responsible for the rigid body + , manager_(nullptr) // The rigid body manager responsible for the rigid body , finite_ (true) // Finiteness flag , visible_(true) // Visibility flag , remote_ (false) // Remote flag @@ -75,8 +75,7 @@ RigidBody::RigidBody( id_t const typeID, id_t sid, id_t uid ) /*!\brief Destructor for the RigidBody class. */ RigidBody::~RigidBody() -{ -} += default; //************************************************************************************************* diff --git a/src/pe/utility/GetBody.cpp b/src/pe/utility/GetBody.cpp index 6d0b695f85915d2cae66ef9fb573420462b9a2ce..bc5f5c1534600d9802e219aa1c21015e9cfbcfaa 100644 --- a/src/pe/utility/GetBody.cpp +++ b/src/pe/utility/GetBody.cpp @@ -58,7 +58,7 @@ BodyID getBody(BodyStorage& globalStorage, BlockStorage& blocks, BlockDataID sto } } - return NULL; + return nullptr; } } // namespace pe diff --git a/src/pe/vtk/BodyVtkOutput.cpp b/src/pe/vtk/BodyVtkOutput.cpp index 6d13f3df3bc051fa85bfdb7e558d1d265f667cbd..a176e01e028c7534933e76510ed33a2a6809bf63 100644 --- a/src/pe/vtk/BodyVtkOutput.cpp +++ b/src/pe/vtk/BodyVtkOutput.cpp @@ -34,9 +34,9 @@ namespace pe { std::vector< DefaultBodyVTKOutput::Attributes > DefaultBodyVTKOutput::getAttributes() const { std::vector< Attributes > attributes; - attributes.push_back( Attributes( vtk::typeToString< float >(), "Velocity", uint_c(3) ) ); - attributes.push_back( Attributes( vtk::typeToString< int >(), "rank", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< int >(), "shadow", uint_c(1) ) ); + attributes.emplace_back( vtk::typeToString< float >(), "Velocity", uint_c(3) ); + attributes.emplace_back( vtk::typeToString< int >(), "rank", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< int >(), "shadow", uint_c(1) ); return attributes; } diff --git a/src/pe/vtk/EllipsoidVtkOutput.cpp b/src/pe/vtk/EllipsoidVtkOutput.cpp index 816fb2028208731672f30f2cb8cb3e98dfadcdb0..67be6f2473301074ac79ebfdf6ccbdee2601f570 100644 --- a/src/pe/vtk/EllipsoidVtkOutput.cpp +++ b/src/pe/vtk/EllipsoidVtkOutput.cpp @@ -32,12 +32,12 @@ namespace pe { std::vector< EllipsoidVtkOutput::Attributes > EllipsoidVtkOutput::getAttributes() const { std::vector< Attributes > attributes; - attributes.push_back( Attributes( vtk::typeToString< float >(), "mass", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< float >(), "tensorGlyph", uint_c(6) ) ); - attributes.push_back( Attributes( vtk::typeToString< float >(), "velocity", uint_c(3) ) ); - attributes.push_back( Attributes( vtk::typeToString< int >(), "rank", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< id_t >(), "id", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< id_t >(), "uid", uint_c(1) ) ); + attributes.emplace_back( vtk::typeToString< float >(), "mass", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< float >(), "tensorGlyph", uint_c(6) ); + attributes.emplace_back( vtk::typeToString< float >(), "velocity", uint_c(3) ); + attributes.emplace_back( vtk::typeToString< int >(), "rank", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< id_t >(), "id", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< id_t >(), "uid", uint_c(1) ); return attributes; } diff --git a/src/pe/vtk/SphereVtkOutput.cpp b/src/pe/vtk/SphereVtkOutput.cpp index 626685a43610f3c4cd205351f7b3835cb41a3655..7ae03c08840e7ecd8d4ce3594f4eb17de918953f 100644 --- a/src/pe/vtk/SphereVtkOutput.cpp +++ b/src/pe/vtk/SphereVtkOutput.cpp @@ -35,13 +35,13 @@ namespace pe { std::vector< SphereVtkOutput::Attributes > SphereVtkOutput::getAttributes() const { std::vector< Attributes > attributes; - attributes.push_back( Attributes( vtk::typeToString< float >(), "mass", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< float >(), "radius", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< float >(), "velocity", uint_c(3) ) ); - attributes.push_back( Attributes( vtk::typeToString< float >(), "orientation", uint_c(3) ) ); - attributes.push_back( Attributes( vtk::typeToString< int >(), "rank", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< id_t >(), "id", uint_c(1) ) ); - attributes.push_back( Attributes( vtk::typeToString< id_t >(), "uid", uint_c(1) ) ); + attributes.emplace_back( vtk::typeToString< float >(), "mass", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< float >(), "radius", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< float >(), "velocity", uint_c(3) ); + attributes.emplace_back( vtk::typeToString< float >(), "orientation", uint_c(3) ); + attributes.emplace_back( vtk::typeToString< int >(), "rank", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< id_t >(), "id", uint_c(1) ); + attributes.emplace_back( vtk::typeToString< id_t >(), "uid", uint_c(1) ); return attributes; } diff --git a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp index 75ea1ed2f3f6870152d54fc0b921e1219fcc8a4a..d0d36a921672c5cc6793d4e1bc6739dc08b444e4 100644 --- a/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp +++ b/src/pe_coupling/partially_saturated_cells_method/BodyAndVolumeFractionMapping.cpp @@ -60,7 +60,7 @@ void mapPSMBodyAndVolumeFraction( const pe::BodyID body, IBlock & block, Structu // if the cell intersected with the body, store a pointer to that body and the corresponding volume fraction in the field if( fraction > real_t(0) ) { - bodyAndVolumeFractionField->get(cell).push_back( BodyAndVolumeFraction_T( body, fraction ) ); + bodyAndVolumeFractionField->get(cell).emplace_back( body, fraction ); } } } @@ -72,7 +72,7 @@ void BodyAndVolumeFractionMapping::initialize() { BodyAndVolumeFractionField_T * bodyAndVolumeFractionField = blockIt->getData< BodyAndVolumeFractionField_T >( bodyAndVolumeFractionFieldID_ ); - if( updatedBodyAndVolumeFractionField_ == NULL ) + if( updatedBodyAndVolumeFractionField_ == nullptr ) { // hold internally an identical field for swapping updatedBodyAndVolumeFractionField_ = shared_ptr<BodyAndVolumeFractionField_T>( bodyAndVolumeFractionField->cloneUninitialized() ); @@ -219,7 +219,7 @@ void BodyAndVolumeFractionMapping::updatePSMBodyAndVolumeFraction( pe::BodyID bo // if the cell intersected with the body, store a pointer to that body and the corresponding volume fraction in the field if( fraction > real_t(0) ) { - updatedBodyAndVolumeFractionField_->get(x,y,z).push_back( BodyAndVolumeFraction_T( body, fraction ) ); + updatedBodyAndVolumeFractionField_->get(x,y,z).emplace_back( body, fraction ); } } } diff --git a/src/pe_coupling/utility/TimeStep.cpp b/src/pe_coupling/utility/TimeStep.cpp index 79a9d85d03946047bb91c2bcfda7d40c7a44aaea..a85fb0de3e857ff8b40e983f42fdd95ad07b16e3 100644 --- a/src/pe_coupling/utility/TimeStep.cpp +++ b/src/pe_coupling/utility/TimeStep.cpp @@ -49,7 +49,7 @@ void TimeStep::operator()() // generate map from all known bodies (process local) to total forces/torques // this has to be done on a block-local basis, since the same body could reside on several blocks from this process - typedef domain_decomposition::IBlockID::IDType BlockID_T; + using BlockID_T = domain_decomposition::IBlockID::IDType; std::map< BlockID_T, std::map< walberla::id_t, std::array< real_t, 6 > > > forceTorqueMap; for( auto blockIt = blockStorage_->begin(); blockIt != blockStorage_->end(); ++blockIt ) diff --git a/src/postprocessing/sqlite/SQLite.cpp b/src/postprocessing/sqlite/SQLite.cpp index e83aa46e18a0627452791efb16568d07e07efcb6..5e27286ef4b3f10c77cfb68b65d9ae81cef13bd0 100644 --- a/src/postprocessing/sqlite/SQLite.cpp +++ b/src/postprocessing/sqlite/SQLite.cpp @@ -35,7 +35,7 @@ namespace postprocessing { SQLiteDB::SQLiteDB( const string & dbFile, const int busyTimeout ) - : valid_(true), dbHandle_(NULL), file_( dbFile ) + : valid_(true), dbHandle_(nullptr), file_( dbFile ) { static const char * CREATE_RUN_TABLE = "CREATE TABLE IF NOT EXISTS runs (" @@ -52,11 +52,11 @@ SQLiteDB::SQLiteDB( const string & dbFile, const int busyTimeout ) } sqlite3_busy_timeout( dbHandle_, busyTimeout*1000 ); - sqlite3_exec( dbHandle_, "PRAGMA foreign_keys = ON;",0,0,0 ); - sqlite3_exec( dbHandle_, CREATE_RUN_TABLE, 0,0,0); + sqlite3_exec( dbHandle_, "PRAGMA foreign_keys = ON;",nullptr,nullptr,nullptr ); + sqlite3_exec( dbHandle_, CREATE_RUN_TABLE, nullptr,nullptr,nullptr); static const char* UPDATE_RUN_TABLE_CMD = "ALTER TABLE runs ADD COLUMN uuid STRING;"; - sqlite3_exec( dbHandle_, UPDATE_RUN_TABLE_CMD, 0, 0, 0 ); + sqlite3_exec( dbHandle_, UPDATE_RUN_TABLE_CMD, nullptr, nullptr, nullptr ); } @@ -89,7 +89,7 @@ uint_t storeRunImpl( sqlite3 * dbHandle, std::string & filename, { WALBERLA_ASSERT_NOT_NULLPTR( dbHandle ); - sqlite3_exec( dbHandle, "BEGIN;",0,0,0 ); + sqlite3_exec( dbHandle, "BEGIN;",nullptr,nullptr,nullptr ); string insertRunCommand = "INSERT INTO runs (timestamp, uuid "; std::stringstream values; @@ -101,7 +101,7 @@ uint_t storeRunImpl( sqlite3 * dbHandle, std::string & filename, insertRunCommand += "," + i->first; values << ", " << i->second; string command = "ALTER TABLE runs ADD COLUMN " + i->first + " INTEGER "; - sqlite3_exec ( dbHandle, command.c_str(), 0,0,0 ); // ignore errors (column can exist already) + sqlite3_exec ( dbHandle, command.c_str(), nullptr,nullptr,nullptr ); // ignore errors (column can exist already) } // Add columns for string properties @@ -110,7 +110,7 @@ uint_t storeRunImpl( sqlite3 * dbHandle, std::string & filename, insertRunCommand += "," + i->first; values << ", " << "\"" << i->second << "\""; string command = "ALTER TABLE runs ADD COLUMN " + i->first + " TEXT "; - sqlite3_exec ( dbHandle, command.c_str(), 0,0,0 ); // ignore errors (column can exist already) + sqlite3_exec ( dbHandle, command.c_str(), nullptr,nullptr,nullptr ); // ignore errors (column can exist already) } @@ -122,7 +122,7 @@ uint_t storeRunImpl( sqlite3 * dbHandle, std::string & filename, insertRunCommand += "," + i->first; values << ", " << i->second; string command = "ALTER TABLE runs ADD COLUMN " + i->first + " DOUBLE "; - sqlite3_exec( dbHandle, command.c_str(), 0, 0, 0 ); // ignore errors (column can exist already) + sqlite3_exec( dbHandle, command.c_str(), nullptr, nullptr, nullptr ); // ignore errors (column can exist already) } else { @@ -138,20 +138,20 @@ uint_t storeRunImpl( sqlite3 * dbHandle, std::string & filename, values << " ,1"; // no boolean in sqlite3, use integer instead string command = "ALTER TABLE runs ADD COLUMN " + i->getIdentifier() + " INTEGER "; - sqlite3_exec ( dbHandle, command.c_str(), 0,0,0 ); // ignore errors (column can exist already) + sqlite3_exec ( dbHandle, command.c_str(), nullptr,nullptr,nullptr ); // ignore errors (column can exist already) } insertRunCommand += " ) "; values << "); "; insertRunCommand += values.str(); - int ret = sqlite3_exec ( dbHandle, insertRunCommand.c_str(), 0, 0, 0 ); + int ret = sqlite3_exec ( dbHandle, insertRunCommand.c_str(), nullptr, nullptr, nullptr ); if ( ret != SQLITE_OK) { WALBERLA_LOG_WARNING( "Failed to insert a row into run table of sqlite3 database: " << sqlite3_errmsg(dbHandle) << "\n sql command: " << insertRunCommand.c_str() ); } uint_t generatedPrimaryKey = uint_c ( sqlite3_last_insert_rowid( dbHandle ) ); - sqlite3_exec( dbHandle, "END TRANSACTION;",0,0,0 ); + sqlite3_exec( dbHandle, "END TRANSACTION;",nullptr,nullptr,nullptr ); return generatedPrimaryKey; } @@ -172,14 +172,14 @@ void storeAdditionalRunInfoImpl( sqlite3 * dbHandle, const map<string, string > & stringProperties , const map<string, double > & realProperties ) { - sqlite3_exec( dbHandle, "BEGIN;",0,0,0 ); + sqlite3_exec( dbHandle, "BEGIN;",nullptr,nullptr,nullptr ); std::string CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + tableName + " (runId INTEGER, " " FOREIGN KEY (runId) REFERENCES runs(runId) " " );" ; - sqlite3_exec( dbHandle, CREATE_TABLE.c_str(), 0,0,0); + sqlite3_exec( dbHandle, CREATE_TABLE.c_str(), nullptr,nullptr,nullptr); string insertRunCommand = "INSERT INTO " + tableName + "( runId"; std::stringstream values; @@ -190,7 +190,7 @@ void storeAdditionalRunInfoImpl( sqlite3 * dbHandle, insertRunCommand += "," + i->first; values << ", " << i->second; string command = "ALTER TABLE " + tableName + " ADD COLUMN " + i->first + " INTEGER "; - sqlite3_exec ( dbHandle, command.c_str(), 0,0,0 ); // ignore errors (column can exist already) + sqlite3_exec ( dbHandle, command.c_str(), nullptr,nullptr,nullptr ); // ignore errors (column can exist already) } // Add columns for string properties @@ -199,7 +199,7 @@ void storeAdditionalRunInfoImpl( sqlite3 * dbHandle, insertRunCommand += "," + i->first; values << ", " << "\"" << i->second << "\""; string command = "ALTER TABLE " + tableName + " ADD COLUMN " + i->first + " TEXT "; - sqlite3_exec ( dbHandle, command.c_str(), 0,0,0 ); // ignore errors (column can exist already) + sqlite3_exec ( dbHandle, command.c_str(), nullptr,nullptr,nullptr ); // ignore errors (column can exist already) } @@ -209,18 +209,18 @@ void storeAdditionalRunInfoImpl( sqlite3 * dbHandle, insertRunCommand += "," + i->first; values << ", " << i->second ; string command = "ALTER TABLE " + tableName + " ADD COLUMN " + i->first + " DOUBLE "; - sqlite3_exec ( dbHandle, command.c_str(), 0,0,0 ); // ignore errors (column can exist already) + sqlite3_exec ( dbHandle, command.c_str(), nullptr,nullptr,nullptr ); // ignore errors (column can exist already) } insertRunCommand += " ) "; values << "); "; insertRunCommand += values.str(); - int ret = sqlite3_exec ( dbHandle, insertRunCommand.c_str(), 0, 0, 0 ); + int ret = sqlite3_exec ( dbHandle, insertRunCommand.c_str(), nullptr, nullptr, nullptr ); if ( ret != SQLITE_OK) { WALBERLA_LOG_WARNING( "Failed to insert a row into run table of sqlite3 database: " << sqlite3_errmsg(dbHandle) << "\n sql command: " << insertRunCommand.c_str() ); } - sqlite3_exec( dbHandle, "END TRANSACTION;",0,0,0 ); + sqlite3_exec( dbHandle, "END TRANSACTION;",nullptr,nullptr,nullptr ); } @@ -293,7 +293,7 @@ void SQLiteDB::storeTimingPool ( uint_t runId, const WcTimingPool & tp, const std::string & timingPoolName ) { - sqlite3_exec( dbHandle_, "BEGIN;",0,0,0 ); + sqlite3_exec( dbHandle_, "BEGIN;",nullptr,nullptr,nullptr ); assert ( timingPoolName.length() > 0 && timingPoolName.length() < 255 ); @@ -316,10 +316,10 @@ void SQLiteDB::storeTimingPool ( uint_t runId, " INSERT INTO timingPool (runId,name,sweep,average,min,max,count,variance,percentage) " " VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ? )"; - sqlite3_exec( dbHandle_, CREATE_TIMINGPOOL_TABLE, 0,0,0 ); + sqlite3_exec( dbHandle_, CREATE_TIMINGPOOL_TABLE, nullptr,nullptr,nullptr ); - sqlite3_stmt *stmt = NULL; - auto retVal = sqlite3_prepare_v2(dbHandle_, INSERT_STATEMENT, -1, &stmt, 0 ); + sqlite3_stmt *stmt = nullptr; + auto retVal = sqlite3_prepare_v2(dbHandle_, INSERT_STATEMENT, -1, &stmt, nullptr ); if ( retVal != SQLITE_OK ) { WALBERLA_LOG_WARNING( "Failed to prepare SQL Insert statement." << file_ ); return; @@ -346,7 +346,7 @@ void SQLiteDB::storeTimingPool ( uint_t runId, sqlite3_step ( stmt ); // execute statement sqlite3_reset ( stmt ); // undo binding } - sqlite3_exec( dbHandle_, "END TRANSACTION;",0,0,0 ); + sqlite3_exec( dbHandle_, "END TRANSACTION;",nullptr,nullptr,nullptr ); sqlite3_finalize( stmt ); // free prepared statement } @@ -365,7 +365,7 @@ void SQLiteDB::storeTimingTree ( uint_t runId, const WcTimingTree & tt, const std::string & timingTreeName ) { - sqlite3_exec( dbHandle_, "BEGIN;",0,0,0 ); + sqlite3_exec( dbHandle_, "BEGIN;",nullptr,nullptr,nullptr ); assert ( timingTreeName.length() > 0 && timingTreeName.length() < 255 ); @@ -385,7 +385,7 @@ void SQLiteDB::storeTimingTree ( uint_t runId, " FOREIGN KEY (runId) REFERENCES runs(runId) " " );" ; - sqlite3_exec( dbHandle_, CREATE_TIMINGTREE_TABLE, 0,0,0 ); + sqlite3_exec( dbHandle_, CREATE_TIMINGTREE_TABLE, nullptr,nullptr,nullptr ); double totalTime = 0.0; for (auto it = tt.getRawData().tree_.begin(); it != tt.getRawData().tree_.end(); ++it) @@ -395,7 +395,7 @@ void SQLiteDB::storeTimingTree ( uint_t runId, storeTimingNode(runId, std::numeric_limits<int>::max(), tt.getRawData(), timingTreeName, "Total", totalTime); - sqlite3_exec( dbHandle_, "END TRANSACTION;",0,0,0 ); + sqlite3_exec( dbHandle_, "END TRANSACTION;",nullptr,nullptr,nullptr ); } //******************************************************************************************************************* @@ -418,8 +418,8 @@ void SQLiteDB::storeTimingNode ( const uint_t runId, " INSERT INTO timingTree (runId,name,parentId,sweep,average,min,max,count,variance,percentage) " " VALUES( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"; - sqlite3_stmt *stmt = NULL; - auto retVal = sqlite3_prepare_v2(dbHandle_, INSERT_STATEMENT, -1, &stmt, 0 ); + sqlite3_stmt *stmt = nullptr; + auto retVal = sqlite3_prepare_v2(dbHandle_, INSERT_STATEMENT, -1, &stmt, nullptr ); if ( retVal != SQLITE_OK ) { WALBERLA_LOG_WARNING( "Failed to prepare SQL Insert statement (" << retVal << ")." ); return; diff --git a/src/python_coupling/Shell.cpp b/src/python_coupling/Shell.cpp index 8f4379a9ed68e2810f920c440d5471181d5ec437..1a34e91a4c4b0d717ec8201cc82c7db47eafd791 100644 --- a/src/python_coupling/Shell.cpp +++ b/src/python_coupling/Shell.cpp @@ -238,7 +238,7 @@ namespace walberla { namespace python_coupling { Shell::Shell( const std::string & ) {} - Shell::~Shell() {} + Shell::~Shell() = default; void Shell::operator()() {} } // namespace python_coupling diff --git a/src/python_coupling/helper/ModuleInit.cpp b/src/python_coupling/helper/ModuleInit.cpp index 60b18f57d5e15d873c3a5fbc619404d240a405fd..0058c7a713bbba4db5fc11449dd375c2c26dcb83 100644 --- a/src/python_coupling/helper/ModuleInit.cpp +++ b/src/python_coupling/helper/ModuleInit.cpp @@ -54,7 +54,7 @@ void initWalberlaForPythonModule() Abort::instance()->resetAbortFunction( Abort::exceptionAbort ); - mpi::MPIManager::instance()->initializeMPI( 0,0 ); + mpi::MPIManager::instance()->initializeMPI( nullptr,nullptr ); mpi::MPIManager::instance()->useWorldComm(); } diff --git a/src/timeloop/PerformanceMeter.cpp b/src/timeloop/PerformanceMeter.cpp index 8842912156ab1971cd1ca5a41984d550174f9934..6efb92d969bb67da70230c1453a7c0a4cb62db9b 100644 --- a/src/timeloop/PerformanceMeter.cpp +++ b/src/timeloop/PerformanceMeter.cpp @@ -85,7 +85,7 @@ namespace timeloop { void PerformanceMeter::addMeasurement ( const std::string & name, CountFunction countFunction, uint_t countFreq, real_t scaling ) { - measurements_.push_back( Measurement( countFunction, name, scaling, countFreq ) ); + measurements_.emplace_back( countFunction, name, scaling, countFreq ); uint_t cells = 0; for( auto block = blockStorage_.begin(); block != blockStorage_.end(); ++block ) cells += countFunction( *block ); @@ -105,7 +105,7 @@ namespace timeloop { *******************************************************************************************************************/ void PerformanceMeter::addMeasurement ( const std::string & name, real_t scaling ) { - measurements_.push_back( Measurement( CountFunction(), name, scaling, uint_t(0) ) ); + measurements_.emplace_back( CountFunction(), name, scaling, uint_t(0) ); uint_t cellsOnProcess = 0; for( auto block = blockStorage_.begin(); block != blockStorage_.end(); ++block ) diff --git a/src/timeloop/Timeloop.cpp b/src/timeloop/Timeloop.cpp index dea97c05787fb69adf29bcc84d51a4a9c03c9f9b..6b2f548d54ec9922200488243eec2355e3a9f676 100644 --- a/src/timeloop/Timeloop.cpp +++ b/src/timeloop/Timeloop.cpp @@ -138,7 +138,7 @@ Timeloop::FctHandle Timeloop::addFuncBeforeTimeStep(const VoidFctNoArguments& f, const std::string & id, const Set<SUID> & r, const Set<SUID> & e ) { - beforeFunctions_.push_back( SelectableFunc(f,r,e,id) ); + beforeFunctions_.emplace_back(f,r,e,id ); return beforeFunctions_.size() - 1; } @@ -157,7 +157,7 @@ Timeloop::FctHandle Timeloop::addFuncAfterTimeStep(const VoidFctNoArguments& f, const std::string & id, const Set<SUID> & r, const Set<SUID> & e ) { - afterFunctions_.push_back( SelectableFunc(f,r,e,id) ); + afterFunctions_.emplace_back(f,r,e,id ); return afterFunctions_.size() - 1; } @@ -179,7 +179,7 @@ void Timeloop::executeSelectable( const selectable::SetSelectableObject<VoidFctN { std::string objectName; const VoidFctNoArguments * exe = selectable.getUnique( selector,objectName ); - if( exe == NULL ) + if( exe == nullptr ) WALBERLA_ABORT( "Trying to selecting " << what << ": " << "Multiple Matches found! Check your selector " << selector << std::endl << "All registered objects: " << std::endl << selectable << std::endl ); diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index 7e660ac3157ab190a038781ea2f9ee8840a7f251..9f1e027cfd64b3edb52828d34c5d7c02ba7897c8 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -45,7 +45,7 @@ VTKOutput::VTKOutput( const BlockStorage & bs, const std::string & identifier, c const uint_t initialExecutionCount ) : unstructuredBlockStorage_( &bs ), - blockStorage_( NULL ), + blockStorage_( nullptr ), baseFolder_( baseFolder ), executionFolder_( executionFolder ), executionCounter_(initialExecutionCount), initialWriteCallsToSkip_(0), writeFrequency_( writeFrequency ), continuousNumbering_( continuousNumbering ), pvdEnd_(-2), binary_( binary ), format_( binary ? std::string("binary") : std::string("ascii") ), @@ -86,7 +86,7 @@ VTKOutput::VTKOutput( const shared_ptr< PointDataSource > pds, const std::string const bool continuousNumbering, const bool binary, const bool littleEndian, const bool useMPIIO, const uint_t initialExecutionCount ) : - unstructuredBlockStorage_(NULL), blockStorage_( NULL ), pointDataSource_( pds ), + unstructuredBlockStorage_(nullptr), blockStorage_( nullptr ), pointDataSource_( pds ), baseFolder_( baseFolder ), executionFolder_( executionFolder ), executionCounter_(initialExecutionCount), initialWriteCallsToSkip_(0), writeFrequency_( writeFrequency ), continuousNumbering_( continuousNumbering ), pvdEnd_(-2), binary_( binary ), format_( binary ? std::string("binary") : std::string("ascii") ), @@ -107,7 +107,7 @@ VTKOutput::VTKOutput( const shared_ptr< PolylineDataSource > pds, const std::str const bool continuousNumbering, const bool binary, const bool littleEndian, const bool useMPIIO, const uint_t initialExecutionCount ) : - unstructuredBlockStorage_(NULL), blockStorage_( NULL ), polylineDataSource_( pds ), + unstructuredBlockStorage_(nullptr), blockStorage_( nullptr ), polylineDataSource_( pds ), baseFolder_( baseFolder ), executionFolder_( executionFolder ), executionCounter_(initialExecutionCount), initialWriteCallsToSkip_(0), writeFrequency_( writeFrequency ), continuousNumbering_( continuousNumbering ), pvdEnd_(-2), binary_( binary ), format_( binary ? std::string("binary") : std::string("ascii") ), @@ -1240,9 +1240,9 @@ void VTKOutput::writeVTUPiece( std::ostream& ofs, const IBlock& block, const Cel { vimap[v] = numeric_cast< Index >(vc.size()); ci.push_back(numeric_cast< Index >(vc.size())); - vc.push_back(VertexCoord((x == 0) ? aabb.xMin() : aabb.xMax(), + vc.emplace_back((x == 0) ? aabb.xMin() : aabb.xMax(), (y == 0) ? aabb.yMin() : aabb.yMax(), - (z == 0) ? aabb.zMin() : aabb.zMax())); + (z == 0) ? aabb.zMin() : aabb.zMax()); } } } @@ -1329,9 +1329,9 @@ void VTKOutput::writeVTUPiece_sampling(std::ostream& ofs, const IBlock& block, c { vimap[v] = numeric_cast< Index >(vc.size()); ci.push_back(numeric_cast< Index >(vc.size())); - vc.push_back(VertexCoord((x == 0) ? cell->aabb_.xMin() : cell->aabb_.xMax(), + vc.emplace_back((x == 0) ? cell->aabb_.xMin() : cell->aabb_.xMax(), (y == 0) ? cell->aabb_.yMin() : cell->aabb_.yMax(), - (z == 0) ? cell->aabb_.zMin() : cell->aabb_.zMax())); + (z == 0) ? cell->aabb_.zMin() : cell->aabb_.zMax()); } } } diff --git a/tests/blockforest/BlockForestTest.cpp b/tests/blockforest/BlockForestTest.cpp index 4ce1d00193675a6177a51c15aa367e7875facc56..e032b7de66420ca0e17c4fa6206c5e29889452b4 100644 --- a/tests/blockforest/BlockForestTest.cpp +++ b/tests/blockforest/BlockForestTest.cpp @@ -86,7 +86,7 @@ static void workloadMemorySUIDAssignmentFunction( SetupBlockForest& forest ) { for( uint_t i = 0; i != forest.getNumberOfLevels(); ++i ) { std::ostringstream oss; oss << "Level_" << i; - suids.push_back( SUID( oss.str(), false ) ); + suids.emplace_back( oss.str(), false ); } for( uint_t i = 0; i != blocks.size(); ++i ) { @@ -139,7 +139,7 @@ static uint_t* blockdata5( const IBlock* const /*block*/ ) { class Base { public: - virtual ~Base() {} + virtual ~Base() = default; bool operator==( const Base& /*rhs*/ ) const { return true; } uint_t override() const { return 1; } virtual uint_t func() const { return 2; } @@ -149,7 +149,7 @@ class Derived : public Base { public: uint_t override() const { return 10; } - uint_t func() const { return 20; } + uint_t func() const override { return 20; } }; @@ -169,7 +169,7 @@ static Derived* blockdataDerived( const IBlock* const /*block*/ ) class SecondBase { public: - virtual ~SecondBase() {} + virtual ~SecondBase() = default; bool operator==( const SecondBase& /*rhs*/ ) const { return true; } uint_t override() const { return 100; } }; @@ -179,7 +179,7 @@ class Multi : public Base, public SecondBase public: bool operator==( const Multi& /*rhs*/ ) const { return true; } uint_t override() const { return 1000; } - uint_t func() const { return 2000; } + uint_t func() const override { return 2000; } }; diff --git a/tests/blockforest/SaveLoadTest.cpp b/tests/blockforest/SaveLoadTest.cpp index 677d7531cf4254694cb98189021014f9c344ec9f..12e41b44ac3c495f13ac90d6a7ec95ec925226ab 100644 --- a/tests/blockforest/SaveLoadTest.cpp +++ b/tests/blockforest/SaveLoadTest.cpp @@ -19,6 +19,8 @@ //====================================================================================================================== +#include <memory> + #include "blockforest/all.h" #include "core/all.h" #include "core/math/IntegerFactorization.h" @@ -58,7 +60,7 @@ void blockForestSaveLoadTest(const BlockForest::FileIOMode ioMode, const bool br check.clear(); - auto forestCheck = shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), "SerializeDeserialize.sbf", broadcast ) ); + auto forestCheck = std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), "SerializeDeserialize.sbf", broadcast ); for (auto blockIt = forestCheck->begin(); blockIt != forestCheck->end(); ++blockIt) { diff --git a/tests/blockforest/SetupBlockForestTest.cpp b/tests/blockforest/SetupBlockForestTest.cpp index d2f1a73c0fffc6044f44ec6f4b0d00980cb48c01..f910fe4ecb23ac6099f1676fd44d5ae71e762986 100644 --- a/tests/blockforest/SetupBlockForestTest.cpp +++ b/tests/blockforest/SetupBlockForestTest.cpp @@ -173,7 +173,7 @@ static void checkNeighborhoodConsistency( const SetupBlockForest& forest ) { // either one neighbor must be hit OR the block is located at the border of the (non-periodic) simulation domain if( noHit ) - WALBERLA_CHECK( forest.getBlock(x,y,z) == NULL ); + WALBERLA_CHECK( forest.getBlock(x,y,z) == nullptr ); } // every neighbor must be hit by at least one point diff --git a/tests/boundary/BoundaryHandling.cpp b/tests/boundary/BoundaryHandling.cpp index df06f25f3d4f06ac1c8c236ee99b9a321c6bf7db..dbc83e1fe2ed0137d412fdcb8e6f8a96f6020505 100644 --- a/tests/boundary/BoundaryHandling.cpp +++ b/tests/boundary/BoundaryHandling.cpp @@ -42,9 +42,9 @@ namespace walberla { -typedef uint8_t flag_t; +using flag_t = uint8_t; -typedef FlagField< flag_t > FlagField_T; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< uint_t, stencil::D3Q27::Size > WorkField_T; typedef GhostLayerField< uint_t, 1 > FactorField_T; diff --git a/tests/core/GridGeneratorTest.cpp b/tests/core/GridGeneratorTest.cpp index bb5520a402a76ed22a2accdafe9e4cf384f65fb1..7971b5f07b1861e03e8c63027903eb0cf30df2c9 100644 --- a/tests/core/GridGeneratorTest.cpp +++ b/tests/core/GridGeneratorTest.cpp @@ -113,39 +113,39 @@ int main( int argc, char** argv ) WALBERLA_UNUSED(env); std::vector< Vector3<real_t> > points; - points.push_back( Vector3<real_t>(0,0,0) ); - points.push_back( Vector3<real_t>(1,0,0) ); - points.push_back( Vector3<real_t>(0,1,0) ); - points.push_back( Vector3<real_t>(1,1,0) ); - points.push_back( Vector3<real_t>(0,0,1) ); - points.push_back( Vector3<real_t>(1,0,1) ); - points.push_back( Vector3<real_t>(0,1,1) ); - points.push_back( Vector3<real_t>(1,1,1) ); + points.emplace_back( real_t(0), real_t(0), real_t(0) ); + points.emplace_back( real_t(1), real_t(0), real_t(0) ); + points.emplace_back( real_t(0), real_t(1), real_t(0) ); + points.emplace_back( real_t(1), real_t(1), real_t(0) ); + points.emplace_back( real_t(0), real_t(0), real_t(1) ); + points.emplace_back( real_t(1), real_t(0), real_t(1) ); + points.emplace_back( real_t(0), real_t(1), real_t(1) ); + points.emplace_back( real_t(1), real_t(1), real_t(1) ); auto correctPointIt = points.begin(); for (auto it = SCIterator(AABB(real_c(-0.01), real_c(-0.01), real_c(-0.01), real_c(1.9),real_c(1.9),real_c(1.9)), Vector3<real_t>(0,0,0), 1); it != SCIterator(); ++it, ++correctPointIt) WALBERLA_CHECK_FLOAT_EQUAL( *it, *correctPointIt, (*it) << "!=" << (*correctPointIt) ); points.clear(); - points.push_back( Vector3<real_t>(0,0,0) ); - points.push_back( Vector3<real_t>(1,0,0) ); - points.push_back( Vector3<real_t>(real_c(0.5), real_c(0.866025),0) ); - points.push_back( Vector3<real_t>(real_c(1.5), real_c(0.866025),0) ); - points.push_back( Vector3<real_t>(0, real_c(1.73205),0) ); - points.push_back( Vector3<real_t>(1, real_c(1.73205),0) ); - - points.push_back( Vector3<real_t>(real_c(0.5), real_c(0.288675), real_c(0.816497)) ); - points.push_back( Vector3<real_t>(real_c(1.5), real_c(0.288675), real_c(0.816497)) ); - points.push_back( Vector3<real_t>(0, real_c(1.1547), real_c(0.816497)) ); - points.push_back( Vector3<real_t>(1, real_c(1.1547), real_c(0.816497)) ); - - points.push_back( Vector3<real_t>(0,0, real_c(1.63299) ) ); - points.push_back( Vector3<real_t>(1,0, real_c(1.63299) ) ); - points.push_back( Vector3<real_t>(real_c(0.5), real_c(0.866025), real_c(1.63299) ) ); - points.push_back( Vector3<real_t>(real_c(1.5), real_c(0.866025), real_c(1.63299) ) ); - points.push_back( Vector3<real_t>(0, real_c(1.73205), real_c(1.63299) ) ); - points.push_back( Vector3<real_t>(1, real_c(1.73205), real_c(1.63299) ) ); + points.emplace_back(real_t(0),real_t(0),real_t(0) ); + points.emplace_back(real_t(1),real_t(0),real_t(0) ); + points.emplace_back(real_c(0.5), real_c(0.866025),real_t(0) ); + points.emplace_back(real_c(1.5), real_c(0.866025),real_t(0) ); + points.emplace_back(real_t(0), real_c(1.73205),real_t(0) ); + points.emplace_back(real_t(1), real_c(1.73205),real_t(0) ); + + points.emplace_back(real_c(0.5), real_c(0.288675), real_c(0.816497) ); + points.emplace_back(real_c(1.5), real_c(0.288675), real_c(0.816497) ); + points.emplace_back(real_t(0), real_c(1.1547), real_c(0.816497) ); + points.emplace_back(real_t(1), real_c(1.1547), real_c(0.816497) ); + + points.emplace_back(real_t(0),real_t(0), real_c(1.63299) ); + points.emplace_back(real_t(1),real_t(0), real_c(1.63299) ); + points.emplace_back(real_c(0.5), real_c(0.866025), real_c(1.63299) ); + points.emplace_back(real_c(1.5), real_c(0.866025), real_c(1.63299) ); + points.emplace_back(real_t(0), real_c(1.73205), real_c(1.63299) ); + points.emplace_back(real_t(1), real_c(1.73205), real_c(1.63299) ); correctPointIt = points.begin(); - for (auto it = HCPIterator(AABB(real_c(-0.01), real_c(-0.01), real_c(-0.01), real_c(1.9),real_c(1.9),real_c(1.9)), Vector3<real_t>(0,0,0), 1); it != HCPIterator(); ++it, ++correctPointIt) + for (auto it = HCPIterator(AABB(real_c(-0.01), real_c(-0.01), real_c(-0.01), real_c(1.9),real_c(1.9),real_c(1.9)), Vector3<real_t>(real_t(0),real_t(0),real_t(0)), 1); it != HCPIterator(); ++it, ++correctPointIt) { WALBERLA_CHECK( floatIsEqual((*it)[0], (*correctPointIt)[0], real_c(0.00001)), (*it) << "!=" << (*correctPointIt)); WALBERLA_CHECK( floatIsEqual((*it)[1], (*correctPointIt)[1], real_c(0.00001)), (*it) << "!=" << (*correctPointIt)); diff --git a/tests/core/debug/CheckMacroTest.cpp b/tests/core/debug/CheckMacroTest.cpp index c4401e1698c2b0a2fbdab9024e7afbf4f677b93e..d2e4cf7a8ed94de05f876af83cc3e6ac67280fa3 100644 --- a/tests/core/debug/CheckMacroTest.cpp +++ b/tests/core/debug/CheckMacroTest.cpp @@ -54,7 +54,7 @@ int main() { // Pointers - int* nullPointer = 0; + int* nullPointer = nullptr; shared_ptr<int> sharedNullPointer; WALBERLA_CHECK_NULLPTR(nullPointer); WALBERLA_CHECK_NULLPTR(sharedNullPointer); diff --git a/tests/core/load_balancing/MetisTest.cpp b/tests/core/load_balancing/MetisTest.cpp index a460077c21653d9e628c12f868e330012a7d861f..22038220a93d192e4ac06c88a5fb220e5c415f8d 100644 --- a/tests/core/load_balancing/MetisTest.cpp +++ b/tests/core/load_balancing/MetisTest.cpp @@ -116,8 +116,8 @@ int main( int argc, char * argv[] ) int64_t edgecut; std::vector< int64_t > part( numeric_cast<size_t>( nvtxs ) ); - int result = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj.front()), &(adjncy.front()), NULL, NULL, NULL, - &nparts, NULL, NULL, NULL, &edgecut, &(part.front()) ); + int result = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj.front()), &(adjncy.front()), nullptr, nullptr, nullptr, + &nparts, nullptr, nullptr, nullptr, &edgecut, &(part.front()) ); WALBERLA_CHECK_EQUAL( result, core::METIS_OK ); diff --git a/tests/core/load_balancing/ParMetisTest.cpp b/tests/core/load_balancing/ParMetisTest.cpp index 0b9643961ab083a4da5a4fc886c5060eb9bc4116..fd72061009c5e4b26648e38473bd0f3185800ecc 100644 --- a/tests/core/load_balancing/ParMetisTest.cpp +++ b/tests/core/load_balancing/ParMetisTest.cpp @@ -136,7 +136,7 @@ int main( int argc, char * argv[] ) std::vector< int64_t > part( fieldSize[0] * fieldSize[1] ); MPI_Comm comm = MPIManager::instance()->comm(); - int result = core::ParMETIS_V3_PartKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), NULL, NULL, &wgtflag, &numflag, &ncon, &nparts, + int result = core::ParMETIS_V3_PartKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), nullptr, nullptr, &wgtflag, &numflag, &ncon, &nparts, &(tpwgts.front()), &(ubvec.front()), options, &edgecut, &(part.front()), &comm ); diff --git a/tests/core/load_balancing/PlainParMetisTest.cpp b/tests/core/load_balancing/PlainParMetisTest.cpp index 4419b3c0d96503bd9fdf142e48e993231c0f3896..3da514b38451c70db287b216e76ea7a78b634da0 100644 --- a/tests/core/load_balancing/PlainParMetisTest.cpp +++ b/tests/core/load_balancing/PlainParMetisTest.cpp @@ -171,22 +171,22 @@ int main( int argc, char * argv[] ) MPI_Comm comm = MPI_COMM_WORLD; std::cout << "ParMETIS_V3_PartKway" << std::endl; - WALBERLA_CHECK_EQUAL( ParMETIS_V3_PartKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), NULL, NULL, &wgtflag, &numflag, &ncon, &nparts, + WALBERLA_CHECK_EQUAL( ParMETIS_V3_PartKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), nullptr, nullptr, &wgtflag, &numflag, &ncon, &nparts, &(tpwgts.front()), &(ubvec.front()), options, &edgecut, &(part.front()), &comm ), METIS_OK ); std::cout << "ParMETIS_V3_PartGeomKway" << std::endl; - WALBERLA_CHECK_EQUAL( ParMETIS_V3_PartGeomKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), NULL, NULL, &wgtflag, &numflag, &ndims, &(xyz.front()), &ncon, &nparts, + WALBERLA_CHECK_EQUAL( ParMETIS_V3_PartGeomKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), nullptr, nullptr, &wgtflag, &numflag, &ndims, &(xyz.front()), &ncon, &nparts, &(tpwgts.front()), &(ubvec.front()), options, &edgecut, &(part.front()), &comm ), METIS_OK ); std::cout << "ParMETIS_V3_PartGeom" << std::endl; WALBERLA_CHECK_EQUAL( ParMETIS_V3_PartGeom( &(vtxdist.front()), &ndims, &(xyz.front()), &(part.front()), &comm ), METIS_OK ); std::cout << "ParMETIS_V3_AdaptiveRepart" << std::endl; - WALBERLA_CHECK_EQUAL( ParMETIS_V3_AdaptiveRepart( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), NULL, NULL, NULL, &wgtflag, &numflag, &ncon, &nparts, + WALBERLA_CHECK_EQUAL( ParMETIS_V3_AdaptiveRepart( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), nullptr, nullptr, nullptr, &wgtflag, &numflag, &ncon, &nparts, &(tpwgts.front()), &(ubvec.front()), &ipc2redist, options, &edgecut, &(part.front()), &comm ), METIS_OK ); std::cout << "ParMETIS_V3_RefineKway" << std::endl; - WALBERLA_CHECK_EQUAL( ParMETIS_V3_RefineKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), NULL, NULL, &wgtflag, &numflag, &ncon, &nparts, + WALBERLA_CHECK_EQUAL( ParMETIS_V3_RefineKway( &(vtxdist.front()), &(xadj.front()), &(adjncy.front()), nullptr, nullptr, &wgtflag, &numflag, &ncon, &nparts, &(tpwgts.front()), &(ubvec.front()), options, &edgecut, &(part.front()), &comm ), METIS_OK ); diff --git a/tests/core/logging/LoggingTest.cpp b/tests/core/logging/LoggingTest.cpp index f3068417ee17071e35460f1896130cc1343835c3..60c2e1b506da2bd45b36766e5fbac270acb22fd8 100644 --- a/tests/core/logging/LoggingTest.cpp +++ b/tests/core/logging/LoggingTest.cpp @@ -33,15 +33,15 @@ class MyStamp : public logging::Logging::CustomStamp { public: MyStamp() : step_(uint_c(0)) {} - ~MyStamp() {} + ~MyStamp() override = default; void step( uint_t s ) { step_ = s; } - std::string stamp() + std::string stamp() override { std::ostringstream oss; oss << "[" << step_ << "]"; return oss.str(); } - uint_t maxStampWidth() { return 5; } + uint_t maxStampWidth() override { return 5; } private: uint_t step_; }; diff --git a/tests/core/math/GenericAABBTest.cpp b/tests/core/math/GenericAABBTest.cpp index 9194c0ba802093334f89a50532ec45a36b27879b..e27731aaeabeb336af33e0a45e493941f990d921 100644 --- a/tests/core/math/GenericAABBTest.cpp +++ b/tests/core/math/GenericAABBTest.cpp @@ -36,7 +36,7 @@ using math::GenericAABB; template< typename T > void testEmptyAABB( const GenericAABB< T > & aabb ) { - typedef Vector3< T > VecT; + using VecT = Vector3<T>; WALBERLA_CHECK_EQUAL( aabb.minCorner(), VecT( T(0), T(0), T(0) ) ); WALBERLA_CHECK_EQUAL( aabb.maxCorner(), VecT( T(0), T(0), T(0) ) ); @@ -122,7 +122,7 @@ void testNonEmptyAABB( const GenericAABB< T > & aabb ) template< typename T > void testAnyAABB( const GenericAABB< T > & aabb ) { - typedef Vector3< T > VecT; + using VecT = Vector3<T>; WALBERLA_CHECK_IDENTICAL( aabb.minCorner()[0], aabb.xMin() ); @@ -274,7 +274,7 @@ void testAnyAABB( const GenericAABB< T > & aabb ) template< typename T > void testFixedAABB() { - typedef Vector3< T > VecT; + using VecT = Vector3<T>; GenericAABB<T> aabb0; testEmptyAABB( aabb0 ); @@ -330,7 +330,7 @@ void testFixedAABB() template< typename T > void testConstructors( const T x0, const T y0, const T z0, const T x1, const T y1, const T z1 ) { - typedef Vector3< T > VecT; + using VecT = Vector3<T>; { GenericAABB< T > refAABB; diff --git a/tests/core/math/PlaneTest.cpp b/tests/core/math/PlaneTest.cpp index 73e7d56c73808062b320609666219077e374398c..12b1f32d084f38dd29d2386a54e2aeaa2e6f1ebc 100644 --- a/tests/core/math/PlaneTest.cpp +++ b/tests/core/math/PlaneTest.cpp @@ -36,10 +36,10 @@ using math::Plane; template < typename scalar_t > struct RandomPointGenerator { - typedef walberla::Vector3<scalar_t> vector_t; + using vector_t = walberla::Vector3<scalar_t>; typedef std::mersenne_twister_engine< walberla::uint32_t, 32, 351, 175, 19, 0xccab8ee7, 11, 0xffffffff, 7, 0x31b6ab00, 15, 0xffe50000, 17, 0xa37d3c92 > mt11213b; - typedef mt11213b RandomNumberEngine; - typedef std::normal_distribution<scalar_t> NormalDistribution; + using RandomNumberEngine = mt11213b; + using NormalDistribution = std::normal_distribution<scalar_t>; RandomPointGenerator( const vector_t & mu, const vector_t & sigma ) { @@ -99,7 +99,7 @@ int main(int argc, char * argv[]) mpi::Environment mpiEnv( argc, argv ); - typedef Vector3<real_t> Vec3Real; + using Vec3Real = Vector3<real_t>; Plane p( Vec3Real( real_t(0), real_t(0), real_t(0) ), Vec3Real( real_t(1), real_t(0), real_t(0) ) ); diff --git a/tests/core/math/equation_system/EquationSolverTest.cpp b/tests/core/math/equation_system/EquationSolverTest.cpp index 4d4fec40cc0d76bffab3c3aed814d1edd830dd26..4319769cfc8790368de21be1d261d6b5f13d4e04 100644 --- a/tests/core/math/equation_system/EquationSolverTest.cpp +++ b/tests/core/math/equation_system/EquationSolverTest.cpp @@ -81,23 +81,23 @@ int equationInput(){ std::vector<std::string> eqStringList; //// Parameters - eqStringList.push_back( "dt = 2e-7"); - eqStringList.push_back( "dx = 5e-6"); - eqStringList.push_back( "eta = 0.0001"); - eqStringList.push_back( "omega = 1.95"); - eqStringList.push_back( "rho = 1000"); + eqStringList.emplace_back("dt = 2e-7"); + eqStringList.emplace_back("dx = 5e-6"); + eqStringList.emplace_back("eta = 0.0001"); + eqStringList.emplace_back("omega = 1.95"); + eqStringList.emplace_back("rho = 1000"); //// LBM Equations - eqStringList.push_back( "'rho_L' = 1.0"); - eqStringList.push_back( "'dt_L' = 1.0"); - eqStringList.push_back( "'dx_L' = 1.0"); - eqStringList.push_back( "'c' = 'dx_L' / 'dt_L'"); - eqStringList.push_back( "'nu' = 'eta' / 'rho'"); - eqStringList.push_back( "'nu_L' = 'eta_L' / 'rho_L'"); - eqStringList.push_back( "'dt' = ( 0.1 * 'dx' ) / 'maxOcurringPhysVel'"); - eqStringList.push_back( "'cs' = ( 1.0 / ( 3.0 ^ 0.5 ) ) * 'c'"); - eqStringList.push_back( "'omega' = 1.0 / 'tau'"); - eqStringList.push_back( "'nu_L' = ( 'cs' ^ 2.0 ) * ( 'tau' - ( 0.5 * 'dt_L' ) )"); + eqStringList.emplace_back("'rho_L' = 1.0"); + eqStringList.emplace_back("'dt_L' = 1.0"); + eqStringList.emplace_back("'dx_L' = 1.0"); + eqStringList.emplace_back("'c' = 'dx_L' / 'dt_L'"); + eqStringList.emplace_back("'nu' = 'eta' / 'rho'"); + eqStringList.emplace_back("'nu_L' = 'eta_L' / 'rho_L'"); + eqStringList.emplace_back("'dt' = ( 0.1 * 'dx' ) / 'maxOcurringPhysVel'"); + eqStringList.emplace_back("'cs' = ( 1.0 / ( 3.0 ^ 0.5 ) ) * 'c'"); + eqStringList.emplace_back("'omega' = 1.0 / 'tau'"); + eqStringList.emplace_back("'nu_L' = ( 'cs' ^ 2.0 ) * ( 'tau' - ( 0.5 * 'dt_L' ) )"); /* // Unsolvable: // Parameters @@ -171,7 +171,7 @@ int unitTest(double v) } int unitTests(unsigned int count){ - srand( static_cast<unsigned int>(time(NULL)) ); + srand( static_cast<unsigned int>(time(nullptr)) ); double values[] = {0.0, 1.0, 1e-15, 1e+15}; unsigned int size = 4; diff --git a/tests/core/mpi/BufferSystemTest.cpp b/tests/core/mpi/BufferSystemTest.cpp index a6104a87ed537e76b3ce273f3aaf443d838b97e5..a57d24123ed8269d30e71112f4780ce72737b8e6 100644 --- a/tests/core/mpi/BufferSystemTest.cpp +++ b/tests/core/mpi/BufferSystemTest.cpp @@ -41,7 +41,7 @@ using namespace std::literals::chrono_literals; -typedef std::mt19937 base_generator_type; +using base_generator_type = std::mt19937; /** * Utility function for sleeping a random time @@ -55,7 +55,7 @@ void randomSleep( int maxTimeInMs = 20 ) counter += 100; int rank = MPIManager::instance()->worldRank(); - unsigned int seed = static_cast<unsigned int>(std::time(0)) + static_cast<unsigned int>(rank*1000) + counter; + unsigned int seed = static_cast<unsigned int>(std::time(nullptr)) + static_cast<unsigned int>(rank*1000) + counter; generator.seed(seed); std::uniform_int_distribution<> uni_dist(0,maxTimeInMs); diff --git a/tests/core/mpi/SetReductionTest.cpp b/tests/core/mpi/SetReductionTest.cpp index d8dcc52ee95264f5cc2bb026412a721d4e86deeb..03822b995adf3c6482733fc3c9b53328d3c5cdc7 100644 --- a/tests/core/mpi/SetReductionTest.cpp +++ b/tests/core/mpi/SetReductionTest.cpp @@ -103,7 +103,7 @@ void testStrings() std::vector< std::string > reducedValuesUnion = mpi::allReduceSet( values, mpi::UNION ); - values.push_back( "GRAPES" ); + values.emplace_back("GRAPES" ); std::vector< std::string > reducedValuesIntersection = mpi::allReduceSet( values, mpi::INTERSECTION ); if( numProcesses == 1 ) diff --git a/tests/core/selectable/SetSelectableObjectTest.cpp b/tests/core/selectable/SetSelectableObjectTest.cpp index bbef76361d80d750bb69319077f1fa92bd918f1a..7e3ffec4a7d0146d2c704a79c257d7a9d6725bf1 100644 --- a/tests/core/selectable/SetSelectableObjectTest.cpp +++ b/tests/core/selectable/SetSelectableObjectTest.cpp @@ -41,7 +41,7 @@ int main( int /*argc*/, char** /*argv*/ ) { debug::enterTestMode(); - typedef Set<size_t> A; + using A = Set<size_t>; selectable::SetSelectableObject< std::string, size_t > container; @@ -64,21 +64,21 @@ int main( int /*argc*/, char** /*argv*/ ) { container.get( functions, A(1)+A(2)+A(3) ); expected.clear(); - expected.push_back("function_1"); - expected.push_back("function_5"); + expected.emplace_back("function_1"); + expected.emplace_back("function_5"); WALBERLA_CHECK_EQUAL( functions, expected ); WALBERLA_CHECK_EQUAL( container.get( function, A(1)+A(2)+A(3)+A(4) ), static_cast< size_t >(1) ); expected.clear(); - expected.push_back("function_4"); + expected.emplace_back("function_4"); WALBERLA_CHECK_EQUAL( function, expected[0] ); WALBERLA_CHECK_EQUAL( container.get( function, A(1)+A(2) ), static_cast< size_t >(1) ); expected.clear(); - expected.push_back("function_3"); + expected.emplace_back("function_3"); WALBERLA_CHECK_EQUAL( function, expected[0] ); WALBERLA_CHECK_EQUAL( container.get( function, A(1)+A(2)+A(3)+A(5)+A(6)+A(7) ), static_cast< size_t >(3) ); @@ -87,16 +87,16 @@ int main( int /*argc*/, char** /*argv*/ ) { container.get( functions, A(1)+A(2)+A(3)+A(5)+A(6)+A(7) ); expected.clear(); - expected.push_back("function_1"); - expected.push_back("function_2"); - expected.push_back("function_5"); + expected.emplace_back("function_1"); + expected.emplace_back("function_2"); + expected.emplace_back("function_5"); WALBERLA_CHECK_EQUAL( functions, expected ); WALBERLA_CHECK_EQUAL( container.get( function, A(1)+A(2)+A(3)+A(4)+A(5)+A(6)+A(7) ), static_cast< size_t >(1) ); expected.clear(); - expected.push_back("function_4"); + expected.emplace_back("function_4"); WALBERLA_CHECK_EQUAL( function, expected[0] ); WALBERLA_CHECK_EQUAL( container.get( function, A(3)+A(5)+A(6) ), static_cast< size_t >(2) ); @@ -105,27 +105,27 @@ int main( int /*argc*/, char** /*argv*/ ) { container.get( functions, A(3)+A(5)+A(6) ); expected.clear(); - expected.push_back("function_6"); - expected.push_back("function_7"); + expected.emplace_back("function_6"); + expected.emplace_back("function_7"); WALBERLA_CHECK_EQUAL( functions, expected ); WALBERLA_CHECK_EQUAL( container.get( function, A(1)+A(5)+A(6) ), static_cast< size_t >(1) ); expected.clear(); - expected.push_back("function_7"); + expected.emplace_back("function_7"); WALBERLA_CHECK_EQUAL( function, expected[0] ); WALBERLA_CHECK_EQUAL( container.get( function, A(4)+A(5)+A(6) ), static_cast< size_t >(1) ); expected.clear(); - expected.push_back("function_6"); + expected.emplace_back("function_6"); WALBERLA_CHECK_EQUAL( function, expected[0] ); WALBERLA_CHECK_EQUAL( container.get( function, A(7)+A(5)+A(6) ), static_cast< size_t >(1) ); expected.clear(); - expected.push_back("function_2"); + expected.emplace_back("function_2"); WALBERLA_CHECK_EQUAL( function, expected[0] ); functions.clear(); @@ -133,13 +133,13 @@ int main( int /*argc*/, char** /*argv*/ ) { functions.push_back( *it ); expected.clear(); - expected.push_back("function_1"); - expected.push_back("function_2"); - expected.push_back("function_3"); - expected.push_back("function_4"); - expected.push_back("function_5"); - expected.push_back("function_6"); - expected.push_back("function_7"); + expected.emplace_back("function_1"); + expected.emplace_back("function_2"); + expected.emplace_back("function_3"); + expected.emplace_back("function_4"); + expected.emplace_back("function_5"); + expected.emplace_back("function_6"); + expected.emplace_back("function_7"); WALBERLA_CHECK_EQUAL( functions, expected ); diff --git a/tests/core/timing/SweepTimeloopTimerReduction.cpp b/tests/core/timing/SweepTimeloopTimerReduction.cpp index 7fcc4f17fe05ca2cf82cf45a20b787f5a5d6f0d1..d071b0503d338b45ecccebb584d667754f52b4cd 100644 --- a/tests/core/timing/SweepTimeloopTimerReduction.cpp +++ b/tests/core/timing/SweepTimeloopTimerReduction.cpp @@ -63,8 +63,8 @@ int main( int argc, char ** argv ) walberla::MPIManager::instance()->useWorldComm(); // create StructuredBlockForest (encapsulates a newly created BlockForest) - auto bf = walberla::shared_ptr< BlockForest >( new BlockForest( walberla::uint_c( walberla::MPIManager::instance()->rank() ), sforest, true ) ); - auto sbf = walberla::shared_ptr< StructuredBlockForest >( new StructuredBlockForest( bf, 10, 10, 10 ) ); + auto bf = std::make_shared< BlockForest >( walberla::uint_c( walberla::MPIManager::instance()->rank() ), sforest, true ); + auto sbf = std::make_shared< StructuredBlockForest >( bf, 10, 10, 10 ); sbf->createCellBoundingBoxes(); diff --git a/tests/field/FieldTiming.cpp b/tests/field/FieldTiming.cpp index 98271eec2d197428650cfc98aff1fb4454522906..4eea53a3362c15761edbac70315910488280c820 100644 --- a/tests/field/FieldTiming.cpp +++ b/tests/field/FieldTiming.cpp @@ -85,7 +85,7 @@ double sumHandWrittenPlusIf(const DoubleField & field) const double* end = &field.get(cell_idx_c(field.xSize())-1,y,z,f)+1; for(; begin!=end; ++begin) { sum += *begin; - if(begin == 0) // Artificial if condition to simulate iterators + if(begin == nullptr) // Artificial if condition to simulate iterators cout << "Should not happen" << endl; } } @@ -197,7 +197,7 @@ double initFieldRandom(DoubleField & field) return sum; } -typedef std::function<double (const DoubleField & field)> Func; +using Func = std::function<double (const DoubleField &)>; void timeFunction( WcTimer & timer, Func f, const DoubleField & field, double sum, double epsilon, int nrExecutions=30 ) { for(int i=0 ; i < nrExecutions; ++i) diff --git a/tests/field/FlagFieldTest.cpp b/tests/field/FlagFieldTest.cpp index a73c506fa1d67f1ff7f7dae4d26e02d09614ef8e..97b9d382ee34b5bfd732756b893faf298eb4de70 100644 --- a/tests/field/FlagFieldTest.cpp +++ b/tests/field/FlagFieldTest.cpp @@ -65,14 +65,14 @@ void registerTest() WALBERLA_CHECK(overFlow); vector<string> names; - names.push_back("Flag1"); - names.push_back("Flag2"); - names.push_back("Flag3"); - names.push_back("Flag4"); - names.push_back("Flag5"); - names.push_back("Flag6"); - names.push_back("Flag7"); - names.push_back("Flag8"); + names.emplace_back("Flag1"); + names.emplace_back("Flag2"); + names.emplace_back("Flag3"); + names.emplace_back("Flag4"); + names.emplace_back("Flag5"); + names.emplace_back("Flag6"); + names.emplace_back("Flag7"); + names.emplace_back("Flag8"); for(size_t i=0; i<names.size(); ++i) { @@ -119,7 +119,7 @@ void shallowCopyTest() { // Test shallow copy - typedef FlagField<wlb::uint8_t> FField; + using FField = FlagField<wlb::uint8_t>; FField ff ( 3,3,3,1 ); ff.registerFlag("FirstFlag"); @@ -152,7 +152,7 @@ void shallowCopyTest() void printingTest() { - typedef FlagField<wlb::uint8_t> FField; + using FField = FlagField<wlb::uint8_t>; FField ff ( 3,3,3,1 ); auto ns = ff.registerFlag("NoSlip"); auto fs = ff.registerFlag("FreeSlip"); @@ -172,7 +172,7 @@ void printingTest() void neighborhoodTest() { - typedef FlagField<wlb::uint8_t> FField; + using FField = FlagField<wlb::uint8_t>; FField ff ( 3,3,3,1 ); auto i = ff.registerFlag("Interface"); auto l = ff.registerFlag("Liquid"); diff --git a/tests/field/adaptors/AdaptorTest.cpp b/tests/field/adaptors/AdaptorTest.cpp index bcfc43efd4e9581ee86da4cc9982b7bbfb97ab35..109c348e344803d4816b1c58e4d3602ebdab4ddd 100644 --- a/tests/field/adaptors/AdaptorTest.cpp +++ b/tests/field/adaptors/AdaptorTest.cpp @@ -43,9 +43,9 @@ namespace walberla { -typedef lbm::D3Q19< lbm::collision_model::SRT > LatticeModel_T; +using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; -typedef lbm::PdfField< LatticeModel_T > PdfField; +using PdfField = lbm::PdfField<LatticeModel_T>; typedef GhostLayerField<real_t,1 > ScalarField; typedef GhostLayerField<Vector3<real_t>,1 > VectorField; @@ -54,9 +54,9 @@ template<typename Field_T> class DoubledValueOfField { public: - typedef Field_T basefield_t; - typedef typename Field_T::const_base_iterator basefield_iterator; - typedef typename Field_T::value_type value_type; + using basefield_t = Field_T; + using basefield_iterator = typename Field_T::const_base_iterator; + using value_type = typename Field_T::value_type; static_assert( basefield_t::F_SIZE >= 2, "Only for fields with F_SIZE >=2 " ); @@ -84,7 +84,7 @@ void iteratorTest() GhostLayerField<real_t, 2> field ( 4, 4, 3, 2, MAGIC_SRC ); // adapter reduces field to have only one f and one ghost layer - typedef DoubledValueOfField< decltype(field) > Functor; + using Functor = DoubledValueOfField<decltype(field)>; field::GhostLayerFieldAdaptor<Functor, 1 > adaptor ( field ); uint_t ctr = 0; diff --git a/tests/field/distributors/DistributionTest.cpp b/tests/field/distributors/DistributionTest.cpp index 3b9a693982efb6526b845d188628c3d2d3355155..daf4784ba15e9ca733b49622eead02b63b8c9c41 100644 --- a/tests/field/distributors/DistributionTest.cpp +++ b/tests/field/distributors/DistributionTest.cpp @@ -38,8 +38,8 @@ using namespace walberla; const uint_t FieldGhostLayers( 1 ); -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< real_t, 1> ScalarField_T; typedef GhostLayerField< Vector3<real_t>, 1> Vec3Field_T; @@ -249,7 +249,7 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); real_t distributionValue(real_t(100)); auto containingBlockID = blocks->getBlock(distributionPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); @@ -268,7 +268,7 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & Vector3<real_t> distributionPoint(real_t(5.4),real_t(2.1),real_t(3.2)); Vector3<real_t> distributionValue(real_t(100), real_t(-10), real_t(1)); auto containingBlockID = blocks->getBlock(distributionPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<Vec3Distributor_T>(vectorDistributorID); distPtr->distribute(distributionPoint, &distributionValue); @@ -296,7 +296,7 @@ void testNearestNeighborDistributor( const shared_ptr<StructuredBlockStorage> & distributionValue[1] = real_t(-10); distributionValue[2] = real_t(1); auto containingBlockID = blocks->getBlock(distributionPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<MultiComponentDistributor_T>(multiComponentDistributorID); distPtr->distribute(distributionPoint, distributionValue.begin()); @@ -334,7 +334,7 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); real_t distributionValue(real_t(100)); auto containingBlockID = blocks->getBlock(distributionPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); @@ -353,7 +353,7 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c Vector3<real_t> distributionPoint(real_t(5.4),real_t(2.1),real_t(3.2)); Vector3<real_t> distributionValue(real_t(100), real_t(-10), real_t(1)); auto containingBlockID = blocks->getBlock(distributionPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<Vec3Distributor_T>(vectorDistributorID); distPtr->distribute(distributionPoint, &distributionValue); @@ -381,7 +381,7 @@ void testKernelDistributor( const shared_ptr<StructuredBlockStorage> & blocks, c distributionValue[1] = real_t(-10); distributionValue[2] = real_t(1); auto containingBlockID = blocks->getBlock(distributionPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { auto distPtr = containingBlockID->getData<MultiComponentDistributor_T>(multiComponentDistributorID); distPtr->distribute(distributionPoint, distributionValue.begin()); @@ -415,7 +415,7 @@ void testNearestNeighborDistributorAtBoundary( const shared_ptr<StructuredBlockS Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); real_t distributionValue(real_t(100)); auto containingBlockID = blocks->getBlock(distributionPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } @@ -433,7 +433,7 @@ void testNearestNeighborDistributorAtBoundary( const shared_ptr<StructuredBlockS Vector3<real_t> distributionPoint(real_t(2.7), real_t(2.1), real_t(1.1)); real_t distributionValue(real_t(100)); auto containingBlockID = blocks->getBlock(distributionPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } @@ -459,7 +459,7 @@ void testKernelDistributorAtBoundary( const shared_ptr<StructuredBlockStorage> & Vector3<real_t> distributionPoint(real_t(1.9), real_t(2.1), real_t(2.1)); real_t distributionValue(real_t(100)); auto containingBlockID = blocks->getBlock(distributionPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } @@ -477,7 +477,7 @@ void testKernelDistributorAtBoundary( const shared_ptr<StructuredBlockStorage> & Vector3<real_t> distributionPoint(real_t(2.7), real_t(2.1), real_t(1.1)); real_t distributionValue(real_t(100)); auto containingBlockID = blocks->getBlock(distributionPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { auto distPtr = containingBlockID->getData<ScalarDistributor_T>(scalarDistributorID); distPtr->distribute(distributionPoint, &distributionValue); } diff --git a/tests/field/interpolators/FieldInterpolationTest.cpp b/tests/field/interpolators/FieldInterpolationTest.cpp index a98842aec7e01f92c98341701d9f28fcb5bc45e6..3571c3fd9cf154b98d88801301db89181e8b47b5 100644 --- a/tests/field/interpolators/FieldInterpolationTest.cpp +++ b/tests/field/interpolators/FieldInterpolationTest.cpp @@ -38,8 +38,8 @@ namespace field_interpolation_tests { const uint_t FieldGhostLayers( 1 ); -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< real_t, 1> ScalarField_T; typedef GhostLayerField< Vector3<real_t>, 1> Vec3Field_T; @@ -129,7 +129,7 @@ void testNearestNeighborFieldInterpolator( const shared_ptr<StructuredBlockStora { Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); @@ -142,7 +142,7 @@ void testNearestNeighborFieldInterpolator( const shared_ptr<StructuredBlockStora { Vector3<real_t> interpolationPoint(real_t(5.4),real_t(2.1),real_t(3.2)); auto containingBlockID = blocks->getBlock( interpolationPoint ); - if( containingBlockID != NULL ) { + if( containingBlockID != nullptr ) { Vector3<real_t> interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<Vec3FieldInterpolator_T>(vectorFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -156,7 +156,7 @@ void testNearestNeighborFieldInterpolator( const shared_ptr<StructuredBlockStora { Vector3<real_t> interpolationPoint(real_t(4.4),real_t(2.1),real_t(3.2)); auto containingBlockID = blocks->getBlock( interpolationPoint ); - if( containingBlockID != NULL ) { + if( containingBlockID != nullptr ) { std::vector<real_t> interpolatedValue(3, real_t(0)); auto interPtr = containingBlockID->getData<MultiComponentFieldInterpolator_T>(multiComponentFieldInterpolatorID); interPtr->get(interpolationPoint, interpolatedValue.begin()); @@ -182,7 +182,7 @@ void testTrilinearFieldInterpolator( const shared_ptr<StructuredBlockStorage> & { Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); @@ -195,7 +195,7 @@ void testTrilinearFieldInterpolator( const shared_ptr<StructuredBlockStorage> & { Vector3<real_t> interpolationPoint(real_t(5.4),real_t(2.1),real_t(3.2)); auto containingBlockID = blocks->getBlock( interpolationPoint ); - if( containingBlockID != NULL ) { + if( containingBlockID != nullptr ) { Vector3<real_t> interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<Vec3FieldInterpolator_T>(vectorFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -209,7 +209,7 @@ void testTrilinearFieldInterpolator( const shared_ptr<StructuredBlockStorage> & { Vector3<real_t> interpolationPoint(real_t(4.4),real_t(2.1),real_t(3.2)); auto containingBlockID = blocks->getBlock( interpolationPoint ); - if( containingBlockID != NULL ) { + if( containingBlockID != nullptr ) { std::vector<real_t> interpolatedValue(3, real_t(0)); auto interPtr = containingBlockID->getData<MultiComponentFieldInterpolator_T>(multiComponentFieldInterpolatorID); interPtr->get(interpolationPoint, interpolatedValue.begin()); @@ -235,7 +235,7 @@ void testKernelFieldInterpolator( const shared_ptr<StructuredBlockStorage> & blo { Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if( containingBlockID != NULL ) + if( containingBlockID != nullptr ) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); @@ -248,7 +248,7 @@ void testKernelFieldInterpolator( const shared_ptr<StructuredBlockStorage> & blo { Vector3<real_t> interpolationPoint(real_t(5.4),real_t(2.1),real_t(3.2)); auto containingBlockID = blocks->getBlock( interpolationPoint ); - if( containingBlockID != NULL ) { + if( containingBlockID != nullptr ) { Vector3<real_t> interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<Vec3FieldInterpolator_T>(vectorFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -262,7 +262,7 @@ void testKernelFieldInterpolator( const shared_ptr<StructuredBlockStorage> & blo { Vector3<real_t> interpolationPoint(real_t(4.4),real_t(2.1),real_t(3.2)); auto containingBlockID = blocks->getBlock( interpolationPoint ); - if( containingBlockID != NULL ) { + if( containingBlockID != nullptr ) { std::vector<real_t> interpolatedValue(3, real_t(0)); auto interPtr = containingBlockID->getData<MultiComponentFieldInterpolator_T>(multiComponentFieldInterpolatorID); interPtr->get(interpolationPoint, interpolatedValue.begin()); @@ -284,7 +284,7 @@ void testNearestNeighborFieldInterpolatorAtBoundary( const shared_ptr<Structured { Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -297,7 +297,7 @@ void testNearestNeighborFieldInterpolatorAtBoundary( const shared_ptr<Structured { Vector3<real_t> interpolationPoint(real_t(2.7), real_t(2.1), real_t(1.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -317,7 +317,7 @@ void testTrilinearFieldInterpolatorAtBoundary( const shared_ptr<StructuredBlockS { Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -330,7 +330,7 @@ void testTrilinearFieldInterpolatorAtBoundary( const shared_ptr<StructuredBlockS { Vector3<real_t> interpolationPoint(real_t(2.7), real_t(2.1), real_t(1.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -350,7 +350,7 @@ void testKernelFieldInterpolatorAtBoundary( const shared_ptr<StructuredBlockStor { Vector3<real_t> interpolationPoint(real_t(1.9), real_t(2.1), real_t(2.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); @@ -367,7 +367,7 @@ void testKernelFieldInterpolatorAtBoundary( const shared_ptr<StructuredBlockStor { Vector3<real_t> interpolationPoint(real_t(2.7), real_t(2.1), real_t(1.1)); auto containingBlockID = blocks->getBlock(interpolationPoint); - if (containingBlockID != NULL) { + if (containingBlockID != nullptr) { real_t interpolatedValue(real_t(0)); auto interPtr = containingBlockID->getData<ScalarFieldInterpolator_T>(scalarFieldInterpolatorID); interPtr->get(interpolationPoint, &interpolatedValue); diff --git a/tests/gather/GatherSchemeTest.cpp b/tests/gather/GatherSchemeTest.cpp index 3c1b63868f225b007c6d23bc673078bf5008784f..438d731dee22992aa9020560e98d9eead4575398 100644 --- a/tests/gather/GatherSchemeTest.cpp +++ b/tests/gather/GatherSchemeTest.cpp @@ -95,7 +95,7 @@ public: : cellInterval_ ( ci ) {} - virtual void process(const std::vector<std::vector<real_t> > & data) + void process(const std::vector<std::vector<real_t> > & data) override { uint_t counter =0; for( auto it = cellInterval_.begin(); it != cellInterval_.end(); ++it ) diff --git a/tests/gather/MPIGatherSchemeTest.cpp b/tests/gather/MPIGatherSchemeTest.cpp index 1bc3f7de095adf9d452fc9ab584536238e0e4778..aecb1e1848dd80ae3544dc4f464e67b42dd72a4f 100644 --- a/tests/gather/MPIGatherSchemeTest.cpp +++ b/tests/gather/MPIGatherSchemeTest.cpp @@ -39,11 +39,11 @@ namespace walberla { class TestGatherPackInfo : public gather::GatherPackInfo { public: - TestGatherPackInfo() {} - virtual ~TestGatherPackInfo() {} + TestGatherPackInfo() = default; + ~TestGatherPackInfo() override = default; - virtual void packData ( const IBlock *, mpi::GenericSendBuffer<unsigned char> & outBuffer ) + void packData ( const IBlock *, mpi::GenericSendBuffer<unsigned char> & outBuffer ) override { auto mpi = MPIManager::instance(); @@ -56,7 +56,7 @@ public: } - virtual void unpackData( mpi::GenericRecvBuffer<unsigned char> & buffer ) + void unpackData( mpi::GenericRecvBuffer<unsigned char> & buffer ) override { int nrOfItems; buffer >> nrOfItems; @@ -68,7 +68,7 @@ public: receivedRanks_.insert( nrOfItems ); } - virtual void gatherFinished() + void gatherFinished() override { auto mpi = MPIManager::instance(); diff --git a/tests/geometry/Functions.cpp b/tests/geometry/Functions.cpp index f4341fae6b10f860d63f9311219aa6a3949d892a..83da9eac2452e9a26a81a0fac2964febf817de66 100644 --- a/tests/geometry/Functions.cpp +++ b/tests/geometry/Functions.cpp @@ -27,7 +27,7 @@ using namespace walberla; using namespace walberla::geometry; -typedef math::Vector3<real_t> Vec3; +using Vec3 = math::Vector3<real_t>; int main( int argc, char** argv ) { diff --git a/tests/geometry/ScalarFieldFromBodyTest.cpp b/tests/geometry/ScalarFieldFromBodyTest.cpp index 095f411e392708312c656d90b3ae2231d7d3b2a5..d6c29f3d1b4ddd97b36155b78e9a8087ea426867 100644 --- a/tests/geometry/ScalarFieldFromBodyTest.cpp +++ b/tests/geometry/ScalarFieldFromBodyTest.cpp @@ -38,6 +38,7 @@ #include "timeloop/SweepTimeloop.h" #include <fstream> +#include <memory> namespace walberla { @@ -269,8 +270,8 @@ int main( int argc, char ** argv ) using namespace geometry::initializer; - auto geometryInitializationManager = shared_ptr<InitializationManager> ( new InitializationManager( blocks->getBlockStorage() ) ); - auto freeSurfaceInitializer = shared_ptr<OverlapFieldFromBody> ( new OverlapFieldFromBody( *blocks, scalarFieldID, "drop", "bubble" ) ); + auto geometryInitializationManager = std::make_shared<InitializationManager> ( blocks->getBlockStorage() ); + auto freeSurfaceInitializer = std::make_shared<OverlapFieldFromBody> ( *blocks, scalarFieldID, "drop", "bubble" ); geometryInitializationManager->registerInitializer( "FreeSurface", freeSurfaceInitializer ); diff --git a/tests/geometry/ScalarFieldFromGrayScaleImageTest.cpp b/tests/geometry/ScalarFieldFromGrayScaleImageTest.cpp index ec63490c6e250abbb18a956c7159ceaddd243f36..ea753bab2ac73d477ed6fbcf29d87ed65de42501 100644 --- a/tests/geometry/ScalarFieldFromGrayScaleImageTest.cpp +++ b/tests/geometry/ScalarFieldFromGrayScaleImageTest.cpp @@ -35,6 +35,7 @@ #include "timeloop/SweepTimeloop.h" #include <fstream> +#include <memory> namespace walberla { @@ -66,8 +67,8 @@ int main( int argc, char ** argv ) // Geometry Initialization from config file using namespace geometry::initializer; - auto geometryInitializationManager = shared_ptr<InitializationManager> ( new InitializationManager( blocks->getBlockStorage() ) ); - auto freeSurfaceInitializer = shared_ptr<ScalarFieldFromGrayScaleImage> ( new ScalarFieldFromGrayScaleImage( *blocks, scalarFieldID ) ); + auto geometryInitializationManager = std::make_shared<InitializationManager> ( blocks->getBlockStorage() ); + auto freeSurfaceInitializer = std::make_shared<ScalarFieldFromGrayScaleImage> ( *blocks, scalarFieldID ); geometryInitializationManager->registerInitializer( "FreeSurfaceImage", freeSurfaceInitializer ); diff --git a/tests/geometry/VoxelFileTest.cpp b/tests/geometry/VoxelFileTest.cpp index e93b1cfa157ae4c023c8fe1bcbf330d2e3ac8775..726616dc11a6c68ef962ee5ac9bdfe462b95ce81 100644 --- a/tests/geometry/VoxelFileTest.cpp +++ b/tests/geometry/VoxelFileTest.cpp @@ -293,7 +293,7 @@ void runTests(const std::string & filename, size_t xSize, size_t ySize, size_t z data.clear(); - typedef boost::multi_array_types::index bindex; + using bindex = boost::multi_array_types::index; boost::multi_array<T, 3> reference(boost::extents[walberla::numeric_cast<bindex>(zSize)][walberla::numeric_cast<bindex>(ySize)][walberla::numeric_cast<bindex>(xSize)]); makeRandomMultiArray(reference); diff --git a/tests/gui/GuiPdfView.cpp b/tests/gui/GuiPdfView.cpp index e09f74f8d8993966b287f44a1ae3698bc190dd82..279db04f82961d69ba4c9dc8ccc1663dfdd4446f 100644 --- a/tests/gui/GuiPdfView.cpp +++ b/tests/gui/GuiPdfView.cpp @@ -40,7 +40,7 @@ namespace walberla { typedef GhostLayerField<real_t,19> PdfField; typedef GhostLayerField<real_t,1> ScalarField; typedef GhostLayerField<Vector3<real_t>,1 > VectorField; -typedef FlagField<walberla::uint32_t > FField; +using FField = FlagField<walberla::uint32_t>; int main(int argc, char **argv) diff --git a/tests/gui/SimpleGuiRun.cpp b/tests/gui/SimpleGuiRun.cpp index c04272d4eea56a047ef377ab1961a4add6d3c461..cb8d39af582fadb2b05bf8dcfaac1bda22dad72f 100644 --- a/tests/gui/SimpleGuiRun.cpp +++ b/tests/gui/SimpleGuiRun.cpp @@ -46,9 +46,9 @@ namespace walberla { typedef GhostLayerField<real_t,19> PdfField; typedef GhostLayerField<real_t,1> ScalarField; typedef GhostLayerField<Vector3<real_t>,1 > VectorField; -typedef FlagField<walberla::uint32_t > FField; +using FField = FlagField<walberla::uint32_t>; -typedef lbm::D3Q19<lbm::collision_model::SRT> LatticeModel; +using LatticeModel = lbm::D3Q19<lbm::collision_model::SRT>; int main(int argc, char **argv ) diff --git a/tests/lbm/BoundaryHandlingCommunication.cpp b/tests/lbm/BoundaryHandlingCommunication.cpp index d8e3a7c82f4fbdbacbb15652b5006cb61e2fc474..781b7ca9cfe622768a27d0e9578981c2de7ce16a 100644 --- a/tests/lbm/BoundaryHandlingCommunication.cpp +++ b/tests/lbm/BoundaryHandlingCommunication.cpp @@ -65,8 +65,8 @@ namespace walberla{ -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; const FlagUID Fluid_Flag( "fluid" ); const FlagUID UBB_Flag( "velocity bounce back" ); @@ -108,7 +108,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const StructuredBlockStorage * const storage ) const { - typedef lbm::PdfField<LatticeModel_T> PdfField_T; + using PdfField_T = lbm::PdfField< LatticeModel_T >; WALBERLA_ASSERT_NOT_NULLPTR( block ); WALBERLA_ASSERT_NOT_NULLPTR( storage ); @@ -267,7 +267,7 @@ int main( int argc, char ** argv ) // D3Q19 // /////////// - typedef lbm::D3Q19< lbm::collision_model::TRT > D3Q19_TRT_COMP; + using D3Q19_TRT_COMP = lbm::D3Q19<lbm::collision_model::TRT>; D3Q19_TRT_COMP d3q19comp = D3Q19_TRT_COMP( lbm::collision_model::TRT::constructWithMagicNumber( GlobalOmega ) ); BlockDataID pdfFieldId1 = lbm::addPdfFieldToStorage( blocks, "pdf field (D3Q19 with ghosts set)", d3q19comp ); @@ -315,7 +315,7 @@ int main( int argc, char ** argv ) // D3Q27 // /////////// - typedef lbm::D3Q27< lbm::collision_model::TRT > D3Q27_TRT_COMP; + using D3Q27_TRT_COMP = lbm::D3Q27<lbm::collision_model::TRT>; D3Q27_TRT_COMP d3q27comp = D3Q27_TRT_COMP( lbm::collision_model::TRT::constructWithMagicNumber( GlobalOmega ) ); BlockDataID pdfFieldId3 = lbm::addPdfFieldToStorage( blocks, "pdf field (D3Q27 with ghosts set)", d3q27comp ); diff --git a/tests/lbm/DiffusionTest.cpp b/tests/lbm/DiffusionTest.cpp index 4bed8c474f97b469ff3893fcfe3049fa4fe10a3c..c1aa845088b935ef751deb37c31df158dc5bab13 100644 --- a/tests/lbm/DiffusionTest.cpp +++ b/tests/lbm/DiffusionTest.cpp @@ -84,12 +84,12 @@ namespace walberla { -typedef uint8_t flag_t; -typedef Vector3< real_t > vec3_t; +using flag_t = uint8_t; +using vec3_t = Vector3<real_t>; typedef GhostLayerField< real_t, 1 > ScalarField; typedef GhostLayerField< vec3_t, 1 > VectorField; -typedef FlagField < flag_t > MyFlagField; +using MyFlagField = FlagField<flag_t>; typedef lbm::D3Q19< lbm::collision_model::SRT, true, lbm::force_model::Correction<VectorField>, 1 > AdvDiffLatticeModel_Corr; typedef lbm::D3Q19< lbm::collision_model::SRT, true, lbm::force_model::None, 1 > AdvDiffLatticeModel_None; @@ -170,8 +170,8 @@ template< typename AdvDiffLatticeModel > int run( int argc, char **argv ) { // typedefs - typedef typename AdvDiffLatticeModel::Stencil AdvDiffStencil; - typedef lbm::PdfField< AdvDiffLatticeModel > AdvDiffPDFField; + using AdvDiffStencil = typename AdvDiffLatticeModel::Stencil; + using AdvDiffPDFField = lbm::PdfField<AdvDiffLatticeModel>; #ifdef _OPENMP omp_set_num_threads( std::max( omp_get_num_threads()>>1, 4 ) ); diff --git a/tests/lbm/Poiseuille.cpp b/tests/lbm/Poiseuille.cpp index 7f74d5eac669b7f9d9732386cebccb9e74fcf1df..fecccb13da47d29eaa26ed83aa63dd03c6a7baa2 100644 --- a/tests/lbm/Poiseuille.cpp +++ b/tests/lbm/Poiseuille.cpp @@ -88,7 +88,7 @@ namespace walberla { -typedef walberla::uint8_t flag_t; +using flag_t = walberla::uint8_t; // Compressible SRT with constant force using lbm::collision_model::SRT; @@ -96,8 +96,8 @@ using lbm::force_model::GuoConstant; typedef lbm::D3Q19< SRT, true, GuoConstant> LM; // Fields -typedef lbm::PdfField<LM> PdfField; -typedef FlagField<flag_t> FField; +using PdfField = lbm::PdfField<LM>; +using FField = FlagField<flag_t>; typedef GhostLayerField<Vector3<real_t>,1 > VectorField; typedef GhostLayerField<real_t,1 > ScalarField; diff --git a/tests/lbm/SweepEquivalenceTest.cpp b/tests/lbm/SweepEquivalenceTest.cpp index e29bab05f4a4a503cd5322f92b5ffeb0a0697b7e..2c8f0e15a9c9fd018f949c20b6a150e7d565d7a1 100644 --- a/tests/lbm/SweepEquivalenceTest.cpp +++ b/tests/lbm/SweepEquivalenceTest.cpp @@ -72,8 +72,8 @@ namespace walberla { -typedef walberla::uint64_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint64_t; +using FlagField_T = FlagField<flag_t>; const FlagUID Fluid_Flag( "fluid" ); const FlagUID UBB_Flag( "velocity bounce back" ); @@ -119,7 +119,7 @@ template< typename LatticeModel_T > typename MyBoundaryHandling<LatticeModel_T>::BoundaryHandling_T * MyBoundaryHandling<LatticeModel_T>::operator()( IBlock * const block, const StructuredBlockStorage * const storage ) const { - typedef lbm::PdfField<LatticeModel_T> PdfField_T; + using PdfField_T = lbm::PdfField< LatticeModel_T >; WALBERLA_ASSERT_NOT_NULLPTR( block ); WALBERLA_ASSERT_NOT_NULLPTR( storage ); @@ -256,8 +256,8 @@ struct AddTRTTest< LatticeModel_T, typename boost::enable_if_c< boost::is_same< template< typename LatticeModel1_T, typename LatticeModel2_T > void check( const shared_ptr< StructuredBlockForest > & blocks, const BlockDataID & fieldId1, const BlockDataID & fieldId2 ) { - typedef lbm::PdfField< LatticeModel1_T > PdfField1_T; - typedef lbm::PdfField< LatticeModel2_T > PdfField2_T; + using PdfField1_T = lbm::PdfField< LatticeModel1_T >; + using PdfField2_T = lbm::PdfField< LatticeModel2_T >; for( auto block = blocks->begin(); block != blocks->end(); ++block ) { @@ -363,7 +363,7 @@ int main( int argc, char ** argv ) // D3Q19, incompressible // /////////////////////////// - fieldIds.push_back( std::vector< BlockDataID >() ); + fieldIds.emplace_back( ); // SRT @@ -490,7 +490,7 @@ int main( int argc, char ** argv ) // D3Q19, compressible // ///////////////////////// - fieldIds.push_back( std::vector< BlockDataID >() ); + fieldIds.emplace_back( ); // SRT @@ -553,7 +553,7 @@ int main( int argc, char ** argv ) // D3Q27, incompressible // /////////////////////////// - fieldIds.push_back( std::vector< BlockDataID >() ); + fieldIds.emplace_back( ); // SRT @@ -616,7 +616,7 @@ int main( int argc, char ** argv ) // D3Q27, compressible // ///////////////////////// - fieldIds.push_back( std::vector< BlockDataID >() ); + fieldIds.emplace_back( ); // SRT @@ -651,7 +651,7 @@ int main( int argc, char ** argv ) // TRT <-> MRT COMPARISON // //////////////////////////// - fieldIds.push_back( std::vector< BlockDataID >() ); + fieldIds.emplace_back( ); // TRT @@ -703,7 +703,7 @@ int main( int argc, char ** argv ) // D2Q9, incompressible // ////////////////////////// - fieldIds.push_back( std::vector< BlockDataID >() ); + fieldIds.emplace_back( ); // SRT diff --git a/tests/lbm/boundary/DiffusionDirichlet.cpp b/tests/lbm/boundary/DiffusionDirichlet.cpp index 807dd39ffee30805ce33ab979a1ea6fcb06a5fe9..98215ff647f6af4f81d85c4d484b09574eecb703 100644 --- a/tests/lbm/boundary/DiffusionDirichlet.cpp +++ b/tests/lbm/boundary/DiffusionDirichlet.cpp @@ -84,17 +84,17 @@ namespace walberla { -typedef uint8_t flag_t; -typedef Vector3< real_t > vec3_t; +using flag_t = uint8_t; +using vec3_t = Vector3<real_t>; typedef lbm::D3Q19< lbm::collision_model::SRT, true, lbm::force_model::None, 1 > LM; -typedef LM::CommunicationStencil CommunicationStencil; +using CommunicationStencil = LM::CommunicationStencil; -typedef lbm::PdfField < LM > MyPdfField; +using MyPdfField = lbm::PdfField<LM>; typedef GhostLayerField< real_t, 1 > ScalarField; typedef GhostLayerField< Vector3<real_t>, 1> VectorField; -typedef FlagField < flag_t > MyFlagField; +using MyFlagField = FlagField<flag_t>; typedef lbm::DefaultDiffusionBoundaryHandlingFactory< LM, MyFlagField > MyBoundaryHandling; @@ -104,7 +104,7 @@ const FlagUID& getFluidFlag(){ static FlagUID uid( "Fluid" ); return uid; } class PlugFlow { public: - typedef std::complex<real_t> cplx_t; + using cplx_t = std::complex<real_t>; PlugFlow( real_t L, real_t H, real_t u, real_t k ) : period_( real_t(2)*math::PI/L ), @@ -196,7 +196,7 @@ class CosBoundaryConfiguration : public MyBoundaryHandling::DiffusionDirichlet_T public: CosBoundaryConfiguration( real_t period ) : period_( period ){} - virtual void val( real_t& _val, cell_idx_t x, cell_idx_t, cell_idx_t ) const { _val = real_c( cos( period_*( real_c(x) + real_c(0.5) ) ) ); } + void val( real_t& _val, cell_idx_t x, cell_idx_t, cell_idx_t ) const override { _val = real_c( cos( period_*( real_c(x) + real_c(0.5) ) ) ); } private: const real_t period_; diff --git a/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp b/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp index 1d4e95008f8987b97e9606d8230bfae2fa6b4990..30c95b82abe998b1ced956ea650fd6ec7c9f7e8a 100644 --- a/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp +++ b/tests/lbm/boundary/SimpleDiffusionDirichlet.cpp @@ -93,11 +93,11 @@ typedef GhostLayerField< Vector3<real_t>, 1 > VectorField; typedef lbm::D3Q19< lbm::collision_model::SRT, true, lbm::force_model::None, 1 > LM; -typedef LM::CommunicationStencil CommunicationStencil; -typedef lbm::PdfField< LM > MyPdfField; +using CommunicationStencil = LM::CommunicationStencil; +using MyPdfField = lbm::PdfField<LM>; -typedef uint8_t flag_t; -typedef FlagField< flag_t > MyFlagField; +using flag_t = uint8_t; +using MyFlagField = FlagField<flag_t>; typedef lbm::DefaultDiffusionBoundaryHandlingFactory< LM, MyFlagField > MyBoundaryHandling; diff --git a/tests/lbm/boundary/SimplePABTest.cpp b/tests/lbm/boundary/SimplePABTest.cpp index 6b07233dffbff785e02d0698d7ae0bce0d58fde2..31bc21a747617028e54cd2be91bfa537a60ca498 100644 --- a/tests/lbm/boundary/SimplePABTest.cpp +++ b/tests/lbm/boundary/SimplePABTest.cpp @@ -62,12 +62,12 @@ namespace walberla { - typedef uint8_t flag_t; + using flag_t = uint8_t; typedef lbm::D3Q19< lbm::collision_model::SRT, false > LatticeModel; - typedef LatticeModel::Stencil Stencil; - typedef LatticeModel::CommunicationStencil CommunicationStencil; - typedef lbm::PdfField< LatticeModel > PDFField; - typedef FlagField< flag_t > MyFlagField; + using Stencil = LatticeModel::Stencil; + using CommunicationStencil = LatticeModel::CommunicationStencil; + using PDFField = lbm::PdfField<LatticeModel>; + using MyFlagField = FlagField<flag_t>; shared_ptr< StructuredBlockForest > makeStructuredBlockStorage( uint_t channelWidth, uint_t channelLength ) diff --git a/tests/lbm/evaluations/PermeabilityTest.cpp b/tests/lbm/evaluations/PermeabilityTest.cpp index 9188fd04deed4fd4a8724f2822cdf7cde9d2bfe3..022ad27889a260167a7d900f50ee64b41efbe308 100644 --- a/tests/lbm/evaluations/PermeabilityTest.cpp +++ b/tests/lbm/evaluations/PermeabilityTest.cpp @@ -30,8 +30,8 @@ namespace walberla { -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; enum Scenario { BCC }; @@ -117,7 +117,7 @@ BlockDataID initPdfField( const shared_ptr<StructuredBlockForest> & blocks, real template< > BlockDataID initPdfField< lbm::collision_model::SRT >( const shared_ptr<StructuredBlockForest> & blocks, real_t omega ) { - typedef lbm::D3Q19< lbm::collision_model::SRT > LatticeModel_T; + using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::SRT( omega ) ); return lbm::addPdfFieldToStorage( blocks, "PDF Field (SRT)", latticeModel, Vector3<real_t>(), real_t(1) ); @@ -126,7 +126,7 @@ BlockDataID initPdfField< lbm::collision_model::SRT >( const shared_ptr<Structur template< > BlockDataID initPdfField< lbm::collision_model::TRT >( const shared_ptr<StructuredBlockForest> & blocks, real_t omega ) { - typedef lbm::D3Q19< lbm::collision_model::TRT > LatticeModel_T; + using LatticeModel_T = lbm::D3Q19<lbm::collision_model::TRT>; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::TRT::constructWithMagicNumber( omega ) ); return lbm::addPdfFieldToStorage( blocks, "PDF Field (TRT)", latticeModel, Vector3<real_t>(), real_t(1) ); @@ -135,7 +135,7 @@ BlockDataID initPdfField< lbm::collision_model::TRT >( const shared_ptr<Structur template< > BlockDataID initPdfField< lbm::collision_model::D3Q19MRT >( const shared_ptr<StructuredBlockForest> & blocks, real_t omega ) { - typedef lbm::D3Q19< lbm::collision_model::D3Q19MRT > LatticeModel_T; + using LatticeModel_T = lbm::D3Q19<lbm::collision_model::D3Q19MRT>; LatticeModel_T latticeModel = LatticeModel_T( lbm::collision_model::D3Q19MRT::constructPanWithMagicNumber( omega ) ); return lbm::addPdfFieldToStorage( blocks, "PDF Field (MRT)", latticeModel, Vector3<real_t>(), real_t(1) ); @@ -155,7 +155,7 @@ template< typename LatticeModel_T > BlockDataID initBoundaryHandling( shared_ptr<StructuredBlockForest> & blocks, const BlockDataID & pdfFieldId, const BlockDataID & flagFieldId, const FlagUID & fluid, Setup setup ) { typedef lbm::DefaultBoundaryHandlingFactory< LatticeModel_T, FlagField_T > BHFactory_T; - typedef typename BHFactory_T::BoundaryHandling BoundaryHandling_T; + using BoundaryHandling_T = typename BHFactory_T::BoundaryHandling; BlockDataID boundaryHandlingId = BHFactory_T::addBoundaryHandlingToStorage( blocks, "boundary handling", flagFieldId, pdfFieldId, fluid, Vector3<real_t>(), @@ -172,16 +172,16 @@ BlockDataID initBoundaryHandling( shared_ptr<StructuredBlockForest> & blocks, co const real_t r = real_c(std::sqrt(real_c(3))) / real_c(4) * L * setup.kappa; // spheres in all eight corners of the domain - spheres.push_back( geometry::Sphere( Vector3<real_t>( 0, 0, 0 ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( L, 0, 0 ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( 0, L, 0 ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( 0, 0, L ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( L, L, 0 ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( L, 0, L ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( 0, L, L ), r ) ); - spheres.push_back( geometry::Sphere( Vector3<real_t>( L, L, L ), r ) ); + spheres.emplace_back( Vector3<real_t>( 0, 0, 0 ), r ); + spheres.emplace_back( Vector3<real_t>( L, 0, 0 ), r ); + spheres.emplace_back( Vector3<real_t>( 0, L, 0 ), r ); + spheres.emplace_back( Vector3<real_t>( 0, 0, L ), r ); + spheres.emplace_back( Vector3<real_t>( L, L, 0 ), r ); + spheres.emplace_back( Vector3<real_t>( L, 0, L ), r ); + spheres.emplace_back( Vector3<real_t>( 0, L, L ), r ); + spheres.emplace_back( Vector3<real_t>( L, L, L ), r ); // and one sphere in the middle - spheres.push_back( geometry::Sphere( Vector3<real_t>( L / real_c(2), L / real_c(2), L / real_c(2) ), r ) ); + spheres.emplace_back( Vector3<real_t>( L / real_c(2), L / real_c(2), L / real_c(2) ), r ); break; } @@ -207,9 +207,9 @@ BlockDataID initBoundaryHandling( shared_ptr<StructuredBlockForest> & blocks, co template< typename LM_T > int setupAndExecute( Setup setup ) { - typedef lbm::PdfField< LM_T > PdfField_T; + using PdfField_T = lbm::PdfField< LM_T >; typedef lbm::DefaultBoundaryHandlingFactory< LM_T, FlagField_T > BHFactory_T; - typedef typename BHFactory_T::BoundaryHandling BoundaryHandling_T; + using BoundaryHandling_T = typename BHFactory_T::BoundaryHandling; Vector3<uint_t> blockLength; blockLength[0] = setup.length / setup.blocks[0]; diff --git a/tests/lbm/geometry/IntersectionRatioTest.cpp b/tests/lbm/geometry/IntersectionRatioTest.cpp index ae7a4a159f2f60f62220b0b691cd9db0826add58..a252f9b65fd0f2eeb119088a394cc0894c21c41a 100644 --- a/tests/lbm/geometry/IntersectionRatioTest.cpp +++ b/tests/lbm/geometry/IntersectionRatioTest.cpp @@ -80,9 +80,9 @@ void testAABB() std::mt19937 randomEngine; std::vector<math::AABB> testAABBs; - testAABBs.push_back( math::AABB( -UNIT, UNIT ) ); - testAABBs.push_back( math::AABB( ZERO, UNIT ) ); - testAABBs.push_back( math::AABB( -UNIT, ZERO ) ); + testAABBs.emplace_back( -UNIT, UNIT ); + testAABBs.emplace_back( ZERO, UNIT ); + testAABBs.emplace_back( -UNIT, ZERO ); for( auto aabbIt = testAABBs.begin(); aabbIt != testAABBs.end(); ++aabbIt ) { @@ -94,7 +94,7 @@ void testAABB() Vector3<real_t> outerPoint, innerPoint; do { outerPoint = outerAABB.randomPoint( randomEngine ); } while( aabbIt->contains( outerPoint ) ); innerPoint = aabbIt->randomPoint( randomEngine ); - testPoints.push_back( std::make_pair( outerPoint, innerPoint - outerPoint ) ); + testPoints.emplace_back( outerPoint, innerPoint - outerPoint ); } for( auto pointIt = testPoints.begin(); pointIt != testPoints.end(); ++pointIt ) diff --git a/tests/lbm/initializer/PdfFieldInitializerTest.cpp b/tests/lbm/initializer/PdfFieldInitializerTest.cpp index 282fbd689b199af9ea72a342bcdd18f7f1f78c7c..5e8b2ac39dfc2ef78f5e59d6f7a7587d311ea2d3 100644 --- a/tests/lbm/initializer/PdfFieldInitializerTest.cpp +++ b/tests/lbm/initializer/PdfFieldInitializerTest.cpp @@ -33,9 +33,9 @@ namespace walberla { -typedef lbm::D3Q19< lbm::collision_model::SRT > LatticeModel_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; -typedef lbm::initializer::PdfFieldInitializer< LatticeModel_T > PdfFieldInitializer_T; +using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; +using PdfField_T = lbm::PdfField<LatticeModel_T>; +using PdfFieldInitializer_T = lbm::initializer::PdfFieldInitializer<LatticeModel_T>; struct DensityInit diff --git a/tests/lbm/refinement/CommunicationEquivalence.cpp b/tests/lbm/refinement/CommunicationEquivalence.cpp index 9b14c143011edf3bf5776f821a98fc25dcca597a..150f7894947f95347c820d30b348779303fd5790 100644 --- a/tests/lbm/refinement/CommunicationEquivalence.cpp +++ b/tests/lbm/refinement/CommunicationEquivalence.cpp @@ -72,12 +72,12 @@ namespace walberla{ typedef lbm::D3Q19< lbm::collision_model::SRT, false > LatticeModel_T; //typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; //typedef lbm::D3Q19< lbm::collision_model::D3Q19MRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; +using Stencil_T = LatticeModel_T::Stencil; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = 4; diff --git a/tests/lbm/refinement/NonConstantDiffusion.cpp b/tests/lbm/refinement/NonConstantDiffusion.cpp index dca9d0529341ce97b1e291f8ab0f92731e895722..83ac2f989663821ac7f2db15a49c904d5cef42ca 100644 --- a/tests/lbm/refinement/NonConstantDiffusion.cpp +++ b/tests/lbm/refinement/NonConstantDiffusion.cpp @@ -93,11 +93,11 @@ typedef GhostLayerField< Vector3<real_t>, 1 > VectorField; typedef lbm::D3Q19< lbm::collision_model::SRTField<ScalarField>, true, lbm::force_model::None, 1 > LM; -typedef LM::Stencil Stencil; -typedef lbm::PdfField< LM > MyPdfField; +using Stencil = LM::Stencil; +using MyPdfField = lbm::PdfField<LM>; -typedef uint8_t flag_t; -typedef FlagField< flag_t > MyFlagField; +using flag_t = uint8_t; +using MyFlagField = FlagField<flag_t>; typedef lbm::DefaultDiffusionBoundaryHandlingFactory< LM, MyFlagField > MyBoundaryHandling; diff --git a/tests/lbm/refinement/Uniformity.cpp b/tests/lbm/refinement/Uniformity.cpp index aabd8d6fb6fad931c7a3bcb91c038373a77c33ef..cd6eda7cd83f48dd72b8d8ab162e35668c3b451f 100644 --- a/tests/lbm/refinement/Uniformity.cpp +++ b/tests/lbm/refinement/Uniformity.cpp @@ -78,18 +78,18 @@ using walberla::uint_t; typedef lbm::D3Q19< lbm::collision_model::SRT, false > LatticeModel_T; //typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; //typedef lbm::D3Q19< lbm::collision_model::D3Q19MRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; +using Stencil_T = LatticeModel_T::Stencil; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = 4; // dummy boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -typedef boost::tuples::tuple< NoSlip_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; /////////// diff --git a/tests/mesh/DistributedMeshVTKTest.cpp b/tests/mesh/DistributedMeshVTKTest.cpp index 8b9dcc55aa3a3db48b3240253e2c0b4b6f02f0c7..e69aad05e39b930621e96cad07bb49090316f724 100644 --- a/tests/mesh/DistributedMeshVTKTest.cpp +++ b/tests/mesh/DistributedMeshVTKTest.cpp @@ -42,7 +42,7 @@ void test( const std::string & meshFile ) auto aabb = computeAABB( *mesh ); - typedef typename MeshType::Scalar Scalar; + using Scalar = typename MeshType::Scalar; Vector3<Scalar> translation( numeric_cast<Scalar>( aabb.xSize() ) * Scalar(2) * Scalar( MPIManager::instance()->rank() ), Scalar(0), Scalar(0) ); translate( *mesh, translation ); diff --git a/tests/mesh/MeshBlockExclusionTest.cpp b/tests/mesh/MeshBlockExclusionTest.cpp index 60833bf923b05693c4761253ca48a722f42f9f1b..7685ac644dc38bbbbbd408f8ca834aae93214aef 100644 --- a/tests/mesh/MeshBlockExclusionTest.cpp +++ b/tests/mesh/MeshBlockExclusionTest.cpp @@ -58,7 +58,7 @@ struct PointInAABB struct AnyPointInAABB { - typedef std::vector< Vector3<real_t> > Points; + using Points = std::vector<Vector3<real_t> >; AnyPointInAABB( const Points & points ) : points_(points) {} diff --git a/tests/mesh/MeshOperationsTest.cpp b/tests/mesh/MeshOperationsTest.cpp index b12d6fb3325541d6f8792015e460f30b9b1886d3..91af5d0bf97f4139958dbab6adc10def7b48e743 100644 --- a/tests/mesh/MeshOperationsTest.cpp +++ b/tests/mesh/MeshOperationsTest.cpp @@ -47,7 +47,7 @@ void testCube() { MeshType mesh; - typedef typename MeshType::Scalar Scalar; + using Scalar = typename MeshType::Scalar; readAndBroadcast("cube.obj", mesh); diff --git a/tests/mesh/MeshPeRaytracing.cpp b/tests/mesh/MeshPeRaytracing.cpp index 4f78824f2493e7681a79d472757dc1d2a7856f53..b2714388554ac63bc7bf4f063303f9d2b1b1067f 100644 --- a/tests/mesh/MeshPeRaytracing.cpp +++ b/tests/mesh/MeshPeRaytracing.cpp @@ -43,14 +43,14 @@ int CpRayIntersectionTest(const int resolution = 10) using namespace walberla::pe::raytracing; std::vector<Vector3<real_t>> points; - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t( 1) ) ); + points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t( 1), real_t( 1), real_t( 1) ); shared_ptr< TriangleMesh > mesh = make_shared<TriangleMesh>(); mesh::QHull<TriangleMesh> qhull( points, mesh ); diff --git a/tests/mesh/PeVTKMeshWriterTest.cpp b/tests/mesh/PeVTKMeshWriterTest.cpp index 5399af727b70e2a4a5015f3d6a74527127c8f5f4..0c56132e3e2a3adeeb400ad44f1f878676c922a8 100644 --- a/tests/mesh/PeVTKMeshWriterTest.cpp +++ b/tests/mesh/PeVTKMeshWriterTest.cpp @@ -54,14 +54,14 @@ typedef boost::tuple<ConvexPolyhedron, Plane> BodyTuple ; std::vector<Vector3<real_t>> generatePointCloudCube() { std::vector<Vector3<real_t>> points; - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t( 1) ) ); + points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t( 1), real_t( 1), real_t( 1) ); return points; } @@ -76,9 +76,9 @@ std::vector<Vector3<real_t>> generatePointCloudDodecahedron() for( auto phi : {-PHI, PHI} ) for( auto piv : {-PHI_INV, PHI_INV} ) { - points.push_back( Vector3<real_t>( real_t( 0), real_t(piv), real_t(phi) ) ); - points.push_back( Vector3<real_t>( real_t(piv), real_t(phi), real_t( 0) ) ); - points.push_back( Vector3<real_t>( real_t(phi), real_t( 0), real_t(piv) ) ); + points.emplace_back( real_t( 0), real_t(piv), real_t(phi) ); + points.emplace_back( real_t(piv), real_t(phi), real_t( 0) ); + points.emplace_back( real_t(phi), real_t( 0), real_t(piv) ); } return points; @@ -143,10 +143,10 @@ int main( int argc, char ** argv ) cr.setRelaxationParameter( real_t(0.7) ); cr.setGlobalLinearAcceleration( Vec3(0,0,5) ); - std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(*forest), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); - typedef mesh::FloatPolyMesh OutputMeshType; - typedef mesh::pe::DefaultTesselation<OutputMeshType> TesselationType; + using OutputMeshType = mesh::FloatPolyMesh; + using TesselationType = mesh::pe::DefaultTesselation<OutputMeshType>; TesselationType tesselation; mesh::pe::PeVTKMeshWriter<OutputMeshType, TesselationType> writer( forest, storageID, tesselation, "MeshOutput", uint_c(visSpacing) ); @@ -191,8 +191,8 @@ int main( int argc, char ** argv ) //BoxID sp = pe::createBox( *globalBodyStorage, *forest, storageID, 0, *it, Vec3(radius), material ); mesh::pe::ConvexPolyhedronID sp = mesh::pe::createConvexPolyhedron( *globalBodyStorage, *forest, storageID, 0, *it, pointCloud, material ); Vec3 rndVel(math::realRandom<real_t>(-vMax, vMax), math::realRandom<real_t>(-vMax, vMax), math::realRandom<real_t>(-vMax, vMax)); - if (sp != NULL) sp->setLinearVel(rndVel); - if (sp != NULL) ++numParticles; + if (sp != nullptr) sp->setLinearVel(rndVel); + if (sp != nullptr) ++numParticles; } } mpi::reduceInplace(numParticles, mpi::SUM); diff --git a/tests/mesh/QHullTest.cpp b/tests/mesh/QHullTest.cpp index c755a46ec3fa3bb9e93f4fa3a1497e6c03c3c630..ddb4d46e51523e8f5608cf8b05f6c58d5d10ba25 100644 --- a/tests/mesh/QHullTest.cpp +++ b/tests/mesh/QHullTest.cpp @@ -46,12 +46,12 @@ class PointCloudDataSource : public vtk::PointDataSource public: PointCloudDataSource( const std::vector<Vector3<real_t>> & pointCloud ) : pointCloud_( pointCloud ) {} - virtual std::vector< Attributes > getAttributes() const { return std::vector< Attributes >(); } - virtual std::vector< Vector3< real_t > > getPoints() { return pointCloud_; } - virtual void configure() {}; + std::vector< Attributes > getAttributes() const override { return std::vector< Attributes >(); } + std::vector< Vector3< real_t > > getPoints() override { return pointCloud_; } + void configure() override {}; - virtual void push( std::ostream& /*os*/, const uint_t /*data*/, const uint_t /*point*/, const uint_t /*component*/ ) {}; - virtual void push( vtk::Base64Writer& /*b64*/, const uint_t /*data*/, const uint_t /*point*/, const uint_t /*component*/ ) {}; + void push( std::ostream& /*os*/, const uint_t /*data*/, const uint_t /*point*/, const uint_t /*component*/ ) override {}; + void push( vtk::Base64Writer& /*b64*/, const uint_t /*data*/, const uint_t /*point*/, const uint_t /*component*/ ) override {}; private: std::vector<Vector3<real_t>> pointCloud_; @@ -104,7 +104,7 @@ void test( const std::string & testName, const std::vector<Vector3<real_t>> & po const typename MeshType::Point pointOnFace = mesh.point( *mesh.cfv_begin(fh) ); for(const auto & p : pointCloud) { - typedef typename MeshType::Scalar Scalar; + using Scalar = typename MeshType::Scalar; WALBERLA_CHECK_LESS( (toOpenMeshNumericCast<Scalar>(p) - pointOnFace) | n, real_comparison::Epsilon<Scalar>::value, "Point: " << p << " Face normal: " << n << " v: " << toOpenMeshNumericCast<Scalar>(p) - pointOnFace ); } @@ -116,14 +116,14 @@ void test( const std::string & testName, const std::vector<Vector3<real_t>> & po std::vector<Vector3<real_t>> generatePointCloudCube() { std::vector<Vector3<real_t>> points; - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t( 1) ) ); + points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t( 1), real_t( 1), real_t( 1) ); return points; } @@ -132,10 +132,10 @@ std::vector<Vector3<real_t>> generatePointCloudCube() std::vector<Vector3<real_t>> generatePointCloudTetrahedron() { std::vector<Vector3<real_t>> points; - points.push_back( Vector3<real_t>( real_t( 1), real_t( 1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t(-1), real_t(-1) ) ); - points.push_back( Vector3<real_t>( real_t(-1), real_t( 1), real_t( 1) ) ); - points.push_back( Vector3<real_t>( real_t( 1), real_t(-1), real_t( 1) ) ); + points.emplace_back( real_t( 1), real_t( 1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t(-1), real_t(-1) ); + points.emplace_back( real_t(-1), real_t( 1), real_t( 1) ); + points.emplace_back( real_t( 1), real_t(-1), real_t( 1) ); return points; } @@ -146,9 +146,9 @@ std::vector<Vector3<real_t>> generatePointCloudOctahedron() for( auto one : {real_t(-1), real_t(1)} ) { - points.push_back( Vector3<real_t>( one, 0, 0 ) ); - points.push_back( Vector3<real_t>( 0, one, 0 ) ); - points.push_back( Vector3<real_t>( 0, 0, one ) ); + points.emplace_back( one, 0, 0 ); + points.emplace_back( 0, one, 0 ); + points.emplace_back( 0, 0, one ); } return points; @@ -163,9 +163,9 @@ std::vector<Vector3<real_t>> generatePointCloudIcosahedron() for( auto one : {real_t(-1), real_t(1)} ) for( auto phi : {-PHI, PHI} ) { - points.push_back( Vector3<real_t>( real_t( 0), real_t(one), real_t(phi) ) ); - points.push_back( Vector3<real_t>( real_t(one), real_t(phi), real_t( 0) ) ); - points.push_back( Vector3<real_t>( real_t(phi), real_t( 0), real_t(one) ) ); + points.emplace_back( real_t( 0), real_t(one), real_t(phi) ); + points.emplace_back( real_t(one), real_t(phi), real_t( 0) ); + points.emplace_back( real_t(phi), real_t( 0), real_t(one) ); } return points; @@ -181,9 +181,9 @@ std::vector<Vector3<real_t>> generatePointCloudDodecahedron() for( auto phi : {-PHI, PHI} ) for( auto piv : {-PHI_INV, PHI_INV} ) { - points.push_back( Vector3<real_t>( real_t( 0), real_t(piv), real_t(phi) ) ); - points.push_back( Vector3<real_t>( real_t(piv), real_t(phi), real_t( 0) ) ); - points.push_back( Vector3<real_t>( real_t(phi), real_t( 0), real_t(piv) ) ); + points.emplace_back( real_t( 0), real_t(piv), real_t(phi) ); + points.emplace_back( real_t(piv), real_t(phi), real_t( 0) ); + points.emplace_back( real_t(phi), real_t( 0), real_t(piv) ); } return points; diff --git a/tests/pde/CGTest.cpp b/tests/pde/CGTest.cpp index b3619d157f2d7b1ebc608c660c1d04ff072d8001..eecd1c6a2646291d7509bc1f4db3a35eab9013b3 100644 --- a/tests/pde/CGTest.cpp +++ b/tests/pde/CGTest.cpp @@ -48,8 +48,8 @@ namespace walberla { typedef GhostLayerField< real_t, 1 > PdeField_T; -typedef stencil::D2Q5 Stencil_T; -typedef pde::CGIteration<Stencil_T>::StencilField_T StencilField_T; +using Stencil_T = stencil::D2Q5; +using StencilField_T = pde::CGIteration<Stencil_T>::StencilField_T; diff --git a/tests/pde/JacobiTest.cpp b/tests/pde/JacobiTest.cpp index 22376f9b96f73da577e26139d0db87a811b9d310..275cbf8dfe50506986f9d3de6d3896ad82844b76 100644 --- a/tests/pde/JacobiTest.cpp +++ b/tests/pde/JacobiTest.cpp @@ -51,8 +51,8 @@ namespace walberla { typedef GhostLayerField< real_t, 1 > PdeField_T; -typedef stencil::D2Q5 Stencil_T; -typedef pde::Jacobi<Stencil_T>::StencilField_T StencilField_T; +using Stencil_T = stencil::D2Q5; +using StencilField_T = pde::Jacobi<Stencil_T>::StencilField_T; diff --git a/tests/pde/MGConvergenceTest.cpp b/tests/pde/MGConvergenceTest.cpp index 56065b48af288bd347693820d7b909ebd672b2f4..f9643a83fc02bd10ff2ab4046d8afa02e6ef0761 100644 --- a/tests/pde/MGConvergenceTest.cpp +++ b/tests/pde/MGConvergenceTest.cpp @@ -49,8 +49,8 @@ namespace walberla { typedef GhostLayerField< real_t, 1 > PdeField_T; -typedef stencil::D3Q7 Stencil_T; -typedef pde::VCycles<Stencil_T>::StencilField_T StencilField_T; +using Stencil_T = stencil::D3Q7; +using StencilField_T = pde::VCycles<Stencil_T>::StencilField_T; diff --git a/tests/pde/MGTest.cpp b/tests/pde/MGTest.cpp index 648d83b3869f90eb60619ed61859c424d63f0e4c..275a2ecc19150c0300dd96927c9254ddfd9f2da9 100644 --- a/tests/pde/MGTest.cpp +++ b/tests/pde/MGTest.cpp @@ -50,8 +50,8 @@ namespace walberla { typedef GhostLayerField< real_t, 1 > PdeField_T; -typedef stencil::D3Q7 Stencil_T; -typedef pde::VCycles<Stencil_T>::StencilField_T StencilField_T; +using Stencil_T = stencil::D3Q7; +using StencilField_T = pde::VCycles<Stencil_T>::StencilField_T; diff --git a/tests/pde/RBGSTest.cpp b/tests/pde/RBGSTest.cpp index f289a4ca845b15874265de4abbfcc8f0baee4ad7..c3a922ea15176f9fc6ba0674601a683a393807c8 100644 --- a/tests/pde/RBGSTest.cpp +++ b/tests/pde/RBGSTest.cpp @@ -51,8 +51,8 @@ namespace walberla { typedef GhostLayerField< real_t, 1 > PdeField_T; -typedef stencil::D2Q5 Stencil_T; -typedef pde::RBGS<Stencil_T>::StencilField_T StencilField_T; +using Stencil_T = stencil::D2Q5; +using StencilField_T = pde::RBGS<Stencil_T>::StencilField_T; diff --git a/tests/pde/SORTest.cpp b/tests/pde/SORTest.cpp index 46f55ea94ac9a71b627434523f8e2e58ffe4e0f1..520df1cfa8fd8eb1796f20710d640dae962d0e25 100644 --- a/tests/pde/SORTest.cpp +++ b/tests/pde/SORTest.cpp @@ -51,8 +51,8 @@ namespace walberla { typedef GhostLayerField< real_t, 1 > PdeField_T; -typedef stencil::D2Q5 Stencil_T; -typedef pde::SOR<Stencil_T>::StencilField_T StencilField_T; +using Stencil_T = stencil::D2Q5; +using StencilField_T = pde::SOR<Stencil_T>::StencilField_T; diff --git a/tests/pe/BodyFlags.cpp b/tests/pe/BodyFlags.cpp index 0c39b0d43634d910ecb9b042d8ad4f55830d1ec8..dac32839193613cd8029d289ead1311c382c8cb0 100644 --- a/tests/pe/BodyFlags.cpp +++ b/tests/pe/BodyFlags.cpp @@ -37,7 +37,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; int main( int argc, char ** argv ) { @@ -66,7 +66,7 @@ int main( int argc, char ** argv ) auto fcdID = forest->addBlockData(fcd::createGenericFCDDataHandling<BodyTuple, fcd::AnalyticCollideFunctor>(), "FCD"); //cr::DEM cr(globalStorage, forest->getBlockStorage(), storageID, ccdID, fcdID, NULL ); - cr::HCSITS cr(globalStorage, forest->getBlockStoragePointer(), storageID, ccdID, fcdID, NULL ); + cr::HCSITS cr(globalStorage, forest->getBlockStoragePointer(), storageID, ccdID, fcdID, nullptr ); MaterialID iron = Material::find("iron"); @@ -78,11 +78,11 @@ int main( int argc, char ** argv ) Sphere refFixedSphere(2, 0, Vec3(9,9,14), Vec3(0,0,0), Quat(), 3, iron, false, false, true); SphereID fixedSphere = createSphere( *globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(9,9,14), 3, iron, false, false, true); walberla::id_t fixedSphereID = 0; - if (fixedSphere != NULL) fixedSphereID = fixedSphere->getSystemID(); + if (fixedSphere != nullptr) fixedSphereID = fixedSphere->getSystemID(); mpi::allReduceInplace(fixedSphereID, mpi::SUM); // synchronize particles - syncShadowOwners<BodyTuple>( forest->getBlockForest(), storageID, NULL, real_c(0.0), true); + syncShadowOwners<BodyTuple>( forest->getBlockForest(), storageID, nullptr, real_c(0.0), true); cr.setGlobalLinearAcceleration(Vec3(0, 0, real_c(-9.81))); @@ -104,7 +104,7 @@ int main( int argc, char ** argv ) WALBERLA_LOG_PROGRESS_ON_ROOT("*** SIMULATION - START ***"); cr.timestep( real_c(1.0) ); - syncShadowOwners<BodyTuple>( forest->getBlockForest(), storageID, NULL, real_c(0.0), false); + syncShadowOwners<BodyTuple>( forest->getBlockForest(), storageID, nullptr, real_c(0.0), false); WALBERLA_LOG_PROGRESS_ON_ROOT("*** SIMULATION - END ***"); refGlobalSphere.setPosition(Vec3(11,11,11)); diff --git a/tests/pe/BodyIterators.cpp b/tests/pe/BodyIterators.cpp index 232378417a58d54f5359eebdae3dc590f903210c..e53b44a6acb633cea157ebe0f4ba9187966f4748 100644 --- a/tests/pe/BodyIterators.cpp +++ b/tests/pe/BodyIterators.cpp @@ -36,7 +36,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; int main( int argc, char **argv ) { @@ -73,13 +73,13 @@ int main( int argc, char **argv ) uint_t sphereCount = 0; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(25), real_t(25), real_t(50) ), 1) != NULL) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(25), real_t(25), real_t(50) ), 1) != nullptr) ++sphereCount; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(99), real_t(25), real_t(50) ), 2) != NULL) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(99), real_t(25), real_t(50) ), 2) != nullptr) ++sphereCount; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(101), real_t(25), real_t(50) ), 2) != NULL) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(101), real_t(25), real_t(50) ), 2) != nullptr) ++sphereCount; - if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(125), real_t(25), real_t(50) ), 1) != NULL) + if (pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), storageID, 0, Vec3( real_t(125), real_t(25), real_t(50) ), 1) != nullptr) ++sphereCount; syncShadowOwners<BodyTuple>( blocks->getBlockForest(), storageID); diff --git a/tests/pe/BodyStorage.cpp b/tests/pe/BodyStorage.cpp index 498f973944f7d2529ea84072253a4516616104db..73063931739512c6a0208f9fe0bde6f0e328c280 100644 --- a/tests/pe/BodyStorage.cpp +++ b/tests/pe/BodyStorage.cpp @@ -32,14 +32,14 @@ class Body1 : public Sphere { public: static int refCount; Body1(walberla::id_t id, MaterialID matID) : Sphere(id, id, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, matID, false, true, false) {++refCount;} - ~Body1() {--refCount;} + ~Body1() override {--refCount;} }; class Body2 : public Sphere { public: static int refCount; Body2(walberla::id_t id, MaterialID matID) : Sphere(id, id, Vec3(0,0,0), Vec3(0,0,0), Quat(), 1, matID, false, true, false) {++refCount;} - ~Body2() {--refCount;} + ~Body2() override {--refCount;} }; int Body1::refCount = 0; diff --git a/tests/pe/Collision.cpp b/tests/pe/Collision.cpp index c69ac6b06a9e5b421e85924f5799426c41f17381..958b4de97bf52072a8f70c723b14e694f72e512c 100644 --- a/tests/pe/Collision.cpp +++ b/tests/pe/Collision.cpp @@ -235,7 +235,7 @@ void CapsuleTest2() void UnionTest() { - typedef Union< boost::tuple<Sphere> > UnionT; + using UnionT = Union<boost::tuple<Sphere> >; UnionT un1(120, 0, Vec3(0,0,0), Vec3(0,0,0), Quat(), false, true, false); UnionT un2(121, 0, Vec3(real_t(1.5),0,0), Vec3(0,0,0), Quat(), false, true, false); auto sp1 = createSphere(&un1, 123, Vec3(0,0,0), 1); diff --git a/tests/pe/DeleteBody.cpp b/tests/pe/DeleteBody.cpp index bd47954f097a0ce6fe9cb37575784135d7f1983b..ea6adfbfcdf023fc14cdfeaf9911b6d0bec3acd9 100644 --- a/tests/pe/DeleteBody.cpp +++ b/tests/pe/DeleteBody.cpp @@ -36,7 +36,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; int main( int argc, char** argv ) { @@ -71,7 +71,7 @@ int main( int argc, char** argv ) SetBodyTypeIDs<BodyTuple>::execute(); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); - Storage* firstStorage = NULL, *secondStorage = NULL; + Storage* firstStorage = nullptr, *secondStorage = nullptr; for (auto it = forest->begin(); it != forest->end(); ++it) { IBlock & currentBlock = *it; @@ -85,10 +85,10 @@ int main( int argc, char** argv ) std::function<void(void)> syncCall; if (!syncShadowOwners) { - syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); } else { - syncCall = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + syncCall = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); } pe::createSphere(*globalBodyStorage, forest->getBlockStorage(), storageID, 0, Vec3(5,5,5), 2); diff --git a/tests/pe/DestroyBody.cpp b/tests/pe/DestroyBody.cpp index ccef444fb4178095607370a93f67181528c9aed5..b2deb57fa759e8b4dc634eb70ae0b1cd703725e1 100644 --- a/tests/pe/DestroyBody.cpp +++ b/tests/pe/DestroyBody.cpp @@ -34,7 +34,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; int main( int argc, char** argv ) { @@ -56,7 +56,7 @@ int main( int argc, char** argv ) SetBodyTypeIDs<BodyTuple>::execute(); auto storageID = forest->addBlockData(createStorageDataHandling<BodyTuple>(), "Storage"); - Storage* firstStorage = NULL, *secondStorage = NULL; + Storage* firstStorage = nullptr, *secondStorage = nullptr; for (auto it = forest->begin(); it != forest->end(); ++it) { IBlock & currentBlock = *it; diff --git a/tests/pe/DynamicRefinement.cpp b/tests/pe/DynamicRefinement.cpp index ef0266270540992cb01e67d0e40aeb8d266de3ec..284949abab81c6b1ebe0d622c7e08edd9aa42adf 100644 --- a/tests/pe/DynamicRefinement.cpp +++ b/tests/pe/DynamicRefinement.cpp @@ -32,7 +32,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; class ReGrid { diff --git a/tests/pe/ForceSync.cpp b/tests/pe/ForceSync.cpp index 44acba816ff7c6208ddcbb2ee52c68e8976859ba..d19422354622bf1218d7fcd31a44d181a9bcbcae 100644 --- a/tests/pe/ForceSync.cpp +++ b/tests/pe/ForceSync.cpp @@ -112,9 +112,9 @@ int main( int argc, char ** argv ) SphereID sp1 = static_cast<SphereID> (getBody(*globalStorage, forest->getBlockStorage(), storageID_, id1)); SphereID sp2 = static_cast<SphereID> (getBody(*globalStorage, forest->getBlockStorage(), storageID_, id2)); - if ( (sp1 != NULL) && (!sp1->isRemote() )) + if ( (sp1 != nullptr) && (!sp1->isRemote() )) WALBERLA_ASSERT_FLOAT_EQUAL(sp1->getForce(), Vec3(1,0,0)); - if ( (sp2 != NULL) && (!sp2->isRemote() )) + if ( (sp2 != nullptr) && (!sp2->isRemote() )) WALBERLA_ASSERT_FLOAT_EQUAL(sp2->getForce(), Vec3(1,1,0)); // for (auto it = forest->begin(); it != forest->end(); ++it){ diff --git a/tests/pe/HashGrids.cpp b/tests/pe/HashGrids.cpp index afefe3ce536ebbef7805c31da8bdf25e200a4151..7d83456a0e735ceb88689e12feacfe74cda1a8ad 100644 --- a/tests/pe/HashGrids.cpp +++ b/tests/pe/HashGrids.cpp @@ -66,7 +66,7 @@ int main( int argc, char** argv ) auto sccdID = forest->addBlockData(ccd::createSimpleCCDDataHandling( globalBodyStorage, storageID ), "SCCD"); auto hccdID = forest->addBlockData(ccd::createHashGridsDataHandling( globalBodyStorage, storageID ), "HCCD"); auto fcdID = forest->addBlockData(fcd::createGenericFCDDataHandling<BodyTuple, fcd::AnalyticCollideFunctor>(), "FCD"); - cr::PlainIntegrator cr(globalBodyStorage, forest->getBlockStoragePointer(), storageID, NULL); + cr::PlainIntegrator cr(globalBodyStorage, forest->getBlockStoragePointer(), storageID, nullptr); pe::createPlane( *globalBodyStorage, 0, Vec3(0, +1, 0), Vec3(5, 0,5), iron); pe::createPlane( *globalBodyStorage, 0, Vec3(0, -1, 0), Vec3(5,30,5), iron); @@ -107,7 +107,7 @@ int main( int argc, char** argv ) { SphereID sp = pe::createSphere(*globalBodyStorage, forest->getBlockStorage(), storageID, i, Vec3(math::realRandom<real_t>(real_c(0), real_c(30)), math::realRandom<real_t>(real_c(0), real_c(30)), math::realRandom<real_t>(real_c(0), real_c(30))), real_c(0.4)); - if (sp != NULL) sp->setLinearVel(Vec3(math::realRandom<real_t>(-dv, dv), math::realRandom<real_t>(-dv, dv), math::realRandom<real_t>(-dv, dv))); + if (sp != nullptr) sp->setLinearVel(Vec3(math::realRandom<real_t>(-dv, dv), math::realRandom<real_t>(-dv, dv), math::realRandom<real_t>(-dv, dv))); } pe::createSphere(*globalBodyStorage, forest->getBlockStorage(), storageID, 999999999, diff --git a/tests/pe/LoadFromConfig.cpp b/tests/pe/LoadFromConfig.cpp index b1d381b63588e2ad3cb829c5cd96dd5214b5e953..7e3236205412c41c87016d69a628a790c72c6a89 100644 --- a/tests/pe/LoadFromConfig.cpp +++ b/tests/pe/LoadFromConfig.cpp @@ -40,7 +40,7 @@ int main( int argc, char ** argv ) Environment env(argc, argv); //! [Load Config] auto cfg = env.config(); - if (cfg == NULL) WALBERLA_ABORT("No config specified!"); + if (cfg == nullptr) WALBERLA_ABORT("No config specified!"); const Config::BlockHandle configBlock = cfg->getBlock( "LoadFromConfig" ); //! [Load Config] diff --git a/tests/pe/Marshalling.cpp b/tests/pe/Marshalling.cpp index a5272bfe3f695cdd065e3633ab52cbf4485da01e..8eaa11069bffe325b3f747e6ab3c1e1519fbc77a 100644 --- a/tests/pe/Marshalling.cpp +++ b/tests/pe/Marshalling.cpp @@ -38,10 +38,10 @@ namespace walberla { using namespace walberla::pe; using namespace walberla::pe::communication; -typedef boost::tuple<Sphere> UnionTypeTuple; -typedef Union< UnionTypeTuple > UnionT; -typedef UnionT* UnionID; -typedef std::unique_ptr<UnionT> UnionPtr; +using UnionTypeTuple = boost::tuple<Sphere>; +using UnionT = Union<UnionTypeTuple>; +using UnionID = UnionT *; +using UnionPtr = std::unique_ptr<UnionT>; typedef boost::tuple<Box, Capsule, Sphere, Squirmer, UnionT, Ellipsoid> BodyTuple ; diff --git a/tests/pe/ParMetis.cpp b/tests/pe/ParMetis.cpp index f43a92f57e36d2ea6acbb7fcf643d074a7aaff4f..0f66faf31b2f384ce0e7c8359943c46e82bbe8de 100644 --- a/tests/pe/ParMetis.cpp +++ b/tests/pe/ParMetis.cpp @@ -45,8 +45,8 @@ class MetisAssignmentFunctor { public: - typedef blockforest::DynamicParMetisBlockInfo PhantomBlockWeight; - typedef blockforest::DynamicParMetisBlockInfoPackUnpack PhantomBlockWeightPackUnpackFunctor; + using PhantomBlockWeight = blockforest::DynamicParMetisBlockInfo; + using PhantomBlockWeightPackUnpackFunctor = blockforest::DynamicParMetisBlockInfoPackUnpack; void operator()( std::vector< std::pair< const PhantomBlock *, walberla::any > > & blockData, const PhantomBlockForest & ) { diff --git a/tests/pe/ParallelEquivalence.cpp b/tests/pe/ParallelEquivalence.cpp index 5ccc4b961f82c48d0caf430d25f869763e587414..a8fd5bffe87a2fe0afdbe1de42eb6e43e5679550 100644 --- a/tests/pe/ParallelEquivalence.cpp +++ b/tests/pe/ParallelEquivalence.cpp @@ -104,7 +104,7 @@ void sim(shared_ptr< StructuredBlockForest > forest, std::vector<BodyData>& res, } auto fcdID_ = forest->addBlockData(fcd::createGenericFCDDataHandling<BodyTuple, fcd::AnalyticCollideFunctor>(), "FCD"); - cr::DEM cr( globalStorage, forest->getBlockStoragePointer(), storageID_, ccdID_, fcdID_, NULL); + cr::DEM cr( globalStorage, forest->getBlockStoragePointer(), storageID_, ccdID_, fcdID_, nullptr); // auto vtkOutput_ = make_shared<DefaultBodyVTKOutput>(storageID_, *forest) ; // auto vtkWriter_ = vtk::createVTKOutput_PointData(vtkOutput_, "Bodies", 1); @@ -132,7 +132,7 @@ void sim(shared_ptr< StructuredBlockForest > forest, std::vector<BodyData>& res, SphereID sp = pe::createSphere( *globalStorage, forest->getBlockStorage(), storageID_, ++counter, Vec3(real_c(x) + real_c(0.5), real_c(y) + real_c(0.5), real_c(z) + real_c(0.5)), real_c(0.3)); Vec3 randVel = Vec3(math::realRandom<real_t>(-dv, dv), math::realRandom<real_t>(-dv, dv), math::realRandom<real_t>(-dv, dv)); - if (sp != NULL) sp->setLinearVel(randVel); + if (sp != nullptr) sp->setLinearVel(randVel); } WALBERLA_CHECK_EQUAL(globalStorage->size(), 6); @@ -157,7 +157,7 @@ void sim(shared_ptr< StructuredBlockForest > forest, std::vector<BodyData>& res, for (auto bodyIt = localStorage.begin(); bodyIt != localStorage.end(); ++bodyIt) { BodyID b = bodyIt.getBodyID(); - res.push_back(BodyData(b->getID(), b->getPosition(), b->getLinearVel())); + res.emplace_back(b->getID(), b->getPosition(), b->getLinearVel()); } } mpi::SendBuffer sendBuf; @@ -172,7 +172,7 @@ void sim(shared_ptr< StructuredBlockForest > forest, std::vector<BodyData>& res, res.clear(); while (!recvBuf.isEmpty()) { - res.push_back( BodyData(recvBuf) ); + res.emplace_back(recvBuf ); } forest.reset(); diff --git a/tests/pe/PeDocumentationSnippets.cpp b/tests/pe/PeDocumentationSnippets.cpp index 5c9b15724b6acb01bfd348a926028c44077d684d..d9b3396bbb6125b44133861571b632fb30d642e0 100644 --- a/tests/pe/PeDocumentationSnippets.cpp +++ b/tests/pe/PeDocumentationSnippets.cpp @@ -48,8 +48,8 @@ using namespace walberla::pe; //! [Definition of Union Types] typedef boost::tuple<Box, Capsule, Sphere> UnionTypeTuple; -typedef Union< UnionTypeTuple > UnionT; -typedef UnionT* UnionID; +using UnionT = Union<UnionTypeTuple>; +using UnionID = UnionT *; //! [Definition of Union Types] //! [Definition BodyTypeTuple] @@ -97,14 +97,14 @@ int main( int argc, char ** argv ) // simulation. The function returns a handle to the newly created box, which can // be used to for instance rotate the box around the global y-axis. BoxID box = createBox( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), Vec3(2.5,2.5,2.5) ); - if (box != NULL) + if (box != nullptr) box->rotate( 0.0, real_c(math::PI/3.0), 0.0 ); //! [Create a Box] //! [Create a Capsule] // Create a capsule and rotate it after successfull creation. CapsuleID capsule = createCapsule( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), real_t(1), real_t(1) ); - if (capsule != NULL) + if (capsule != nullptr) capsule->rotate( 0.0, real_c(math::PI/3.0), 0.0 ); //! [Create a Capsule] @@ -117,14 +117,14 @@ int main( int argc, char ** argv ) //! [Create a Sphere] // Create a sphere and rotate it after successfull creation. SphereID sphere = createSphere( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4), real_t(1) ); - if (sphere != NULL) + if (sphere != nullptr) sphere->rotate( 0.0, real_c(math::PI/3.0), 0.0 ); //! [Create a Sphere] //! [Create a Union] // Create a union and add a box, capsule and sphere. UnionID un = createUnion<UnionTypeTuple>( *globalBodyStorage, forest->getBlockStorage(), storageID, 1, Vec3(2,3,4) ); - if (un != NULL) + if (un != nullptr) { createBox ( un, 1, Vec3(2,3,4), Vec3(2.5,2.5,2.5) ); createCapsule( un, 1, Vec3(3,3,4), real_t(1), real_t(1) ); diff --git a/tests/pe/Raytracing.cpp b/tests/pe/Raytracing.cpp index 49e4a277e5fb7223772dd43251fb7cf82bca8a22..cb935d969b0591b8bda2b3c97e45ab86dc09bce9 100644 --- a/tests/pe/Raytracing.cpp +++ b/tests/pe/Raytracing.cpp @@ -308,7 +308,7 @@ void RaytracerTest(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RAYTRAC createSphere(*globalBodyStorage, *forest, storageID, 3, Vec3(4,real_t(5.5),5), real_t(1)); createSphere(*globalBodyStorage, *forest, storageID, 6, Vec3(3,real_t(8.5),5), real_t(1)); BoxID box = createBox(*globalBodyStorage, *forest, storageID, 7, Vec3(5,real_t(6.5),5), Vec3(2,4,3)); - if (box != NULL) box->rotate(0,math::M_PI/4,math::M_PI/4); + if (box != nullptr) box->rotate(0,math::M_PI/4,math::M_PI/4); createBox(*globalBodyStorage, *forest, storageID, 8, Vec3(5,1,8), Vec3(2,2,2)); // Test scene v1 end @@ -316,7 +316,7 @@ void RaytracerTest(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RAYTRAC createBox(*globalBodyStorage, *forest, storageID, 9, Vec3(9,9,5), Vec3(1,1,10)); createCapsule(*globalBodyStorage, *forest, storageID, 10, Vec3(3, 9, 1), real_t(0.5), real_t(7), iron); CapsuleID capsule = createCapsule(*globalBodyStorage, *forest, storageID, 11, Vec3(7, real_t(3.5), real_t(7.5)), real_t(1), real_t(2), iron); - if (capsule != NULL) capsule->rotate(0,math::M_PI/3,math::M_PI/4-math::M_PI/8); + if (capsule != nullptr) capsule->rotate(0,math::M_PI/3,math::M_PI/4-math::M_PI/8); // Test scene v2 end // Test scene v3 additions start @@ -456,7 +456,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a real_t z = math::realRandom(forestAABB.zMin(), forestAABB.zMax()); walberla::id_t id = walberla::id_t(i); BoxID box_ = createBox(*globalBodyStorage, *forest, storageID, id, Vec3(x, y, z), Vec3(len, len, len)); - WALBERLA_CHECK(box_ != NULL); + WALBERLA_CHECK(box_ != nullptr); if (boxRotation) { box_->rotate(0, math::realRandom(real_t(0), real_t(1))*math::M_PI, math::realRandom(real_t(0), real_t(1))*math::M_PI); } @@ -472,7 +472,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a real_t z = math::realRandom(forestAABB.zMin(), forestAABB.zMax()); walberla::id_t id = walberla::id_t(boxes+i); CapsuleID capsule = createCapsule(*globalBodyStorage, *forest, storageID, id, Vec3(x, y, z), radius, len); - WALBERLA_CHECK(capsule != NULL); + WALBERLA_CHECK(capsule != nullptr); capsule->rotate(0, math::realRandom(real_t(0), real_t(1))*math::M_PI, math::realRandom(real_t(0), real_t(1))*math::M_PI); bodies.push_back(capsule); bodySIDs.push_back(capsule->getSystemID()); @@ -485,7 +485,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a real_t z = math::realRandom(forestAABB.zMin(), forestAABB.zMax()); walberla::id_t id = walberla::id_t(boxes+capsules+i); SphereID sphere = createSphere(*globalBodyStorage, *forest, storageID, id, Vec3(x, y, z), radius); - WALBERLA_CHECK(sphere != NULL); + WALBERLA_CHECK(sphere != nullptr); bodies.push_back(sphere); bodySIDs.push_back(sphere->getSystemID()); } @@ -512,45 +512,45 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, walberla::uint8_t a std::vector<std::tuple<Vec3, Vec3, Vec3>> viewVectors; // y up, in negative z direction - viewVectors.push_back(std::make_tuple(Vec3(2, real_t(2.1), 7), + viewVectors.emplace_back(Vec3(2, real_t(2.1), 7), Vec3(real_t(2.1), 2, 4), - Vec3(0,1,0))); + Vec3(0,1,0)); // y up, in positive z direction - viewVectors.push_back(std::make_tuple(Vec3(2, 2, -3), + viewVectors.emplace_back(Vec3(2, 2, -3), Vec3(2, real_t(2.1), real_t(0.1)), - Vec3(0,1,0))); + Vec3(0,1,0)); // x up, in positive z direction - viewVectors.push_back(std::make_tuple(Vec3(2, 2, -3), + viewVectors.emplace_back(Vec3(2, 2, -3), Vec3(2, real_t(2.1), real_t(0.1)), - Vec3(1,0,0))); + Vec3(1,0,0)); // y and x up, in positive z direction - viewVectors.push_back(std::make_tuple(Vec3(2, 2, -3), + viewVectors.emplace_back(Vec3(2, 2, -3), Vec3(2, real_t(2.1), real_t(0.1)), - Vec3(1,1,0))); + Vec3(1,1,0)); // y and x up, in negative z direction - viewVectors.push_back(std::make_tuple(Vec3(2, 2, 6.5), + viewVectors.emplace_back(Vec3(2, 2, 6.5), Vec3(real_t(2.1), real_t(2.1), 4), - Vec3(real_t(0.5),1,0))); + Vec3(real_t(0.5),1,0)); // z up, in positive x direction - viewVectors.push_back(std::make_tuple(Vec3(-3, 2, real_t(1.9)), + viewVectors.emplace_back(Vec3(-3, 2, real_t(1.9)), Vec3(0, real_t(2.1), 2), - Vec3(0,0,1))); + Vec3(0,0,1)); // z up, in negative x direction - viewVectors.push_back(std::make_tuple(Vec3(7, 2, real_t(1.9)), + viewVectors.emplace_back(Vec3(7, 2, real_t(1.9)), Vec3(4, real_t(2.1), 2), - Vec3(0,0,1))); + Vec3(0,0,1)); // z and y up, in negative x direction - viewVectors.push_back(std::make_tuple(Vec3(7, 2, real_t(1.9)), + viewVectors.emplace_back(Vec3(7, 2, real_t(1.9)), Vec3(4, real_t(2.1), 2), - Vec3(0,1,1))); + Vec3(0,1,1)); // z and x up, in negative y direction - viewVectors.push_back(std::make_tuple(Vec3(2, 6, real_t(1.9)), + viewVectors.emplace_back(Vec3(2, 6, real_t(1.9)), Vec3(real_t(2.3), 4, 2), - Vec3(1,0,1))); + Vec3(1,0,1)); // z up, in positive y direction - viewVectors.push_back(std::make_tuple(Vec3(2, real_t(-3.6), real_t(1.9)), + viewVectors.emplace_back(Vec3(2, real_t(-3.6), real_t(1.9)), Vec3(real_t(2.3), 0, real_t(2.1)), - Vec3(0,0,1))); + Vec3(0,0,1)); Lighting lighting0(Vec3(forestAABB.xSize()/real_t(2)+1, forestAABB.ySize()/real_t(2), real_t(2)*forestAABB.zMax()+2), // 8, 5, 9.5 gut für ebenen, 0,5,8 @@ -661,7 +661,7 @@ void HashGridsArtifactsTest(Raytracer::Algorithm raytracingAlgorithm, walberla:: } walberla::id_t id = walberla::id_t(i); BoxID box_ = createBox(*globalBodyStorage, *forest, storageID, id, Vec3(x_min, y_min, z_min), Vec3(len, len, len)); - WALBERLA_CHECK(box_ != NULL); + WALBERLA_CHECK(box_ != nullptr); } raytraceArtifactsForest(raytracingAlgorithm, antiAliasFactor, @@ -706,7 +706,7 @@ void HashGridsFromNegativeArtifactsTest(Raytracer::Algorithm raytracingAlgorithm //real_t z_min = len+0.1; walberla::id_t id = walberla::id_t(i); BoxID box_ = createBox(*globalBodyStorage, *forest, storageID, id, Vec3(x_min, y_min, z_min), Vec3(len, len, len)); - WALBERLA_CHECK(box_ != NULL); + WALBERLA_CHECK(box_ != nullptr); } raytraceArtifactsForest(raytracingAlgorithm, antiAliasFactor, @@ -749,7 +749,7 @@ void HashGridsFromNegativeXArtifactsTest(Raytracer::Algorithm raytracingAlgorith //real_t z_min = len+0.1; walberla::id_t id = walberla::id_t(i); BoxID box_ = createBox(*globalBodyStorage, *forest, storageID, id, Vec3(x_min, y_min, z_min), Vec3(len, len, len)); - WALBERLA_CHECK(box_ != NULL); + WALBERLA_CHECK(box_ != nullptr); } raytraceArtifactsForest(raytracingAlgorithm, antiAliasFactor, @@ -818,25 +818,25 @@ void HashGridsTestScene(Raytracer::Algorithm raytracingAlgorithm = Raytracer::RA std::vector<std::tuple<Vec3, Vec3, Vec3>> viewVectors; // in negative x direction -> cubes to the right - viewVectors.push_back(std::make_tuple(Vec3(15,4,4), + viewVectors.emplace_back(Vec3(15,4,4), Vec3(8,4,4), - Vec3(0,1,0))); + Vec3(0,1,0)); // in negative x direction and negative z direction, up vector in y direction -> cubes from the right tilted - viewVectors.push_back(std::make_tuple(Vec3(12,4,8), + viewVectors.emplace_back(Vec3(12,4,8), Vec3(6,4,2), - Vec3(0,1,0))); + Vec3(0,1,0)); // in negative x direction and negative z direction, up vector in negative y direction - viewVectors.push_back(std::make_tuple(Vec3(12,4,8), + viewVectors.emplace_back(Vec3(12,4,8), Vec3(6,4,2), - Vec3(0,-1,0))); + Vec3(0,-1,0)); // in positive x direction - viewVectors.push_back(std::make_tuple(Vec3(-7,4,4), + viewVectors.emplace_back(Vec3(-7,4,4), Vec3(0,4,4), - Vec3(0,1,0))); + Vec3(0,1,0)); // in negative x direction - viewVectors.push_back(std::make_tuple(Vec3(4,4,15), + viewVectors.emplace_back(Vec3(4,4,15), Vec3(4,4,8), - Vec3(0,1,0))); + Vec3(0,1,0)); WcTimingTree tt; diff --git a/tests/pe/Refinement.cpp b/tests/pe/Refinement.cpp index c53907e410f91fad638e2c4270ef5109a0f221be..361cc322e069680d7911be277e5f3042bece498a 100644 --- a/tests/pe/Refinement.cpp +++ b/tests/pe/Refinement.cpp @@ -141,7 +141,7 @@ int main( int argc, char ** argv ) auto fcdID = forest->addBlockData(fcd::createGenericFCDDataHandling<BodyTuple, fcd::AnalyticCollideFunctor>(), "FCD"); //cr::DEM cr(globalStorage, forest->getBlockStorage(), storageID, ccdID, fcdID, NULL ); - cr::HCSITS cr(globalStorage, forest->getBlockStoragePointer(), storageID, ccdID, fcdID, NULL ); + cr::HCSITS cr(globalStorage, forest->getBlockStoragePointer(), storageID, ccdID, fcdID, nullptr ); auto vtkOutput = make_shared<DefaultBodyVTKOutput>(storageID, forest->getBlockStorage()) ; auto vtkWriter = vtk::createVTKOutput_PointData(vtkOutput, "Bodies", 1, "vtk", "simulation_step", false, false); diff --git a/tests/pe/SerializeDeserialize.cpp b/tests/pe/SerializeDeserialize.cpp index 883a15242529079dc0e52f9cab1c85881ce4ab18..9d92831a20d50d36b370f671a91946bc8029ecb2 100644 --- a/tests/pe/SerializeDeserialize.cpp +++ b/tests/pe/SerializeDeserialize.cpp @@ -37,7 +37,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; void createDump() { diff --git a/tests/pe/SetBodyTypeIDs.cpp b/tests/pe/SetBodyTypeIDs.cpp index 9e99059b24d2fb962f788ff9697130c836dbcf57..6cc5999945b74729741aaf0feb62c9a0df2a13f3 100644 --- a/tests/pe/SetBodyTypeIDs.cpp +++ b/tests/pe/SetBodyTypeIDs.cpp @@ -38,7 +38,7 @@ namespace pe { class Base{ public: Base(id_t const typeID) : typeID_(typeID) {} - virtual ~Base() {} + virtual ~Base() = default; id_t getTypeID() const { return typeID_;} private: id_t typeID_; diff --git a/tests/pe/ShadowCopy.cpp b/tests/pe/ShadowCopy.cpp index 359582c332a5df9491a59f02d4bfe653f1dbb8f6..bf3f39c921ad7878366d02b4454e2b2ae1f32540 100644 --- a/tests/pe/ShadowCopy.cpp +++ b/tests/pe/ShadowCopy.cpp @@ -34,7 +34,7 @@ namespace walberla { using namespace walberla::pe; -typedef Union< boost::tuple<Sphere> > UnionT; +using UnionT = Union<boost::tuple<Sphere> >; typedef boost::tuple<Sphere, UnionT> BodyTuple ; int main( int argc, char** argv ) @@ -81,10 +81,10 @@ int main( int argc, char** argv ) std::function<void(void)> syncCall; if (!syncShadowOwners) { - syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + syncCall = std::bind( pe::syncNextNeighbors<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); } else { - syncCall = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(NULL), real_c(0.0), false ); + syncCall = std::bind( pe::syncShadowOwners<BodyTuple>, std::ref(forest->getBlockForest()), storageID, static_cast<WcTimingTree*>(nullptr), real_c(0.0), false ); } WALBERLA_LOG_PROGRESS_ON_ROOT( " *** SPHERE *** "); diff --git a/tests/pe/SimpleCCD.cpp b/tests/pe/SimpleCCD.cpp index 08571dce0ae31607751754e6b8a52f2337670aba..b1388dab5846c876b419940148acd58a6dc6583f 100644 --- a/tests/pe/SimpleCCD.cpp +++ b/tests/pe/SimpleCCD.cpp @@ -36,7 +36,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; int main( int argc, char** argv ) { diff --git a/tests/pe/SyncEquivalence.cpp b/tests/pe/SyncEquivalence.cpp index a4400e0cec917a7bb10ab0874b2047c57612d8c9..f15dcd4c7bfa47bb74c1c77c3afd456ce0874a39 100644 --- a/tests/pe/SyncEquivalence.cpp +++ b/tests/pe/SyncEquivalence.cpp @@ -44,7 +44,7 @@ namespace walberla { using namespace walberla::pe; using namespace walberla::timing; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; struct BodyData { @@ -126,8 +126,8 @@ void createSimulation(math::AABB& simulationDomain, { SphereID sp = pe::createSphere( *(info.globalBodyStorage.get()), info.forest->getBlockStorage(), info.storageID, static_cast<walberla::id_t>(mpi::MPIManager::instance()->worldRank() * 1000000 + numParticles), *it, radius); Vec3 rndVel(math::realRandom<real_t>(-vMax, vMax, generator), math::realRandom<real_t>(-vMax, vMax, generator), math::realRandom<real_t>(-vMax, vMax, generator)); - if (sp != NULL) sp->setLinearVel(rndVel); - if (sp != NULL) ++numParticles; + if (sp != nullptr) sp->setLinearVel(rndVel); + if (sp != nullptr) ++numParticles; } } WALBERLA_LOG_INFO_ON_ROOT(numParticles << " particles created on root"); diff --git a/tests/pe/Synchronization.cpp b/tests/pe/Synchronization.cpp index f718d492f15d51f21e8fca203c51e725600dc154..646e6d2390fafa8066033ff23dee1a3467962ded 100644 --- a/tests/pe/Synchronization.cpp +++ b/tests/pe/Synchronization.cpp @@ -36,7 +36,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; void checkSphere(StructuredBlockForest& forest, BlockDataID storageID, walberla::id_t sid, Sphere& ref, const Vec3& newPos) { @@ -124,7 +124,7 @@ int main( int argc, char ** argv ) SphereID sphere = createSphere( globalStorage, forest->getBlockStorage(), storageID, 0, gpos, 3); int sphereRank = -1; - if (sphere != NULL) + if (sphere != nullptr) { sphere->setLinearVel(4, 5, 6); sphere->setAngularVel( 1, 2, 3); diff --git a/tests/pe/SynchronizationDelete.cpp b/tests/pe/SynchronizationDelete.cpp index b3eb8f929af9fde16a5a07e95871de84fcf41d42..6b649c29872b57ce376a60c089a259ff0ad385dd 100644 --- a/tests/pe/SynchronizationDelete.cpp +++ b/tests/pe/SynchronizationDelete.cpp @@ -36,7 +36,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; void integrate(StructuredBlockForest& forest, BlockDataID storageID, const real_t dt) { @@ -104,7 +104,7 @@ int main( int argc, char ** argv ) if ((fabs(x) > 0.1) || (fabs(y) > 0.1) || (fabs(z) > 0.1)) { SphereID sp = createSphere( *globalBodyStorage, forest->getBlockStorage(), storageID, 0, Vec3(15,15,15), 3); - if (sp != NULL) sp->setLinearVel(Vec3(x, y, z)); + if (sp != nullptr) sp->setLinearVel(Vec3(x, y, z)); } } diff --git a/tests/pe/SynchronizationLargeBody.cpp b/tests/pe/SynchronizationLargeBody.cpp index 607db910fc753781cbaa11f630e2c3c048d45b07..3846a2b55a9b61606c152f082a6f34af3cf46abb 100644 --- a/tests/pe/SynchronizationLargeBody.cpp +++ b/tests/pe/SynchronizationLargeBody.cpp @@ -35,7 +35,7 @@ namespace walberla { using namespace walberla::pe; -typedef boost::tuple<Sphere> BodyTuple ; +using BodyTuple = boost::tuple<Sphere> ; // checkSphere without dx void checkSphere(StructuredBlockForest& forest, BlockDataID storageID, walberla::id_t sid, SphereID ref, const Vec3& newPos) @@ -167,10 +167,10 @@ int main( int argc, char ** argv ) SphereID sphere = createSphere( *globalStorage, forest->getBlockStorage(), storageID, 0, gpos, r); walberla::id_t sphereID = 789456123; - if (sphere != NULL) sphereID = sphere->getSystemID(); + if (sphere != nullptr) sphereID = sphere->getSystemID(); int sphereRank = -1; - if (sphere != NULL) + if (sphere != nullptr) { sphere->setLinearVel(4, 5, 6); sphere->setAngularVel( 1, 2, 3); @@ -212,10 +212,10 @@ int main( int argc, char ** argv ) //test with dx real_t dx = real_c(0.5); - syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); - syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); - syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); - syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); + syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, nullptr, dx); + syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, nullptr, dx); + syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, nullptr, dx); + syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, nullptr, dx); for (auto dir = stencil::D3Q27::beginNoCenter(); dir != stencil::D3Q27::end(); ++dir) { @@ -223,19 +223,19 @@ int main( int argc, char ** argv ) Vec3 delta = Vec3( real_c(dir.cx()), real_c(dir.cy()), real_c(dir.cz()) ) / real_c(3.0); for (int i = 0; i < 21; ++i) { - syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); + syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, nullptr, dx); Vec3 pos = refSphere.getPosition() + delta; if (!forest->getDomain().contains( pos, real_c(0.5) )) forest->mapToPeriodicDomain(pos); checkSphere(*forest, storageID, sid, &refSphere, pos, dx); } } - syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, NULL, dx); + syncShadowOwners<BodyTuple>(forest->getBlockForest(), storageID, nullptr, dx); WALBERLA_LOG_PROGRESS("TEST WITH DX ... finished"); sphere = static_cast<SphereID> (getBody(*globalStorage, forest->getBlockStorage(), storageID, sphereID)); - if (sphere != NULL) + if (sphere != nullptr) { // WALBERLA_LOG_DEVEL("pos: " << sphere->getPosition()); // WALBERLA_LOG_DEVEL("aabb: " << sphere->getAABB()); diff --git a/tests/pe/Union.cpp b/tests/pe/Union.cpp index bd780f28fc73051e94d913873be581c831ce6e99..91db8412e917ffb127d1432d8524a7c25a9526d6 100644 --- a/tests/pe/Union.cpp +++ b/tests/pe/Union.cpp @@ -44,7 +44,7 @@ namespace walberla { using namespace walberla::pe; -typedef Union< boost::tuple<Sphere> > UnionType ; +using UnionType = Union<boost::tuple<Sphere> > ; typedef boost::tuple<Sphere, Plane, UnionType> BodyTuple ; void SnowManFallingOnPlane() diff --git a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp index ca71c9f03e5f806abae1842c53190c4847dae8fd..8730491ecd8f112c2c4d4b41c159fb7d428cab79 100644 --- a/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/HinderedSettlingDynamicsDPM.cpp @@ -75,19 +75,19 @@ const uint_t FieldGhostLayers( 1 ); typedef GhostLayerField< Matrix3<real_t>, 1 > TensorField_T; typedef GhostLayerField< Vector3<real_t>, 1 > Vec3Field_T; typedef GhostLayerField< real_t, 1 > ScalarField_T; -typedef lbm::force_model::GuoField< Vec3Field_T > ForceModel_T; +using ForceModel_T = lbm::force_model::GuoField<Vec3Field_T>; typedef lbm::D3Q19< lbm::collision_model::SRTField<ScalarField_T>, false, ForceModel_T > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -typedef boost::tuples::tuple< NoSlip_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; typedef boost::tuple<pe::Plane, pe::Sphere> BodyTypeTuple ; @@ -273,7 +273,7 @@ uint_t createSpheresRandomly( StructuredBlockForest & forest, pe::BodyStorage & pe::SphereID sp = pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( xParticle, yParticle, zParticle ), diameter * real_t(0.5), material ); - if( sp != NULL ) + if( sp != nullptr ) { sp->setLinearVel(Vector3<real_t>(real_t(0),real_t(0),initialZVelocity)); } @@ -302,7 +302,7 @@ uint_t createSphereLattice( StructuredBlockForest & forest, pe::BodyStorage & gl { pe::SphereID sp = pe::createSphere( globalBodyStorage, forest.getBlockStorage(), bodyStorageID, 0, *it, diameter * real_t(0.5), material ); - if( sp != NULL ) + if( sp != nullptr ) { sp->setLinearVel(Vector3<real_t>(real_t(0),real_t(0),initialZVelocity)); ++numSpheres; @@ -558,7 +558,7 @@ class DummySweep { public: DummySweep( ) - {} + = default; void operator()(IBlock * const /*block*/) {} @@ -852,7 +852,7 @@ int main( int argc, char **argv ) // connect to pe const real_t overlap = real_t( 1.5 ) * dx; - auto syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + auto syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); shared_ptr<CollisionPropertiesEvaluator> collisionPropertiesEvaluator = walberla::make_shared<CollisionPropertiesEvaluator>( *cr ); // create the spheres @@ -1328,13 +1328,13 @@ int main( int argc, char **argv ) { if( useLubricationCorrection ) { - typedef pe_coupling::LubricationCorrection LE_T; + using LE_T = pe_coupling::LubricationCorrection; shared_ptr<LE_T> lubEval = make_shared<LE_T>( blocks, globalBodyStorage, bodyStorageID, viscosity, lubricationCutOffDistance ); lubricationEvaluationFunction = std::bind(&LE_T::operator(), lubEval); } else { - typedef pe_coupling::discrete_particle_methods::LubricationForceEvaluator LE_T; + using LE_T = pe_coupling::discrete_particle_methods::LubricationForceEvaluator; shared_ptr<LE_T> lubEval = make_shared<LE_T>( blocks, globalBodyStorage, bodyStorageID, viscosity, lubricationCutOffDistance ); lubricationEvaluationFunction = std::bind(&LE_T::operator(), lubEval); } diff --git a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp index 052676d3f0adcc1d0cf63abbd1888f9e1222ce9d..41f952f16f68655b26089ccd3e8db822372ca067 100644 --- a/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp +++ b/tests/pe_coupling/discrete_particle_methods/SphereWallCollisionBehaviorDPM.cpp @@ -74,19 +74,19 @@ const uint_t FieldGhostLayers( 1 ); typedef GhostLayerField< Matrix3<real_t>, 1 > TensorField_T; typedef GhostLayerField< Vector3<real_t>, 1 > Vec3Field_T; typedef GhostLayerField< real_t, 1 > ScalarField_T; -typedef lbm::force_model::GuoField< Vec3Field_T > ForceModel_T; +using ForceModel_T = lbm::force_model::GuoField<Vec3Field_T>; typedef lbm::D3Q19< lbm::collision_model::SRTField<ScalarField_T>, false, ForceModel_T > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -typedef boost::tuples::tuple< NoSlip_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; typedef boost::tuple<pe::Plane, pe::Sphere> BodyTypeTuple ; @@ -699,7 +699,7 @@ int main( int argc, char **argv ) // connect to pe const real_t overlap = real_t( 1.5 ) * dx; - auto syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + auto syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create the sphere const real_t restitutionCoeff = real_t(0.97); @@ -1125,13 +1125,13 @@ int main( int argc, char **argv ) { if( useLubricationCorrection ) { - typedef pe_coupling::LubricationCorrection LE_T; + using LE_T = pe_coupling::LubricationCorrection; shared_ptr<LE_T> lubEval = make_shared<LE_T>( blocks, globalBodyStorage, bodyStorageID, viscosity, lubricationCutOffDistance ); lubricationEvaluationFunction = std::bind(&LE_T::operator(), lubEval); } else { - typedef pe_coupling::discrete_particle_methods::LubricationForceEvaluator LE_T; + using LE_T = pe_coupling::discrete_particle_methods::LubricationForceEvaluator; shared_ptr<LE_T> lubEval = make_shared<LE_T>( blocks, globalBodyStorage, bodyStorageID, viscosity, lubricationCutOffDistance ); lubricationEvaluationFunction = std::bind(&LE_T::operator(), lubEval); } diff --git a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp index bbf5224bf01124e9f8a0864e5e53130c21145105..e78072cbfd76e186f40dee5599d19569dbfc3e6e 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyAtBlockBoarderCheck.cpp @@ -77,23 +77,23 @@ using namespace walberla; using walberla::uint_t; // PDF field, flag field & body field -typedef lbm::D3Q19< lbm::collision_model::TRT > LatticeModel_T; +using LatticeModel_T = lbm::D3Q19<lbm::collision_model::TRT>; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; const uint_t FieldGhostLayers = 4; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; // boundary handling typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< MO_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<MO_T>; typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; -typedef boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -282,18 +282,18 @@ int main( int argc, char **argv ) // connect to pe const real_t overlap = real_c( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); auto sphereMaterialID = pe::createMaterial( "sphereMat", real_c(1) , real_c(0.3), real_c(0.2), real_c(0.2), real_c(0.24), real_c(200), real_c(200), real_c(0), real_c(0) ); // create two spheres: one which overlaps with a block boundary and one inside the block pe::Vec3 referenceVelocity( real_c(0.1), real_c(0), real_c(0) ); auto sphereAtBorder = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_c(31), real_c(31), real_c(31) ), radius, sphereMaterialID ); - if( sphereAtBorder != NULL ) + if( sphereAtBorder != nullptr ) { sphereAtBorder->setLinearVel( referenceVelocity ); } auto sphereInInner = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_c(7), real_c(7), real_c(7) ), radius, sphereMaterialID ); - if( sphereInInner != NULL ) + if( sphereInInner != nullptr ) { sphereInInner->setLinearVel( referenceVelocity ); } @@ -315,7 +315,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp b/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp index 0c527317c58a43c8eab8b835e59772bd9df3042c..695b8740056f5cc91835f302c2816a2c53b67441 100644 --- a/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/BodyMappingTest.cpp @@ -60,15 +60,15 @@ using namespace walberla; using walberla::uint_t; // PDF field, flag field & body field -typedef lbm::D3Q19< lbm::collision_model::SRT > LatticeModel_T; +using LatticeModel_T = lbm::D3Q19<lbm::collision_model::SRT>; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; const uint_t FieldGhostLayers = 1; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; // boundary handling @@ -77,7 +77,7 @@ 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 boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -457,7 +457,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >(MyBoundaryHandling( flagFieldID, pdfFieldID, bodyFieldID ), "boundary handling" ); @@ -504,7 +504,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectRegularBodies ); @@ -517,7 +517,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ///////////////////// @@ -529,7 +529,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectGlobalBodies ); @@ -542,7 +542,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////// @@ -554,7 +554,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, false, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectFixedBodies ); @@ -567,7 +567,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); } ////////////////////////////////// @@ -583,7 +583,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectRegularBodies ); @@ -596,7 +596,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ///////////////////// @@ -608,7 +608,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectGlobalBodies ); @@ -621,7 +621,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////// @@ -633,7 +633,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, false, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectFixedBodies ); @@ -646,7 +646,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); } ///////////////////////////////////// @@ -662,7 +662,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarder, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectRegularBodies ); @@ -675,7 +675,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ///////////////////// @@ -693,7 +693,7 @@ int main( int argc, char **argv ) pe::SphereID sp2 = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarderCopy, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectGlobalBodies ); @@ -707,7 +707,7 @@ int main( int argc, char **argv ) pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp2->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////// @@ -719,7 +719,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarder, radius, sphereMaterialID, false, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); pe_coupling::mapBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, NoSlip_Flag, pe_coupling::selectFixedBodies ); @@ -732,7 +732,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); } ////////////////////////// @@ -752,7 +752,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectRegularBodies ); @@ -766,7 +766,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////////// @@ -778,7 +778,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) regularBodyMapper(&(*blockIt)); @@ -792,7 +792,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ///////////////////// @@ -804,7 +804,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectGlobalBodies ); @@ -818,7 +818,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////////// @@ -830,7 +830,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) globalBodyMapper(&(*blockIt)); @@ -844,7 +844,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////// @@ -856,7 +856,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionInsideBlock, radius, sphereMaterialID, false, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectFixedBodies ); @@ -870,7 +870,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); } ////////////////////////////////// @@ -886,7 +886,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectRegularBodies ); @@ -900,7 +900,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////////// @@ -912,7 +912,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) regularBodyMapper(&(*blockIt)); @@ -926,7 +926,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ///////////////////// @@ -938,7 +938,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectGlobalBodies ); @@ -952,7 +952,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////////// @@ -964,7 +964,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) globalBodyMapper(&(*blockIt)); @@ -978,7 +978,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////// @@ -990,7 +990,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtBlockBoarder, radius, sphereMaterialID, false, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectFixedBodies ); @@ -1004,7 +1004,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); } ///////////////////////////////////// @@ -1020,7 +1020,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarder, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectRegularBodies ); @@ -1034,7 +1034,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////////// @@ -1046,7 +1046,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarder, radius, sphereMaterialID, false, true, false); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); for( auto blockIt = blocks->begin(); blockIt != blocks->end(); ++blockIt ) regularBodyMapper(&(*blockIt)); @@ -1060,7 +1060,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ///////////////////// @@ -1078,7 +1078,7 @@ int main( int argc, char **argv ) pe::SphereID sp2 = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarderCopy, radius, sphereMaterialID, true, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectGlobalBodies ); @@ -1093,7 +1093,7 @@ int main( int argc, char **argv ) pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp2->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, false); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, false); } ////////////////// @@ -1105,7 +1105,7 @@ int main( int argc, char **argv ) pe::SphereID sp = pe::createSphere(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, positionAtPeriodicBoarder, radius, sphereMaterialID, false, false, true); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); pe_coupling::mapMovingBodies< BoundaryHandling_T >(*blocks, boundaryHandlingID, bodyStorageID, *globalBodyStorage, bodyFieldID, MO_Flag, pe_coupling::selectFixedBodies ); @@ -1119,7 +1119,7 @@ int main( int argc, char **argv ) WALBERLA_LOG_DEVEL(testIdentifier << " - ended"); pe::destroyBodyBySID(*globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, sp->getSystemID()); - pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(NULL), overlap, true); + pe::syncNextNeighbors<BodyTypeTuple>(blocks->getBlockForest(), bodyStorageID, static_cast<WcTimingTree *>(nullptr), overlap, true); } diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp index c1d3d69a0964a5d187d79d9304497c00d4bf4ce6..caa0987ed52d9bb2e03b6ffd6618dbe7063e81d1 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEM.cpp @@ -76,14 +76,14 @@ using walberla::uint_t; using lbm::force_model::SimpleConstant; // PDF field, flag field & body field -typedef lbm::force_model::LuoConstant ForceModel_T; +using ForceModel_T = lbm::force_model::LuoConstant; typedef lbm::D3Q19< lbm::collision_model::TRT, false, ForceModel_T, 1> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; @@ -96,7 +96,7 @@ 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 boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -480,7 +480,7 @@ int main( int argc, char **argv ) // synchronize often enough for large bodies for( uint_t i = 0; i < XBlocks / 2; ++i) - pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, NULL, overlap); + pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, nullptr, overlap); /////////////////////// // ADD DATA TO BLOCKS // @@ -502,7 +502,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp index 33371ade972cb4f1315a3edb6838e8cad5a7c011..3d60be54a5ac0f5fc4c7c67ab2e0e126f6078cc5 100644 --- a/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/DragForceSphereMEMRefinement.cpp @@ -86,13 +86,13 @@ using lbm::force_model::SimpleConstant; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false, lbm::force_model::SimpleConstant, 1> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; const uint_t FieldGhostLayers = 4; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; // boundary handling @@ -102,7 +102,7 @@ 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 boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -522,7 +522,7 @@ int main( int argc, char **argv ) // synchronize often enough for large bodies for( uint_t i = 0; i < std::max( uint_c(1), XBlocks / uint_c(2) ) * ( uint_t(1) << ( setup.levels - uint_t(1) ) ); ++i) - pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, NULL, overlap); + pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, nullptr, overlap); /////////////////////// // ADD DATA TO BLOCKS // @@ -540,7 +540,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp index 393df5213fede9b51d2596568193800f5a474a8f..4643443ed0b81f32d660400cd1d038b8e1ba0373 100644 --- a/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/GlobalBodyAsBoundaryMEMStaticRefinement.cpp @@ -78,11 +78,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 4; @@ -90,10 +90,10 @@ const uint_t FieldGhostLayers = 4; // boundary handling typedef pe_coupling::SimpleBB< LatticeModel_T, FlagField_T > MO_SBB_T; -typedef boost::tuples::tuple< MO_SBB_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<MO_SBB_T>; typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; -typedef boost::tuple< pe::Plane > BodyTypeTuple; +using BodyTypeTuple = boost::tuple<pe::Plane>; /////////// // FLAGS // @@ -379,7 +379,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( MyBoundaryHandling( flagFieldID, pdfFieldID, bodyFieldID ), "boundary handling" ); diff --git a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp index 787718266e09f2c642568e1e615b066ab9d35828..0f4dbd3fecab43b90f7a5c12601bdb9beb3f16e0 100644 --- a/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/LubricationCorrectionMEM.cpp @@ -79,11 +79,11 @@ using walberla::uint_t; // pdf field & flag field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; const uint_t FieldGhostLayers = 1; @@ -788,11 +788,11 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_c( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create the material const auto myMat = pe::createMaterial( "myMat", real_c(1.4), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0) ); @@ -808,9 +808,9 @@ int main( int argc, char **argv ) // create two approaching spheres auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, id1, Vector3<real_t> (real_c(50.0), real_c(64.0), real_c(64.0)), radius, myMat ); - if ( sphere != NULL ) sphere->setLinearVel( velocity); + if ( sphere != nullptr ) sphere->setLinearVel( velocity); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, id2, Vector3<real_t> (real_c(78.0), real_c(64.0), real_c(64.0)), radius, myMat ); - if ( sphere != NULL ) sphere->setLinearVel(-velocity); + if ( sphere != nullptr ) sphere->setLinearVel(-velocity); } // sphere-wall test @@ -828,7 +828,7 @@ int main( int argc, char **argv ) // <19.2,64,64> // <25.6,64,64> // <28.8,64,64> // <38.4,64,64> //1st: <41.765,64,64> // <27.205,64,64> // <20.88,64,64> (chosen s.th. last gap: 0.05 and initial s=1.1 ) // like Ding: <17,64,64> // 6 // 8 // 9 // 12 //1st // 13.05 // 8.5 // 6.525 // like Ding: 4.25 auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, id1, Vector3<real_t> (real_c(38.4), real_c(64.0), real_c(64.0)), radius, myMat ); - if ( sphere != NULL ) sphere->setLinearVel( velocity); + if ( sphere != nullptr ) sphere->setLinearVel( velocity); } if ( funcTest ) @@ -841,9 +841,9 @@ int main( int argc, char **argv ) // create two approaching spheres auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, id1, Vector3<real_t> (real_c( 6.0) , real_c(6.0), real_c(6.0)), radius, myMat ); - if ( sphere != NULL ) sphere->setLinearVel( velocity); + if ( sphere != nullptr ) sphere->setLinearVel( velocity); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, id2, Vector3<real_t> (real_c(12.0) , real_c(6.0), real_c(6.0)), radius, myMat ); - if ( sphere != NULL ) sphere->setLinearVel( -velocity); + if ( sphere != nullptr ) sphere->setLinearVel( -velocity); // set the same boundary handling as for the sphere-sphereTest sphSphTest = true; @@ -908,7 +908,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling & initialize outer domain boundaries (moving walls on the front, back, top, and bottom plane) BlockDataID boundaryHandlingID; diff --git a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp index bbf831d830ea84b7e37aa22d1668787256275546..2ecfd788de6d83a3dc1e9677f7bdba9a437095b9 100644 --- a/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/PeriodicParticleChannelMEM.cpp @@ -86,11 +86,11 @@ using walberla::uint_t; // pdf field & flag field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; @@ -125,7 +125,7 @@ class VelocityCheck { public: - typedef lbm::PdfField< LatticeModel_T > PdfField; + using PdfField = lbm::PdfField<LatticeModel_T>; VelocityCheck( const ConstBlockDataID & pdfFieldID, const ConstBlockDataID & flagFieldID, const Set< FlagUID > & cellsToCheck, const real_t uMax, const uint_t checkFrequency ) : @@ -410,11 +410,11 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_c( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies const auto material = pe::createMaterial( "granular", real_c(1.2), real_c(0.25), real_c(0.4), real_c(0.4), real_c(0.35), real_c(1.39e11), real_c(5.18e7), real_c(1.07e2), real_c(1.07e2) ); @@ -439,31 +439,31 @@ int main( int argc, char **argv ) const real_t radius = real_t(10); auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(50), real_t(35) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(35), real_t(50) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(65), real_t(50) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(15), real_t(50), real_t(65) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(35), real_t(35) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(65), real_t(35) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(35), real_t(65) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(35), real_t(65), real_t(65) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, Vector3<real_t>( real_t(50), real_t(50), real_t(50) ), radius, material ); - if( sphere != NULL ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); + if( sphere != nullptr ) sphere->setLinearVel( velocity, real_t(0), real_t(0) ); //synchronize the pe set up on all processes syncCall(); @@ -486,7 +486,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling & initialize outer domain boundaries (moving walls on the front, back, top, and bottom plane) BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp index c05c2636c7caa4c300f94c5dadfd0f2177bc947e..a238ce167bc2e2b17f7ad38d5faf1d4667b8bbdc 100644 --- a/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SegreSilberbergMEM.cpp @@ -84,11 +84,11 @@ using lbm::force_model::SimpleConstant; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false, SimpleConstant > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; @@ -544,17 +544,17 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; std::function<void(void)> syncCall; if (!syncShadowOwners) { - syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); } else { - syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); } // create pe bodies @@ -568,7 +568,7 @@ int main( int argc, char **argv ) const auto sphereMaterial = pe::createMaterial( "mySphereMat", setup.rho_p , real_t(0.5), real_t(0.1), real_t(0.1), real_t(0.24), real_t(200), real_t(200), real_t(0), real_t(0) ); Vector3<real_t> position( real_c(setup.xlength) * real_t(0.5), real_c(setup.ylength) * real_t(0.5), real_c(setup.zlength) * real_t(0.5) - real_t(1) ); auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, position, particleRadius, sphereMaterial ); - if( sphere != NULL ) + if( sphere != nullptr ) { real_t height = real_t( 0.5 ) * real_c( setup.zlength ); // set sphere velocity to undisturbed fluid velocity at sphere center @@ -601,7 +601,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp index 9a8f53528aa3750c92b2f748c553fb26808f16a4..b90dcf0056803b867190b27ccae6dd2e640620ec 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEM.cpp @@ -81,11 +81,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; @@ -455,11 +455,11 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies @@ -495,7 +495,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( MyBoundaryHandling( flagFieldID, pdfFieldID, bodyFieldID ), "boundary handling" ); diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp index 6ebde5403e925066e172980f9286ca4f4455311d..3104a3c881cace72fe9694b92b9ab25b8078228b 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMDynamicRefinement.cpp @@ -83,11 +83,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 4; @@ -287,7 +287,7 @@ public: blocks_( blocks ), flagFieldID_( flagFieldID ), pdfFieldID_( pdfFieldID ), bodyFieldID_ ( bodyFieldID ) {} - BoundaryHandling_T * initialize( IBlock * const block ); + BoundaryHandling_T * initialize( IBlock * const block ) override; private: @@ -675,11 +675,11 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies @@ -715,7 +715,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addBlockData( make_shared< MyBoundaryHandling >( blocks, flagFieldID, pdfFieldID, bodyFieldID ), diff --git a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp index aa9ef62e7ff6318f5fbde40653afdb820ad07281..41da5d22c76cf4cbc5de3f44b9ad668cb3265cd9 100644 --- a/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SettlingSphereMEMStaticRefinement.cpp @@ -81,11 +81,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 4; @@ -542,11 +542,11 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies @@ -584,7 +584,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field", FieldGhostLayers ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf, FieldGhostLayers ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf, FieldGhostLayers ); // add boundary handling BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( MyBoundaryHandling( flagFieldID, pdfFieldID, bodyFieldID ), "boundary handling" ); diff --git a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp index 08a7ad4d2b61ebaa7c6108255619423a10127763..ecc2e6642f8ce1a404b35714a03a2a20a0892ecd 100644 --- a/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp +++ b/tests/pe_coupling/momentum_exchange_method/SquirmerTest.cpp @@ -80,14 +80,14 @@ using namespace walberla; using walberla::uint_t; // PDF field, flag field & body field -typedef lbm::force_model::None ForceModel_T; +using ForceModel_T = lbm::force_model::None; typedef lbm::D3Q19<lbm::collision_model::TRT, false, ForceModel_T> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField<LatticeModel_T> PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField<flag_t> FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField<pe::BodyID, 1> PeBodyField_T; const uint_t FieldGhostLayers = 1; @@ -95,10 +95,10 @@ const uint_t FieldGhostLayers = 1; // boundary handling typedef pe_coupling::SimpleBB<LatticeModel_T, FlagField_T> MO_BB_T; -typedef boost::tuples::tuple<MO_BB_T> BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<MO_BB_T>; typedef BoundaryHandling<FlagField_T, Stencil_T, BoundaryConditions_T> BoundaryHandling_T; -typedef boost::tuple<pe::Squirmer> BodyTypeTuple; +using BodyTypeTuple = boost::tuple<pe::Squirmer>; /////////// // FLAGS // @@ -292,7 +292,7 @@ int main(int argc, char **argv) { std::function<void(void)> syncCall = std::bind(pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, - static_cast<WcTimingTree *>(NULL), overlap, false); + static_cast<WcTimingTree *>(nullptr), overlap, false); const auto myMat = pe::createMaterial("myMat", real_c(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(1), real_t(1), real_t(0), real_t(0)); @@ -325,7 +325,7 @@ int main(int argc, char **argv) { BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>(blocks, "flag field"); // add body field - BlockDataID bodyFieldID = field::addToStorage<PeBodyField_T>(blocks, "body field", NULL, field::zyxf); + BlockDataID bodyFieldID = field::addToStorage<PeBodyField_T>(blocks, "body field", nullptr, field::zyxf); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addStructuredBlockData<BoundaryHandling_T>( diff --git a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp index 54cf9698ead46a8afeb1a6b90a6cbca1ac4715b8..0205b4695a0eeff177c2d6a00f5acac3ac8c6315 100644 --- a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp @@ -77,18 +77,18 @@ using walberla::uint_t; // pdf field & flag field typedef lbm::D3Q19< lbm::collision_model::TRT, false > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; typedef pe_coupling::CurvedLinear< LatticeModel_T, FlagField_T > MO_T; -typedef boost::tuples::tuple< MO_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<MO_T>; typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; typedef boost::tuple< pe::Capsule, pe::CylindricalBoundary > BodyTypeTuple; @@ -305,7 +305,7 @@ int main( int argc, char **argv ) // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies const auto material = pe::createMaterial( "granular", real_t(1.2), real_t(0.25), real_t(0.4), real_t(0.4), real_t(0.35), real_t(1.39e11), real_t(5.18e7), real_t(1.07e2), real_t(1.07e2) ); @@ -333,7 +333,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling & initialize outer domain boundaries (moving walls on the front, back, top, and bottom plane) BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp index 2ff3f3c98e779a184d5c5e51e1407df41814814f..7f43c9fd26fd49fc1453fcb677542cab9064c5b4 100644 --- a/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TorqueSphereMEM.cpp @@ -78,11 +78,11 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::TRT, false, lbm::force_model::None, 1> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; @@ -95,7 +95,7 @@ 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 boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -421,14 +421,14 @@ int main( int argc, char **argv ) // create the sphere in the middle of the domain Vector3<real_t> position (real_c(setup.length) * real_c(0.5)); auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, position, setup.radius ); - if ( sphere != NULL ) + if ( sphere != nullptr ) { sphere->setAngularVel( real_c(0), setup.angularVel, real_c(0) ); } // synchronize often enough for large bodies for( uint_t i = 0; i < XBlocks / 2; ++i) - pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, NULL, overlap); + pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, nullptr, overlap); /////////////////////// @@ -452,7 +452,7 @@ int main( int argc, char **argv ) BlockDataID flagFieldID = field::addFlagFieldToStorage<FlagField_T>( blocks, "flag field" ); // add body field - BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", NULL, field::zyxf ); + BlockDataID bodyFieldID = field::addToStorage<BodyField_T>( blocks, "body field", nullptr, field::zyxf ); // add boundary handling & initialize outer domain boundaries BlockDataID boundaryHandlingID = blocks->addStructuredBlockData< BoundaryHandling_T >( diff --git a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp index 1547b5baa773303c0002aa8779127d5cecc4e711..fb92b0c68975877bf00a5066acd6ce08735113ba 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSM.cpp @@ -76,19 +76,19 @@ using walberla::uint_t; using lbm::force_model::SimpleConstant; // PDF field, flag field & body field -typedef lbm::force_model::LuoConstant ForceModel_T; +using ForceModel_T = lbm::force_model::LuoConstant; typedef lbm::D3Q19< lbm::collision_model::SRT, false, ForceModel_T, 1> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef std::pair< pe::BodyID, real_t > BodyAndVolumeFraction_T; typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolumeFractionField_T; -typedef boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -415,7 +415,7 @@ int main( int argc, char **argv ) // synchronize often enough for large bodies for( uint_t i = 0; i < XBlocks / 2; ++i) - pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, NULL, overlap); + pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, nullptr, overlap); /////////////////////// // ADD DATA TO BLOCKS // diff --git a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp index d3b4fce22a25f4972df158c1331b29cc5d9e789e..2fbc0fcbe38bcdb21cc3b0a936ef552ff60f3f83 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/DragForceSpherePSMRefinement.cpp @@ -86,22 +86,22 @@ using lbm::force_model::SimpleConstant; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::SRT, false, lbm::force_model::SimpleConstant, 1> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; const uint_t FieldGhostLayers = 4; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef std::pair< pe::BodyID, real_t > BodyAndVolumeFraction_T; typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolumeFractionField_T; typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -typedef boost::tuples::tuple< NoSlip_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; -typedef boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -527,7 +527,7 @@ int main( int argc, char **argv ) // synchronize often enough for large bodies for( uint_t i = 0; i < std::max( uint_c(1), XBlocks / uint_c(2) ) * ( uint_t(1) << ( setup.levels - uint_t(1) ) ); ++i) - pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, NULL, overlap); + pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, nullptr, overlap); /////////////////////// // ADD DATA TO BLOCKS // diff --git a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp index f0153483fe0b11da945750d7f428fed8b22e02ac..46f2a10e4fbc83242bd90a2b1510a4425543a090 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/SegreSilberbergPSM.cpp @@ -65,6 +65,7 @@ #include "lbm/vtk/all.h" #include <functional> +#include <memory> namespace segre_silberberg_psm { @@ -83,11 +84,11 @@ using lbm::force_model::SimpleConstant; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::SRT, false, SimpleConstant > LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef GhostLayerField< pe::BodyID, 1 > BodyField_T; const uint_t FieldGhostLayers = 1; @@ -97,7 +98,7 @@ typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolu // boundary handling typedef lbm::NoSlip< LatticeModel_T, flag_t > NoSlip_T; -typedef boost::tuples::tuple< NoSlip_T > BoundaryConditions_T; +using BoundaryConditions_T = boost::tuples::tuple<NoSlip_T>; typedef BoundaryHandling< FlagField_T, Stencil_T, BoundaryConditions_T > BoundaryHandling_T; typedef boost::tuple< pe::Sphere, pe::Plane > BodyTypeTuple; @@ -500,11 +501,11 @@ int main( int argc, char **argv ) auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); // set up collision response, here DEM solver - pe::cr::DEM cr( globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL ); + pe::cr::DEM cr( globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr ); // set up synchronization procedure const real_t overlap = real_c( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncShadowOwners<BodyTypeTuple>, std::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // create pe bodies @@ -517,7 +518,7 @@ int main( int argc, char **argv ) const auto sphereMaterial = pe::createMaterial( "mySphereMat", setup.rho_p , real_c(0.5), real_c(0.1), real_c(0.1), real_c(0.24), real_c(200), real_c(200), real_c(0), real_c(0) ); Vector3<real_t> position( real_c(setup.xlength) * real_c(0.5), real_c(setup.ylength) * real_c(0.5), real_c(setup.zlength) * real_c(0.5) - real_c(1) ); auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, position, particleRadius, sphereMaterial ); - if( sphere != NULL ) + if( sphere != nullptr ) { real_t height = real_c( 0.5 ) * real_c( setup.zlength ); // set sphere velocity to undisturbed fluid velocity at sphere center @@ -632,8 +633,8 @@ int main( int argc, char **argv ) timeloop.addFuncAfterTimeStep( pe_coupling::TimeStep( blocks, bodyStorageID, cr, syncCall, dt_pe, pe_interval ), "pe Time Step" ); // check for convergence of the particle position - shared_ptr< SteadyStateCheck > check = shared_ptr< SteadyStateCheck >( new SteadyStateCheck( &timeloop, &setup, blocks, bodyStorageID, - fileIO, SC1W1, SC2W1, SC3W1, SC1W2, SC2W2, SC3W2 ) ); + shared_ptr< SteadyStateCheck > check = std::make_shared< SteadyStateCheck >( &timeloop, &setup, blocks, bodyStorageID, + fileIO, SC1W1, SC2W1, SC3W1, SC1W2, SC2W2, SC3W2 ); timeloop.addFuncAfterTimeStep( SharedFunctor< SteadyStateCheck >( check ), "steady state check" ); if( vtkIO ) diff --git a/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp b/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp index f91b5566e82396466744845bae224e5028e769a6..64114c43e0f76a36da85962123e6ca71074fb144 100644 --- a/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp +++ b/tests/pe_coupling/partially_saturated_cells_method/TorqueSpherePSM.cpp @@ -77,16 +77,16 @@ using walberla::uint_t; // PDF field, flag field & body field typedef lbm::D3Q19< lbm::collision_model::SRT, false, lbm::force_model::None, 1> LatticeModel_T; -typedef LatticeModel_T::Stencil Stencil_T; -typedef lbm::PdfField< LatticeModel_T > PdfField_T; +using Stencil_T = LatticeModel_T::Stencil; +using PdfField_T = lbm::PdfField<LatticeModel_T>; -typedef walberla::uint8_t flag_t; -typedef FlagField< flag_t > FlagField_T; +using flag_t = walberla::uint8_t; +using FlagField_T = FlagField<flag_t>; typedef std::pair< pe::BodyID, real_t > BodyAndVolumeFraction_T; typedef GhostLayerField< std::vector< BodyAndVolumeFraction_T >, 1 > BodyAndVolumeFractionField_T; -typedef boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /////////// // FLAGS // @@ -355,14 +355,14 @@ int main( int argc, char **argv ) // create the sphere in the middle of the domain Vector3<real_t> position (real_c(setup.length) * real_c(0.5)); auto sphere = pe::createSphere( *globalBodyStorage, blocks->getBlockStorage(), bodyStorageID, 0, position, setup.radius ); - if ( sphere != NULL ) + if ( sphere != nullptr ) { sphere->setAngularVel( real_c(0), setup.angularVel, real_c(0) ); } // synchronize often enough for large bodies for( uint_t i = 0; i < XBlocks / 2; ++i) - pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, NULL, overlap); + pe::syncShadowOwners<BodyTypeTuple>( blocks->getBlockForest(), bodyStorageID, nullptr, overlap); /////////////////////// diff --git a/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp b/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp index ed015b72f6c78f0ecf445ea4e7e8295a036f1d1e..bf84cbe06f2dafcd9b732505913ab2fd1da4efdf 100644 --- a/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp +++ b/tests/pe_coupling/utility/BodiesForceTorqueContainerTest.cpp @@ -40,7 +40,7 @@ namespace force_torque_container_test using namespace walberla; -typedef boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /*!\brief Test cases for the force torque container provided by the coupling module @@ -90,7 +90,7 @@ int main( int argc, char **argv ) // pe coupling const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // sphere positions for test scenarios Vector3<real_t> positionInsideBlock(real_t(10), real_t(10), real_t(10)); diff --git a/tests/pe_coupling/utility/PeSubCyclingTest.cpp b/tests/pe_coupling/utility/PeSubCyclingTest.cpp index c21cdff12ee606166f60c42cc53e9a42435c2146..fb869661f14bbcec5c24396947183181bc481329 100644 --- a/tests/pe_coupling/utility/PeSubCyclingTest.cpp +++ b/tests/pe_coupling/utility/PeSubCyclingTest.cpp @@ -41,7 +41,7 @@ namespace pe_sub_cycling_test using namespace walberla; -typedef boost::tuple<pe::Sphere> BodyTypeTuple ; +using BodyTypeTuple = boost::tuple<pe::Sphere> ; /*!\brief test case to check functionality of sub cycling in the pe time step provided by the coupling module * @@ -95,11 +95,11 @@ int main( int argc, char **argv ) auto ccdID = blocks->addBlockData(pe::ccd::createHashGridsDataHandling( globalBodyStorage, bodyStorageID ), "CCD"); auto fcdID = blocks->addBlockData(pe::fcd::createGenericFCDDataHandling<BodyTypeTuple, pe::fcd::AnalyticCollideFunctor>(), "FCD"); - pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, NULL); + pe::cr::DEM cr(globalBodyStorage, blocks->getBlockStoragePointer(), bodyStorageID, ccdID, fcdID, nullptr); // set up synchronization procedure const real_t overlap = real_t( 1.5 ) * dx; - std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(NULL), overlap, false ); + std::function<void(void)> syncCall = std::bind( pe::syncNextNeighbors<BodyTypeTuple>, boost::ref(blocks->getBlockForest()), bodyStorageID, static_cast<WcTimingTree*>(nullptr), overlap, false ); // sphere positions for test scenarios