From 2b31342ca89d5bead6feedd3f7e89a0865f9821a Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Wed, 13 Jun 2018 10:56:44 +0200 Subject: [PATCH] replaced memory allocations in CreateWorld with smart pointers --- src/pe/utility/CreateWorld.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pe/utility/CreateWorld.cpp b/src/pe/utility/CreateWorld.cpp index aa7df4ea4..919840085 100644 --- a/src/pe/utility/CreateWorld.cpp +++ b/src/pe/utility/CreateWorld.cpp @@ -79,7 +79,7 @@ std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB simula blocks[2] = 2; } - auto sforest = std::unique_ptr<SetupBlockForest>( new SetupBlockForest() ); + auto sforest = std::make_unique<SetupBlockForest>( ); sforest->addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment ); sforest->addRefinementSelectionFunction( FixedRefinementLevelSelector(initialRefinementLevel) ); sforest->init( simulationDomain, blocks[0], blocks[1], blocks[2], isPeriodic[0], isPeriodic[1], isPeriodic[2] ); @@ -103,7 +103,7 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, } std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest( simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel )); - return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), *sforest, false ) ); + return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), *sforest, false ); } shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, @@ -142,7 +142,7 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, WALBERLA_LOG_INFO_ON_ROOT( "Production Run!" ); WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure: loading from file \'" << sbffile << "\' ..." ); - return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) ); + return std::make_shared< BlockForest >( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ); } -- GitLab