From 274610d9402e18f484fc2294c62c2e0bf8a33944 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Fri, 3 Aug 2018 11:04:28 +0200 Subject: [PATCH] clang-tidy -checks=-*,modernize-use-emplace --- src/blockforest/Block.cpp | 4 +- src/blockforest/BlockForest.cpp | 18 +++--- src/blockforest/PhantomBlockForest.cpp | 6 +- .../loadbalancing/StaticParMetis.cpp | 2 +- .../StructuredBlockStorage.cpp | 2 +- src/pe/vtk/BodyVtkOutput.cpp | 6 +- src/pe/vtk/EllipsoidVtkOutput.cpp | 12 ++-- src/pe/vtk/SphereVtkOutput.cpp | 14 ++--- .../BodyAndVolumeFractionMapping.cpp | 4 +- src/timeloop/PerformanceMeter.cpp | 4 +- src/timeloop/Timeloop.cpp | 4 +- src/vtk/VTKOutput.cpp | 8 +-- tests/blockforest/BlockForestTest.cpp | 2 +- tests/core/GridGeneratorTest.cpp | 54 ++++++++--------- .../equation_system/EquationSolverTest.cpp | 30 +++++----- tests/core/mpi/SetReductionTest.cpp | 2 +- .../selectable/SetSelectableObjectTest.cpp | 40 ++++++------- tests/field/FlagFieldTest.cpp | 16 ++--- tests/lbm/SweepEquivalenceTest.cpp | 12 ++-- tests/lbm/evaluations/PermeabilityTest.cpp | 18 +++--- tests/lbm/geometry/IntersectionRatioTest.cpp | 8 +-- tests/mesh/MeshPeRaytracing.cpp | 16 ++--- tests/mesh/PeVTKMeshWriterTest.cpp | 22 +++---- tests/mesh/QHullTest.cpp | 42 ++++++------- tests/pe/ParallelEquivalence.cpp | 4 +- tests/pe/Raytracing.cpp | 60 +++++++++---------- 26 files changed, 205 insertions(+), 205 deletions(-) diff --git a/src/blockforest/Block.cpp b/src/blockforest/Block.cpp index d13ba9de7..f366f8d3d 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 9b16b57bb..2fee938bc 100644 --- a/src/blockforest/BlockForest.cpp +++ b/src/blockforest/BlockForest.cpp @@ -545,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 ) { @@ -567,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 ); } } @@ -615,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 ); @@ -1495,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; @@ -1571,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); } } @@ -1600,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++; } } @@ -2165,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() ) ); } } @@ -2470,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 // @@ -2601,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) diff --git a/src/blockforest/PhantomBlockForest.cpp b/src/blockforest/PhantomBlockForest.cpp index 68a8e1a70..accf55746 100644 --- a/src/blockforest/PhantomBlockForest.cpp +++ b/src/blockforest/PhantomBlockForest.cpp @@ -238,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(), @@ -263,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 ); @@ -297,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 ); diff --git a/src/blockforest/loadbalancing/StaticParMetis.cpp b/src/blockforest/loadbalancing/StaticParMetis.cpp index 10345343d..34f83aca8 100644 --- a/src/blockforest/loadbalancing/StaticParMetis.cpp +++ b/src/blockforest/loadbalancing/StaticParMetis.cpp @@ -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/domain_decomposition/StructuredBlockStorage.cpp b/src/domain_decomposition/StructuredBlockStorage.cpp index 6cdafd357..1c4351735 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/pe/vtk/BodyVtkOutput.cpp b/src/pe/vtk/BodyVtkOutput.cpp index 6d13f3df3..a176e01e0 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 816fb2028..67be6f247 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 626685a43..7ae03c088 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 adf675597..d0d36a921 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 ); } } } @@ -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/timeloop/PerformanceMeter.cpp b/src/timeloop/PerformanceMeter.cpp index 884291215..6efb92d96 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 d0641f9ca..6b2f548d5 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; } diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index 3661f7ad9..9f1e027cf 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -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 4ce1d0019..19cda03b5 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 ) { diff --git a/tests/core/GridGeneratorTest.cpp b/tests/core/GridGeneratorTest.cpp index bb5520a40..7971b5f07 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/math/equation_system/EquationSolverTest.cpp b/tests/core/math/equation_system/EquationSolverTest.cpp index 29ec4ed31..4319769cf 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 diff --git a/tests/core/mpi/SetReductionTest.cpp b/tests/core/mpi/SetReductionTest.cpp index d8dcc52ee..03822b995 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 bbef76361..484050711 100644 --- a/tests/core/selectable/SetSelectableObjectTest.cpp +++ b/tests/core/selectable/SetSelectableObjectTest.cpp @@ -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/field/FlagFieldTest.cpp b/tests/field/FlagFieldTest.cpp index a73c506fa..ce5887c5b 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) { diff --git a/tests/lbm/SweepEquivalenceTest.cpp b/tests/lbm/SweepEquivalenceTest.cpp index e29bab05f..dbd98b1fe 100644 --- a/tests/lbm/SweepEquivalenceTest.cpp +++ b/tests/lbm/SweepEquivalenceTest.cpp @@ -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/evaluations/PermeabilityTest.cpp b/tests/lbm/evaluations/PermeabilityTest.cpp index 9188fd04d..6a0d25cbd 100644 --- a/tests/lbm/evaluations/PermeabilityTest.cpp +++ b/tests/lbm/evaluations/PermeabilityTest.cpp @@ -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; } diff --git a/tests/lbm/geometry/IntersectionRatioTest.cpp b/tests/lbm/geometry/IntersectionRatioTest.cpp index ae7a4a159..a252f9b65 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/mesh/MeshPeRaytracing.cpp b/tests/mesh/MeshPeRaytracing.cpp index 0cde05aa0..432d27293 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 48d975110..518f020e7 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; diff --git a/tests/mesh/QHullTest.cpp b/tests/mesh/QHullTest.cpp index c755a46ec..5206b9997 100644 --- a/tests/mesh/QHullTest.cpp +++ b/tests/mesh/QHullTest.cpp @@ -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/pe/ParallelEquivalence.cpp b/tests/pe/ParallelEquivalence.cpp index 712779131..a8fd5bffe 100644 --- a/tests/pe/ParallelEquivalence.cpp +++ b/tests/pe/ParallelEquivalence.cpp @@ -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/Raytracing.cpp b/tests/pe/Raytracing.cpp index 36aa2ca93..cb935d969 100644 --- a/tests/pe/Raytracing.cpp +++ b/tests/pe/Raytracing.cpp @@ -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 @@ -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; -- GitLab