Skip to content
Snippets Groups Projects
Commit 2b31342c authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

replaced memory allocations in CreateWorld with smart pointers

parent c78e3428
No related merge requests found
...@@ -79,7 +79,7 @@ std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB simula ...@@ -79,7 +79,7 @@ std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB simula
blocks[2] = 2; blocks[2] = 2;
} }
auto sforest = std::unique_ptr<SetupBlockForest>( new SetupBlockForest() ); auto sforest = std::make_unique<SetupBlockForest>( );
sforest->addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment ); sforest->addWorkloadMemorySUIDAssignmentFunction( blockforest::uniformWorkloadAndMemoryAssignment );
sforest->addRefinementSelectionFunction( FixedRefinementLevelSelector(initialRefinementLevel) ); sforest->addRefinementSelectionFunction( FixedRefinementLevelSelector(initialRefinementLevel) );
sforest->init( simulationDomain, blocks[0], blocks[1], blocks[2], isPeriodic[0], isPeriodic[1], isPeriodic[2] ); 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, ...@@ -103,7 +103,7 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain,
} }
std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest( simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel )); 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, shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain,
...@@ -142,7 +142,7 @@ 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( "Production Run!" );
WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure: loading from file \'" << sbffile << "\' ..." ); 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 );
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment