diff --git a/.clang-tidy b/.clang-tidy index 00ffd56f0a78c48c38c69cbc6ea2577d090e8a69..7127535c8e66a377978897492b26cb954201dc20 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -65,7 +65,6 @@ readability-use-anyofallof ' WarningsAsErrors: '*' -HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false +HeaderFilterRegex: '.*' ... diff --git a/src/blockforest/AABBRefinementSelection.h b/src/blockforest/AABBRefinementSelection.h index fc454bedc4de777788d6b4a25ceb202bf950a373..45847dca596dc84415629404a8ac622684a3e8ec 100644 --- a/src/blockforest/AABBRefinementSelection.h +++ b/src/blockforest/AABBRefinementSelection.h @@ -40,7 +40,7 @@ class AABBRefinementSelection { public: - AABBRefinementSelection(){} + AABBRefinementSelection()= default; AABBRefinementSelection( const Config::BlockHandle & configBlock ) { @@ -74,12 +74,12 @@ public: void addAABB( const math::AABB & aabb, const uint_t level ) { - aabbs_.push_back( std::make_pair( aabb, level ) ); + aabbs_.emplace_back( aabb, level ); } void addRegion( const math::AABB & region, const uint_t level ) { - regions_.push_back( std::make_pair( region, level ) ); + regions_.emplace_back( region, level ); } // for static refinement @@ -144,12 +144,12 @@ private: std::vector< std::pair< math::AABB, uint_t > > aabbs; for( auto region = regions_.begin(); region != regions_.end(); ++region ) { - aabbs.push_back( std::make_pair( math::AABB( simulationDomain.xMin() + region->first.xMin() * simulationDomain.xSize(), - simulationDomain.yMin() + region->first.yMin() * simulationDomain.ySize(), - simulationDomain.zMin() + region->first.zMin() * simulationDomain.zSize(), - simulationDomain.xMin() + region->first.xMax() * simulationDomain.xSize(), - simulationDomain.yMin() + region->first.yMax() * simulationDomain.ySize(), - simulationDomain.zMin() + region->first.zMax() * simulationDomain.zSize() ), region->second ) ); + aabbs.emplace_back( math::AABB( simulationDomain.xMin() + region->first.xMin() * simulationDomain.xSize(), + simulationDomain.yMin() + region->first.yMin() * simulationDomain.ySize(), + simulationDomain.zMin() + region->first.zMin() * simulationDomain.zSize(), + simulationDomain.xMin() + region->first.xMax() * simulationDomain.xSize(), + simulationDomain.yMin() + region->first.yMax() * simulationDomain.ySize(), + simulationDomain.zMin() + region->first.zMax() * simulationDomain.zSize() ), region->second ); } return aabbs; } diff --git a/src/blockforest/Block.h b/src/blockforest/Block.h index 39d958b7e8ecad45bd56d7113f1eebb8412fb41f..caf87d6239c355bdd155e209fdf45afd84fadf45 100644 --- a/src/blockforest/Block.h +++ b/src/blockforest/Block.h @@ -79,14 +79,14 @@ public: Block( BlockForest & forest, const BlockID & id, const AABB & aabb, const uint_t level, mpi::RecvBuffer & buffer, const std::function< uint_t ( const uint_t ) > & processMapping = std::function< uint_t ( const uint_t ) >() ); - virtual ~Block() {} + ~Block() override = default; void toBuffer( mpi::SendBuffer & buffer ) const; const BlockForest & getForest() const { return forest_; } BlockForest & getForest() { return forest_; } - const BlockID & getId() const { return id_; } + const BlockID & getId() const override { return id_; } uint_t getProcess() const; uint_t getLevel() const { return level_; } @@ -135,7 +135,7 @@ public: protected: - bool equal( const IBlock* rhs ) const; + bool equal( const IBlock* rhs ) const override; private: @@ -296,7 +296,7 @@ inline void Block::addNeighbor( const BlockID & id, const uint_t process, const WALBERLA_ASSERT( neighborhood_[i].getId() < id || id < neighborhood_[i].getId() ); #endif - neighborhood_.push_back( NeighborBlock( forest_, id, process, state ) ); + neighborhood_.emplace_back( forest_, id, process, state ); } diff --git a/src/blockforest/BlockDataHandling.h b/src/blockforest/BlockDataHandling.h index c947b3e032de0a01bf727a30e86d81ff23c035f5..be978d3a8ba7d098ac4c55c99ea812bb6a868f79 100644 --- a/src/blockforest/BlockDataHandling.h +++ b/src/blockforest/BlockDataHandling.h @@ -36,7 +36,7 @@ template< typename T > class BlockDataHandling : public domain_decomposition::BlockDataHandling<T> { public: - virtual ~BlockDataHandling() {} + ~BlockDataHandling() override = default; /// must be thread-safe ! virtual void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) = 0; @@ -60,19 +60,19 @@ template< typename T > class AlwaysInitializeBlockDataHandling : public BlockDataHandling<T> { public: - ~AlwaysInitializeBlockDataHandling() {} + ~AlwaysInitializeBlockDataHandling() override = default; - void serialize( IBlock * const, const BlockDataID &, mpi::SendBuffer & ) {} - void serializeCoarseToFine( Block * const, const BlockDataID &, mpi::SendBuffer &, const uint_t ) {} - void serializeFineToCoarse( Block * const, const BlockDataID &, mpi::SendBuffer & ) {} + void serialize( IBlock * const, const BlockDataID &, mpi::SendBuffer & ) override {} + void serializeCoarseToFine( Block * const, const BlockDataID &, mpi::SendBuffer &, const uint_t ) override {} + void serializeFineToCoarse( Block * const, const BlockDataID &, mpi::SendBuffer & ) override {} - T * deserialize( IBlock * const block ) { return this->initialize( block ); } - T * deserializeCoarseToFine( Block * const block ) { return this->initialize( block ); } - T * deserializeFineToCoarse( Block * const block ) { return this->initialize( block ); } + T * deserialize( IBlock * const block ) override { return this->initialize( block ); } + T * deserializeCoarseToFine( Block * const block ) override { return this->initialize( block ); } + T * deserializeFineToCoarse( Block * const block ) override { return this->initialize( block ); } - void deserialize( IBlock * const, const BlockDataID &, mpi::RecvBuffer & ) {} - void deserializeCoarseToFine( Block * const, const BlockDataID &, mpi::RecvBuffer & ) {} - void deserializeFineToCoarse( Block * const, const BlockDataID &, mpi::RecvBuffer &, const uint_t ) {} + void deserialize( IBlock * const, const BlockDataID &, mpi::RecvBuffer & ) override {} + void deserializeCoarseToFine( Block * const, const BlockDataID &, mpi::RecvBuffer & ) override {} + void deserializeFineToCoarse( Block * const, const BlockDataID &, mpi::RecvBuffer &, const uint_t ) override {} }; @@ -81,9 +81,9 @@ template< typename T > class AlwaysCreateBlockDataHandling : public AlwaysInitializeBlockDataHandling<T> { public: - ~AlwaysCreateBlockDataHandling() {} + ~AlwaysCreateBlockDataHandling() override = default; - T * initialize( IBlock * const /*block*/ ) {return new T();} + T * initialize( IBlock * const /*block*/ ) override {return new T();} }; @@ -97,7 +97,7 @@ class BlockDataHandlingWrapper : public domain_decomposition::internal::BlockDat public: typedef domain_decomposition::internal::BlockData BlockData; - virtual ~BlockDataHandlingWrapper() {} + ~BlockDataHandlingWrapper() override = default; virtual void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) = 0; virtual void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) = 0; @@ -118,67 +118,67 @@ public: typedef domain_decomposition::internal::BlockData BlockData; BlockDataHandlingHelper( const shared_ptr< BlockDataHandling<T> > & dataHandling ) : dataHandling_( dataHandling ) {} - ~BlockDataHandlingHelper() {} + ~BlockDataHandlingHelper() override = default; - BlockData * initialize( IBlock * const block ) + BlockData * initialize( IBlock * const block ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); T * ptr = dataHandling_->initialize( block ); - return ptr ? new BlockData( ptr ) : NULL; + return ptr ? new BlockData( ptr ) : nullptr; } - void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) + void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->serialize( block, id, buffer ); } - void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) + void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->serializeCoarseToFine( block, id, buffer, child ); } - void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) + void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->serializeFineToCoarse( block, id, buffer ); } - BlockData * deserialize( IBlock * const block ) + BlockData * deserialize( IBlock * const block ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); T * ptr = dataHandling_->deserialize( block ); - return ptr ? new BlockData( ptr ) : NULL; + return ptr ? new BlockData( ptr ) : nullptr; } - BlockData * deserializeCoarseToFine( Block * const block ) + BlockData * deserializeCoarseToFine( Block * const block ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); T * ptr = dataHandling_->deserializeCoarseToFine( block ); - return ptr ? new BlockData( ptr ) : NULL; + return ptr ? new BlockData( ptr ) : nullptr; } - BlockData * deserializeFineToCoarse( Block * const block ) + BlockData * deserializeFineToCoarse( Block * const block ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); T * ptr = dataHandling_->deserializeFineToCoarse( block ); - return ptr ? new BlockData( ptr ) : NULL; + return ptr ? new BlockData( ptr ) : nullptr; } - void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->deserialize( block, id, buffer ); } - void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) + void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->deserializeCoarseToFine( block, id, buffer ); } - void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) + void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->deserializeFineToCoarse( block, id, buffer, child ); diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h index b0731c1150a09ab1aa0d3fe944eebfca43d52243..bd66ced43c30940857cf5609847e839f019ba593 100644 --- a/src/blockforest/BlockForest.h +++ b/src/blockforest/BlockForest.h @@ -179,13 +179,13 @@ public: bool getState( Set<SUID>& state, const BlockID& id ) const { const Node* node = getNode( id ); if( node ) { state = node->state_; return true; } return false; } - bool exists( const real_t x, const real_t y, const real_t z ) const { return getNode(x,y,z) != NULL; } - bool exists( const BlockID& id ) const { return getNode( id ) != NULL; } + bool exists( const real_t x, const real_t y, const real_t z ) const { return getNode(x,y,z) != nullptr; } + bool exists( const BlockID& id ) const { return getNode( id ) != nullptr; } bool existsRemotely( const real_t x, const real_t y, const real_t z ) const - { const Node* node = getNode( x, y, z ); return ( node != NULL && node->process_ != forest_.getProcess() ); } + { const Node* node = getNode( x, y, z ); return ( node != nullptr && node->process_ != forest_.getProcess() ); } bool existsRemotely( const BlockID& id ) const - { const Node* node = getNode( id ); return ( node != NULL && node->process_ != forest_.getProcess() ); } + { const Node* node = getNode( id ); return ( node != nullptr && node->process_ != forest_.getProcess() ); } bool getId( BlockID& id, const real_t x, const real_t y, const real_t z ) const; @@ -197,10 +197,10 @@ public: bool getRootBlockState( Set<SUID>& state, const uint_t x, const uint_t y, const uint_t z ) const { const Node* node = getRootNode(x,y,z); if( node ) { state = node->state_; return true; } return false; } - bool rootBlockExists( const uint_t x, const uint_t y, const uint_t z ) const { return getRootNode(x,y,z) != NULL; } + bool rootBlockExists( const uint_t x, const uint_t y, const uint_t z ) const { return getRootNode(x,y,z) != nullptr; } bool rootBlockExistsRemotely( const uint_t x, const uint_t y, const uint_t z ) const - { const Node* node = getRootNode(x,y,z); return ( node != NULL && node->process_ != forest_.getProcess() ); } + { const Node* node = getRootNode(x,y,z); return ( node != nullptr && node->process_ != forest_.getProcess() ); } private: @@ -210,7 +210,7 @@ public: const Node * getRootNode( const uint_t x, const uint_t y, const uint_t z ) const { const uint_t index = z * forest_.getYSize() * forest_.getXSize() + y * forest_.getXSize() + x; if( index >= nodes_.size() ) - return NULL; + return nullptr; return nodes_[ index ].get(); } @@ -223,7 +223,7 @@ public: BlockForest( const uint_t process, const SetupBlockForest& forest, const bool keepGlobalBlockInformation = false ); BlockForest( const uint_t process, const char* const filename, const bool broadcastFile = true, const bool keepGlobalBlockInformation = false ); - ~BlockForest() {} + ~BlockForest() override = default; uint_t getProcess() const { return process_; } uint_t getProcessIdBytes() const { return processIdBytes_; } @@ -277,45 +277,45 @@ public: inline void getBlocks( std::vector< const Block* >& blocks, const uint_t level ) const; inline void getBlocks( std::vector< Block* >& blocks, const uint_t level ); - inline void getBlocksContainedWithinAABB( std::vector< const IBlock* >& blocks, const AABB& aabb ) const; - inline void getBlocksContainedWithinAABB( std::vector< IBlock* >& blocks, const AABB& aabb ); + inline void getBlocksContainedWithinAABB( std::vector< const IBlock* >& blocks, const AABB& aabb ) const override; + inline void getBlocksContainedWithinAABB( std::vector< IBlock* >& blocks, const AABB& aabb ) override; - inline void getBlocksOverlappedByAABB( std::vector< const IBlock* >& blocks, const AABB& aabb ) const; - inline void getBlocksOverlappedByAABB( std::vector< IBlock* >& blocks, const AABB& aabb ); + inline void getBlocksOverlappedByAABB( std::vector< const IBlock* >& blocks, const AABB& aabb ) const override; + inline void getBlocksOverlappedByAABB( std::vector< IBlock* >& blocks, const AABB& aabb ) override; using BlockStorage::getBlock; - inline const Block* getBlock( const IBlockID& id ) const; - inline Block* getBlock( const IBlockID& id ); + inline const Block* getBlock( const IBlockID& id ) const override; + inline Block* getBlock( const IBlockID& id ) override; - inline const Block* getBlock( const real_t x, const real_t y, const real_t z ) const; - inline Block* getBlock( const real_t x, const real_t y, const real_t z ); + inline const Block* getBlock( const real_t x, const real_t y, const real_t z ) const override; + inline Block* getBlock( const real_t x, const real_t y, const real_t z ) override; inline const Block* getRootBlock( const uint_t x, const uint_t y, const uint_t z ) const; inline Block* getRootBlock( const uint_t x, const uint_t y, const uint_t z ); - bool containsGlobalBlockInformation() const { return blockInformation_->active(); } + bool containsGlobalBlockInformation() const override { return blockInformation_->active(); } - inline void getAllBlocks( std::vector< shared_ptr< IBlockID > >& blocks ) const; + inline void getAllBlocks( std::vector< shared_ptr< IBlockID > >& blocks ) const override; - inline bool blockExists ( const real_t x, const real_t y, const real_t z ) const; - inline bool blockExistsLocally ( const real_t x, const real_t y, const real_t z ) const; - inline bool blockExistsRemotely( const real_t x, const real_t y, const real_t z ) const; + inline bool blockExists ( const real_t x, const real_t y, const real_t z ) const override; + inline bool blockExistsLocally ( const real_t x, const real_t y, const real_t z ) const override; + inline bool blockExistsRemotely( const real_t x, const real_t y, const real_t z ) const override; - inline bool blockExists ( const IBlockID& id ) const; - inline bool blockExistsLocally ( const IBlockID& id ) const; - inline bool blockExistsRemotely( const IBlockID& id ) const; + inline bool blockExists ( const IBlockID& id ) const override; + inline bool blockExistsLocally ( const IBlockID& id ) const override; + inline bool blockExistsRemotely( const IBlockID& id ) const override; inline bool rootBlockExists ( const uint_t x, const uint_t y, const uint_t z ) const; inline bool rootBlockExistsLocally ( const uint_t x, const uint_t y, const uint_t z ) const; inline bool rootBlockExistsRemotely( const uint_t x, const uint_t y, const uint_t z ) const; - void getBlockID( IBlockID& id, const real_t x, const real_t y, const real_t z ) const; - void getAABB ( AABB& aabb, const IBlockID& id ) const; - void getState ( Set<SUID>& state, const IBlockID& id ) const; - void getProcessRank( uint_t& rank, const IBlockID& id ) const; + void getBlockID( IBlockID& id, const real_t x, const real_t y, const real_t z ) const override; + void getAABB ( AABB& aabb, const IBlockID& id ) const override; + void getState ( Set<SUID>& state, const IBlockID& id ) const override; + void getProcessRank( uint_t& rank, const IBlockID& id ) const override; void getRootBlockAABB ( AABB& aabb, const uint_t x, const uint_t y, const uint_t z ) const; void getRootBlockState ( Set<SUID>& state, const uint_t x, const uint_t y, const uint_t z ) const; @@ -324,7 +324,7 @@ public: const BlockInformation & getBlockInformation() const { return *blockInformation_; } - inline uint_t getLevel( const IBlock& block ) const; + inline uint_t getLevel( const IBlock& block ) const override; inline uint_t getLevelFromBlockId( const BlockID& id ) const; inline uint_t getAABBFromBlockId( AABB& aabb, const BlockID& id ) const; inline AABB getAABBFromBlockId( const BlockID& id ) const; @@ -338,9 +338,9 @@ public: bool insertBuffersIntoProcessNetwork() const { return insertBuffersIntoProcessNetwork_; } const std::vector< uint_t > & getNeighborhood() const { return neighborhood_; } - const std::vector< uint_t > & getNeighboringProcesses() const { return getNeighborhood(); } + const std::vector< uint_t > & getNeighboringProcesses() const override { return getNeighborhood(); } - std::map< uint_t, std::vector< Vector3<real_t> > > getNeighboringProcessOffsets() const; + std::map< uint_t, std::vector< Vector3<real_t> > > getNeighboringProcessOffsets() const override; @@ -484,7 +484,7 @@ public: protected: - bool equal( const BlockStorage* rhs ) const; + bool equal( const BlockStorage* rhs ) const override; void addBlockData( IBlock * const block, const BlockDataID & index, domain_decomposition::internal::BlockData * const data ) { BlockStorage::addBlockData( block, index, data ); } @@ -643,7 +643,7 @@ inline const Block* BlockForest::getBlock( const IBlockID& id ) const { if( it != blocks_.end() ) return it->second.get(); - return NULL; + return nullptr; } @@ -657,7 +657,7 @@ inline Block* BlockForest::getBlock( const IBlockID& id ) { if( it != blocks_.end() ) return it->second.get(); - return NULL; + return nullptr; } @@ -667,7 +667,7 @@ inline const Block* BlockForest::getBlock( const real_t x, const real_t y, const for( auto it = blocks_.begin(); it != blocks_.end(); ++it ) if( it->second->getAABB().contains(x,y,z) ) return it->second.get(); - return NULL; + return nullptr; } @@ -677,7 +677,7 @@ inline Block* BlockForest::getBlock( const real_t x, const real_t y, const real_ for( auto it = blocks_.begin(); it != blocks_.end(); ++it ) if( it->second->getAABB().contains(x,y,z) ) return it->second.get(); - return NULL; + return nullptr; } @@ -721,14 +721,14 @@ inline bool BlockForest::blockExists( const real_t x, const real_t y, const real if( blockInformation_->active() ) return blockInformation_->exists(x,y,z); - return getBlock(x,y,z) != NULL; + return getBlock(x,y,z) != nullptr; } inline bool BlockForest::blockExistsLocally( const real_t x, const real_t y, const real_t z ) const { - return getBlock(x,y,z) != NULL; + return getBlock(x,y,z) != nullptr; } @@ -738,7 +738,7 @@ inline bool BlockForest::blockExistsRemotely( const real_t x, const real_t y, co if( blockInformation_->active() ) return blockInformation_->existsRemotely(x,y,z); - return getBlock(x,y,z) == NULL; + return getBlock(x,y,z) == nullptr; } @@ -750,14 +750,14 @@ inline bool BlockForest::blockExists( const IBlockID& id ) const { if( blockInformation_->active() ) return blockInformation_->exists( *static_cast< const BlockID* >( &id ) ); - return getBlock( id ) != NULL; + return getBlock( id ) != nullptr; } inline bool BlockForest::blockExistsLocally( const IBlockID& id ) const { - return getBlock( id ) != NULL; + return getBlock( id ) != nullptr; } @@ -769,7 +769,7 @@ inline bool BlockForest::blockExistsRemotely( const IBlockID& id ) const { if( blockInformation_->active() ) return blockInformation_->existsRemotely( *static_cast< const BlockID* >( &id ) ); - return getBlock( id ) == NULL; + return getBlock( id ) == nullptr; } @@ -779,14 +779,14 @@ inline bool BlockForest::rootBlockExists( const uint_t x, const uint_t y, const if( blockInformation_->active() ) return blockInformation_->rootBlockExists(x,y,z); - return getRootBlock(x,y,z) != NULL; + return getRootBlock(x,y,z) != nullptr; } inline bool BlockForest::rootBlockExistsLocally( const uint_t x, const uint_t y, const uint_t z ) const { - return getRootBlock(x,y,z) != NULL; + return getRootBlock(x,y,z) != nullptr; } @@ -796,7 +796,7 @@ inline bool BlockForest::rootBlockExistsRemotely( const uint_t x, const uint_t y if( blockInformation_->active() ) return blockInformation_->rootBlockExistsRemotely(x,y,z); - return getRootBlock(x,y,z) == NULL; + return getRootBlock(x,y,z) == nullptr; } diff --git a/src/blockforest/BlockID.h b/src/blockforest/BlockID.h index ff64a5b19b9746c5a2b0135f1069c29905813ff9..d4efc6bcc4bf557755dfb6a296a3f8681c7c6f74 100644 --- a/src/blockforest/BlockID.h +++ b/src/blockforest/BlockID.h @@ -283,18 +283,18 @@ public: void removeBranchId() { WALBERLA_ASSERT_GREATER_EQUAL( getUsedBits(), uint_c(4) ); id_ >>= 3; } uint_t getBranchId() const { WALBERLA_ASSERT_GREATER_EQUAL( getUsedBits(), uint_c(4) ); return id_ & uint_c(7); } - bool operator< ( const IBlockID& rhs ) const + bool operator< ( const IBlockID& rhs ) const override { WALBERLA_ASSERT_EQUAL( dynamic_cast< const BlockID* >( &rhs ), &rhs ); return id_ < static_cast< const BlockID* >( &rhs )->id_; } bool operator> ( const IBlockID& rhs ) const { WALBERLA_ASSERT_EQUAL( dynamic_cast< const BlockID* >( &rhs ), &rhs ); return id_ > static_cast< const BlockID* >( &rhs )->id_; } - bool operator==( const IBlockID& rhs ) const + bool operator==( const IBlockID& rhs ) const override { WALBERLA_ASSERT_EQUAL( dynamic_cast< const BlockID* >( &rhs ), &rhs ); return id_ == static_cast< const BlockID* >( &rhs )->id_; } - bool operator!=( const IBlockID& rhs ) const + bool operator!=( const IBlockID& rhs ) const override { WALBERLA_ASSERT_EQUAL( dynamic_cast< const BlockID* >( &rhs ), &rhs ); return id_ != static_cast< const BlockID* >( &rhs )->id_; } - inline IDType getID() const; + inline IDType getID() const override; - inline std::ostream& toStream( std::ostream& os ) const; + inline std::ostream& toStream( std::ostream& os ) const override; void toByteArray( std::vector< uint8_t >& array, const uint_t offset, const uint_t bytes ) const { uintToByteArray( id_, array, offset, bytes ); } diff --git a/src/blockforest/BlockReconstruction.h b/src/blockforest/BlockReconstruction.h index 68a2aba2f49053d316e977abb77e07b7935d2a45..c41689b94ea3e717486676452257d020579fe59a 100644 --- a/src/blockforest/BlockReconstruction.h +++ b/src/blockforest/BlockReconstruction.h @@ -164,7 +164,7 @@ void BlockReconstruction::reconstructNeighborhood( BLOCK* block, const std::vect const NeighborhoodReconstructionBlock* neighbor = &(neighbors[i]); uint_t index = 0; - if( neighborhood.insert( neighbor ).second == true ) { + if( neighborhood.insert( neighbor ).second ) { index = block->getNeighborhoodSize(); neighborhoodIndex[ neighbor ] = index; diff --git a/src/blockforest/GlobalLoadBalancing.h b/src/blockforest/GlobalLoadBalancing.h index 521af77de0c6c1fa8b186286e04e427110cf03e0..ca7c687a9095d427f597ff23897aa7e2cff6b1e9 100644 --- a/src/blockforest/GlobalLoadBalancing.h +++ b/src/blockforest/GlobalLoadBalancing.h @@ -57,7 +57,7 @@ public: public: typedef std::function< memory_t ( const BLOCK* const, const BLOCK* const ) > CommunicationFunction; - MetisConfiguration( const bool _includeMetis = false, const bool _forceMetis = false, CommunicationFunction _communicationFunction = 0, + MetisConfiguration( const bool _includeMetis = false, const bool _forceMetis = false, CommunicationFunction _communicationFunction = nullptr, const real_t _maxUbvec = real_c(1.5), const uint_t _iterations = uint_c(10) ) : includeMetis_( _includeMetis ), forceMetis_( _forceMetis ), communicationFunction_( _communicationFunction ), maxUbvec_( _maxUbvec ), iterations_( _iterations ) {} @@ -103,13 +103,13 @@ public: template< typename BLOCK > static inline uint_t minimizeProcesses( const std::vector< BLOCK* >& blocks, const memory_t memoryLimit, const MetisConfiguration<BLOCK>& metisConfig, - const std::vector< workload_t >* processesWork = NULL, - const std::vector< memory_t >* processesMemory = NULL ); + const std::vector< workload_t >* processesWork = nullptr, + const std::vector< memory_t >* processesMemory = nullptr ); template< typename BLOCK > static inline uint_t maximizeMemoryUtilization( const std::vector< BLOCK* >& blocks, const memory_t memoryLimit, const MetisConfiguration<BLOCK>& metisConfig, - const std::vector< workload_t >* processesWork = NULL, - const std::vector< memory_t >* processesMemory = NULL ); + const std::vector< workload_t >* processesWork = nullptr, + const std::vector< memory_t >* processesMemory = nullptr ); // optimize workload template< typename BLOCK > @@ -130,7 +130,7 @@ private: template< typename BLOCK > static uint_t fixedWork( const std::vector< BLOCK* >& blocks, const workload_t workloadLimit, const memory_t memoryLimit, - const std::vector< workload_t >* processesWork = NULL, const std::vector< memory_t >* processesMemory = NULL ); + const std::vector< workload_t >* processesWork = nullptr, const std::vector< memory_t >* processesMemory = nullptr ); #ifdef WALBERLA_BUILD_WITH_METIS @@ -490,7 +490,7 @@ inline uint_t GlobalLoadBalancing::minimizeProcesses( const std::vector< BLOCK* // minimize number of processes == do not care about the amount of workload that is assigned to a process, // just put as many blocks as possible on any process - workload_t workloadLimit = workloadSum( blocks ) + ( ( processesWork == NULL ) ? static_cast< workload_t >(0) : + workload_t workloadLimit = workloadSum( blocks ) + ( ( processesWork == nullptr ) ? static_cast< workload_t >(0) : math::kahanSummation( processesWork->begin(), processesWork->end() ) ); uint_t numberOfProcesses = fixedWork( blocks, workloadLimit, memoryLimit, processesWork, processesMemory ); @@ -642,7 +642,7 @@ void GlobalLoadBalancing::prepareProcessReordering( const std::vector< BLOCK* > const BLOCK* const block = (*it).second; for( uint_t i = 0; i != block->getNeighborhoodSize(); ++i ) - if( neighbors.insert( block->getNeighborTargetProcess(i) ).second == true ) + if( neighbors.insert( block->getNeighborTargetProcess(i) ).second ) processNeighbors[ uint_c(p) ].push_back( block->getNeighborTargetProcess(i) ); // for( uint_t n = 0; n != 26; ++n ) @@ -673,7 +673,7 @@ void GlobalLoadBalancing::reorderProcessesByBFS( std::vector< BLOCK* > & blocks, uint_t startIndex = numberOfProcesses; for( uint_t i = previousStartIndex; i < numberOfProcesses; ++i ) { - if( !processed[i] && processNeighbors[i].size() != 0 ) + if( !processed[i] && !processNeighbors[i].empty() ) { startIndex = i; break; @@ -741,8 +741,8 @@ uint_t GlobalLoadBalancing::fixedWork( const std::vector< BLOCK* >& blocks, cons WALBERLA_ASSERT_GREATER( memoryLimit , static_cast< memory_t >(0) ); uint_t processes = 0; - workload_t workload = ( processesWork != NULL && processes < processesWork->size() ) ? (*processesWork)[processes] : static_cast< workload_t >(0); - memory_t memory = ( processesMemory != NULL && processes < processesMemory->size() ) ? (*processesMemory)[processes] : static_cast< memory_t >(0); + workload_t workload = ( processesWork != nullptr && processes < processesWork->size() ) ? (*processesWork)[processes] : static_cast< workload_t >(0); + memory_t memory = ( processesMemory != nullptr && processes < processesMemory->size() ) ? (*processesMemory)[processes] : static_cast< memory_t >(0); for( uint_t i = 0; i != blocks.size(); ++i ) { @@ -754,8 +754,8 @@ uint_t GlobalLoadBalancing::fixedWork( const std::vector< BLOCK* >& blocks, cons ++processes; - workload = ( processesWork != NULL && processes < processesWork->size() ) ? (*processesWork)[processes] : static_cast< workload_t >(0); - memory = ( processesMemory != NULL && processes < processesMemory->size() ) ? (*processesMemory)[processes] : static_cast< memory_t >(0); + workload = ( processesWork != nullptr && processes < processesWork->size() ) ? (*processesWork)[processes] : static_cast< workload_t >(0); + memory = ( processesMemory != nullptr && processes < processesMemory->size() ) ? (*processesMemory)[processes] : static_cast< memory_t >(0); } WALBERLA_ASSERT_LESS_EQUAL( blocks[i]->getWorkload() + workload, workloadLimit ); diff --git a/src/blockforest/Initialization.h b/src/blockforest/Initialization.h index 3a87f28117e09f46333bce69c72c776f3da18027..aecdd20adc5c4d995e27998d3898cc6c188b3930 100644 --- a/src/blockforest/Initialization.h +++ b/src/blockforest/Initialization.h @@ -34,11 +34,11 @@ namespace blockforest { shared_ptr< StructuredBlockForest > createUniformBlockGridFromConfig( const shared_ptr< Config > & config, - CellInterval * requestedDomainSize = NULL, + CellInterval * requestedDomainSize = nullptr, const bool keepGlobalBlockInformation = false ); shared_ptr< StructuredBlockForest > createUniformBlockGridFromConfig( const Config::BlockHandle & configBlock, - CellInterval * requestedDomainSize = NULL, + CellInterval * requestedDomainSize = nullptr, const bool keepGlobalBlockInformation = false ); diff --git a/src/blockforest/PhantomBlock.h b/src/blockforest/PhantomBlock.h index 0df6986903e2b9b0e98ad4da76f9fea7d28e1bf3..2d6c2b6ee60e9d21fea189a647f98aadc1866575 100644 --- a/src/blockforest/PhantomBlock.h +++ b/src/blockforest/PhantomBlock.h @@ -304,7 +304,7 @@ inline void PhantomBlock::addNeighbor( const BlockID & id, const uint_t process, WALBERLA_ASSERT( neighborhood_[i].getId() < id || id < neighborhood_[i].getId() ); #endif - neighborhood_.push_back( NeighborBlock( phantomForest_, id, process, state ) ); + neighborhood_.emplace_back( phantomForest_, id, process, state ); } diff --git a/src/blockforest/SetupBlock.h b/src/blockforest/SetupBlock.h index bd391aac8dcd7e2332f525f7618f44ba61f43c12..64b7b89caaa5546dc841ea4be3f80632eded4522 100644 --- a/src/blockforest/SetupBlock.h +++ b/src/blockforest/SetupBlock.h @@ -83,7 +83,7 @@ public: inline SetupBlock* getChild( const uint_t index ) { WALBERLA_ASSERT_LESS( index, children_.size() ); return children_[index]; } inline void setChild( const uint_t index, SetupBlock* const child ); - bool hasFather() const { return father_ != NULL; } + bool hasFather() const { return father_ != nullptr; } bool hasChildren() const { return !children_.empty(); } const std::vector< SetupBlock* >& getNeighborhoodSection( const uint_t index ) const { WALBERLA_ASSERT_LESS( index, 26 ); return neighborhoodSection_[index]; } @@ -168,7 +168,7 @@ inline void SetupBlock::setChild( const uint_t index, SetupBlock* const child ) WALBERLA_ASSERT( children_.empty() || children_.size() == 8 ); if( children_.empty() ) - children_.resize( 8, NULL ); + children_.resize( 8, nullptr ); children_[index] = child; } diff --git a/src/blockforest/SetupBlockForest.h b/src/blockforest/SetupBlockForest.h index a9192cac2f3946d02bf79bfb2f32c0f2293fa882..2dac1578f59feaf30e366e822793baf4242c7354 100644 --- a/src/blockforest/SetupBlockForest.h +++ b/src/blockforest/SetupBlockForest.h @@ -98,7 +98,7 @@ public: public: - iterator( const iterator& it ) : forest_( it.forest_ ), block_( it.block_ ) {} + iterator( const iterator& it ) = default; iterator& operator++() { WALBERLA_ASSERT_NOT_NULLPTR( block_ ); block_ = forest_->getNextBlock( block_ ); return *this; } // prefix ++X iterator operator++(int) { iterator it( *this ); operator++(); return it; }; // postfix X++ @@ -127,7 +127,7 @@ public: public: const_iterator( const iterator& it ) : forest_( it.forest_ ), block_( it.block_ ) {} - const_iterator( const const_iterator& it ) : forest_( it.forest_ ), block_( it.block_ ) {} + const_iterator( const const_iterator& it ) = default; const_iterator& operator++() { WALBERLA_ASSERT_NOT_NULLPTR( block_ ); block_ = forest_->getNextBlock( block_ ); return *this; } // prefix ++X const_iterator operator++(int) { const_iterator it( *this ); operator++(); return it; }; // postfix X++ @@ -183,10 +183,10 @@ public: uint_t getNumberOfBlocks( const uint_t level ) const; inline const_iterator begin() const; - inline const_iterator end() const { return const_iterator( this, NULL ); } + inline const_iterator end() const { return const_iterator( this, nullptr ); } inline iterator begin(); - inline iterator end() { return iterator( this, NULL ); } + inline iterator end() { return iterator( this, nullptr ); } const SetupBlock* getFirstBlock() const; SetupBlock* getFirstBlock(); @@ -420,7 +420,7 @@ inline SetupBlockForest::~SetupBlockForest() { for( uint_t i = 0; i != forest_.size(); ++i ) { - if( forest_[i] != NULL ) delete forest_[i]; + if( forest_[i] != nullptr ) delete forest_[i]; } } @@ -430,7 +430,7 @@ inline SetupBlockForest::const_iterator SetupBlockForest::begin() const { const SetupBlock* block = getFirstBlock(); - if( block == NULL ) + if( block == nullptr ) return end(); return SetupBlockForest::const_iterator( this, block ); @@ -442,7 +442,7 @@ inline SetupBlockForest::iterator SetupBlockForest::begin() { SetupBlock* block = getFirstBlock(); - if( block == NULL ) + if( block == nullptr ) return end(); return SetupBlockForest::iterator( this, block ); @@ -467,10 +467,10 @@ inline SetupBlock* SetupBlockForest::getRootBlock( const uint_t x, const uint_t inline const SetupBlock* SetupBlockForest::getBlock( const real_t px, const real_t py, const real_t pz ) const { if( !domain_.contains( px, py, pz ) ) - return NULL; + return nullptr; SetupBlock* block = forest_[ mapPointToTreeIndex( px, py, pz ) ]; - if( block == NULL ) return NULL; + if( block == nullptr ) return nullptr; return mapPointToBlock( block, px, py, pz ); } @@ -480,10 +480,10 @@ inline const SetupBlock* SetupBlockForest::getBlock( const real_t px, const real inline SetupBlock* SetupBlockForest::getBlock( const real_t px, const real_t py, const real_t pz ) { if( !domain_.contains( px, py, pz ) ) - return NULL; + return nullptr; SetupBlock* block = forest_[ mapPointToTreeIndex( px, py, pz ) ]; - if( block == NULL ) return NULL; + if( block == nullptr ) return nullptr; return mapPointToBlock( block, px, py, pz ); } diff --git a/src/blockforest/StructuredBlockForest.h b/src/blockforest/StructuredBlockForest.h index ac021fe66acce0eb8a24fa662b625ad906170762..04b61a94fbc7b4b84ab60714db58a78932471a7a 100644 --- a/src/blockforest/StructuredBlockForest.h +++ b/src/blockforest/StructuredBlockForest.h @@ -50,31 +50,31 @@ public: using StructuredBlockStorage::blockExistsLocally; using StructuredBlockStorage::blockExistsRemotely; - bool blockExists ( const Cell& cell, const uint_t level = 0 ) const; - inline bool blockExistsLocally ( const Cell& cell, const uint_t level = 0 ) const; - inline bool blockExistsRemotely( const Cell& cell, const uint_t level = 0 ) const; + bool blockExists ( const Cell& cell, const uint_t level = 0 ) const override; + inline bool blockExistsLocally ( const Cell& cell, const uint_t level = 0 ) const override; + inline bool blockExistsRemotely( const Cell& cell, const uint_t level = 0 ) const override; - void getBlockID( IBlockID& id, const Cell& cell, const uint_t level = 0 ) const; + void getBlockID( IBlockID& id, const Cell& cell, const uint_t level = 0 ) const override; - inline uint_t getLevel( const IBlock& block ) const; + inline uint_t getLevel( const IBlock& block ) const override; using StructuredBlockStorage::getNumberOfXCells; using StructuredBlockStorage::getNumberOfYCells; using StructuredBlockStorage::getNumberOfZCells; #ifdef NDEBUG - uint_t getNumberOfXCells( const IBlock& /*block*/ ) const { return blockCells_[0]; } - uint_t getNumberOfYCells( const IBlock& /*block*/ ) const { return blockCells_[1]; } - uint_t getNumberOfZCells( const IBlock& /*block*/ ) const { return blockCells_[2]; } + uint_t getNumberOfXCells( const IBlock& /*block*/ ) const override { return blockCells_[0]; } + uint_t getNumberOfYCells( const IBlock& /*block*/ ) const override { return blockCells_[1]; } + uint_t getNumberOfZCells( const IBlock& /*block*/ ) const override { return blockCells_[2]; } #else - uint_t getNumberOfXCells( const IBlock& block ) const { WALBERLA_ASSERT_EQUAL( &(getBlockStorage()), &(block.getBlockStorage()) ); return blockCells_[0]; } - uint_t getNumberOfYCells( const IBlock& block ) const { WALBERLA_ASSERT_EQUAL( &(getBlockStorage()), &(block.getBlockStorage()) ); return blockCells_[1]; } - uint_t getNumberOfZCells( const IBlock& block ) const { WALBERLA_ASSERT_EQUAL( &(getBlockStorage()), &(block.getBlockStorage()) ); return blockCells_[2]; } + uint_t getNumberOfXCells( const IBlock& block ) const override { WALBERLA_ASSERT_EQUAL( &(getBlockStorage()), &(block.getBlockStorage()) ); return blockCells_[0]; } + uint_t getNumberOfYCells( const IBlock& block ) const override { WALBERLA_ASSERT_EQUAL( &(getBlockStorage()), &(block.getBlockStorage()) ); return blockCells_[1]; } + uint_t getNumberOfZCells( const IBlock& block ) const override { WALBERLA_ASSERT_EQUAL( &(getBlockStorage()), &(block.getBlockStorage()) ); return blockCells_[2]; } #endif using StructuredBlockStorage::getNumberOfCells; - inline uint_t getNumberOfCells( const IBlock& block, const uint_t index ) const; + inline uint_t getNumberOfCells( const IBlock& block, const uint_t index ) const override; // direct access to all member functions which are special to of BlockForest (-> for documentation of these functions see class BlockForest) @@ -164,21 +164,21 @@ public: protected: - inline bool equal( const StructuredBlockStorage* rhs ) const; + inline bool equal( const StructuredBlockStorage* rhs ) const override; // helper class for 'StructuredBlockForest::addCellBoundingBoxesAsBlockData' class CellBoundingBoxHandling : public AlwaysInitializeBlockDataHandling< CellInterval > { public: CellBoundingBoxHandling( const StructuredBlockForest & forest ) : forest_( forest ) {} - CellInterval * initialize( IBlock * const block ) { return forest_.initializeCellBoundingBox( block ); } + CellInterval * initialize( IBlock * const block ) override { return forest_.initializeCellBoundingBox( block ); } private: const StructuredBlockForest & forest_; }; friend class CellBoundingBoxHandling; //using StructuredBlockStorage::initializeCellBoundingBox; - inline BlockDataID addCellBoundingBoxesAsBlockData( const std::string & identifier ); + inline BlockDataID addCellBoundingBoxesAsBlockData( const std::string & identifier ) override; private: @@ -217,7 +217,7 @@ inline StructuredBlockForest::StructuredBlockForest( const shared_ptr< BlockFore inline bool StructuredBlockForest::blockExistsLocally( const Cell& cell, const uint_t level ) const { - return getBlock( cell, level ) != NULL; + return getBlock( cell, level ) != nullptr; } diff --git a/src/blockforest/communication/NonUniformPackInfo.h b/src/blockforest/communication/NonUniformPackInfo.h index a653169a5d90f6515e74b96d062feea779d68301..0b32369c654e4ca9642d88f5d85763f880b7e55d 100644 --- a/src/blockforest/communication/NonUniformPackInfo.h +++ b/src/blockforest/communication/NonUniformPackInfo.h @@ -44,8 +44,8 @@ public: //**Construction & Destruction************************************************************ /*! \name Construction & Destruction */ //@{ - NonUniformPackInfo() {} - virtual ~NonUniformPackInfo() {} + NonUniformPackInfo() = default; + virtual ~NonUniformPackInfo() = default; //@} //******************************************************************************************************************* diff --git a/src/blockforest/loadbalancing/Cartesian.h b/src/blockforest/loadbalancing/Cartesian.h index 261473a9dc76f486545d91691929e71c387ed91d..a147f1c9875902f0dc7b5c10ae91226b901e8e64 100644 --- a/src/blockforest/loadbalancing/Cartesian.h +++ b/src/blockforest/loadbalancing/Cartesian.h @@ -35,7 +35,7 @@ class CartesianDistribution public: CartesianDistribution( const uint_t numberOfXProcesses, const uint_t numberOfYProcesses, const uint_t numberOfZProcesses, - std::vector< uint_t > * processIdMap = NULL ) : + std::vector< uint_t > * processIdMap = nullptr ) : numberOfXProcesses_( numberOfXProcesses ), numberOfYProcesses_( numberOfYProcesses ), numberOfZProcesses_( numberOfZProcesses ), processIdMap_( processIdMap ) {} diff --git a/src/boundary/Boundary.h b/src/boundary/Boundary.h index 8d83aea92e3db51f7a045495dd19615e0ad071f0..d7b3679f8aa9278751989182f6827b2a5fbfbcc4 100644 --- a/src/boundary/Boundary.h +++ b/src/boundary/Boundary.h @@ -36,7 +36,7 @@ namespace boundary { class BoundaryConfiguration { public: - virtual ~BoundaryConfiguration() {} + virtual ~BoundaryConfiguration() = default; static const BoundaryConfiguration& null() { return *boundaryNullPtr; } static const shared_ptr<BoundaryConfiguration> nullPtr() { return boundaryNullPtr; } private: diff --git a/src/boundary/BoundaryHandling.h b/src/boundary/BoundaryHandling.h index cf724cdc15f5ad90ec3aa543dfc2e2f99be5ca7b..0910be4552c9f97d587c668cd8a95551f23cd3fe 100644 --- a/src/boundary/BoundaryHandling.h +++ b/src/boundary/BoundaryHandling.h @@ -414,7 +414,7 @@ private: template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = nullptr ) const { if( uid == std::get<N>( boundaryConditions ).getUID() ) return std::get<N>( boundaryConditions ); @@ -424,7 +424,7 @@ private: template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > inline const typename std::enable_if<(N==0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, - typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = 0 ) const + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::value >::type* /*dummy*/ = nullptr ) const { if( uid == std::get<N>( boundaryConditions ).getUID() ) return std::get<N>( boundaryConditions ); @@ -439,8 +439,8 @@ private: template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > inline const typename std::enable_if<(N!=0), Boundary_T>::type & getBoundaryCondition( const BoundaryUID & uid, const BoundariesTuple & boundaryConditions, typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, typename std::tuple_element<N, BoundariesTuple>::type >::type, - std::false_type >::value >::type* /*dummy*/ = 0, - typename std::enable_if< (N>0) >::type* /*dummy*/ = 0 ) const + std::false_type >::value >::type* /*dummy*/ = nullptr, + typename std::enable_if< (N>0) >::type* /*dummy*/ = nullptr ) const { return getBoundaryCondition< Boundary_T, BoundariesTuple, N-1 >( uid, boundaryConditions ); } @@ -490,7 +490,7 @@ private: template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size<BoundariesTuple>::value - 1 > inline const typename std::enable_if<(N==0), Boundary_T>::type & getBoundaryCondition_TypeExists( const BoundaryUID & uid, const BoundariesTuple & /*boundaryConditions*/, typename std::enable_if< std::is_same< typename std::is_same< Boundary_T, typename std::tuple_element<0, BoundariesTuple>::type >::type, - std::false_type >::value >::type* /*dummy*/ = 0 ) const + std::false_type >::value >::type* /*dummy*/ = nullptr ) const { WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); diff --git a/src/boundary/communication/HandlingPackInfo.h b/src/boundary/communication/HandlingPackInfo.h index d730bf2adbf07b05f8460452c167c7074e3af3b1..460ec60e4ec4945154a4d8b0ec3d797a18f486bd 100644 --- a/src/boundary/communication/HandlingPackInfo.h +++ b/src/boundary/communication/HandlingPackInfo.h @@ -39,18 +39,18 @@ public: HandlingPackInfo( const BlockDataID & bdId, const bool assumeIdenticalFlagMapping = true, const uint_t numberOfLayers = 0 ) : bdId_( bdId ), numberOfLayers_( numberOfLayers ), assumeIdenticalFlagMapping_( assumeIdenticalFlagMapping ) {} - ~HandlingPackInfo() {} + ~HandlingPackInfo() override = default; - bool constantDataExchange() const { return false; } - bool threadsafeReceiving() const { return false; } + bool constantDataExchange() const override { return false; } + bool threadsafeReceiving() const override { return false; } - void unpackData( IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ); + void unpackData( IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; - void communicateLocal( const IBlock * sender, IBlock * receiver, stencil::Direction dir ); + void communicateLocal( const IBlock * sender, IBlock * receiver, stencil::Direction dir ) override; protected: - void packDataImpl( const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const; + void packDataImpl( const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; diff --git a/src/communication/ReducePackInfo.h b/src/communication/ReducePackInfo.h index d353d6f37308041feb4b59dd9f3275a4f071ccc7..141dd98283f76c110cf93b12c45fa30e74b89725 100644 --- a/src/communication/ReducePackInfo.h +++ b/src/communication/ReducePackInfo.h @@ -42,7 +42,7 @@ class ReducePackInfo { public: ReducePackInfo( ) : size_(0u) {} - virtual ~ReducePackInfo() {} + virtual ~ReducePackInfo() = default; size_t getSize() const { return size_; } diff --git a/src/communication/UniformMPIDatatypeInfo.h b/src/communication/UniformMPIDatatypeInfo.h index be86894416ed9f29cbc26b2440c4e4654fb82bc4..8f8e0d6c46fb45f584023bc2160c6f1ab54aec10 100644 --- a/src/communication/UniformMPIDatatypeInfo.h +++ b/src/communication/UniformMPIDatatypeInfo.h @@ -49,8 +49,8 @@ namespace communication { //**Construction & Destruction************************************************************************************ /*! \name Construction & Destruction */ //@{ - UniformMPIDatatypeInfo() {} - virtual ~UniformMPIDatatypeInfo() {} + UniformMPIDatatypeInfo() = default; + virtual ~UniformMPIDatatypeInfo() = default; //@} //**************************************************************************************************************** diff --git a/src/communication/UniformPackInfo.h b/src/communication/UniformPackInfo.h index d2737a19cc40439848107a853fb99bcada8c3172..5ec6db29d32dff36713ab903498048b450f748f2 100644 --- a/src/communication/UniformPackInfo.h +++ b/src/communication/UniformPackInfo.h @@ -57,8 +57,8 @@ public: //**Construction & Destruction*************************************************************************************** /*! \name Construction & Destruction */ //@{ - UniformPackInfo() {} - virtual ~UniformPackInfo() {} + UniformPackInfo() = default; + virtual ~UniformPackInfo() = default; //@} //******************************************************************************************************************* diff --git a/src/core/Abort.h b/src/core/Abort.h index 8c52f6783d8539613492498be0bd66ae7858b1a6..23b1ef1ff30d428fd0dce81a1f72360e7ec6eb40 100644 --- a/src/core/Abort.h +++ b/src/core/Abort.h @@ -52,7 +52,7 @@ public: private: - Abort() {} + Abort() = default; AbortFunction abortFunction_; }; diff --git a/src/core/Array.h b/src/core/Array.h index 1c5f8c2b22b6261b226367fe5927284f365fe63d..42ab4efe51118b5edecb211b9066299466725ebc 100644 --- a/src/core/Array.h +++ b/src/core/Array.h @@ -41,12 +41,12 @@ class Array { public: - inline Array() : array_( NULL ), size_( uint_c(0) ) {} + inline Array() : array_( nullptr ), size_( uint_c(0) ) {} inline Array( const uint_t n, const T& t = T() ); inline Array( const std::vector<T>& vector ); inline Array( const Array& array ); - ~Array() { if( array_ != NULL ) delete[] array_; } + ~Array() { if( array_ != nullptr ) delete[] array_; } uint_t size() const { return size_; } bool empty() const { return size_ == 0; } diff --git a/src/core/ConcatIterator.h b/src/core/ConcatIterator.h index f76c79f6238e1d02f4191e15d015519e383f3a6f..9b0ad071d38a4d7d3c1e902f19cd8cf5be10e6ef 100644 --- a/src/core/ConcatIterator.h +++ b/src/core/ConcatIterator.h @@ -62,14 +62,7 @@ public: { if (ended_ || rhs.ended_) { - if (ended_ == rhs.ended_) - { - return true; - } - else - { - return false; - } + return ended_ == rhs.ended_; } return it_ == rhs.it_; diff --git a/src/core/NonCopyable.h b/src/core/NonCopyable.h index c01b4faf3dc4edd763300a81cae7efc11b2f4a5c..59b7773d23cd77c8daed1e76928d85567af0595d 100644 --- a/src/core/NonCopyable.h +++ b/src/core/NonCopyable.h @@ -36,8 +36,8 @@ class NonCopyable { protected: - NonCopyable(){} // no object of type 'NonCopyable' can be created! - ~NonCopyable(){} + NonCopyable()= default; // no object of type 'NonCopyable' can be created! + ~NonCopyable()= default; private: diff --git a/src/core/Set.h b/src/core/Set.h index 3b77f42e7abdb89bcfdfe18e28db5bd38ca16b62..7f094ad961abf8a0d0cb434684a712fbd2cfc3e3 100644 --- a/src/core/Set.h +++ b/src/core/Set.h @@ -96,10 +96,10 @@ public: friend inline bool operator==( const Set& a, const Set& b ) { return setIsEqual(a,b); } ///< compares the content of two sets friend inline bool operator!=( const Set& a, const Set& b ) { return !setIsEqual(a,b); } ///< compares the content of two sets - inline Set() {} + inline Set() = default; inline Set( const T& element ) { set_.insert( element ); } - inline virtual ~Set() {} + inline virtual ~Set() = default; static const Set<T> emptySet() { return {}; } diff --git a/src/core/StringUtility.impl.h b/src/core/StringUtility.impl.h index ddc5f748275dc04e3500793e83758f658d58aa92..730bf592867b6d2b7abbf134300431b3de25bfbf 100644 --- a/src/core/StringUtility.impl.h +++ b/src/core/StringUtility.impl.h @@ -104,7 +104,7 @@ inline std::vector<std::string> string_split(std::string s, const std::string &d if (*it == d) { // current character in s is a delimiter sub_end = it; if (sub_begin < sub_end) { // make sure that the substring is not empty - substrings.push_back(std::string(sub_begin, sub_end)); + substrings.emplace_back(sub_begin, sub_end); } sub_begin = ++sub_end; continue; @@ -114,7 +114,7 @@ inline std::vector<std::string> string_split(std::string s, const std::string &d // add substring from last delimiter to the end of s if (sub_begin < s.end()) { - substrings.push_back(std::string(sub_begin, s.end())); + substrings.emplace_back(sub_begin, s.end()); } return substrings; diff --git a/src/core/cell/Cell.h b/src/core/cell/Cell.h index 8fc8ef14e29f216f173604b667807801b49e4f83..3df78ce5b147c26650cf8caf799a4bb342e34f4c 100644 --- a/src/core/cell/Cell.h +++ b/src/core/cell/Cell.h @@ -47,7 +47,7 @@ public: /*! \name Constructors */ //@{ - Cell() {} + Cell() = default; inline Cell( const cell_idx_t _x, const cell_idx_t _y, const cell_idx_t _z ) { cell[0] = _x; cell[1] = _y; cell[2] = _z; } //inline Cell( const int _x, const int _y, const int _z ); inline Cell( const uint_t _x, const uint_t _y, const uint_t _z ); diff --git a/src/core/cell/CellArray.h b/src/core/cell/CellArray.h index 3f26ee61c80a9a1ee160fdffb91ee3cfe13ddbf4..732b2b85337f0a8051170aa678cff05b285c9535 100644 --- a/src/core/cell/CellArray.h +++ b/src/core/cell/CellArray.h @@ -41,7 +41,7 @@ public: CellArray( const CellVector& cells ) { - this->array_ = cells.size() == 0 ? NULL : new Cell[ cells.size() ]; + this->array_ = cells.empty() ? nullptr : new Cell[ cells.size() ]; this->size_ = cells.size(); for( uint_t i = 0; i != this->size_; ++i ) @@ -50,7 +50,7 @@ public: CellArray( const CellSet& cells ) { - this->array_ = cells.size() == 0 ? NULL : new Cell[ cells.size() ]; + this->array_ = cells.empty() ? nullptr : new Cell[ cells.size() ]; this->size_ = cells.size(); uint_t i = 0; diff --git a/src/core/cell/CellInterval.h b/src/core/cell/CellInterval.h index 10dfb0d9b1bbc375aeac80e08118b61af8c8cfd4..10f2529aaebe86813a63524bc61a306371455481 100644 --- a/src/core/cell/CellInterval.h +++ b/src/core/cell/CellInterval.h @@ -236,11 +236,8 @@ inline bool CellInterval::overlaps( const CellInterval& other ) const if( empty() || other.empty() ) return false; - if( other.min_.x() > max_.x() || other.min_.y() > max_.y() || other.min_.z() > max_.z() || - other.max_.x() < min_.x() || other.max_.y() < min_.y() || other.max_.z() < min_.z() ) - return false; - else - return true; + return !(other.min_.x() > max_.x() || other.min_.y() > max_.y() || other.min_.z() > max_.z() || + other.max_.x() < min_.x() || other.max_.y() < min_.y() || other.max_.z() < min_.z()); } diff --git a/src/core/cell/CellVector.h b/src/core/cell/CellVector.h index 0d9fe9f810175cd12b76d4179db347b0295e6e73..aa0fdefbd91171929dc0bceca786c515ed220ab7 100644 --- a/src/core/cell/CellVector.h +++ b/src/core/cell/CellVector.h @@ -56,7 +56,7 @@ public: /*! \name Constructors */ //@{ - CellVector() {} + CellVector() = default; CellVector(size_type n, const Cell & value = Cell()) : cells_(n, value) {} template <class InputIterator> CellVector(InputIterator first, InputIterator last) : cells_(first, last) { } @@ -140,14 +140,14 @@ std::ostream & operator<<( std::ostream & os, const CellVector & cells ); inline void CellVector::push_back( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z ) { - cells_.push_back( Cell(x, y, z) ); + cells_.emplace_back(x, y, z ); } inline void CellVector::push_back( const uint_t x, const uint_t y, const uint_t z ) { - cells_.push_back( Cell(x, y, z) ); + cells_.emplace_back(x, y, z ); } diff --git a/src/core/config/Config.h b/src/core/config/Config.h index 9837b870c7f0151aad400f509958c69d5290f171..0566612517457c7b5ac4f9d1f5afb102e30cb95a 100644 --- a/src/core/config/Config.h +++ b/src/core/config/Config.h @@ -280,7 +280,7 @@ public: template< typename T > inline Parameter<T> getParameter( const std::string & key, const T& defaultValue ) const; - bool isValid() const { return block_ != NULL; } + bool isValid() const { return block_ != nullptr; } operator bool() const { return isValid(); } inline const_iterator begin() const; @@ -1058,7 +1058,7 @@ inline Config::const_iterator Config::Block::end() const // an error until the BlockHandle object is bound to a block. */ inline Config::BlockHandle::BlockHandle() - :block_(0) + :block_(nullptr) {} //********************************************************************************************************************** diff --git a/src/core/config/Iterator.h b/src/core/config/Iterator.h index 3b9759426f1a70bbe30a0219ff960d0a9ae0e795..9796f59bfc16b5179240093ef29e018819dac1ad 100644 --- a/src/core/config/Iterator.h +++ b/src/core/config/Iterator.h @@ -29,7 +29,7 @@ namespace config { struct ConfigGenerator { - virtual ~ConfigGenerator() {} + virtual ~ConfigGenerator() = default; virtual shared_ptr<Config> next() = 0; }; @@ -37,7 +37,7 @@ namespace config { class Iterator { public: - Iterator() {} + Iterator() = default; Iterator( const shared_ptr<ConfigGenerator> & configGenerator ) : generator_ ( configGenerator ) { diff --git a/src/core/debug/CheckFunctions.h b/src/core/debug/CheckFunctions.h index 04444255cbec2bcf722ccee3d9f8788a6abb7b9a..4431b654daca92342bf6dfe1cee1b26cbde43729 100644 --- a/src/core/debug/CheckFunctions.h +++ b/src/core/debug/CheckFunctions.h @@ -212,7 +212,7 @@ namespace check_functions_detail { struct ExitHandler { - ExitHandler() {}; + ExitHandler() = default; ExitHandler( const std::string & message ) : message_( message ) {} void operator()( const std::string & checkErrorMessage ); private: diff --git a/src/core/debug/CheckFunctions.impl.h b/src/core/debug/CheckFunctions.impl.h index 023d5f7d3fa48d2920d7ba26444453931502572c..e1932fddae763bfe6bc983be52637f978754b8e9 100644 --- a/src/core/debug/CheckFunctions.impl.h +++ b/src/core/debug/CheckFunctions.impl.h @@ -37,7 +37,7 @@ namespace check_functions_detail { template< typename T > inline bool check_nullptr( T * p ) { - return p == 0; + return p == nullptr; } template< typename T > @@ -49,7 +49,7 @@ inline bool check_nullptr( const shared_ptr<T> & p ) template< typename T > inline bool check_not_nullptr( T * p ) { - return p != 0; + return p != nullptr; } template< typename T > diff --git a/src/core/debug/demangle.h b/src/core/debug/demangle.h index 2e317436e6d9bace3045ef40a79aa4fdd0f88a85..55334b5509744c9cbe40d772a569c16c91182b85 100644 --- a/src/core/debug/demangle.h +++ b/src/core/debug/demangle.h @@ -42,7 +42,7 @@ inline std::string demangle( const std::string & name ) #ifdef HAVE_CXXABI_H int status = 0; std::size_t size = 0; - const char * demangled = abi::__cxa_demangle( name.c_str(), NULL, &size, &status ); + const char * demangled = abi::__cxa_demangle( name.c_str(), nullptr, &size, &status ); if( demangled == nullptr ) { return name; diff --git a/src/core/logging/Logging.h b/src/core/logging/Logging.h index 1a43778516e837e874fed0dda040c25508b93c06..8d174df51acee3b451cf17a211b1f29c5325ca78 100644 --- a/src/core/logging/Logging.h +++ b/src/core/logging/Logging.h @@ -82,7 +82,7 @@ public: class CustomStamp { public: - virtual ~CustomStamp() {} + virtual ~CustomStamp() = default; virtual std::string stamp() = 0; virtual uint_t maxStampWidth() = 0; }; diff --git a/src/core/math/Matrix2.h b/src/core/math/Matrix2.h index f8310899c1ae21c02c20a99c9aaa1167d156ecbc..a9377506d81203be3881810ad4c1ab124b722819 100644 --- a/src/core/math/Matrix2.h +++ b/src/core/math/Matrix2.h @@ -375,12 +375,10 @@ inline bool Matrix2<Type>::operator==( const Matrix2<Other>& rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type. - if( !equal( v_[0], rhs.v_[0] ) || - !equal( v_[1], rhs.v_[1] ) || - !equal( v_[2], rhs.v_[2] ) || - !equal( v_[3], rhs.v_[3] ) ) - return false; - else return true; + return equal( v_[0], rhs.v_[0] ) && + equal( v_[1], rhs.v_[1] ) && + equal( v_[2], rhs.v_[2] ) && + equal( v_[3], rhs.v_[3] ); } //********************************************************************************************************************** @@ -398,12 +396,7 @@ inline bool Matrix2<Type>::operator!=( const Matrix2<Other>& rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type. - if( !equal( v_[0], rhs.v_[0] ) || - !equal( v_[1], rhs.v_[1] ) || - !equal( v_[2], rhs.v_[2] ) || - !equal( v_[3], rhs.v_[3] ) ) - return true; - else return false; + return !(*this == rhs); } //********************************************************************************************************************** @@ -781,9 +774,7 @@ inline const Matrix2<Type> Matrix2<Type>::getInverse() const template< typename Type > inline bool Matrix2<Type>::isSingular() const { - if( equal( getDeterminant(), Type(0) ) ) - return true; - else return false; + return equal( getDeterminant(), Type(0) ); } //********************************************************************************************************************** @@ -875,11 +866,8 @@ std::ostream& operator<<( std::ostream& os, const Matrix2<Type>& m ) template< typename Type > inline bool isnan( const Matrix2<Type>& m ) { - if( math::isnan( m[0] ) || math::isnan( m[1] )|| - math::isnan( m[2] ) || math::isnan( m[3] ) ) - return true; - else - return false; + return math::isnan( m[0] ) || math::isnan( m[1] )|| + math::isnan( m[2] ) || math::isnan( m[3] ); } //********************************************************************************************************************** diff --git a/src/core/math/Matrix3.h b/src/core/math/Matrix3.h index 665c6529ee6bd898fd2d353950a25255eb4921c0..e8253b4ad578b7a38c94bc0bb34180813f6f5cb4 100644 --- a/src/core/math/Matrix3.h +++ b/src/core/math/Matrix3.h @@ -525,17 +525,15 @@ inline bool Matrix3<Type>::operator==( const Matrix3<Other>& rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type. - if( !equal( v_[0], rhs.v_[0] ) || - !equal( v_[1], rhs.v_[1] ) || - !equal( v_[2], rhs.v_[2] ) || - !equal( v_[3], rhs.v_[3] ) || - !equal( v_[4], rhs.v_[4] ) || - !equal( v_[5], rhs.v_[5] ) || - !equal( v_[6], rhs.v_[6] ) || - !equal( v_[7], rhs.v_[7] ) || - !equal( v_[8], rhs.v_[8] ) ) - return false; - else return true; + return equal( v_[0], rhs.v_[0] ) && + equal( v_[1], rhs.v_[1] ) && + equal( v_[2], rhs.v_[2] ) && + equal( v_[3], rhs.v_[3] ) && + equal( v_[4], rhs.v_[4] ) && + equal( v_[5], rhs.v_[5] ) && + equal( v_[6], rhs.v_[6] ) && + equal( v_[7], rhs.v_[7] ) && + equal( v_[8], rhs.v_[8] ); } //********************************************************************************************************************** @@ -553,17 +551,7 @@ inline bool Matrix3<Type>::operator!=( const Matrix3<Other>& rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type. - if( !equal( v_[0], rhs.v_[0] ) || - !equal( v_[1], rhs.v_[1] ) || - !equal( v_[2], rhs.v_[2] ) || - !equal( v_[3], rhs.v_[3] ) || - !equal( v_[4], rhs.v_[4] ) || - !equal( v_[5], rhs.v_[5] ) || - !equal( v_[6], rhs.v_[6] ) || - !equal( v_[7], rhs.v_[7] ) || - !equal( v_[8], rhs.v_[8] ) ) - return true; - else return false; + return !(*this == rhs); } //********************************************************************************************************************** @@ -1129,9 +1117,7 @@ inline const Matrix3<HIGH> Matrix3<Type>::diagRotate( const Matrix3<Other>& m ) template< typename Type > inline bool Matrix3<Type>::isSingular() const { - if( equal( getDeterminant(), Type(0) ) ) - return true; - else return false; + return equal( getDeterminant(), Type(0) ); } //********************************************************************************************************************** @@ -1145,9 +1131,7 @@ inline bool Matrix3<Type>::isSingular() const template< typename Type > inline bool Matrix3<Type>::isSymmetric() const { - if( !equal( v_[1], v_[3] ) || !equal( v_[2], v_[6] ) || !equal( v_[5], v_[7] ) ) - return false; - else return true; + return equal( v_[1], v_[3] ) && equal( v_[2], v_[6] ) && equal( v_[5], v_[7] ); } //********************************************************************************************************************** @@ -1160,7 +1144,7 @@ inline bool Matrix3<Type>::isSymmetric() const template< typename Type > inline bool Matrix3<Type>::isZero() const { - if( equal( v_[0], Type(0) ) && + return equal( v_[0], Type(0) ) && equal( v_[1], Type(0) ) && equal( v_[2], Type(0) ) && equal( v_[3], Type(0) ) && @@ -1168,9 +1152,7 @@ inline bool Matrix3<Type>::isZero() const equal( v_[5], Type(0) ) && equal( v_[6], Type(0) ) && equal( v_[7], Type(0) ) && - equal( v_[8], Type(0) ) ) - return true; - else return false; + equal( v_[8], Type(0) ); } //********************************************************************************************************************** @@ -1595,11 +1577,9 @@ std::ostream& operator<<( std::ostream& os, const Matrix3<Type>& m ) template< typename Type > inline bool isnan( const Matrix3<Type>& m ) { - if( math::isnan( m[0] ) || math::isnan( m[1] ) || math::isnan( m[2] ) || + return math::isnan( m[0] ) || math::isnan( m[1] ) || math::isnan( m[2] ) || math::isnan( m[3] ) || math::isnan( m[4] ) || math::isnan( m[5] ) || - math::isnan( m[6] ) || math::isnan( m[7] ) || math::isnan( m[8] ) ) - return true; - else return false; + math::isnan( m[6] ) || math::isnan( m[7] ) || math::isnan( m[8] ); } //********************************************************************************************************************** @@ -1658,11 +1638,9 @@ inline const Matrix3<Type> fabs( const Matrix3<Type>& m ) template< typename Type > inline bool isinf( const Matrix3<Type>& m ) { - if( math::isinf( m[0] ) || math::isinf( m[1] ) || math::isinf( m[2] ) || + return math::isinf( m[0] ) || math::isinf( m[1] ) || math::isinf( m[2] ) || math::isinf( m[3] ) || math::isinf( m[4] ) || math::isinf( m[5] ) || - math::isinf( m[6] ) || math::isinf( m[7] ) || math::isinf( m[8] ) ) - return true; - else return false; + math::isinf( m[6] ) || math::isinf( m[7] ) || math::isinf( m[8] ); } //********************************************************************************************************************** diff --git a/src/core/math/MatrixMxN.h b/src/core/math/MatrixMxN.h index be490da348c410e51dec88b8044bdcd0f1e88ab6..1d633e74e862da728b10931051a440827262b1e9 100644 --- a/src/core/math/MatrixMxN.h +++ b/src/core/math/MatrixMxN.h @@ -203,7 +203,7 @@ inline constexpr MatrixMxN<Type>::MatrixMxN() : m_ ( 0 ) // The current number of rows of the matrix , n_ ( 0 ) // The current number of columns of the matrix , capacity_( 0 ) // The maximum capacity of the matrix - , v_ ( 0 ) // The matrix elements + , v_ ( nullptr ) // The matrix elements {} //************************************************************************************************* diff --git a/src/core/math/Quaternion.h b/src/core/math/Quaternion.h index 90fd652de353026cab2612aed1be1570d754ea66..9ca8c6f53b8d7877121acdbd85ed626862ebcbfb 100644 --- a/src/core/math/Quaternion.h +++ b/src/core/math/Quaternion.h @@ -816,12 +816,10 @@ inline bool operator==( const Quaternion<T1>& lhs, const Quaternion<T2>& rhs ) { // In order to compare the two quaternions, the data values of the lower-order data // type are converted to the higher-order data type within the equal function. - if( !equal( lhs[0], rhs[0] ) || - !equal( lhs[1], rhs[1] ) || - !equal( lhs[2], rhs[2] ) || - !equal( lhs[2], rhs[2] ) ) - return false; - else return true; + return equal( lhs[0], rhs[0] ) && + equal( lhs[1], rhs[1] ) && + equal( lhs[2], rhs[2] ) && + equal( lhs[2], rhs[2] ); } //************************************************************************************************* @@ -911,9 +909,7 @@ std::istream& operator>>( std::istream& is, Quaternion<Type>& q ) template< typename Type > // Data type of the quaternion inline bool isnan( const Quaternion<Type>& q ) { - if( isnan( q[0] ) || isnan( q[1] ) || isnan( q[2] ) || isnan( q[3] ) ) - return true; - else return false; + return isnan( q[0] ) || isnan( q[1] ) || isnan( q[2] ) || isnan( q[3] ); } //************************************************************************************************* diff --git a/src/core/math/Vector2.h b/src/core/math/Vector2.h index b0decf8ec0a2953fc2a2c3ab3a9e8c619de99e60..c69f7bcc780ab19f3fe0a9b070ce3718cca856c2 100644 --- a/src/core/math/Vector2.h +++ b/src/core/math/Vector2.h @@ -322,9 +322,7 @@ inline bool Vector2<Type>::operator==( Other rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs ) || !equal( v_[1], rhs ) ) - return false; - else return true; + return equal( v_[0], rhs ) && equal( v_[1], rhs ); } //********************************************************************************************************************** @@ -342,9 +340,7 @@ inline bool Vector2<Type>::operator==( const Vector2<Other>& rhs ) const { // In order to compare the two vectors, the data values of the lower-order data // type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs.v_[0] ) || !equal( v_[1], rhs.v_[1] ) ) - return false; - else return true; + return equal( v_[0], rhs.v_[0] ) && equal( v_[1], rhs.v_[1] ); } //********************************************************************************************************************** @@ -365,9 +361,7 @@ inline bool Vector2<Type>::operator!=( Other rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs ) || !equal( v_[1], rhs ) ) - return true; - else return false; + return !(*this == rhs); } //********************************************************************************************************************** @@ -385,9 +379,7 @@ inline bool Vector2<Type>::operator!=( const Vector2<Other>& rhs ) const { // In order to compare the two vectors, the data values of the lower-order data // type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs.v_[0] ) || !equal( v_[1], rhs.v_[1] ) ) - return true; - else return false; + return !(*this == rhs); } //********************************************************************************************************************** @@ -1457,10 +1449,7 @@ inline std::istream& operator>>( std::istream& is, Vector2<bool>& v ) template< typename Type > inline bool isnan( const Vector2<Type>& v ) { - if( walberla::math::isnan( v[0] ) || walberla::math::isnan( v[1] ) ) - return true; - else - return false; + return walberla::math::isnan( v[0] ) || walberla::math::isnan( v[1] ); } //********************************************************************************************************************** diff --git a/src/core/math/Vector3.h b/src/core/math/Vector3.h index 8bc4e3233cd650905c39adedcdc4e6922ba6799e..72b6a45fabdb65b7fe8506c6857cf4599bc7e1f5 100644 --- a/src/core/math/Vector3.h +++ b/src/core/math/Vector3.h @@ -333,9 +333,7 @@ inline bool Vector3<Type>::operator==( Other rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs ) || !equal( v_[1], rhs ) || !equal( v_[2], rhs ) ) - return false; - else return true; + return equal( v_[0], rhs ) && equal( v_[1], rhs ) && equal( v_[2], rhs ); } //********************************************************************************************************************** @@ -353,9 +351,7 @@ inline bool Vector3<Type>::operator==( const Vector3<Other>& rhs ) const { // In order to compare the two vectors, the data values of the lower-order data // type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs.v_[0] ) || !equal( v_[1], rhs.v_[1] ) || !equal( v_[2], rhs.v_[2] ) ) - return false; - else return true; + return equal( v_[0], rhs.v_[0] ) && equal( v_[1], rhs.v_[1] ) && equal( v_[2], rhs.v_[2] ); } //********************************************************************************************************************** @@ -376,9 +372,7 @@ inline bool Vector3<Type>::operator!=( Other rhs ) const { // In order to compare the vector and the scalar value, the data values of the lower-order // data type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs ) || !equal( v_[1], rhs ) || !equal( v_[2], rhs ) ) - return true; - else return false; + return !(*this == rhs); } //********************************************************************************************************************** @@ -396,9 +390,7 @@ inline bool Vector3<Type>::operator!=( const Vector3<Other>& rhs ) const { // In order to compare the two vectors, the data values of the lower-order data // type are converted to the higher-order data type within the equal function. - if( !equal( v_[0], rhs.v_[0] ) || !equal( v_[1], rhs.v_[1] ) || !equal( v_[2], rhs.v_[2] ) ) - return true; - else return false; + return !(*this == rhs); } //********************************************************************************************************************** diff --git a/src/core/math/equation_system/Operator.h b/src/core/math/equation_system/Operator.h index b0dcd809ba495921df10d12b6068827162746045..e9a6a75e1ed50196b285212e1b5bed3ddfec4649 100644 --- a/src/core/math/equation_system/Operator.h +++ b/src/core/math/equation_system/Operator.h @@ -42,7 +42,7 @@ namespace math { OpType( const char& sign, const std::string& n, const unsigned int strength ) : sign_(sign), name_(n), strength_(strength) {} - virtual ~OpType() {} + virtual ~OpType() = default; private: OpType& operator=( const OpType& ){ return *this; } @@ -68,56 +68,56 @@ namespace math { public: OpNo( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double &, const double & ) { WALBERLA_ABORT( "NO OPERATION" ); return 0; } + double operator() ( const double &, const double & ) override { WALBERLA_ABORT( "NO OPERATION" ); return 0; } }; class OpPlus : public OpType{ public: OpPlus( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {}; - double operator() ( const double & a, const double & b ) { return a + b; } + double operator() ( const double & a, const double & b ) override { return a + b; } }; class OpMinus : public OpType{ public: OpMinus( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) { return a - b; } + double operator() ( const double & a, const double & b ) override { return a - b; } }; class OpMult : public OpType{ public: OpMult( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) { return a * b; } + double operator() ( const double & a, const double & b ) override { return a * b; } }; class OpDiv : public OpType{ public: OpDiv( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) { return a / b; } + double operator() ( const double & a, const double & b ) override { return a / b; } }; class OpProd : public OpType{ public: OpProd( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) { return pow( a, b ); } + double operator() ( const double & a, const double & b ) override { return pow( a, b ); } }; class OpRoot : public OpType{ public: OpRoot( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) { return pow( a, 1/b ); } + double operator() ( const double & a, const double & b ) override { return pow( a, 1/b ); } }; class OpLog : public OpType{ public: OpLog( const char& sign, const std::string& name, const unsigned int strength ) : OpType( sign, name, strength ) {} - double operator() ( const double & a, const double & b ) { return log10(a) / log10(b); } + double operator() ( const double & a, const double & b ) override { return log10(a) / log10(b); } }; diff --git a/src/core/mpi/BufferSystem.h b/src/core/mpi/BufferSystem.h index 8be65ea4a355644a39381eb29944375010fbc4f5..ea1037b13845ca6ba117acc56c157671cc3a1393 100644 --- a/src/core/mpi/BufferSystem.h +++ b/src/core/mpi/BufferSystem.h @@ -118,7 +118,7 @@ public: explicit GenericBufferSystem( const MPI_Comm & communicator, int tag = 0 ); GenericBufferSystem( const GenericBufferSystem & other ); GenericBufferSystem & operator=( const GenericBufferSystem & other ); - ~GenericBufferSystem() {} + ~GenericBufferSystem() = default; //@} //******************************************************************************************************************* diff --git a/src/core/mpi/BufferSystemHelper.h b/src/core/mpi/BufferSystemHelper.h index 661e463587263ec62d8aadbc1ba93d15660ca2ed..78b77c5ed6b3aec418c4057671f683f6c816c8e1 100644 --- a/src/core/mpi/BufferSystemHelper.h +++ b/src/core/mpi/BufferSystemHelper.h @@ -43,7 +43,7 @@ namespace internal { : communicator_( communicator), tag_(tag) {} - virtual ~AbstractCommunication() {} + virtual ~AbstractCommunication() = default; struct ReceiveInfo { @@ -110,15 +110,15 @@ namespace internal { KnownSizeCommunication( const MPI_Comm & communicator, int tag = 0 ) : AbstractCommunication<RecvBuffer_T, SendBuffer_T>( communicator, tag ), sending_(false), receiving_(false) {} - virtual ~KnownSizeCommunication() {} + ~KnownSizeCommunication() override = default; - virtual void send( MPIRank receiver, const SendBuffer_T & sendBuffer ); - virtual void waitForSends(); + void send( MPIRank receiver, const SendBuffer_T & sendBuffer ) override; + void waitForSends() override; - virtual void scheduleReceives ( std::map<MPIRank, ReceiveInfo> & recvInfos ); + void scheduleReceives ( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; /// size field of recvInfos is expected to be valid - virtual MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ); + MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; private: bool sending_; @@ -138,15 +138,15 @@ namespace internal { UnknownSizeCommunication( const MPI_Comm & communicator, int tag = 0 ) : AbstractCommunication<RecvBuffer_T, SendBuffer_T>( communicator, tag ), sending_(false), receiving_(false) {} - virtual ~UnknownSizeCommunication() {} + ~UnknownSizeCommunication() override = default; - virtual void send( MPIRank receiver, const SendBuffer_T & sendBuffer ); - virtual void waitForSends(); + void send( MPIRank receiver, const SendBuffer_T & sendBuffer ) override; + void waitForSends() override; - virtual void scheduleReceives( std::map<MPIRank, ReceiveInfo> & recvInfos ); + void scheduleReceives( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; /// size field of recvInfos can be invalid, is filled in with the actual message size - virtual MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ); + MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; private: bool sending_; @@ -170,15 +170,15 @@ namespace internal { UnknownSizeCommunicationIProbe( const MPI_Comm & communicator, int tag = 0 ) : AbstractCommunication<RecvBuffer_T, SendBuffer_T>( communicator, tag ), sending_(false), receiving_(false) {} - virtual ~UnknownSizeCommunicationIProbe() {} + ~UnknownSizeCommunicationIProbe() override = default; - virtual void send( MPIRank receiver, const SendBuffer_T & sendBuffer ); - virtual void waitForSends(); + void send( MPIRank receiver, const SendBuffer_T & sendBuffer ) override; + void waitForSends() override; - virtual void scheduleReceives( std::map<MPIRank, ReceiveInfo> & recvInfos ); + void scheduleReceives( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; /// size field of recvInfos can be invalid, is filled in with the actual message size - virtual MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ); + MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; private: bool sending_; @@ -198,15 +198,15 @@ namespace internal { NoMPICommunication( const MPI_Comm & communicator, int tag = 0 ) : AbstractCommunication<RecvBuffer_T, SendBuffer_T>( communicator, tag ), received_( false ) {} - virtual ~NoMPICommunication() {} + ~NoMPICommunication() override = default; - virtual void send( MPIRank receiver, const SendBuffer_T & sendBuffer ); - virtual void waitForSends(); + void send( MPIRank receiver, const SendBuffer_T & sendBuffer ) override; + void waitForSends() override; - virtual void scheduleReceives( std::map<MPIRank, ReceiveInfo> & recvInfos ); + void scheduleReceives( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; /// size field of recvInfos can be invalid, is filled in with the actual message size - virtual MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ); + MPIRank waitForNextReceive( std::map<MPIRank, ReceiveInfo> & recvInfos ) override; private: bool received_; diff --git a/src/core/mpi/Gather.h b/src/core/mpi/Gather.h index 5cad161899035d4575dfc1c32b662fd4624c863d..976981f9fa0e8fe9374c4809e77fb656a23257cc 100644 --- a/src/core/mpi/Gather.h +++ b/src/core/mpi/Gather.h @@ -78,7 +78,7 @@ std::vector<T> gather( T value, int recvRank = 0, MPI_Comm comm = MPI_COMM_WORLD return result; } - MPI_Gather( &value, 1, MPITrait<T>::type(), NULL, 1, MPITrait<T>::type(), + MPI_Gather( &value, 1, MPITrait<T>::type(), nullptr, 1, MPITrait<T>::type(), recvRank, comm ); return std::vector<T>(); diff --git a/src/core/mpi/Gatherv.h b/src/core/mpi/Gatherv.h index 7ffda280a2b645e420608b123d3bd5a3880b604e..7a9de2652e45d552f59f5834c2f0b75fdea77232 100644 --- a/src/core/mpi/Gatherv.h +++ b/src/core/mpi/Gatherv.h @@ -90,9 +90,9 @@ std::vector<T> gatherv( const std::vector<T> & values, int recvRank = 0, MPI_Com if( values.empty() ) { if( !result.empty() ) - MPI_Gatherv( NULL, 0, MPITrait<T>::type(), &(result[0]), &(recvCounts[0]), &(displacements[0]), MPITrait<T>::type(), recvRank, comm ); + MPI_Gatherv( nullptr, 0, MPITrait<T>::type(), &(result[0]), &(recvCounts[0]), &(displacements[0]), MPITrait<T>::type(), recvRank, comm ); else - MPI_Gatherv( NULL, 0, MPITrait<T>::type(), NULL, &(recvCounts[0]), &(displacements[0]), MPITrait<T>::type(), recvRank, comm ); + MPI_Gatherv( nullptr, 0, MPITrait<T>::type(), nullptr, &(recvCounts[0]), &(displacements[0]), MPITrait<T>::type(), recvRank, comm ); } else { @@ -109,11 +109,11 @@ std::vector<T> gatherv( const std::vector<T> & values, int recvRank = 0, MPI_Com if( values.empty() ) { - MPI_Gatherv( NULL, 0, MPITrait<T>::type(), NULL, NULL, NULL, MPITrait<T>::type(), recvRank, comm ); + MPI_Gatherv( nullptr, 0, MPITrait<T>::type(), nullptr, nullptr, nullptr, MPITrait<T>::type(), recvRank, comm ); } else { - MPI_Gatherv( const_cast<T*>( &(values[0]) ), int_c( values.size() ), MPITrait<T>::type(), NULL, NULL, NULL, MPITrait<T>::type(), + MPI_Gatherv( const_cast<T*>( &(values[0]) ), int_c( values.size() ), MPITrait<T>::type(), nullptr, nullptr, nullptr, MPITrait<T>::type(), recvRank, comm ); } @@ -171,7 +171,7 @@ std::vector<T> allGatherv( const std::vector<T> & values, MPI_Comm comm = MPI_CO { if( values.empty() ) { - MPI_Allgatherv( NULL, 0, MPITrait<T>::type(), &(result[0]), &(recvCounts[0]), &(displacements[0]), + MPI_Allgatherv( nullptr, 0, MPITrait<T>::type(), &(result[0]), &(recvCounts[0]), &(displacements[0]), MPITrait<T>::type(), comm ); } else diff --git a/src/core/mpi/MPIWrapper.h b/src/core/mpi/MPIWrapper.h index 14e72cc5dafb75281d599d03784d8c1d64462a43..233baa6bb727c1814b15de0e85cef63d1ec7bb20 100644 --- a/src/core/mpi/MPIWrapper.h +++ b/src/core/mpi/MPIWrapper.h @@ -177,10 +177,10 @@ const int MPI_REQUEST_NULL = 0; const int MPI_FILE_NULL = 0; -static MPI_Status* MPI_STATUS_IGNORE = NULL; -static MPI_Status* MPI_STATUSES_IGNORE = NULL; +static MPI_Status* MPI_STATUS_IGNORE = nullptr; +static MPI_Status* MPI_STATUSES_IGNORE = nullptr; -namespace non_mpi_internal { inline void disableDefinedButNotUsedWarning() { MPI_STATUS_IGNORE = NULL; MPI_STATUSES_IGNORE = NULL; } } +namespace non_mpi_internal { inline void disableDefinedButNotUsedWarning() { MPI_STATUS_IGNORE = nullptr; MPI_STATUSES_IGNORE = nullptr; } } const int MPI_MAX_OBJECT_NAME = 255; const int MPI_MAX_ERROR_STRING = 255; diff --git a/src/core/mpi/RecvBuffer.h b/src/core/mpi/RecvBuffer.h index c35b0c2aaf427e90f775fb814e3fe95f96027598..b3dacb3db41a866d66164991c687b4c8837b17e2 100644 --- a/src/core/mpi/RecvBuffer.h +++ b/src/core/mpi/RecvBuffer.h @@ -189,9 +189,9 @@ typedef GenericRecvBuffer<> RecvBuffer; template< typename T > // Element type inline GenericRecvBuffer<T>::GenericRecvBuffer() : capacity_( 0 ) // Capacity of the receive buffer - , begin_ ( NULL ) // Pointer to the first element - , cur_ ( NULL ) // Pointer to the current element - , end_ ( NULL ) // Pointer to the last element + , begin_ ( nullptr ) // Pointer to the first element + , cur_ ( nullptr ) // Pointer to the current element + , end_ ( nullptr ) // Pointer to the last element {} //********************************************************************************************************************** @@ -615,9 +615,9 @@ inline void GenericRecvBuffer<T>::reset() { delete [] begin_; capacity_ = 0; - begin_ = NULL; - cur_ = NULL; - end_ = NULL; + begin_ = nullptr; + cur_ = nullptr; + end_ = nullptr; } //********************************************************************************************************************** diff --git a/src/core/mpi/Reduce.h b/src/core/mpi/Reduce.h index f60502868477906d5981d85d013b055c43edd83d..c93e9443fa92c4f23e4975d59fbdf6fd78c36d58 100644 --- a/src/core/mpi/Reduce.h +++ b/src/core/mpi/Reduce.h @@ -93,7 +93,7 @@ void reduceInplace( T & value, Operation operation, int recvRank = 0, MPI_Comm c } else { - MPI_Reduce( &value, 0, 1, MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( &value, nullptr, 1, MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); } } @@ -130,7 +130,7 @@ inline void reduceInplace( bool & value, Operation operation, int recvRank = 0, } else { - MPI_Reduce( &intValue, 0, 1, MPITrait<int>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( &intValue, nullptr, 1, MPITrait<int>::type(), toMPI_Op(operation), recvRank, comm ); } value = intValue != 0; @@ -174,7 +174,7 @@ T reduce( const T value, Operation operation, int recvRank = 0, MPI_Comm comm = } else { - MPI_Reduce( const_cast<T*>( &value ), 0, 1, MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( const_cast<T*>( &value ), nullptr, 1, MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); } return result; @@ -215,7 +215,7 @@ inline bool reduce( const bool value, Operation operation, int recvRank = 0, MPI } else { - MPI_Reduce( &intValue, 0, 1, MPITrait<int>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( &intValue, nullptr, 1, MPITrait<int>::type(), toMPI_Op(operation), recvRank, comm ); } return intResult != 0; @@ -251,11 +251,11 @@ void reduceInplace( std::vector<T> & values, Operation operation, int recvRank = if( myRank == recvRank ) { - MPI_Reduce( MPI_IN_PLACE, values.empty() ? 0 : &values[0], int_c( values.size() ), MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( MPI_IN_PLACE, values.empty() ? nullptr : &values[0], int_c( values.size() ), MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); } else { - MPI_Reduce( values.empty() ? 0 : &values[0], 0, int_c( values.size() ), MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( values.empty() ? nullptr : &values[0], nullptr, int_c( values.size() ), MPITrait<T>::type(), toMPI_Op(operation), recvRank, comm ); } } @@ -291,14 +291,14 @@ inline void reduceInplace( std::vector<bool> & values, Operation operation, int if( myRank == recvRank ) { - MPI_Reduce( MPI_IN_PLACE, sendBuffer.empty() ? 0 : &sendBuffer[0], int_c( sendBuffer.size() ), MPITrait<uint8_t>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( MPI_IN_PLACE, sendBuffer.empty() ? nullptr : &sendBuffer[0], int_c( sendBuffer.size() ), MPITrait<uint8_t>::type(), toMPI_Op(operation), recvRank, comm ); size_t size = values.size(); convert( sendBuffer, values ); values.resize(size); } else { - MPI_Reduce( sendBuffer.empty() ? 0 : &sendBuffer[0], 0, int_c( sendBuffer.size() ), MPITrait<uint8_t>::type(), toMPI_Op(operation), recvRank, comm ); + MPI_Reduce( sendBuffer.empty() ? nullptr : &sendBuffer[0], nullptr, int_c( sendBuffer.size() ), MPITrait<uint8_t>::type(), toMPI_Op(operation), recvRank, comm ); } } @@ -426,7 +426,7 @@ void allReduceInplace( std::vector<T> & values, Operation operation, MPI_Comm co WALBERLA_NON_MPI_SECTION() { return; } - MPI_Allreduce( MPI_IN_PLACE, values.empty() ? 0 : &values[0], int_c( values.size() ), MPITrait<T>::type(), toMPI_Op(operation), comm ); + MPI_Allreduce( MPI_IN_PLACE, values.empty() ? nullptr : &values[0], int_c( values.size() ), MPITrait<T>::type(), toMPI_Op(operation), comm ); } @@ -451,7 +451,7 @@ inline void allReduceInplace( std::vector<bool> & bools, Operation operation, MP std::vector<uint8_t> sendBuffer; convert( bools, sendBuffer ); - MPI_Allreduce( MPI_IN_PLACE, sendBuffer.empty() ? 0 : &sendBuffer[0], int_c( sendBuffer.size() ), MPITrait<uint8_t>::type(), toMPI_Op(operation), comm ); + MPI_Allreduce( MPI_IN_PLACE, sendBuffer.empty() ? nullptr : &sendBuffer[0], int_c( sendBuffer.size() ), MPITrait<uint8_t>::type(), toMPI_Op(operation), comm ); auto size = bools.size(); convert(sendBuffer, bools); bools.resize(size); diff --git a/src/core/selectable/SelectableObject.h b/src/core/selectable/SelectableObject.h index 7f317c11526226ffbfc9ef90a28a238d5e0a4cf2..6a282536dfdd6f29d92806dfebdb003092246623 100644 --- a/src/core/selectable/SelectableObject.h +++ b/src/core/selectable/SelectableObject.h @@ -138,7 +138,7 @@ public: - virtual ~SelectableObject() {} + virtual ~SelectableObject() = default; void add( const T& object, const A& attributes, const std::string& identifier = std::string() ); @@ -221,7 +221,7 @@ size_t SelectableObject<T,A,S>::get( T& object, const S& selector ) const { select( index, selector ); - if( index.size() >= 1 ) { + if( !index.empty() ) { WALBERLA_ASSERT_LESS( index[0], object_.size() ); object = object_[ index[0] ]; } @@ -270,7 +270,7 @@ size_t SelectableObject<T,A,S>::get( T& object, std::string& identifier, const S select( index, selector ); - if( index.size() >= 1 ) { + if( !index.empty() ) { WALBERLA_ASSERT_LESS( index[0], object_.size() ); object = object_[ index[0] ]; identifier = identifier_[ index[0] ]; @@ -325,7 +325,7 @@ const T* SelectableObject<T,A,S>::getUnique( const S& selector ) const { return &(object_[ index[0] ]); } - return NULL; + return nullptr; } @@ -363,7 +363,7 @@ const T* SelectableObject<T,A,S>::getUnique( const S& selector, std::string & id return &(object_[ index[0] ]); } - return NULL; + return nullptr; } diff --git a/src/core/selectable/SetSelectableObject.h b/src/core/selectable/SetSelectableObject.h index 8c88a3f23b058ed5a02cc251654292166d9bf85f..e43740aef98f12da597710a7e5911c05dbc1b32c 100644 --- a/src/core/selectable/SetSelectableObject.h +++ b/src/core/selectable/SetSelectableObject.h @@ -49,14 +49,14 @@ class SetSelectableObject : public SelectableObject< T, SetSelectionPair<U>, Set { public: - SetSelectableObject() {} + SetSelectableObject() = default; SetSelectableObject( const T& object, const Set<U>& include, const Set<U>& exclude, const std::string& identifier = std::string() ) { add( object, include, exclude, identifier ); } - virtual ~SetSelectableObject() {} + ~SetSelectableObject() override = default; void add( const T& object, const Set<U>& include, const Set<U>& exclude, const std::string& identifier = std::string() ) { @@ -73,7 +73,7 @@ private: }; // added inline qualifier to suppress unjustified MSVC warning C4505 - virtual inline void select( std::vector< size_t >& index, const Set<U>& selector ) const; + inline void select( std::vector< size_t >& index, const Set<U>& selector ) const override; }; // SetSelectableObject diff --git a/src/core/singleton/Singleton.h b/src/core/singleton/Singleton.h index ead687d0c3443b73129b9397e24c644ac0f701a7..f1e5975df02a22e1a6db90e30975e6c81f43035b 100644 --- a/src/core/singleton/Singleton.h +++ b/src/core/singleton/Singleton.h @@ -70,14 +70,14 @@ protected: // In case a cyclic lifetime dependency is detected, a compilation error is created. */ explicit Singleton() - {} + = default; //******************************************************************************************************************* //**Destructor******************************************************************************************************* /*!\brief Destructor for the Singleton class. */ ~Singleton() - {} + = default; //******************************************************************************************************************* public: diff --git a/src/core/timing/TimingNode.h b/src/core/timing/TimingNode.h index acd33ecd213f922243d0b343a89b6a69675182d6..a99dfe05b218c27391603870c8cc3e3297bbe134 100644 --- a/src/core/timing/TimingNode.h +++ b/src/core/timing/TimingNode.h @@ -76,14 +76,14 @@ struct TimingNode template< typename TP > // Timing policy TimingNode<TP>::TimingNode() - : last_(NULL) + : last_(nullptr) { } template< typename TP > // Timing policy TimingNode<TP>::TimingNode(const TimingNode<TP>& tn) - : last_(NULL) + : last_(nullptr) , timer_(tn.timer_) , tree_(tn.tree_) { @@ -301,11 +301,11 @@ void reduceInplace( TimingNode<TP>& tn, ReduceType rt = REDUCE_TOTAL, int target 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/core/timing/TimingPool.h b/src/core/timing/TimingPool.h index 5e8fd71049bb268317d7f84fc4ec47fb6e9ed750..b927151aced1611fb611ba06b19441794fba0df6 100644 --- a/src/core/timing/TimingPool.h +++ b/src/core/timing/TimingPool.h @@ -63,7 +63,7 @@ public: //**Construction & Destruction*************************************************************************************** /*! \name Construction & Destruction */ //@{ - TimingPool() {} + TimingPool() = default; //@} //******************************************************************************************************************* diff --git a/src/core/timing/TimingTree.h b/src/core/timing/TimingTree.h index b4f4e736b77a2942e6d78d26ef28e74c5764a7e9..7fe833b1e2d4d0558e4246533ceb4f6ddda87215 100644 --- a/src/core/timing/TimingTree.h +++ b/src/core/timing/TimingTree.h @@ -179,9 +179,7 @@ bool TimingTree<TP>::isTimerRunning(const std::string& name) const { WALBERLA_ASSERT_NOT_NULLPTR( current_->last_ ); auto timerIt = current_->last_->tree_.find(name); - if ((timerIt == current_->last_->tree_.end()) || (&(timerIt->second) != current_)) - return false; - return true; + return !((timerIt == current_->last_->tree_.end()) || (&(timerIt->second) != current_)); } template< typename TP > // Timing policy diff --git a/src/domain_decomposition/BlockDataHandling.h b/src/domain_decomposition/BlockDataHandling.h index 4bd96dae090d6c09d5c43498d61343600803312b..4b07594e08f58c443b5c4090389f42c804bf8fd0 100644 --- a/src/domain_decomposition/BlockDataHandling.h +++ b/src/domain_decomposition/BlockDataHandling.h @@ -47,7 +47,7 @@ class BlockDataHandling public: typedef T value_type; - virtual ~BlockDataHandling() {} + virtual ~BlockDataHandling() = default; /// must be thread-safe ! virtual T * initialize( IBlock * const block ) = 0; @@ -66,11 +66,11 @@ template< typename T > class AlwaysInitializeBlockDataHandling : public BlockDataHandling<T> { public: - ~AlwaysInitializeBlockDataHandling() {} + ~AlwaysInitializeBlockDataHandling() override = default; - void serialize( IBlock * const, const BlockDataID &, mpi::SendBuffer & ) {} - T * deserialize( IBlock * const block ) { return this->initialize( block ); } - void deserialize( IBlock * const, const BlockDataID &, mpi::RecvBuffer & ) {} + void serialize( IBlock * const, const BlockDataID &, mpi::SendBuffer & ) override {} + T * deserialize( IBlock * const block ) override { return this->initialize( block ); } + void deserialize( IBlock * const, const BlockDataID &, mpi::RecvBuffer & ) override {} }; @@ -86,25 +86,25 @@ public: BlockDataHandlingFunctionAdaptor( const Function & function ) : function_( function ) {} - ~BlockDataHandlingFunctionAdaptor() {} + ~BlockDataHandlingFunctionAdaptor() override = default; - T * initialize( IBlock * const block ) { return function_( block ); } + T * initialize( IBlock * const block ) override { return function_( block ); } - void serialize( IBlock * const, const BlockDataID &, mpi::SendBuffer & ) + void serialize( IBlock * const, const BlockDataID &, mpi::SendBuffer & ) override { WALBERLA_ABORT( "You are trying to serialize a block data item for which only an initialization function was registered" ); #ifdef __IBMCPP__ return NULL; // never reached, helps to suppress a warning from the IBM compiler #endif } - T * deserialize( IBlock * const ) + T * deserialize( IBlock * const ) override { WALBERLA_ABORT( "You are trying to deserialize a block data item for which only an initialization function was registered" ); #ifdef __IBMCPP__ return NULL; // never reached, helps to suppress a warning from the IBM compiler #endif } - void deserialize( IBlock * const, const BlockDataID &, mpi::RecvBuffer & ) + void deserialize( IBlock * const, const BlockDataID &, mpi::RecvBuffer & ) override { WALBERLA_ABORT( "You are trying to deserialize a block data item for which only an initialization function was registered" ); } @@ -155,7 +155,7 @@ namespace internal { class BlockDataHandlingWrapper { public: - virtual ~BlockDataHandlingWrapper() {} + virtual ~BlockDataHandlingWrapper() = default; virtual BlockData * initialize( IBlock * const block ) = 0; @@ -173,27 +173,27 @@ public: BlockDataHandlingHelper( const shared_ptr< BlockDataHandling<T> > & dataHandling ) : dataHandling_( dataHandling ) {} - BlockData * initialize( IBlock * const block ) + BlockData * initialize( IBlock * const block ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); T * ptr = dataHandling_->initialize( block ); - return ptr ? new BlockData( ptr ) : NULL; + return ptr ? new BlockData( ptr ) : nullptr; } - void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) + void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->serialize( block, id, buffer ); } - BlockData * deserialize( IBlock * const block ) + BlockData * deserialize( IBlock * const block ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); T * ptr = dataHandling_->deserialize( block ); - return ptr ? new BlockData( ptr ) : NULL; + return ptr ? new BlockData( ptr ) : nullptr; } - void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override { WALBERLA_ASSERT_NOT_NULLPTR( block ); dataHandling_->deserialize( block, id, buffer ); diff --git a/src/domain_decomposition/BlockStorage.h b/src/domain_decomposition/BlockStorage.h index e00f3ee86ba7c157f2c0ebaa49530fa19768e8eb..0d6dfc6c1e4aa121936e01d4bdba54f7719178c1 100644 --- a/src/domain_decomposition/BlockStorage.h +++ b/src/domain_decomposition/BlockStorage.h @@ -87,8 +87,7 @@ public: using pointer = IBlock*; using reference = IBlock&; - iterator( const iterator & it ) : - it_( it.it_ ), end_( it.end_ ), requiredSelectors_( it.requiredSelectors_ ), incompatibleSelectors_( it.incompatibleSelectors_ ) {} + iterator( const iterator & it ) = default; iterator & operator++() { ++it_; checkStateAndAdapt(); return *this; } // prefix ++X iterator operator++(int) { iterator it( *this ); operator++(); return it; }; // postfix X++ @@ -133,8 +132,7 @@ public: const_iterator( const iterator & it ) : it_( it.it_ ), end_( it.end_ ), requiredSelectors_( it.requiredSelectors_ ), incompatibleSelectors_( it.incompatibleSelectors_ ) {} - const_iterator( const const_iterator & it ) : - it_( it.it_ ), end_( it.end_ ), requiredSelectors_( it.requiredSelectors_ ), incompatibleSelectors_( it.incompatibleSelectors_ ) {} + const_iterator( const const_iterator & it ) = default; const_iterator & operator++() { ++it_; checkStateAndAdapt(); return *this; } // prefix ++X const_iterator operator++(int) { const_iterator it( *this ); operator++(); return it; }; // postfix X++ @@ -285,7 +283,7 @@ public: if( it != iBlocks_.end()) return it->second; - return NULL; + return nullptr; } //******************************************************************************************************************* @@ -306,7 +304,7 @@ public: if( it != iBlocks_.end()) return it->second; - return NULL; + return nullptr; } //******************************************************************************************************************* diff --git a/src/domain_decomposition/IBlock.h b/src/domain_decomposition/IBlock.h index c25c55ee9a6f5e1224941ee51c3144ebd230adcc..27c0b894f253a746e94220c562efd5de399f859b 100644 --- a/src/domain_decomposition/IBlock.h +++ b/src/domain_decomposition/IBlock.h @@ -50,7 +50,7 @@ private: class DataBase { public: - virtual ~DataBase() {} + virtual ~DataBase() = default; virtual bool operator==( const DataBase& rhs ) const = 0; virtual bool isOfSameType( const DataBase& rhs ) const = 0; }; @@ -59,13 +59,13 @@ private: class Data : public DataBase { public: Data( T* data ) : data_( data ) {} - ~Data() { delete data_; } - bool operator==( const DataBase& rhs ) const { + ~Data() override { delete data_; } + bool operator==( const DataBase& rhs ) const override { const Data<T>* rhsData = dynamic_cast< const Data<T>* >( &rhs ); return ( rhsData == &rhs ) && ( *data_ == *(rhsData->data_) ); // every object that is registered as block data // must be comparable with "==" ! } - bool isOfSameType( const DataBase& rhs ) const { return dynamic_cast< const Data<T>* >( &rhs ) == &rhs; } + bool isOfSameType( const DataBase& rhs ) const override { return dynamic_cast< const Data<T>* >( &rhs ) == &rhs; } private: T* data_; }; @@ -299,7 +299,7 @@ inline bool IBlock::isBlockDataAllocated( const ConstBlockDataID & index ) const WALBERLA_ASSERT_LESS( uint_t( index ), data_.size() ); - return ( data_[index] != NULL ); + return ( data_[index] != nullptr ); } @@ -314,8 +314,8 @@ inline const T* IBlock::getData( const ConstBlockDataID & index ) const { WALBERLA_ASSERT_LESS( uint_t( index ), data_.size() ); - if( data_[index] == NULL ) - return NULL; + if( data_[index] == nullptr ) + return nullptr; return data_[index]->template get< T >(); } @@ -337,8 +337,8 @@ inline const T* IBlock::getData( const BlockDataID & index ) const { WALBERLA_ASSERT_LESS( uint_t( index ), data_.size() ); - if( data_[index] == NULL ) - return NULL; + if( data_[index] == nullptr ) + return nullptr; return data_[index]->template get< T >(); } @@ -368,7 +368,7 @@ inline void IBlock::deleteData( const BlockDataID & index ) { WALBERLA_ASSERT_LESS( uint_t( index ), data_.size() ); delete data_[index]; - data_[index] = NULL; + data_[index] = nullptr; } @@ -445,9 +445,9 @@ inline bool IBlock::isDataOfSameType( const ConstBlockDataID & indexA, const Con inline void IBlock::addData( const BlockDataID & index, BlockData * const data ) { if( data_.size() <= index ) - data_.resize( index+1, NULL ); + data_.resize( index+1, nullptr ); - if( data != NULL ) { + if( data != nullptr ) { WALBERLA_ASSERT_NULLPTR( data_[index] ); data_[index] = data; } @@ -465,7 +465,7 @@ inline const T* IBlock::uncheckedFastGetData( const ConstBlockDataID & index ) c WALBERLA_ASSERT_LESS( uint_t( index ), data_.size() ); - if( data_[index] == NULL ) + if( data_[index] == nullptr ) return NULL; return data_[index]->template uncheckedFastGet< T >(); @@ -485,8 +485,8 @@ inline const T* IBlock::uncheckedFastGetData( const BlockDataID & index ) const WALBERLA_ASSERT_LESS( uint_t( index ), data_.size() ); - if( data_[index] == NULL ) - return NULL; + if( data_[index] == nullptr ) + return nullptr; return data_[index]->template uncheckedFastGet< T >(); } diff --git a/src/domain_decomposition/IBlockID.h b/src/domain_decomposition/IBlockID.h index c30f83fdfb14b91bd270859ecb1de01783db7c23..e73a5010128eaaafad456b830ac5a58c8d6b17e6 100644 --- a/src/domain_decomposition/IBlockID.h +++ b/src/domain_decomposition/IBlockID.h @@ -46,7 +46,7 @@ public: /// ID type which can be used as a key in a map typedef uint64_t IDType; - virtual ~IBlockID() {} + virtual ~IBlockID() = default; virtual bool operator< ( const IBlockID& rhs ) const = 0; virtual bool operator==( const IBlockID& rhs ) const = 0; diff --git a/src/domain_decomposition/StructuredBlockStorage.h b/src/domain_decomposition/StructuredBlockStorage.h index 752107f47b4d421719d14898ff365f63141b932d..8a44ebfd8e36c03fa392596e4b095cf24505e405 100644 --- a/src/domain_decomposition/StructuredBlockStorage.h +++ b/src/domain_decomposition/StructuredBlockStorage.h @@ -426,7 +426,7 @@ protected: StructuredBlockStorage( const shared_ptr<BlockStorage> & blockStorage, const std::vector< uint_t > & xCells, const std::vector< uint_t > & yCells, const std::vector< uint_t > & zCells ); - virtual ~StructuredBlockStorage() {} ///< Must not be made public! No one should be allowed to delete a variable of type 'StructuredBlockStorage*' + virtual ~StructuredBlockStorage() = default; ///< Must not be made public! No one should be allowed to delete a variable of type 'StructuredBlockStorage*' void resetCellDecomposition( const std::vector< uint_t > & xCells, const std::vector< uint_t > & yCells, const std::vector< uint_t > & zCells ); @@ -437,7 +437,7 @@ protected: { public: CellBoundingBoxHandling( const StructuredBlockStorage & storage ) : storage_( storage ) {} - CellInterval * initialize( IBlock * const block ) { return storage_.initializeCellBoundingBox( block ); } + CellInterval * initialize( IBlock * const block ) override { return storage_.initializeCellBoundingBox( block ); } private: const StructuredBlockStorage & storage_; }; @@ -693,10 +693,10 @@ inline const IBlock* StructuredBlockStorage::getBlock( const Cell& cell, const u getCellCenter( x, y, z, cell, level ); const IBlock* block = blockStorage_->getBlock(x,y,z); - if( block == NULL ) - return NULL; + if( block == nullptr ) + return nullptr; - return ( getLevel( *block ) == level ) ? block : NULL; + return ( getLevel( *block ) == level ) ? block : nullptr; } @@ -716,10 +716,10 @@ inline IBlock* StructuredBlockStorage::getBlock( const Cell& cell, const uint_t getCellCenter( x, y, z, cell, level ); IBlock* block = blockStorage_->getBlock(x,y,z); - if( block == NULL ) - return NULL; + if( block == nullptr ) + return nullptr; - return ( getLevel( *block ) == level ) ? block : NULL; + return ( getLevel( *block ) == level ) ? block : nullptr; } diff --git a/src/executiontree/ExecutionTree.h b/src/executiontree/ExecutionTree.h index f9c838ec63cc7ff8b5f01e02d962d3b9c9d6e36f..b9d39d79835894d7d959135c8b8d7a2e1a1d397a 100644 --- a/src/executiontree/ExecutionTree.h +++ b/src/executiontree/ExecutionTree.h @@ -107,7 +107,7 @@ std::ostream &operator<<( std::ostream &os, const IFunctionNode &node ); class IFunctionNode { public: - virtual ~IFunctionNode() {} + virtual ~IFunctionNode() = default; virtual void operator()() = 0; virtual std::string getName() const = 0; virtual std::deque< shared_ptr< IFunctionNode > > getChildren() const { return {}; } @@ -122,7 +122,7 @@ public: const std::string &name, const TimingTreePtr & timingTree ); - std::string getName() const override { return name_ != "" ? name_ : "Functor"; }; + std::string getName() const override { return !name_.empty() ? name_ : "Functor"; }; void operator() () override; private: @@ -158,7 +158,7 @@ public: void push_back( const IFunctionNodePtr &fct ) { children_.push_back( fct ); } void push_front( const IFunctionNodePtr &fct ) { children_.push_front( fct ); } - std::string getName() const override { return name_ != "" ? name_ : "Sequence"; }; + std::string getName() const override { return !name_.empty() ? name_ : "Sequence"; }; std::deque< IFunctionNodePtr > getChildren() const override { return children_; }; private: diff --git a/src/field/EvaluationFilter.h b/src/field/EvaluationFilter.h index b4ef168ef4980f02b619f2bc196e021efb482fe5..7c9ac2c1e8fd9c66e778bba5b85a362922bd6cd3 100644 --- a/src/field/EvaluationFilter.h +++ b/src/field/EvaluationFilter.h @@ -69,7 +69,7 @@ class FlagFieldEvaluationFilter public: FlagFieldEvaluationFilter( const ConstBlockDataID & flagFieldId, const Set< FlagUID > & cellsToEvaluate ) : - flagFieldId_( flagFieldId ), flagField_( NULL ), cellsToEvaluate_( cellsToEvaluate ) {} + flagFieldId_( flagFieldId ), flagField_( nullptr ), cellsToEvaluate_( cellsToEvaluate ) {} void operator()( const IBlock & block ) { diff --git a/src/field/Field.impl.h b/src/field/Field.impl.h index 4856de7ee9ccf80b1f7203e15a4e248ec3c5c049..a70bdf813d071293c4c20674ac307a4221db66c5 100644 --- a/src/field/Field.impl.h +++ b/src/field/Field.impl.h @@ -45,7 +45,7 @@ namespace field { *******************************************************************************************************************/ template<typename T, uint_t fSize_> Field<T,fSize_>::Field( ) - : values_( NULL ), valuesWithOffset_( NULL ), + : values_( nullptr ), valuesWithOffset_( nullptr ), xSize_(0), ySize_(0), zSize_(0), xAllocSize_(0), yAllocSize_(0), zAllocSize_(0), fAllocSize_(0) { @@ -63,7 +63,7 @@ namespace field { template<typename T, uint_t fSize_> Field<T,fSize_>::Field( uint_t _xSize, uint_t _ySize, uint_t _zSize, const Layout & l, const shared_ptr<FieldAllocator<T> > &alloc ) - : values_( NULL ), valuesWithOffset_( NULL ) + : values_( nullptr ), valuesWithOffset_( nullptr ) { init(_xSize,_ySize,_zSize,l,alloc); } @@ -82,7 +82,7 @@ namespace field { template<typename T, uint_t fSize_> Field<T,fSize_>::Field( uint_t _xSize, uint_t _ySize, uint_t _zSize, const T & initVal, const Layout & l, const shared_ptr<FieldAllocator<T> > &alloc ) - : values_( NULL ), valuesWithOffset_( NULL ) + : values_( nullptr ), valuesWithOffset_( nullptr ) { init(_xSize,_ySize,_zSize,l,alloc); set(initVal); @@ -122,8 +122,8 @@ namespace field { return; allocator_->decrementReferenceCount( values_ ); - values_ = NULL; - valuesWithOffset_ = NULL; + values_ = nullptr; + valuesWithOffset_ = nullptr; init( _xSize, _ySize, _zSize, layout_, allocator_ ); } @@ -314,7 +314,7 @@ namespace field { WALBERLA_ASSERT_NULLPTR( valuesWithOffset_ ); // Automatically select allocator if none was given - if ( alloc == 0 ) + if ( alloc == nullptr ) { #ifdef __BIGGEST_ALIGNMENT__ const uint_t alignment = __BIGGEST_ALIGNMENT__; @@ -340,7 +340,7 @@ namespace field { allocator_ = alloc; allocator_->setInnerGhostLayerSize( innerGhostLayerSizeForAlignedAlloc ); - values_ = 0; + values_ = nullptr; xSize_ = _xSize; ySize_ = _ySize; zSize_ = _zSize; diff --git a/src/field/FlagField.h b/src/field/FlagField.h index 62f9deef5b9f071923e6c8f4a149f032c4131f6f..ebf17fb39565baa76c00bf396f0f6ab901abc54b 100644 --- a/src/field/FlagField.h +++ b/src/field/FlagField.h @@ -111,7 +111,7 @@ public: FlagField( uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl, const shared_ptr<FieldAllocator<T> > &alloc = make_shared<StdFieldAlloc<T> >()); - virtual ~FlagField(); + ~FlagField() override; inline FlagField<T> * clone() const; inline FlagField<T> * cloneUninitialized() const; @@ -196,7 +196,7 @@ protected: /*! \name Shallow Copy */ //@{ FlagField(const FlagField<T> & other); - virtual Field<T,1> * cloneShallowCopyInternal() const; + Field<T,1> * cloneShallowCopyInternal() const override; //@} //******************************************************************************************************************* diff --git a/src/field/GhostLayerField.h b/src/field/GhostLayerField.h index e6c8b454c5aeec31439c2d80fa4b91a7f40f09c4..9a1a5770412832bb05e4a7b2c7dfa09c13878ed0 100644 --- a/src/field/GhostLayerField.h +++ b/src/field/GhostLayerField.h @@ -90,7 +90,7 @@ namespace field { const std::vector<T> & fValues, const Layout & layout = zyxf, const shared_ptr<FieldAllocator<T> > &alloc = shared_ptr<FieldAllocator<T> >() ); - virtual ~GhostLayerField() {} + ~GhostLayerField() override = default; @@ -102,7 +102,7 @@ namespace field { const shared_ptr<FieldAllocator<T> > &alloc = shared_ptr<FieldAllocator<T> >() ); - virtual void resize( uint_t xSize, uint_t ySize, uint_t zSize ); + void resize( uint_t xSize, uint_t ySize, uint_t zSize ) override; void resize( uint_t xSize, uint_t ySize, uint_t zSize, uint_t gl ); using Field<T,fSize_>::resize; @@ -200,8 +200,8 @@ namespace field { /*! \name Slicing */ //@{ GhostLayerField<T,fSize_> * getSlicedField( const CellInterval & interval ) const; - virtual void slice ( const CellInterval & interval ); - virtual void shiftCoordinates( cell_idx_t cx, cell_idx_t cy, cell_idx_t cz ); + void slice ( const CellInterval & interval ) override; + void shiftCoordinates( cell_idx_t cx, cell_idx_t cy, cell_idx_t cz ) override; //@} //**************************************************************************************************************** @@ -214,8 +214,8 @@ namespace field { //** Shallow Copy ************************************************************************************************ /*! \name Shallow Copy */ //@{ - virtual Field<T,fSize_> * cloneShallowCopyInternal() const; - virtual typename Field<T,fSize_>::FlattenedField * flattenedShallowCopyInternal() const; + Field<T,fSize_> * cloneShallowCopyInternal() const override; + typename Field<T,fSize_>::FlattenedField * flattenedShallowCopyInternal() const override; GhostLayerField(const GhostLayerField<T,fSize_> & other); template <typename T2, uint_t fSize2> GhostLayerField(const GhostLayerField<T2, fSize2> & other); diff --git a/src/field/GhostLayerField.impl.h b/src/field/GhostLayerField.impl.h index 5a8c6cc7ab2566bf02fb78866c34eeef2bc9a602..8e122c36a2e9665c4c3b3b93e78cd066625bdac6 100644 --- a/src/field/GhostLayerField.impl.h +++ b/src/field/GhostLayerField.impl.h @@ -369,15 +369,12 @@ namespace field { template<typename T, uint_t fSize_> bool GhostLayerField<T,fSize_>::isInInnerPart( const Cell & cell ) const { - if ( cell[0] < 0 || + return !(cell[0] < 0 || cell[1] < 0 || cell[2] < 0 || cell[0] >= cell_idx_c( this->xSize() ) || cell[1] >= cell_idx_c( this->ySize() ) || - cell[2] >= cell_idx_c( this->zSize() ) ) - return false; - - return true; + cell[2] >= cell_idx_c( this->zSize() )); } //******************************************************************************************************************* diff --git a/src/field/StabilityChecker.h b/src/field/StabilityChecker.h index 8a6e80b281a84abc9889045d72e20ffe5f15b6f7..85a29e7253f5e9e9a713ffe567e630e6d3d46a2d 100644 --- a/src/field/StabilityChecker.h +++ b/src/field/StabilityChecker.h @@ -184,9 +184,9 @@ private: protected: - void configure() {} + void configure() override {} - uint8_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + uint8_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { WALBERLA_ASSERT( map_.find( this->block_ ) != map_.end() ); WALBERLA_ASSERT( map_[ this->block_ ].find( Cell(x,y,z) ) != map_[ this->block_ ].end() ); @@ -205,8 +205,8 @@ private: public: LocalCoordVTKWriter( const std::string & id ) : vtk::BlockCellDataWriter< cell_idx_t, 3 >( id ) {} protected: - void configure() {} - cell_idx_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + void configure() override {} + cell_idx_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { return ( f == cell_idx_t(0) ) ? x : ( ( f == cell_idx_t(1) ) ? y : z ); } @@ -218,8 +218,8 @@ private: public: GlobalCoordVTKWriter( const std::string & id ) : vtk::BlockCellDataWriter< cell_idx_t, 3 >( id ) {} protected: - void configure() {} - cell_idx_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + void configure() override {} + cell_idx_t evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { Cell cell(x,y,z); this->blockStorage_->transformBlockLocalToGlobalCell( cell, *(this->block_) ); diff --git a/src/field/SymmetryCheck.h b/src/field/SymmetryCheck.h index 8aa914352e17008303e46ec13c45b4b9bfd638f9..ec9237b5460f475ecfedd9215ee6124c5774d2d8 100644 --- a/src/field/SymmetryCheck.h +++ b/src/field/SymmetryCheck.h @@ -41,7 +41,7 @@ namespace field { */ //******************************************************************************************************************* template< typename Field_T > - bool isSymmetric( const Field_T * field, uint_t dimension, uint_t fCoord = 0, Cell * differingCell = NULL ) + bool isSymmetric( const Field_T * field, uint_t dimension, uint_t fCoord = 0, Cell * differingCell = nullptr ) { WALBERLA_ASSERT_LESS( dimension, 3 ); @@ -63,7 +63,7 @@ namespace field { auto value2 = field->get( compareCell, fCoord ); if ( ! math::equal( value1, value2 ) ) { - if ( differingCell != NULL ) + if ( differingCell != nullptr ) *differingCell = currentCell; return false; diff --git a/src/field/adaptors/AdaptorCreators.h b/src/field/adaptors/AdaptorCreators.h index 1c410ca91246600c385f5ba0a6691b7a67474462..56bfff20162ff9287d6fb13bd4b4627ce3040c81 100644 --- a/src/field/adaptors/AdaptorCreators.h +++ b/src/field/adaptors/AdaptorCreators.h @@ -43,7 +43,7 @@ public: AdaptorHandling( const ConstBlockDataID & adaptedFieldId, const AdaptionFunction_T & function ) : adaptedFieldId_( adaptedFieldId ), function_( function ) {} - Adaptor_T * initialize( IBlock * const block ) + Adaptor_T * initialize( IBlock * const block ) override { typedef typename Adaptor_T::basefield_t AdaptedField_T; const AdaptedField_T * adaptedField = block->getData< AdaptedField_T >( adaptedFieldId_ ); diff --git a/src/field/adaptors/GhostLayerFieldAdaptor.h b/src/field/adaptors/GhostLayerFieldAdaptor.h index f26f87b0ab8d55a7c0d6426ab3e61f06e9b3eda7..3b22ae6ef936186bfad6a3619a899527f41471bd 100644 --- a/src/field/adaptors/GhostLayerFieldAdaptor.h +++ b/src/field/adaptors/GhostLayerFieldAdaptor.h @@ -112,7 +112,7 @@ public: // since Field/GhostLayerField is polymorphic, this class also has to be polymorphic // example: dynamic_cast< field_t > would fail if field_t = GhostLayerFieldAdaptor - virtual ~GhostLayerFieldAdaptor() {} + virtual ~GhostLayerFieldAdaptor() = default; const functor_t & getFunctor() const { return functor_; } diff --git a/src/field/allocation/FieldAllocator.h b/src/field/allocation/FieldAllocator.h index f78771e15b2d1df7e0b61a7c2d9f29d44e7a9add..781cda4bc2b8f8547f94473b561d475576f1bb2d 100644 --- a/src/field/allocation/FieldAllocator.h +++ b/src/field/allocation/FieldAllocator.h @@ -238,8 +238,8 @@ namespace field { protected: - virtual T * allocateMemory ( uint_t size0, uint_t size1, uint_t size2, uint_t size3, - uint_t & allocSize1, uint_t & allocSize2, uint_t & allocSize3) + T * allocateMemory ( uint_t size0, uint_t size1, uint_t size2, uint_t size3, + uint_t & allocSize1, uint_t & allocSize2, uint_t & allocSize3) override { allocSize1=size1; allocSize2=size2; @@ -254,7 +254,7 @@ namespace field { return allocateMemory ( size0 * allocSize1 * allocSize2 * allocSize3 ); } - virtual T * allocateMemory ( uint_t size ) + T * allocateMemory ( uint_t size ) override { void * ptr = aligned_malloc_with_offset(size * sizeof(T) + alignment, alignment, offset_ % alignment ); if(!ptr) @@ -274,11 +274,11 @@ namespace field { return ret; } - virtual void setInnerGhostLayerSize( uint_t innerGhostLayerSize ) { + void setInnerGhostLayerSize( uint_t innerGhostLayerSize ) override { offset_ = sizeof(T) * innerGhostLayerSize; } - virtual void deallocate(T *& values ) + void deallocate(T *& values ) override { WALBERLA_ASSERT ( nrOfElements_.find(values) != nrOfElements_.end() ); @@ -328,8 +328,8 @@ namespace field { class StdFieldAlloc : public FieldAllocator<T> { public: - virtual T * allocateMemory ( uint_t size0, uint_t size1, uint_t size2, uint_t size3, - uint_t & allocSize1, uint_t & allocSize2, uint_t & allocSize3) + T * allocateMemory ( uint_t size0, uint_t size1, uint_t size2, uint_t size3, + uint_t & allocSize1, uint_t & allocSize2, uint_t & allocSize3) override { allocSize1=size1; allocSize2=size2; @@ -337,14 +337,14 @@ namespace field { return new T[size0*size1*size2*size3]; } - virtual T * allocateMemory ( uint_t size ) + T * allocateMemory ( uint_t size ) override { return new T[size]; } - virtual void deallocate(T *& values) { + void deallocate(T *& values) override { delete[] values; - values = 0; + values = nullptr; } }; diff --git a/src/field/blockforest/BlockDataHandling.h b/src/field/blockforest/BlockDataHandling.h index dc6328a66508f23429da30c5ad5752ae4aaee9ab..e0caa9869a6360d1e8e045c50869f447709d3e4f 100644 --- a/src/field/blockforest/BlockDataHandling.h +++ b/src/field/blockforest/BlockDataHandling.h @@ -45,11 +45,11 @@ public: typedef typename Field_T::value_type Value_T; typedef std::function< void ( Field_T * field, IBlock * const block ) > InitializationFunction_T; - virtual ~BlockDataHandling() {} + ~BlockDataHandling() override = default; void addInitializationFunction( const InitializationFunction_T & initFunction ) { initFunction_ = initFunction; } - Field_T * initialize( IBlock * const block ) + Field_T * initialize( IBlock * const block ) override { Field_T * field = allocate( block ); @@ -59,20 +59,20 @@ public: return field; } - inline void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ); + inline void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; - void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ); - void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ); + void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override; + void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; - Field_T * deserialize( IBlock * const block ) { return reallocate( block ); } + Field_T * deserialize( IBlock * const block ) override { return reallocate( block ); } - Field_T * deserializeCoarseToFine( Block * const block ) { return reallocate( block ); } - Field_T * deserializeFineToCoarse( Block * const block ) { return reallocate( block ); } + Field_T * deserializeCoarseToFine( Block * const block ) override { return reallocate( block ); } + Field_T * deserializeFineToCoarse( Block * const block ) override { return reallocate( block ); } - void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ); + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; - void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ); - void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ); + void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; + void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override; protected: @@ -421,7 +421,7 @@ public: protected: - GhostLayerField_T * allocate( IBlock * const block ) + GhostLayerField_T * allocate( IBlock * const block ) override { auto blocks = blocks_.lock(); WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'DefaultBlockDataHandling' for a block storage object that doesn't exist anymore" ); @@ -430,7 +430,7 @@ protected: nrOfGhostLayers_, initValue_, layout_ ); } - GhostLayerField_T * reallocate( IBlock * const block ) + GhostLayerField_T * reallocate( IBlock * const block ) override { auto blocks = blocks_.lock(); WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'DefaultBlockDataHandling' for a block storage object that doesn't exist anymore" ); @@ -484,7 +484,7 @@ public: void addInitializationFunction( const InitializationFunction_T & initFunction ) { initFunction_ = initFunction; } - GhostLayerField_T * initialize( IBlock * const block ) + GhostLayerField_T * initialize( IBlock * const block ) override { auto blocks = blocks_.lock(); WALBERLA_CHECK_NOT_NULLPTR( blocks, "Trying to access 'AlwaysInitializeBlockDataHandling' for a block storage object that doesn't exist anymore" ); @@ -524,7 +524,7 @@ public: fieldToClone_( fieldToClone ) {} - Field_T * initialize( IBlock * const block ) + Field_T * initialize( IBlock * const block ) override { const Field_T * toClone = block->template getData< Field_T >( fieldToClone_ ); return toClone->clone(); @@ -550,7 +550,7 @@ public: fieldToClone_( fieldToClone ) {} - typename Field_T::FlattenedField * initialize( IBlock * const block ) + typename Field_T::FlattenedField * initialize( IBlock * const block ) override { const Field_T * toClone = block->template getData< Field_T >( fieldToClone_ ); return toClone->flattenedShallowCopy(); diff --git a/src/field/blockforest/GradientRefinement.h b/src/field/blockforest/GradientRefinement.h index b05b8d1dfa50400bee199f8703c4772a28afde0e..fb7f8b46634d0e7d2467ab95ca63538fb5b4ed42 100644 --- a/src/field/blockforest/GradientRefinement.h +++ b/src/field/blockforest/GradientRefinement.h @@ -81,7 +81,7 @@ void GradientRefinement< VectorField_T, Filter_T, Pseudo2D >::operator()( std::v 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; diff --git a/src/field/communication/PackInfo.h b/src/field/communication/PackInfo.h index 0c74f604f40483ce3ec60e6eaeee090ebaf2b323..a8e95ce75ad707776f1ce90a7fbdc9a5cfe1f0d9 100644 --- a/src/field/communication/PackInfo.h +++ b/src/field/communication/PackInfo.h @@ -50,17 +50,17 @@ public: PackInfo( const BlockDataID & bdId, const uint_t numberOfGhostLayers ) : bdId_( bdId ), communicateAllGhostLayers_( false ), numberOfGhostLayers_( numberOfGhostLayers ) {} - virtual ~PackInfo() {} + ~PackInfo() override = default; - bool constantDataExchange() const { return mpi::BufferSizeTrait<T>::constantSize; } - bool threadsafeReceiving() const { return true; } + bool constantDataExchange() const override { return mpi::BufferSizeTrait<T>::constantSize; } + bool threadsafeReceiving() const override { return true; } - void unpackData(IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer); + void unpackData(IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer) override; - void communicateLocal(const IBlock * sender, IBlock * receiver, stencil::Direction dir); + void communicateLocal(const IBlock * sender, IBlock * receiver, stencil::Direction dir) override; protected: - void packDataImpl(const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer) const; + void packDataImpl(const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer) const override; uint_t numberOfGhostLayersToCommunicate( const GhostLayerField_T * const field ) const; diff --git a/src/field/communication/ReducePackInfo.h b/src/field/communication/ReducePackInfo.h index 81a1426127275c3b186972b715a8f04cd4841b7d..135574dcd37aec91dfea6aa0e009da926ba07c47 100644 --- a/src/field/communication/ReducePackInfo.h +++ b/src/field/communication/ReducePackInfo.h @@ -50,19 +50,19 @@ public: op_() {} - virtual ~ReducePackInfo() {} + ~ReducePackInfo() override = default; bool constantDataExchange() const { return false; } bool threadsafeReceiving() const { return false; } - virtual void safeCommunicateLocal( const IBlock * sender, IBlock * receiver, stencil::Direction dir ); - virtual void packData ( const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer ); - virtual void safeUnpackData ( IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ); + void safeCommunicateLocal( const IBlock * sender, IBlock * receiver, stencil::Direction dir ) override; + void packData ( const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer ) override; + void safeUnpackData ( IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; size_t getDataSize() const { return getSize() * sizeof(T); } protected: - virtual size_t initData( IBlock * receiver, stencil::Direction dir ); + size_t initData( IBlock * receiver, stencil::Direction dir ) override; const BlockDataID bdId_; const T init_; diff --git a/src/field/communication/StencilRestrictedMPIDatatypeInfo.h b/src/field/communication/StencilRestrictedMPIDatatypeInfo.h index 1150c76ff004fd3b5e3d932737708969da1d8b1b..64421ee77b26bbb15a7125854462f315acfabbd8 100644 --- a/src/field/communication/StencilRestrictedMPIDatatypeInfo.h +++ b/src/field/communication/StencilRestrictedMPIDatatypeInfo.h @@ -39,26 +39,26 @@ class StencilRestrictedMPIDatatypeInfo : public walberla::communication::Uniform public: StencilRestrictedMPIDatatypeInfo( BlockDataID fieldID ) : fieldID_( fieldID ) {} - virtual ~StencilRestrictedMPIDatatypeInfo() {} + ~StencilRestrictedMPIDatatypeInfo() override = default; - virtual shared_ptr<mpi::Datatype> getSendDatatype ( IBlock * block, const stencil::Direction dir ) + shared_ptr<mpi::Datatype> getSendDatatype ( IBlock * block, const stencil::Direction dir ) override { return make_shared<mpi::Datatype>( field::communication::mpiDatatypeSliceBeforeGhostlayerXYZ( *getField( block ), dir, uint_t( 1 ), getOptimizedCommunicationIndices( dir ), false ) ); } - virtual shared_ptr<mpi::Datatype> getRecvDatatype ( IBlock * block, const stencil::Direction dir ) + shared_ptr<mpi::Datatype> getRecvDatatype ( IBlock * block, const stencil::Direction dir ) override { return make_shared<mpi::Datatype>( field::communication::mpiDatatypeGhostLayerOnlyXYZ( *getField( block ), dir, false, getOptimizedCommunicationIndices( stencil::inverseDir[dir] ) ) ); } - virtual void * getSendPointer( IBlock * block, const stencil::Direction ) + void * getSendPointer( IBlock * block, const stencil::Direction ) override { return getField(block)->data(); } - virtual void * getRecvPointer( IBlock * block, const stencil::Direction ) + void * getRecvPointer( IBlock * block, const stencil::Direction ) override { return getField(block)->data(); } diff --git a/src/field/communication/StencilRestrictedPackInfo.h b/src/field/communication/StencilRestrictedPackInfo.h index 72e40584519dde9d15729fb15067ec8278930fc5..45527cadf5e11b66f0a70b7c88127af11cd6498a 100644 --- a/src/field/communication/StencilRestrictedPackInfo.h +++ b/src/field/communication/StencilRestrictedPackInfo.h @@ -47,18 +47,18 @@ class StencilRestrictedPackInfo : public walberla::communication::UniformPackInf { public: StencilRestrictedPackInfo( const BlockDataID & fieldId ) : fieldId_( fieldId ) {} - virtual ~StencilRestrictedPackInfo() {} + ~StencilRestrictedPackInfo() override = default; - bool constantDataExchange() const { return true; } - bool threadsafeReceiving() const { return true; } + bool constantDataExchange() const override { return true; } + bool threadsafeReceiving() const override { return true; } - void unpackData( IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ); + void unpackData( IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; - void communicateLocal( const IBlock * sender, IBlock * receiver, stencil::Direction dir ); + void communicateLocal( const IBlock * sender, IBlock * receiver, stencil::Direction dir ) override; protected: - void packDataImpl( const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer ) const; + void packDataImpl( const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer ) const override; const BlockDataID fieldId_; diff --git a/src/field/communication/UniformMPIDatatypeInfo.h b/src/field/communication/UniformMPIDatatypeInfo.h index 4734344c1fb680b1d5f7fb50b73d3eae1bd1c2f7..e7042ab57395e3954b98cd8a2ae3dca66055bab8 100644 --- a/src/field/communication/UniformMPIDatatypeInfo.h +++ b/src/field/communication/UniformMPIDatatypeInfo.h @@ -39,26 +39,26 @@ public: UniformMPIDatatypeInfo( BlockDataID blockDataID, const uint_t numberOfGhostLayers ) : blockDataID_( blockDataID ), communicateAllGhostLayers_( false ), numberOfGhostLayers_( numberOfGhostLayers ) {} - virtual ~UniformMPIDatatypeInfo() {} + ~UniformMPIDatatypeInfo() override = default; - virtual shared_ptr<mpi::Datatype> getSendDatatype ( IBlock * block, const stencil::Direction dir ) + shared_ptr<mpi::Datatype> getSendDatatype ( IBlock * block, const stencil::Direction dir ) override { auto numGl = numberOfGhostLayersToCommunicate( block ); return make_shared<mpi::Datatype>( mpiDatatypeSliceBeforeGhostlayer( *getField( block ), dir, numGl ) ); } - virtual shared_ptr<mpi::Datatype> getRecvDatatype ( IBlock * block, const stencil::Direction dir ) + shared_ptr<mpi::Datatype> getRecvDatatype ( IBlock * block, const stencil::Direction dir ) override { auto numGl = numberOfGhostLayersToCommunicate( block ); return make_shared<mpi::Datatype>( mpiDatatypeGhostLayerOnly( *getField(block), numGl, dir ) ); } - virtual void * getSendPointer( IBlock * block, const stencil::Direction ) + void * getSendPointer( IBlock * block, const stencil::Direction ) override { return getField(block)->data(); } - virtual void * getRecvPointer( IBlock * block, const stencil::Direction ) + void * getRecvPointer( IBlock * block, const stencil::Direction ) override { return getField(block)->data(); } diff --git a/src/field/communication/UniformPullReductionPackInfo.h b/src/field/communication/UniformPullReductionPackInfo.h index 71ceb7e8e6fba381d5623f80e3ca6f9bb2b8ae47..4233a3d2352ccd130d9cd8fca3d43fa86ad5f324 100644 --- a/src/field/communication/UniformPullReductionPackInfo.h +++ b/src/field/communication/UniformPullReductionPackInfo.h @@ -57,17 +57,17 @@ public: UniformPullReductionPackInfo( const BlockDataID & bdID, const uint_t numberOfGhostLayers ) : bdID_( bdID ), communicateAllGhostLayers_( false ), numberOfGhostLayers_( numberOfGhostLayers ) {} - virtual ~UniformPullReductionPackInfo() {} + ~UniformPullReductionPackInfo() override = default; - bool constantDataExchange() const { return mpi::BufferSizeTrait<T>::constantSize; } - bool threadsafeReceiving() const { return true; } + bool constantDataExchange() const override { return mpi::BufferSizeTrait<T>::constantSize; } + bool threadsafeReceiving() const override { return true; } - void unpackData(IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer); + void unpackData(IBlock * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer) override; - void communicateLocal(const IBlock * sender, IBlock * receiver, stencil::Direction dir); + void communicateLocal(const IBlock * sender, IBlock * receiver, stencil::Direction dir) override; protected: - void packDataImpl(const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer) const; + void packDataImpl(const IBlock * sender, stencil::Direction dir, mpi::SendBuffer & outBuffer) const override; uint_t numberOfGhostLayersToCommunicate( const GhostLayerField_T * const field ) const; diff --git a/src/field/distributors/DistributorCreators.h b/src/field/distributors/DistributorCreators.h index e87b907cebac9b1aabf92dba0be34f730e16fffb..ab555911c6a5224f8d985aeaa534a704f7c87c50 100644 --- a/src/field/distributors/DistributorCreators.h +++ b/src/field/distributors/DistributorCreators.h @@ -65,7 +65,7 @@ public: blockStorage_( blockStorage ), distributionDestinationFieldID_( distributionDestinationFieldID ), flagFieldID_( flagFieldID ), cellsToEvaluate_( cellsToEvaluate ) {} - Distributor_T * initialize( IBlock * const block ) + Distributor_T * initialize( IBlock * const block ) override { typedef typename Distributor_T::BaseField_T DistributionDestinationField_T; typedef typename FlagField_T::flag_t flag_t; diff --git a/src/field/interpolators/FieldInterpolatorCreators.h b/src/field/interpolators/FieldInterpolatorCreators.h index 560df7879d03c5b4180b39094bf0f991614a7299..760db9b7c74ed62890b874dbf68ce8a11e9171ac 100644 --- a/src/field/interpolators/FieldInterpolatorCreators.h +++ b/src/field/interpolators/FieldInterpolatorCreators.h @@ -64,7 +64,7 @@ public: blockStorage_( blockStorage ), interpolatedFieldID_( interpolatedFieldID ), flagFieldID_( flagFieldID ), cellsToEvaluate_( cellsToEvaluate ) {} - Interpolator_T * initialize( IBlock * const block ) + Interpolator_T * initialize( IBlock * const block ) override { typedef typename Interpolator_T::BaseField_T InterpolatedField_T; typedef typename FlagField_T::flag_t flag_t; diff --git a/src/field/iterators/FieldIterator.impl.h b/src/field/iterators/FieldIterator.impl.h index 0a132ae01aee0d0615c4655c6f13cc7f5b25a3bf..a643984c8cdc657d6f0ad496e0db4f4a8842a2eb 100644 --- a/src/field/iterators/FieldIterator.impl.h +++ b/src/field/iterators/FieldIterator.impl.h @@ -41,9 +41,9 @@ FieldIterator<T,fs>::FieldIterator( const typename FieldIterator<T,fs>::FieldTyp { if ( field->xyzSize().empty() ) { - linePtr_ = NULL; - lineEnd_ = NULL; - f_ = NULL; + linePtr_ = nullptr; + lineEnd_ = nullptr; + f_ = nullptr; return; } @@ -114,7 +114,7 @@ FieldIterator<T,fs>::FieldIterator( const typename FieldIterator<T,fs>::FieldTyp **********************************************************************************************************************/ template <typename T, uint_t fs> FieldIterator<T,fs>::FieldIterator() - : linePtr_(NULL), lineEnd_(NULL), f_(NULL) + : linePtr_(nullptr), lineEnd_(nullptr), f_(nullptr) { } @@ -228,7 +228,7 @@ inline void FieldIterator<T,fs>::incrementLine() if(cur_[0] == cell_idx_c(sizes_[0]) ) { // iterator at end - linePtr_ = NULL; + linePtr_ = nullptr; return; } } @@ -264,7 +264,7 @@ inline void FieldIterator<T,fs>::decrementLine() if(cur_[0] < 0 ) { // iterator at end - linePtr_ = NULL; + linePtr_ = nullptr; return; } } diff --git a/src/field/refinement/PackInfo.h b/src/field/refinement/PackInfo.h index bfc485289321f556afacd3639c4d3de3b4ff406a..bc4f683440109031d0dd9d53bc0ed6167430af66 100644 --- a/src/field/refinement/PackInfo.h +++ b/src/field/refinement/PackInfo.h @@ -39,25 +39,25 @@ class PackInfo : public blockforest::communication::NonUniformPackInfo public: PackInfo( const BlockDataID & fieldId ) : fieldId_( fieldId ) {} - virtual ~PackInfo() {} + ~PackInfo() override = default; - bool constantDataExchange() const { return true; } - bool threadsafeReceiving() const { return true; } + bool constantDataExchange() const override { return true; } + bool threadsafeReceiving() const override { return true; } - void unpackDataEqualLevel( Block * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ); - void communicateLocalEqualLevel( const Block * sender, Block * receiver, stencil::Direction dir ); + void unpackDataEqualLevel( Block * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; + void communicateLocalEqualLevel( const Block * sender, Block * receiver, stencil::Direction dir ) override; - void unpackDataCoarseToFine( Block * fineReceiver, const BlockID & coarseSender, stencil::Direction dir, mpi::RecvBuffer & buffer ); - void communicateLocalCoarseToFine( const Block * coarseSender, Block * fineReceiver, stencil::Direction dir ); + void unpackDataCoarseToFine( Block * fineReceiver, const BlockID & coarseSender, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; + void communicateLocalCoarseToFine( const Block * coarseSender, Block * fineReceiver, stencil::Direction dir ) override; - void unpackDataFineToCoarse( Block * coarseReceiver, const BlockID & fineSender, stencil::Direction dir, mpi::RecvBuffer & buffer ); - void communicateLocalFineToCoarse( const Block * fineSender, Block * coarseReceiver, stencil::Direction dir ); + void unpackDataFineToCoarse( Block * coarseReceiver, const BlockID & fineSender, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; + void communicateLocalFineToCoarse( const Block * fineSender, Block * coarseReceiver, stencil::Direction dir ) override; protected: - void packDataEqualLevelImpl( const Block * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const; - void packDataCoarseToFineImpl( const Block * coarseSender, const BlockID & fineReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const; - void packDataFineToCoarseImpl( const Block * fineSender, const BlockID & coarseReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const; + void packDataEqualLevelImpl( const Block * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; + void packDataCoarseToFineImpl( const Block * coarseSender, const BlockID & fineReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; + void packDataFineToCoarseImpl( const Block * fineSender, const BlockID & coarseReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; /////////////////////////////////////////////////////////////////////// // Helper functions for determining packing/unpacking cell intervals // diff --git a/src/field/vtk/FlagFieldMapping.h b/src/field/vtk/FlagFieldMapping.h index 8b25ce58e6dea759214898243d717ce5ab97fde8..e496657df43277c3bd79392036400362630ecfb1 100644 --- a/src/field/vtk/FlagFieldMapping.h +++ b/src/field/vtk/FlagFieldMapping.h @@ -41,7 +41,7 @@ public: vtk::BlockCellDataWriter<T,1>( id ), flagId_( flagId ), flagField_( NULL ) {} FlagFieldMapping( const ConstBlockDataID flagId, const std::string& id, const std::map< FlagUID, T > mapping ) : - vtk::BlockCellDataWriter<T,1>( id ), flagId_( flagId ), flagField_( NULL ), mapping_( mapping ) {} + vtk::BlockCellDataWriter<T,1>( id ), flagId_( flagId ), flagField_( nullptr ), mapping_( mapping ) {} void addMapping( const FlagUID& flag, const T& value ) { @@ -51,7 +51,7 @@ public: protected: - void configure() + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); flagField_ = this->block_->template getData< FlagField_T >( flagId_ ); @@ -64,7 +64,7 @@ protected: } } - T evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ ) + T 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( flagField_ ); T result = 0; diff --git a/src/field/vtk/VTKWriter.h b/src/field/vtk/VTKWriter.h index c83033fe81a06a54c7a0874ceb8581fc07b6f353..a86d8fa52cd63fd74e8c1d6e4bd84a0ab2a7b8aa 100644 --- a/src/field/vtk/VTKWriter.h +++ b/src/field/vtk/VTKWriter.h @@ -108,16 +108,16 @@ public: typedef vtk::BlockCellDataWriter<OutputType, OutputTrait::F_SIZE * Field_T::F_SIZE> base_t; VTKWriter( const ConstBlockDataID bdid, const std::string& id ) : - base_t( id ), bdid_( bdid ), field_( NULL ) {} + base_t( id ), bdid_( bdid ), field_( nullptr ) {} protected: - void configure() { + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); field_ = this->block_->template getData< Field_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( field_ ); diff --git a/src/gather/CellGatherPackInfo.h b/src/gather/CellGatherPackInfo.h index 0055a2ba00e32838760221481114effa07b53049..e12e5ab6f205f5ca11f3762da6a471366185e144 100644 --- a/src/gather/CellGatherPackInfo.h +++ b/src/gather/CellGatherPackInfo.h @@ -79,12 +79,12 @@ public: /*! \name Packing Interface */ //@{ - virtual void packData ( const IBlock * sender, - mpi::SendBuffer & outBuffer ); + void packData ( const IBlock * sender, + mpi::SendBuffer & outBuffer ) override; - virtual void unpackData( mpi::RecvBuffer & buffer ); + void unpackData( mpi::RecvBuffer & buffer ) override; - virtual void gatherFinished(); + void gatherFinished() override; //@} //******************************************************************************************************************* diff --git a/src/gather/CurveGatherPackInfo.h b/src/gather/CurveGatherPackInfo.h index 112f018b3a70ac6e982c301c7ec18076546c48e0..6bdd3bab099c0a7cb4c9c5c5ccf94b6e0e1ff1a8 100644 --- a/src/gather/CurveGatherPackInfo.h +++ b/src/gather/CurveGatherPackInfo.h @@ -106,7 +106,7 @@ class CurveGatherPackInfo : public GatherPackInfo const shared_ptr<DataProcessor> & dp); - virtual ~CurveGatherPackInfo() {} + ~CurveGatherPackInfo() override {} //@} //**************************************************************************************************************** @@ -117,13 +117,13 @@ class CurveGatherPackInfo : public GatherPackInfo /*! \name Packing Interface */ //@{ - virtual void packData ( const IBlock * sender, - mpi::SendBuffer & outBuffer ); + void packData ( const IBlock * sender, + mpi::SendBuffer & outBuffer ) override; - virtual void unpackData( mpi::RecvBuffer & buffer ); + void unpackData( mpi::RecvBuffer & buffer ) override; - virtual void gatherFinished(); + void gatherFinished() override; //@} //**************************************************************************************************************** diff --git a/src/gather/GatherPackInfo.h b/src/gather/GatherPackInfo.h index a4688bc0e75f42aa713ff828f62cd8e5343d99ad..640866581544b22253292c5db253c9d2790ea74c 100644 --- a/src/gather/GatherPackInfo.h +++ b/src/gather/GatherPackInfo.h @@ -38,7 +38,7 @@ namespace gather { class GatherPackInfo { public: - virtual ~GatherPackInfo() {} + virtual ~GatherPackInfo() = default; /**********************************************************************************************************//** * Packs all data to be gathered into the given buffer diff --git a/src/gather/GnuPlotGraphWriter.h b/src/gather/GnuPlotGraphWriter.h index c8a70fbfebf1f1f42a9bc8cb1d28a4769877b4f8..48d09f61a13a87da7e22564fde56559cc4795f87 100644 --- a/src/gather/GnuPlotGraphWriter.h +++ b/src/gather/GnuPlotGraphWriter.h @@ -59,7 +59,7 @@ class GnuPlotGraphWriter : public DataProcessor ++callNr; } - virtual void process(const std::vector<std::vector<real_t> > & data) { writeDataSet(data); } + void process(const std::vector<std::vector<real_t> > & data) override { writeDataSet(data); } private: std::string filename_; diff --git a/src/geometry/bodies/DynamicBody.h b/src/geometry/bodies/DynamicBody.h index 8a0ecfd52ef852c5f875474a0f4acbc79b91192b..1ebd1670e4a5e05d261678c083083f59553e1b90 100644 --- a/src/geometry/bodies/DynamicBody.h +++ b/src/geometry/bodies/DynamicBody.h @@ -45,15 +45,15 @@ public: : body_(b) {} - virtual bool contains (const Vector3<real_t> & point ) const + bool contains (const Vector3<real_t> & point ) const override { return geometry::contains( body_, point ); } - virtual FastOverlapResult fastOverlapCheck ( const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) const + FastOverlapResult fastOverlapCheck ( const Vector3<real_t> & cellMidpoint, const Vector3<real_t> & dx ) const override { return geometry::fastOverlapCheck( body_, cellMidpoint, dx ); } - virtual FastOverlapResult fastOverlapCheck ( const AABB & box ) const + FastOverlapResult fastOverlapCheck ( const AABB & box ) const override { return geometry::fastOverlapCheck( body_, box); } diff --git a/src/geometry/containment_octree/IndeterminateLeafNode.h b/src/geometry/containment_octree/IndeterminateLeafNode.h index 349d18369b49d58380a9b68e6daa9e385506a1a4..977c0a1cb0522bee1a5f7f7c11aa90e876884513 100644 --- a/src/geometry/containment_octree/IndeterminateLeafNode.h +++ b/src/geometry/containment_octree/IndeterminateLeafNode.h @@ -44,7 +44,7 @@ public: IndeterminateLeafNode( const shared_ptr<const DistanceObject> & distanceObject, const Scalar epsilon ) : distanceObject_( distanceObject ), sqEpsilon_( epsilon * epsilon ) { } - virtual ~IndeterminateLeafNode() {} + virtual ~IndeterminateLeafNode() = default; virtual bool contains( const Point & p ) const { return distanceObject_->sqSignedDistance(p) <= sqEpsilon_; } diff --git a/src/geometry/containment_octree/InsideLeafNode.h b/src/geometry/containment_octree/InsideLeafNode.h index f291a5c37b900b5b52dc18fe851d97e65c7e2ae9..b673d61e1941b644c68826c1ba5c61156be5fb01 100644 --- a/src/geometry/containment_octree/InsideLeafNode.h +++ b/src/geometry/containment_octree/InsideLeafNode.h @@ -41,7 +41,7 @@ public: typedef typename LeafNode<ContainmentOctreeT>::KahanAccumulator KahanAccumulator; - virtual ~InsideLeafNode() {} + virtual ~InsideLeafNode() = default; virtual bool contains( const Point & /*p*/ ) const { return true; } diff --git a/src/geometry/containment_octree/LeafNode.h b/src/geometry/containment_octree/LeafNode.h index 57c1b6553db38ebee6b26fdc3f43de732d6fca50..47223f8b5d886230ea8044b3b7146200f97743c3 100644 --- a/src/geometry/containment_octree/LeafNode.h +++ b/src/geometry/containment_octree/LeafNode.h @@ -42,7 +42,7 @@ public: typedef typename Node<ContainmentOctreeT>::KahanAccumulator KahanAccumulator; - virtual ~LeafNode() {} + virtual ~LeafNode() = default; virtual uint_t height() const { return uint_t(0); } virtual uint_t numNodes() const { return uint_t(0); } diff --git a/src/geometry/containment_octree/Node.h b/src/geometry/containment_octree/Node.h index 0a0d03ce60301f60b606de8c9dfae1454a8abf38..a1bc9325f5a495c0dbf3b3c97af04e395a753d7e 100644 --- a/src/geometry/containment_octree/Node.h +++ b/src/geometry/containment_octree/Node.h @@ -40,7 +40,7 @@ public: typedef typename ContainmentOctreeT::DistanceObject DistanceObject; typedef typename ContainmentOctreeT::KahanAccumulator KahanAccumulator; - virtual ~Node() {} + virtual ~Node() = default; virtual bool contains( const Point & p ) const = 0; virtual uint_t height() const = 0; virtual uint_t numNodes() const = 0; diff --git a/src/geometry/containment_octree/OutsideLeafNode.h b/src/geometry/containment_octree/OutsideLeafNode.h index 2144b4e4df13d0c34c5a4b147402822e52401514..b5fc618133157323f873a9b2e6b408978027873a 100644 --- a/src/geometry/containment_octree/OutsideLeafNode.h +++ b/src/geometry/containment_octree/OutsideLeafNode.h @@ -42,7 +42,7 @@ public: typedef typename LeafNode<ContainmentOctreeT>::KahanAccumulator KahanAccumulator; - virtual ~OutsideLeafNode() {} + virtual ~OutsideLeafNode() = default; virtual bool contains( const Point & /*p*/ ) const { return false; } diff --git a/src/geometry/initializer/BoundaryFromBody.h b/src/geometry/initializer/BoundaryFromBody.h index 0c5c696a909de92dd84cc33b94d2006285c31dac..1eb9e06b786a858cb6432ee168ed40b0c8501c4b 100644 --- a/src/geometry/initializer/BoundaryFromBody.h +++ b/src/geometry/initializer/BoundaryFromBody.h @@ -79,7 +79,7 @@ public: * The body parameters and the parameters for the boundary are read from configuration. * *****************************************************************************************************************/ - virtual void init( BlockStorage & , const Config::BlockHandle & blockHandle ) { return init(blockHandle); } + void init( BlockStorage & , const Config::BlockHandle & blockHandle ) override { return init(blockHandle); } void init( const Config::BlockHandle & blockHandle ); diff --git a/src/geometry/initializer/BoundaryFromCellInterval.h b/src/geometry/initializer/BoundaryFromCellInterval.h index 80355b49f8a99ea87aca183a38f29109d7e52892..f2245274c9d279a5c3b340595b53879f20822be2 100644 --- a/src/geometry/initializer/BoundaryFromCellInterval.h +++ b/src/geometry/initializer/BoundaryFromCellInterval.h @@ -84,7 +84,7 @@ public: * The cell interval and the parameters for the boundary are read from configuration. * *****************************************************************************************************************/ - virtual void init( BlockStorage & , const Config::BlockHandle & blockHandle ) { return init(blockHandle); } + void init( BlockStorage & , const Config::BlockHandle & blockHandle ) override { return init(blockHandle); } void init( const Config::BlockHandle & blockHandle ); diff --git a/src/geometry/initializer/BoundaryFromDomainBorder.h b/src/geometry/initializer/BoundaryFromDomainBorder.h index 9fa9937815e640880c2722cf3df1b58f1cad864c..9329a72ada1ca2c362f37ea7f8d77af5323c58db 100644 --- a/src/geometry/initializer/BoundaryFromDomainBorder.h +++ b/src/geometry/initializer/BoundaryFromDomainBorder.h @@ -80,7 +80,7 @@ public: void init ( const Config::BlockHandle & blockHandle ); - virtual void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ); + void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ) override; void init( FlagUID flagUID, stencil::Direction direction, diff --git a/src/geometry/initializer/BoundaryFromImage.h b/src/geometry/initializer/BoundaryFromImage.h index 9db375940f1f64febc7330f1365a941c69c0b367..d19f4dcbe939f2bb3a8d6f622850102c26cab48e 100644 --- a/src/geometry/initializer/BoundaryFromImage.h +++ b/src/geometry/initializer/BoundaryFromImage.h @@ -97,7 +97,7 @@ namespace initializer { * Initializes the scalar field using parameters of config block * for syntax see class documentation *****************************************************************************************************************/ - virtual void init ( BlockStorage & , const Config::BlockHandle & block ) { init(block); } + void init ( BlockStorage & , const Config::BlockHandle & block ) override { init(block); } void init( const Config::BlockHandle & block ); diff --git a/src/geometry/initializer/BoundaryFromVoxelFile.h b/src/geometry/initializer/BoundaryFromVoxelFile.h index 6bef2c8c3c2260b1b728fdce1158f08f3c838a9c..3b0640e33052f59d5094539b8a061acae196b376 100644 --- a/src/geometry/initializer/BoundaryFromVoxelFile.h +++ b/src/geometry/initializer/BoundaryFromVoxelFile.h @@ -88,7 +88,7 @@ class BoundaryFromVoxelFile : public Initializer public: BoundaryFromVoxelFile( const StructuredBlockStorage & structuredBlockStorage, BlockDataID & boundaryHandlerID ); - virtual void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ); + void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ) override; protected: diff --git a/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h b/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h index 1ae6a04e217ea2533180775e914f38788c10b5b5..f731a37f02fd8b68bf9836c35a50e2079617319b 100644 --- a/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h +++ b/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h @@ -97,7 +97,7 @@ namespace initializer { ++blockHandleIt; } - if (boundaryConfigBlocks.size () > 0 ) { + if (!boundaryConfigBlocks.empty() ) { WALBERLA_ABORT_NO_DEBUG_INFO( "No boundary setup blocks are allowed when configuring a flag field" << blockHandle.getKey() ); } diff --git a/src/geometry/initializer/Initializer.h b/src/geometry/initializer/Initializer.h index a724baacf8377054f89b334466dac0e8e2c3fa6c..88336d0ec3d92bc2004d19bdf9f267dadcedc59d 100644 --- a/src/geometry/initializer/Initializer.h +++ b/src/geometry/initializer/Initializer.h @@ -51,7 +51,7 @@ namespace initializer { class Initializer { public: - virtual ~Initializer() { } + virtual ~Initializer() = default; virtual void init( domain_decomposition::BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ) = 0; }; diff --git a/src/geometry/initializer/OverlapFieldFromBody.h b/src/geometry/initializer/OverlapFieldFromBody.h index b12b9e2bc097b25a52fa20274c4a49fd96fab84f..0438b85e8c545ae3158aa676cc7e41d969ac378d 100644 --- a/src/geometry/initializer/OverlapFieldFromBody.h +++ b/src/geometry/initializer/OverlapFieldFromBody.h @@ -101,7 +101,7 @@ namespace initializer { * Interface implementation for Initializer - sets a body on a scalar field with options from configuration file * *****************************************************************************************************************/ - virtual void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ); + void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ) override; diff --git a/src/geometry/initializer/ScalarFieldFromBody.h b/src/geometry/initializer/ScalarFieldFromBody.h index ba8b72f9b407c505666121770bf30d1aea6f58d9..97ef3cc95d4709e3d70207c01ad36d58db261b94 100644 --- a/src/geometry/initializer/ScalarFieldFromBody.h +++ b/src/geometry/initializer/ScalarFieldFromBody.h @@ -97,7 +97,7 @@ namespace initializer { * Interface implementation for Initializer - sets a body on a scalar field with options from configuration file * *****************************************************************************************************************/ - virtual void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ); + void init( BlockStorage & blockStorage, const Config::BlockHandle & blockHandle ) override; diff --git a/src/geometry/initializer/ScalarFieldFromGrayScaleImage.h b/src/geometry/initializer/ScalarFieldFromGrayScaleImage.h index f570c0f118a6af7e9293c81fefe5463f1245a567..2664fba729025996ebf9255cb3854b35b92c7706 100644 --- a/src/geometry/initializer/ScalarFieldFromGrayScaleImage.h +++ b/src/geometry/initializer/ScalarFieldFromGrayScaleImage.h @@ -64,7 +64,7 @@ namespace initializer { * Initializes the scalar field using parameters of config block * for syntax see class documentation *****************************************************************************************************************/ - virtual void init ( BlockStorage & blockStorage, const Config::BlockHandle & block ); + void init ( BlockStorage & blockStorage, const Config::BlockHandle & block ) override; /*************************************************************************************************************//** diff --git a/src/geometry/structured/BasicVoxelFileReader.impl.h b/src/geometry/structured/BasicVoxelFileReader.impl.h index 4dbdc8ad87c823c31ba744e8f5303551534408be..9bebb8345764661b8b15957ea9e0c33fa21ccfd8 100644 --- a/src/geometry/structured/BasicVoxelFileReader.impl.h +++ b/src/geometry/structured/BasicVoxelFileReader.impl.h @@ -371,7 +371,7 @@ void BasicVoxelFileReader<T>::close() assert(!filestream_.is_open()); assert(dataBegin_ == std::streampos()); - assert(filename_ == ""); + assert(filename_.empty()); assert(xSize_ == 0); assert(ySize_ == 0); assert(zSize_ == 0); diff --git a/src/geometry/structured/GrayScaleImage.h b/src/geometry/structured/GrayScaleImage.h index a32c2254817ee600ff768b153ce8ba0f86c5df98..3361cc90e18c9300e7d0c2f1b656062ab1aea3c5 100644 --- a/src/geometry/structured/GrayScaleImage.h +++ b/src/geometry/structured/GrayScaleImage.h @@ -70,7 +70,7 @@ namespace geometry { static pixel_t pixelValueFromString( const std::string & str ); protected: - GrayScaleImage() {} + GrayScaleImage() = default; uint_t size_[2]; //< 0=width, 1=height std::vector<unsigned char> image_; //< raw pixels diff --git a/src/geometry/structured/RGBAImage.h b/src/geometry/structured/RGBAImage.h index 4c7be318897f98b9cd4b37c0b7c81a02e31cc51b..4e2871659e215f6e2e8ab60cb0637d23b861f9b8 100644 --- a/src/geometry/structured/RGBAImage.h +++ b/src/geometry/structured/RGBAImage.h @@ -99,7 +99,7 @@ namespace geometry { static pixel_t pixelValueFromString( const std::string & str ); protected: - RGBAImage() {} + RGBAImage() = default; uint_t size_[2]; //< 0=width, 1=height std::vector<unsigned char> image_; //< raw pixels diff --git a/src/geometry/structured/extern/lodepng.h b/src/geometry/structured/extern/lodepng.h index 404ae1ec40fccf1c28295bd81abc9953c701f256..2d4b383cca999b3a9901160615e5ded51504d3ae 100644 --- a/src/geometry/structured/extern/lodepng.h +++ b/src/geometry/structured/extern/lodepng.h @@ -622,7 +622,7 @@ typedef struct LodePNGState unsigned error; #ifdef LODEPNG_COMPILE_CPP //For the lodepng::State subclass. - virtual ~LodePNGState(){} + virtual ~LodePNGState()= default; #endif } LodePNGState; @@ -808,7 +808,7 @@ class State : public LodePNGState public: State(); State(const State& other); - virtual ~State(); + ~State() override; State& operator=(const State& other); }; diff --git a/src/gui/PropertyTree.h b/src/gui/PropertyTree.h index f6a5ae179897f767c2b8fce2100c706a186a822a..df1965d7e511a8bea275688a316a780fc9dded74 100644 --- a/src/gui/PropertyTree.h +++ b/src/gui/PropertyTree.h @@ -139,12 +139,12 @@ namespace gui { * to add children */ template <typename T> - ItemID addItem(const std::string & name, const T & val, ItemID parent=0); + ItemID addItem(const std::string & name, const T & val, ItemID parent=nullptr); /** * Convenience method, behaves like addItem above with no value -> empty second column */ - ItemID addItem(const std::string & name, ItemID parent=0); + ItemID addItem(const std::string & name, ItemID parent=nullptr); /** * Changes an existing item diff --git a/src/gui/PropertyTree.impl.h b/src/gui/PropertyTree.impl.h index a4c7053556fa0a4cf742dd3b8a5f509e06469509..f7d6dae8d38196abb7207d26ed28188787b9b28b 100644 --- a/src/gui/PropertyTree.impl.h +++ b/src/gui/PropertyTree.impl.h @@ -78,7 +78,7 @@ namespace gui { template <typename T> PropertyTree::ItemID PropertyTree::addItem(const std::string &, const T &, ItemID) { - return 0; + return nullptr; } template <typename T> diff --git a/src/lbm/PerformanceLogger.h b/src/lbm/PerformanceLogger.h index 956b4a7daf2eea37f13b2ca8f2d9e370b3c71abd..7e7f183b7b28d8d511ff18936ad25ff8c178cc55 100644 --- a/src/lbm/PerformanceLogger.h +++ b/src/lbm/PerformanceLogger.h @@ -97,7 +97,7 @@ PerformanceLogger<FlagField_T>::PerformanceLogger( const shared_ptr< StructuredB const Set<SUID> & requiredSelectors /*= Set<SUID>::emptySet()*/, const Set<SUID> & incompatibleSelectors /*= Set<SUID>::emptySet()*/ ) : performanceEvaluation_( blocks, flagFieldId, fluid, requiredSelectors, incompatibleSelectors ), - interval_(interval), timestep_(1), refreshCellCountOnCall_(false), timeloop_(NULL) + interval_(interval), timestep_(1), refreshCellCountOnCall_(false), timeloop_(nullptr) { } diff --git a/src/lbm/blockforest/PostProcessing.h b/src/lbm/blockforest/PostProcessing.h index 23644cddc5db68384cd1b99cb10be16ca90f9ad4..361303cc1f079a558ae8b53e2e673f2ec27e7125 100644 --- a/src/lbm/blockforest/PostProcessing.h +++ b/src/lbm/blockforest/PostProcessing.h @@ -377,24 +377,24 @@ public: pdfFieldId_( pdfFieldId ), filter_( filter ) {} - virtual ~MarkerData() {} + ~MarkerData() override = default; - internal::MarkerField_T * initialize( IBlock * const ) { return allocate(); } + internal::MarkerField_T * initialize( IBlock * const ) override { return allocate(); } - void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ); + void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; - void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ); - void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ); + void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override; + void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; - internal::MarkerField_T * deserialize( IBlock * const ) { return allocate(); } + internal::MarkerField_T * deserialize( IBlock * const ) override { return allocate(); } - internal::MarkerField_T * deserializeCoarseToFine( Block * const ) { return allocate(); } - internal::MarkerField_T * deserializeFineToCoarse( Block * const ) { return allocate(); } + internal::MarkerField_T * deserializeCoarseToFine( Block * const ) override { return allocate(); } + internal::MarkerField_T * deserializeFineToCoarse( Block * const ) override { return allocate(); } - void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ); + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; - void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ); - void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ); + void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; + void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override; protected: diff --git a/src/lbm/boundary/Curved.h b/src/lbm/boundary/Curved.h index d5f7aa08ff5480a1d58ba6a0fd11e22010150509..045a02398e12cfc252521ebed6190f4e8e94c99c 100644 --- a/src/lbm/boundary/Curved.h +++ b/src/lbm/boundary/Curved.h @@ -256,7 +256,7 @@ inline void Curved< LatticeModel_T, FlagField_T >::treatDirection( const cell_id } else { - WALBERLA_ASSERT( weights_->get( nx, ny, nz ).get() != NULL ); + WALBERLA_ASSERT( weights_->get( nx, ny, nz ).get() != nullptr ); WALBERLA_ASSERT_LESS( Stencil::invDirIdx(dir), weights_->get( nx, ny, nz )->size() ); // linear multi reflection model without non-equilibirum diff --git a/src/lbm/boundary/DiffusionDirichlet.h b/src/lbm/boundary/DiffusionDirichlet.h index 4f07d41b809e0b375606b0dc13a30d4e24a0fe74..96a5600850a7eef45f583c20446894512642a24d 100644 --- a/src/lbm/boundary/DiffusionDirichlet.h +++ b/src/lbm/boundary/DiffusionDirichlet.h @@ -72,7 +72,7 @@ public: const real_t & val() const { return val_; } - virtual void val( real_t& _val, cell_idx_t, cell_idx_t, cell_idx_t ) const { _val = val(); } + void val( real_t& _val, cell_idx_t, cell_idx_t, cell_idx_t ) const override { _val = val(); } real_t & val(){ return val_; } @@ -122,7 +122,7 @@ inline DiffusionDirichlet< LatticeModel_T, flag_t >::DiffusionDirichlet( const B Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); - if (flagField != NULL) + if (flagField != nullptr) sclField_ = make_shared<ScalarField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), flagField->nrOfGhostLayers(), field::zyxf ); else sclField_ = make_shared<ScalarField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), pdfField->nrOfGhostLayers(), field::zyxf ); diff --git a/src/lbm/boundary/UBB.h b/src/lbm/boundary/UBB.h index 5ce5fcc06251cb3ad868520c523a26383c70ce8f..e2621fb2f30784b7c13e08ceef60888f0deab0df 100644 --- a/src/lbm/boundary/UBB.h +++ b/src/lbm/boundary/UBB.h @@ -87,7 +87,7 @@ public: - inline UBB( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = NULL ); + inline UBB( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField<flag_t> * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } @@ -146,7 +146,7 @@ inline UBB< LatticeModel_T, flag_t, AdaptVelocityToExternalForce, StoreForce >:: Boundary<flag_t>( boundaryUID ), uid_( uid ), pdfField_( pdfField ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); - if (flagField != NULL) + if (flagField != nullptr) vel_ = make_shared<VelField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), flagField->nrOfGhostLayers(), field::zyxf ); else vel_ = make_shared<VelField>( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), pdfField_->nrOfGhostLayers(), field::zyxf ); diff --git a/src/lbm/boundary/VelocityBoundary.h b/src/lbm/boundary/VelocityBoundary.h index 8b470021b3575e755894f49397ff9cc0ddb945c3..0673f5a28bad937a51444fb93a582b46f940855d 100644 --- a/src/lbm/boundary/VelocityBoundary.h +++ b/src/lbm/boundary/VelocityBoundary.h @@ -232,7 +232,7 @@ inline void VelocityBoundary< LatticeModel_T, flag_t >::treatDirection( const ce WALBERLA_ASSERT_EQUAL( mask & this->mask_, this->mask_ ); // only true if "this->mask_" only contains one single flag, which is the case for the // current implementation of this boundary condition (VelocityBoundary) - WALBERLA_ASSERT( vel_->get( nx, ny, nz ).get() != NULL ); + WALBERLA_ASSERT( vel_->get( nx, ny, nz ).get() != nullptr ); WALBERLA_ASSERT_LESS( Stencil::invDirIdx(dir), vel_->get( nx, ny, nz )->size() ); pdfField_->get( nx, ny, nz, Stencil::invDirIdx(dir) ) = (*(vel_->get( nx, ny, nz )))[ Stencil::invDirIdx(dir) ]; diff --git a/src/lbm/field/AddToStorage.h b/src/lbm/field/AddToStorage.h index 3cf80dc43b9783f76b90c003e1d7ccce6a35573a..287673ad4c5ef53c1f2689ec3f4552d0e4b2d95f 100644 --- a/src/lbm/field/AddToStorage.h +++ b/src/lbm/field/AddToStorage.h @@ -50,37 +50,37 @@ public: initialize_( _initialize ), initialVelocity_( initialVelocity ), initialDensity_( initialDensity ), nrOfGhostLayers_( nrOfGhostLayers ), layout_( layout ) {} - inline void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) + inline void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override { packLatticeModel( block, id, buffer ); Base_T::serialize( block, id, buffer ); } - void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) + void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override { packLatticeModel( block, id, buffer ); Base_T::serializeCoarseToFine( block, id, buffer, child ); } - void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) + void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override { packLatticeModel( block, id, buffer ); Base_T::serializeFineToCoarse( block, id, buffer ); } - void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override { unpackLatticeModel( block, id, buffer ); Base_T::deserialize( block, id, buffer ); } - void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) + void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override { unpackLatticeModel( block, id, buffer ); Base_T::deserializeCoarseToFine( block, id, buffer ); } - void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) + void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override { unpackLatticeModel( block, id, buffer ); Base_T::deserializeFineToCoarse( block, id, buffer, child ); @@ -88,12 +88,12 @@ public: protected: - PdfField<LatticeModel_T> * allocate( IBlock * const block ) + PdfField<LatticeModel_T> * allocate( IBlock * const block ) override { return allocateDispatch( block, initialize_, initialDensity_ ); } - PdfField<LatticeModel_T> * reallocate( IBlock * const block ) + PdfField<LatticeModel_T> * reallocate( IBlock * const block ) override { #ifdef NDEBUG return allocateDispatch( block, false, initialDensity_ ); diff --git a/src/lbm/field/Density.h b/src/lbm/field/Density.h index a7c346e13721c9215b67316d440415b3f482607b..3555e79815a1168a0fbed7165a652f6204ae9a0b 100644 --- a/src/lbm/field/Density.h +++ b/src/lbm/field/Density.h @@ -80,7 +80,7 @@ struct Density< LatticeModel_T, typename std::enable_if< LatticeModel_T::compres template< typename LatticeModel_T > struct Density< LatticeModel_T, typename std::enable_if< ! LatticeModel_T::compressible >::type > { - static_assert( LatticeModel_T::compressible == false, "Only works with incompressible models!" ); + static_assert( !LatticeModel_T::compressible, "Only works with incompressible models!" ); template< typename FieldPtrOrIterator > static inline real_t get( const LatticeModel_T & /*latticeModel*/, const FieldPtrOrIterator & it ) diff --git a/src/lbm/field/DensityVelocityCallback.h b/src/lbm/field/DensityVelocityCallback.h index 3c7c69087c7a0b302be099642e4ed471ffc1be11..d7c76c5ca808b898659e6998dea85a7b94b1aa36 100644 --- a/src/lbm/field/DensityVelocityCallback.h +++ b/src/lbm/field/DensityVelocityCallback.h @@ -246,7 +246,7 @@ class AdvectionDiffusionDensityEquilibriumVelocityCalculation public: AdvectionDiffusionDensityEquilibriumVelocityCalculation( const ConstBlockDataID & velocityFieldId ) : - velocityFieldId_( velocityFieldId ), velocityField_( NULL ) {} + velocityFieldId_( velocityFieldId ), velocityField_( nullptr ) {} void operator()( IBlock & block ) { diff --git a/src/lbm/field/PdfField.h b/src/lbm/field/PdfField.h index 5b4429877553be83530ce913a89efadfd0127be4..a9438e42b6d2f255f4349f7ba13926cdd20136d3 100644 --- a/src/lbm/field/PdfField.h +++ b/src/lbm/field/PdfField.h @@ -104,7 +104,7 @@ public: const uint_t ghostLayers = uint_t(1), const field::Layout & _layout = field::zyxf, const shared_ptr< field::FieldAllocator<real_t> > & alloc = shared_ptr< field::FieldAllocator<real_t> >() ); - virtual ~PdfField() {} + ~PdfField() override = default; @@ -282,7 +282,7 @@ protected: /*! \name Shallow Copy */ //@{ inline PdfField( const PdfField< LatticeModel_T > & other ); - Field< real_t, Stencil::Size > * cloneShallowCopyInternal() const { return new PdfField< LatticeModel_T >( *this ); } + Field< real_t, Stencil::Size > * cloneShallowCopyInternal() const override { return new PdfField< LatticeModel_T >( *this ); } //@} //******************************************************************************************************************* diff --git a/src/lbm/geometry/initializer/PoiseuilleInitializer.h b/src/lbm/geometry/initializer/PoiseuilleInitializer.h index 4315bed9cc9a854d44bc78d556021301417ef1bf..8f8898556a6016ae0ce2a3435fac4aa60f8ce4aa 100644 --- a/src/lbm/geometry/initializer/PoiseuilleInitializer.h +++ b/src/lbm/geometry/initializer/PoiseuilleInitializer.h @@ -93,7 +93,7 @@ namespace initializer { field::FlagUID pressureFlag1, field::FlagUID pressureFlag2 ); - virtual void init( BlockStorage & , const Config::BlockHandle & blockHandle ) { init( blockHandle ); } + void init( BlockStorage & , const Config::BlockHandle & blockHandle ) override { init( blockHandle ); } void init( const Config::BlockHandle & blockHandle ); void init( Scenario scenario, BoundaryType boundaryType, real_t pressureDiff, Axis flowAxis, Axis parabolaAxis = INVALID_AXIS ); diff --git a/src/lbm/lattice_model/CollisionModel.h b/src/lbm/lattice_model/CollisionModel.h index df97cc3c5644a74a88d59ae37d0397d4b282eeac..c3077e97f66bbd20555b5c274af772541c72c502 100644 --- a/src/lbm/lattice_model/CollisionModel.h +++ b/src/lbm/lattice_model/CollisionModel.h @@ -145,7 +145,7 @@ public: omegaFieldId_(), omegaField_( NULL ), level_( uint_t(0) ) {} SRTField( const BlockDataID & omegaFieldId, const uint_t _level = uint_t(0) ) : - omegaFieldId_( omegaFieldId ), omegaField_( NULL ), level_( _level ) {} + omegaFieldId_( omegaFieldId ), omegaField_( nullptr ), level_( _level ) {} void setFieldId( const BlockDataID & omegaFieldId, const uint_t _level = uint_t(0) ) { diff --git a/src/lbm/lattice_model/D2Q9.h b/src/lbm/lattice_model/D2Q9.h index a4080f3bc2a89ad6b201039e6308607f1216a848..4fe777ead18a54f878d127cbd69873dab643120c 100644 --- a/src/lbm/lattice_model/D2Q9.h +++ b/src/lbm/lattice_model/D2Q9.h @@ -63,11 +63,11 @@ public: static_assert( (std::is_same< ForceModel_T, force_model::None >::value), "This constructor is only available if the force model is equal to force_model::None!" ); } - virtual ~D2Q9() {} + ~D2Q9() override = default; protected: - virtual void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) {} + void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) override {} }; template< typename CM, bool C, typename FM, int EAO > const char* D2Q9<CM,C,FM,EAO>::NAME = "D2Q9"; diff --git a/src/lbm/lattice_model/D3Q15.h b/src/lbm/lattice_model/D3Q15.h index e969749a4907fbb270350475c0d0a60bb4aa6cb9..a946fce3d93941cf37b953b0561c5b8a03c4c7f2 100644 --- a/src/lbm/lattice_model/D3Q15.h +++ b/src/lbm/lattice_model/D3Q15.h @@ -62,11 +62,11 @@ public: static_assert( (std::is_same< ForceModel_T, force_model::None >::value), "This constructor is only available if the force model is equal to force_model::None!" ); } - virtual ~D3Q15() {} + ~D3Q15() override = default; protected: - virtual void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) {} + void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) override {} }; template< typename CM, bool C, typename FM, int EAO > const char* D3Q15<CM,C,FM,EAO>::NAME = "D3Q15"; diff --git a/src/lbm/lattice_model/D3Q19.h b/src/lbm/lattice_model/D3Q19.h index e196e4ede7b1fefc1394b53ae8e9d6b55a05cc39..d8cfc3dbc8a68c750de54c05acd53d46681826f2 100644 --- a/src/lbm/lattice_model/D3Q19.h +++ b/src/lbm/lattice_model/D3Q19.h @@ -61,11 +61,11 @@ public: static_assert( (std::is_same< ForceModel_T, force_model::None >::value), "This constructor is only available if the force model is equal to force_model::None!" ); } - virtual ~D3Q19() {} + ~D3Q19() override = default; protected: - virtual void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) {} + void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) override {} }; template< typename CM, bool C, typename FM, int EAO > const char* D3Q19<CM,C,FM,EAO>::NAME = "D3Q19"; diff --git a/src/lbm/lattice_model/D3Q27.h b/src/lbm/lattice_model/D3Q27.h index 72b5188f5d471069d3e42fece3cdf2b146bbc46e..fb8289cbf7274b459b81a594c1123a721268e3ba 100644 --- a/src/lbm/lattice_model/D3Q27.h +++ b/src/lbm/lattice_model/D3Q27.h @@ -64,11 +64,11 @@ public: static_assert( (std::is_same< ForceModel_T, force_model::None >::value), "This constructor is only available if the force model is equal to force_model::None!" ); } - virtual ~D3Q27() {} + ~D3Q27() override = default; protected: - virtual void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) {} + void config( IBlock & /*block*/, StructuredBlockStorage & /*sbs*/ ) override {} }; template< typename CM, bool C, typename FM, int EAO > const char* D3Q27<CM,C,FM,EAO>::NAME = "D3Q27"; diff --git a/src/lbm/lattice_model/ForceModel.h b/src/lbm/lattice_model/ForceModel.h index 9b01b48b2d261810ce6e58f4efa37aceae2c2f3a..b82f05634be375d463c8b16ffea423ae571cbc3e 100644 --- a/src/lbm/lattice_model/ForceModel.h +++ b/src/lbm/lattice_model/ForceModel.h @@ -563,7 +563,7 @@ public: static const bool constant = false; GuoField( const BlockDataID & forceFieldId ) : - forceFieldId_( forceFieldId ), forceField_( NULL ) {} + forceFieldId_( forceFieldId ), forceField_( nullptr ) {} void pack( mpi::SendBuffer & buffer ) const { buffer << forceFieldId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> forceFieldId_; } @@ -644,7 +644,7 @@ public: static const bool constant = true; Correction( const BlockDataID & previousRhoVelocityId ) : - force_( real_t(0) ), previousRhoVelocityId_( previousRhoVelocityId ), previousRhoVelocity_(NULL) {} + force_( real_t(0) ), previousRhoVelocityId_( previousRhoVelocityId ), previousRhoVelocity_(nullptr) {} void pack( mpi::SendBuffer & buffer ) const { buffer << force_ << previousRhoVelocityId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> force_ >> previousRhoVelocityId_; } diff --git a/src/lbm/lattice_model/LatticeModelBase.h b/src/lbm/lattice_model/LatticeModelBase.h index 385e9abcccfd31d3ef11a64fc9ce464963ae49ed..82039ee3a550b44dd62e00a6512479b4c51564b0 100644 --- a/src/lbm/lattice_model/LatticeModelBase.h +++ b/src/lbm/lattice_model/LatticeModelBase.h @@ -82,7 +82,7 @@ public: LatticeModelBase( const CollisionModel_T & cm, const ForceModel_T & fm ) : collisionModel_( cm ), forceModel_( fm ) {} - virtual ~LatticeModelBase() {} + virtual ~LatticeModelBase() = default; virtual void pack( mpi::SendBuffer & buffer ) const { diff --git a/src/lbm/refinement/PdfFieldPackInfo.h b/src/lbm/refinement/PdfFieldPackInfo.h index 6fbfb92216ba567974b4dbd717be27dc3e3a403d..7117c64cd69dd297ccf2dbd5771bdcfc22aa801b 100644 --- a/src/lbm/refinement/PdfFieldPackInfo.h +++ b/src/lbm/refinement/PdfFieldPackInfo.h @@ -60,31 +60,31 @@ public: equalLevelCells_( equalLevelCells() ) {} #endif - virtual ~PdfFieldPackInfo() {} + ~PdfFieldPackInfo() override = default; - bool optimizedEqualLevelCommunication() const { return optimizedEqualLevelCommunication_; } - void optimizeEqualLevelCommunication( const bool value = true ) { optimizedEqualLevelCommunication_ = value; } + bool optimizedEqualLevelCommunication() const override { return optimizedEqualLevelCommunication_; } + void optimizeEqualLevelCommunication( const bool value = true ) override { optimizedEqualLevelCommunication_ = value; } - bool optimizedForLinearExplosion() const { return optimizedForLinearExplosion_; } - void optimizeForLinearExplosion( const bool value = true ) { optimizedForLinearExplosion_ = value; } + bool optimizedForLinearExplosion() const override { return optimizedForLinearExplosion_; } + void optimizeForLinearExplosion( const bool value = true ) override { optimizedForLinearExplosion_ = value; } - bool constantDataExchange() const { return true; } - bool threadsafeReceiving() const { return true; } + bool constantDataExchange() const override { return true; } + bool threadsafeReceiving() const override { return true; } - void unpackDataEqualLevel( Block * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ); - void communicateLocalEqualLevel( const Block * sender, Block * receiver, stencil::Direction dir ); + void unpackDataEqualLevel( Block * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; + void communicateLocalEqualLevel( const Block * sender, Block * receiver, stencil::Direction dir ) override; - void unpackDataCoarseToFine( Block * fineReceiver, const BlockID & coarseSender, stencil::Direction dir, mpi::RecvBuffer & buffer ); - void communicateLocalCoarseToFine( const Block * coarseSender, Block * fineReceiver, stencil::Direction dir ); + void unpackDataCoarseToFine( Block * fineReceiver, const BlockID & coarseSender, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; + void communicateLocalCoarseToFine( const Block * coarseSender, Block * fineReceiver, stencil::Direction dir ) override; - void unpackDataFineToCoarse( Block * coarseReceiver, const BlockID & fineSender, stencil::Direction dir, mpi::RecvBuffer & buffer ); - void communicateLocalFineToCoarse( const Block * fineSender, Block * coarseReceiver, stencil::Direction dir ); + void unpackDataFineToCoarse( Block * coarseReceiver, const BlockID & fineSender, stencil::Direction dir, mpi::RecvBuffer & buffer ) override; + void communicateLocalFineToCoarse( const Block * fineSender, Block * coarseReceiver, stencil::Direction dir ) override; protected: - void packDataEqualLevelImpl( const Block * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const; - void packDataCoarseToFineImpl( const Block * coarseSender, const BlockID & fineReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const; - void packDataFineToCoarseImpl( const Block * fineSender, const BlockID & coarseReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const; + void packDataEqualLevelImpl( const Block * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; + void packDataCoarseToFineImpl( const Block * coarseSender, const BlockID & fineReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; + void packDataFineToCoarseImpl( const Block * fineSender, const BlockID & coarseReceiver, stencil::Direction dir, mpi::SendBuffer & buffer ) const override; /////////////////////////////////////////////////////////////////////// // Helper functions for determining packing/unpacking cell intervals // @@ -1090,18 +1090,18 @@ inline std::vector< CellInterval > PdfFieldPackInfo< LatticeModel_T, BoundaryHan WALBERLA_ASSERT_EQUAL( interval.xSize(), equalLevelCells_ ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMax(), - interval.xMax(), interval.yMax(), interval.zMax() ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMin() + cell_idx_t(1), - interval.xMax(), interval.yMin(), interval.zMax() - cell_idx_t(1) ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMax(), interval.zMin() + cell_idx_t(1), - interval.xMax(), interval.yMax(), interval.zMax() - cell_idx_t(1) ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMin(), - interval.xMax(), interval.yMax(), interval.zMin() ) ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMax(), + interval.xMax(), interval.yMax(), interval.zMax() ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMin() + cell_idx_t(1), + interval.xMax(), interval.yMin(), interval.zMax() - cell_idx_t(1) ); + intervals.emplace_back( interval.xMin(), interval.yMax(), interval.zMin() + cell_idx_t(1), + interval.xMax(), interval.yMax(), interval.zMax() - cell_idx_t(1) ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMin(), + interval.xMax(), interval.yMax(), interval.zMin() ); const cell_idx_t x = ( stencil::cx[dir] > 0 ) ? interval.xMax() : interval.xMin(); - intervals.push_back( CellInterval( x, interval.yMin() + cell_idx_t(1), interval.zMin() + cell_idx_t(1), - x, interval.yMax() - cell_idx_t(1), interval.zMax() - cell_idx_t(1) ) ); + intervals.emplace_back( x, interval.yMin() + cell_idx_t(1), interval.zMin() + cell_idx_t(1), + x, interval.yMax() - cell_idx_t(1), interval.zMax() - cell_idx_t(1) ); } else if( stencil::cy[dir] != 0 ) { @@ -1110,18 +1110,18 @@ inline std::vector< CellInterval > PdfFieldPackInfo< LatticeModel_T, BoundaryHan WALBERLA_ASSERT_EQUAL( interval.ySize(), equalLevelCells_ ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMax(), - interval.xMax(), interval.yMax(), interval.zMax() ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMin() + cell_idx_t(1), - interval.xMin(), interval.yMax(), interval.zMax() - cell_idx_t(1) ) ); - intervals.push_back( CellInterval( interval.xMax(), interval.yMin(), interval.zMin() + cell_idx_t(1), - interval.xMax(), interval.yMax(), interval.zMax() - cell_idx_t(1) ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMin(), - interval.xMax(), interval.yMax(), interval.zMin() ) ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMax(), + interval.xMax(), interval.yMax(), interval.zMax() ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMin() + cell_idx_t(1), + interval.xMin(), interval.yMax(), interval.zMax() - cell_idx_t(1) ); + intervals.emplace_back( interval.xMax(), interval.yMin(), interval.zMin() + cell_idx_t(1), + interval.xMax(), interval.yMax(), interval.zMax() - cell_idx_t(1) ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMin(), + interval.xMax(), interval.yMax(), interval.zMin() ); const cell_idx_t y = ( stencil::cy[dir] > 0 ) ? interval.yMax() : interval.yMin(); - intervals.push_back( CellInterval( interval.xMin() + cell_idx_t(1), y, interval.zMin() + cell_idx_t(1), - interval.xMax() - cell_idx_t(1), y, interval.zMax() - cell_idx_t(1) ) ); + intervals.emplace_back( interval.xMin() + cell_idx_t(1), y, interval.zMin() + cell_idx_t(1), + interval.xMax() - cell_idx_t(1), y, interval.zMax() - cell_idx_t(1) ); } else { @@ -1131,18 +1131,18 @@ inline std::vector< CellInterval > PdfFieldPackInfo< LatticeModel_T, BoundaryHan WALBERLA_ASSERT_EQUAL( interval.zSize(), equalLevelCells_ ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMax(), interval.zMin(), - interval.xMax(), interval.yMax(), interval.zMax() ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin() + cell_idx_t(1), interval.zMin(), - interval.xMin(), interval.yMax() - cell_idx_t(1), interval.zMax() ) ); - intervals.push_back( CellInterval( interval.xMax(), interval.yMin() + cell_idx_t(1), interval.zMin(), - interval.xMax(), interval.yMax() - cell_idx_t(1), interval.zMax() ) ); - intervals.push_back( CellInterval( interval.xMin(), interval.yMin(), interval.zMin(), - interval.xMax(), interval.yMin(), interval.zMax() ) ); + intervals.emplace_back( interval.xMin(), interval.yMax(), interval.zMin(), + interval.xMax(), interval.yMax(), interval.zMax() ); + intervals.emplace_back( interval.xMin(), interval.yMin() + cell_idx_t(1), interval.zMin(), + interval.xMin(), interval.yMax() - cell_idx_t(1), interval.zMax() ); + intervals.emplace_back( interval.xMax(), interval.yMin() + cell_idx_t(1), interval.zMin(), + interval.xMax(), interval.yMax() - cell_idx_t(1), interval.zMax() ); + intervals.emplace_back( interval.xMin(), interval.yMin(), interval.zMin(), + interval.xMax(), interval.yMin(), interval.zMax() ); const cell_idx_t z = ( stencil::cz[dir] > 0 ) ? interval.zMax() : interval.zMin(); - intervals.push_back( CellInterval( interval.xMin() + cell_idx_t(1), interval.yMin() + cell_idx_t(1), z, - interval.xMax() - cell_idx_t(1), interval.yMax() - cell_idx_t(1), z ) ); + intervals.emplace_back( interval.xMin() + cell_idx_t(1), interval.yMin() + cell_idx_t(1), z, + interval.xMax() - cell_idx_t(1), interval.yMax() - cell_idx_t(1), z ); } return intervals; diff --git a/src/lbm/refinement/TimeStep.h b/src/lbm/refinement/TimeStep.h index 1be6a470d5402e21600831870524e80c563f6716..84189ba4b0a286a158c29249ecb3df414fd903c9 100644 --- a/src/lbm/refinement/TimeStep.h +++ b/src/lbm/refinement/TimeStep.h @@ -397,14 +397,14 @@ void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::consistencyChecks( continue; auto * pdfField = block->template getData< PdfField< LatticeModel_T > >( pdfFieldId ); - if( pdfField == NULL ) + if( pdfField == nullptr ) { WALBERLA_ABORT( "Could not get the PDF field from block " << block->getId() << ". Check if it is allocated on " "the block and if the LatticeModel matches!" ); } auto * boundaryHandling = block->template getData< BoundaryHandling_T >( boundaryHandlingId ); - if( boundaryHandling == NULL ) + if( boundaryHandling == nullptr ) { WALBERLA_ABORT( "Could not get the boundary handling from block " << block->getId() << ". Check if it is " "allocated on the block and if its type matches!" ); @@ -595,7 +595,7 @@ template< typename LatticeModel_T, typename Sweep_T, typename BoundaryHandling_T inline void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::addPostCollideVoidFunction( const VoidFunction & function, const std::string & identifier ) { VoidFunctionWrappper wrappedFunction( globalPostCollideVoidFunctions_, globalPostCollideVoidFunctions_.size() ); - globalPostCollideVoidFunctions_.push_back( std::make_pair( function, identifier ) ); + globalPostCollideVoidFunctions_.emplace_back( function, identifier ); addFunction< VoidFunction >( postCollideVoidFunctions_, wrappedFunction, identifier ); } @@ -603,7 +603,7 @@ template< typename LatticeModel_T, typename Sweep_T, typename BoundaryHandling_T inline void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::addPostCollideBlockFunction( const BlockFunction & function, const std::string & identifier ) { BlockFunctionWrappper wrappedFunction( globalPostCollideBlockFunctions_, globalPostCollideBlockFunctions_.size() ); - globalPostCollideBlockFunctions_.push_back( std::make_pair( function, identifier ) ); + globalPostCollideBlockFunctions_.emplace_back( function, identifier ); addFunction< BlockFunction >( postCollideBlockFunctions_, wrappedFunction, identifier ); } @@ -623,7 +623,7 @@ template< typename LatticeModel_T, typename Sweep_T, typename BoundaryHandling_T inline void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::addPostBoundaryHandlingVoidFunction( const VoidFunction & function, const std::string & identifier ) { VoidFunctionWrappper wrappedFunction( globalPostBoundaryHandlingVoidFunctions_, globalPostBoundaryHandlingVoidFunctions_.size() ); - globalPostBoundaryHandlingVoidFunctions_.push_back( std::make_pair( function, identifier ) ); + globalPostBoundaryHandlingVoidFunctions_.emplace_back( function, identifier ); addFunction< VoidFunction >( postBoundaryHandlingVoidFunctions_, wrappedFunction, identifier ); } @@ -631,7 +631,7 @@ template< typename LatticeModel_T, typename Sweep_T, typename BoundaryHandling_T inline void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::addPostBoundaryHandlingBlockFunction( const BlockFunction & function, const std::string & identifier ) { BlockFunctionWrappper wrappedFunction( globalPostBoundaryHandlingBlockFunctions_, globalPostBoundaryHandlingBlockFunctions_.size() ); - globalPostBoundaryHandlingBlockFunctions_.push_back( std::make_pair( function, identifier ) ); + globalPostBoundaryHandlingBlockFunctions_.emplace_back( function, identifier ); addFunction< BlockFunction >( postBoundaryHandlingBlockFunctions_, wrappedFunction, identifier ); } @@ -651,7 +651,7 @@ template< typename LatticeModel_T, typename Sweep_T, typename BoundaryHandling_T inline void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::addPostStreamVoidFunction( const VoidFunction & function, const std::string & identifier ) { VoidFunctionWrappper wrappedFunction( globalPostStreamVoidFunctions_, globalPostStreamVoidFunctions_.size() ); - globalPostStreamVoidFunctions_.push_back( std::make_pair( function, identifier ) ); + globalPostStreamVoidFunctions_.emplace_back( function, identifier ); addFunction< VoidFunction >( postStreamVoidFunctions_, wrappedFunction, identifier ); } @@ -659,7 +659,7 @@ template< typename LatticeModel_T, typename Sweep_T, typename BoundaryHandling_T inline void TimeStep< LatticeModel_T, Sweep_T, BoundaryHandling_T >::addPostStreamBlockFunction( const BlockFunction & function, const std::string & identifier ) { BlockFunctionWrappper wrappedFunction( globalPostStreamBlockFunctions_, globalPostStreamBlockFunctions_.size() ); - globalPostStreamBlockFunctions_.push_back( std::make_pair( function, identifier ) ); + globalPostStreamBlockFunctions_.emplace_back( function, identifier ); addFunction< BlockFunction >( postStreamBlockFunctions_, wrappedFunction, identifier ); } diff --git a/src/lbm/srt/SplitPureSweep.impl.h b/src/lbm/srt/SplitPureSweep.impl.h index b193c8636ada13a602e0d112ce13e4e361c30610..3c716216cbba6fb0c05a718be8929773a9ea1d09 100644 --- a/src/lbm/srt/SplitPureSweep.impl.h +++ b/src/lbm/srt/SplitPureSweep.impl.h @@ -99,8 +99,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); @@ -431,8 +431,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); @@ -794,8 +794,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); @@ -1130,8 +1130,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); diff --git a/src/lbm/srt/SplitSweep.impl.h b/src/lbm/srt/SplitSweep.impl.h index b7e630c2222f5c7ccd05954b277c5fcb9bd8c016..e86dc16b234e0b1e046cb30cc818d3979c8ec15a 100644 --- a/src/lbm/srt/SplitSweep.impl.h +++ b/src/lbm/srt/SplitSweep.impl.h @@ -93,9 +93,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -493,9 +493,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -517,8 +517,8 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s { WALBERLA_ASSERT_EQUAL( numberOfGhostLayersToInclude, uint_t(0) ); // the implementation right now doesn't support inclusion of ghost layers in collide step! - PdfField_T * src( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, flagField ); @@ -928,9 +928,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -1333,9 +1333,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -1357,8 +1357,8 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s { WALBERLA_ASSERT_EQUAL( numberOfGhostLayersToInclude, uint_t(0) ); // the implementation right now doesn't support inclusion of ghost layers in collide step! - PdfField_T * src( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, flagField ); diff --git a/src/lbm/sweeps/ActiveCellSweep.h b/src/lbm/sweeps/ActiveCellSweep.h index e191b785d0cb5437bb4b6cfdbf64ac37345a748d..cfc3b6d3519e5d03b48cee0d280d02ea7df8b443 100644 --- a/src/lbm/sweeps/ActiveCellSweep.h +++ b/src/lbm/sweeps/ActiveCellSweep.h @@ -47,7 +47,7 @@ public: const Set< FlagUID > & lbmMask, const bool _useIterators = false ) : FlagFieldSweepBase<LatticeModel_T,FlagField_T>( src, dst, flagField, lbmMask ), cellOperation_( op ), useIterators_( _useIterators ) {} - virtual ~ActiveCellSweep() {} + virtual ~ActiveCellSweep() = default; const CellOperation & getCellOperation() const { return cellOperation_; } CellOperation & getCellOperation() { return cellOperation_; } diff --git a/src/lbm/trt/SplitPureSweep.impl.h b/src/lbm/trt/SplitPureSweep.impl.h index 695cebccf47b618a3d65c2fd4fd6cfea900c5bca..84104e0922756f7be9d21ed7c519f9c9713967f5 100644 --- a/src/lbm/trt/SplitPureSweep.impl.h +++ b/src/lbm/trt/SplitPureSweep.impl.h @@ -98,8 +98,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); @@ -480,8 +480,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); @@ -891,8 +891,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); @@ -1292,8 +1292,8 @@ void SplitPureSweep< LatticeModel_T, typename std::enable_if< std::is_same< type >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); this->getFields( block, src, dst ); diff --git a/src/lbm/trt/SplitSweep.impl.h b/src/lbm/trt/SplitSweep.impl.h index fadc10b487a0bd88f627e46fe72eb8f817c8575e..4439727cacb0aedc42df2cf5abef9b05574170bc 100644 --- a/src/lbm/trt/SplitSweep.impl.h +++ b/src/lbm/trt/SplitSweep.impl.h @@ -93,9 +93,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -545,9 +545,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -568,8 +568,8 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s { WALBERLA_ASSERT_EQUAL( numberOfGhostLayersToInclude, uint_t(0) ); // the implementation right now doesn't support inclusion of ghost layers in collide step! - PdfField_T * src( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, flagField ); @@ -1030,9 +1030,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::operator()( IBlock * const block ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -1501,9 +1501,9 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s >::type >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, dst, flagField ); @@ -1524,8 +1524,8 @@ void SplitSweep< LatticeModel_T, FlagField_T, typename std::enable_if< std::is_s { WALBERLA_ASSERT_EQUAL( numberOfGhostLayersToInclude, uint_t(0) ); // the implementation right now doesn't support inclusion of ghost layers in collide step! - PdfField_T * src( NULL ); - const FlagField_T * flagField( NULL ); + PdfField_T * src( nullptr ); + const FlagField_T * flagField( nullptr ); auto lbm = this->getLbmMaskAndFields( block, src, flagField ); diff --git a/src/lbm/vtk/Density.h b/src/lbm/vtk/Density.h index 387086fe68a19346f04f8672cd3197646375c01f..6b7e4ee51de568f6441666171d5b120963595ab4 100644 --- a/src/lbm/vtk/Density.h +++ b/src/lbm/vtk/Density.h @@ -39,13 +39,13 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; DensityVTKWriter( const ConstBlockDataID & pdf, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( NULL ) {} + vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( nullptr ) {} 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_ ); return numeric_cast< OutputType >( pdf_->getDensity(x,y,z) ); diff --git a/src/lbm/vtk/NonEquilibrium.h b/src/lbm/vtk/NonEquilibrium.h index c8699c43e794ffab50272495341af54459d93cca..3754c58ddc9c669f73a494d4ed00494fbead04af 100644 --- a/src/lbm/vtk/NonEquilibrium.h +++ b/src/lbm/vtk/NonEquilibrium.h @@ -45,13 +45,13 @@ public: typedef typename LatticeModel_T::Stencil Stencil; NonEqulibriumVTKWriter( const ConstBlockDataID & pdf, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, Stencil::Size >( id ), bdid_( pdf ), pdf_( NULL ) {} + vtk::BlockCellDataWriter< OutputType, Stencil::Size >( id ), bdid_( pdf ), pdf_( nullptr ) {} 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_ ); diff --git a/src/lbm/vtk/VTKOutput.h b/src/lbm/vtk/VTKOutput.h index 1c00b11ff3f585e3727e218a80dce2555e2eb738..e42fb6bd927628fc7b64f1e9ba78d33c66fa4063 100644 --- a/src/lbm/vtk/VTKOutput.h +++ b/src/lbm/vtk/VTKOutput.h @@ -90,7 +90,7 @@ public: const FlagUID & domainFlagUID, const FlagMap & flagFieldMapping = FlagMap() ); - virtual ~VTKOutput() {} + virtual ~VTKOutput() = default; virtual void operator()( std::vector< shared_ptr<vtk::BlockCellDataWriterInterface> > & writers, std::map< std::string, vtk::VTKOutput::CellFilter > & filters, diff --git a/src/lbm/vtk/Velocity.h b/src/lbm/vtk/Velocity.h index 6fb513745b11ca9fb7da05d9e0c0bef8de7deea0..10957ee4ac08c8acdc799be4d224fc77624347bb 100644 --- a/src/lbm/vtk/Velocity.h +++ b/src/lbm/vtk/Velocity.h @@ -39,13 +39,13 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; VelocityVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( NULL ) {} + vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ) {} 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_ ); return numeric_cast< OutputType >( (pdf_->getVelocity(x,y,z))[ uint_c(f) ] ); @@ -66,13 +66,13 @@ public: typedef PdfField< LatticeModel_T > PdfField_T; VelocityMagnitudeVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( NULL ) {} + vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ) {} 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_ ); return numeric_cast< OutputType >( pdf_->getVelocity(x,y,z).length() ); diff --git a/src/lbm_mesapd_coupling/utility/SubCyclingManager.h b/src/lbm_mesapd_coupling/utility/SubCyclingManager.h index d1f1989162ad1d9e049647930b34e691ffe40c97..d001a43ba0e4a12de553a228716869c311c2c4b9 100644 --- a/src/lbm_mesapd_coupling/utility/SubCyclingManager.h +++ b/src/lbm_mesapd_coupling/utility/SubCyclingManager.h @@ -40,7 +40,7 @@ public: //@{ explicit SubCyclingManager(size_t numberOfSubCycles, shared_ptr<WcTimingPool> timingPool = nullptr); - virtual ~SubCyclingManager() {} + virtual ~SubCyclingManager() = default; //@} /*! \name Registration Functions */ diff --git a/src/mesa_pd/collision_detection/AnalyticContactDetection.h b/src/mesa_pd/collision_detection/AnalyticContactDetection.h index ce8149c1eca081934e8a63227c0f1beb75aafb16..36941efc1545ed8e58b75144c6af5d66de5348dc 100644 --- a/src/mesa_pd/collision_detection/AnalyticContactDetection.h +++ b/src/mesa_pd/collision_detection/AnalyticContactDetection.h @@ -46,7 +46,7 @@ namespace collision_detection { class AnalyticContactDetection { public: - virtual ~AnalyticContactDetection() {} + virtual ~AnalyticContactDetection() = default; size_t& getIdx1() {return idx1_;} size_t& getIdx2() {return idx2_;} diff --git a/src/mesa_pd/collision_detection/BroadPhase.h b/src/mesa_pd/collision_detection/BroadPhase.h index a3fcb264069e470c2aaa8165bcd13dc96707582e..f98658836b48704e1956aaf9aacfd9abbd7e9dcd 100644 --- a/src/mesa_pd/collision_detection/BroadPhase.h +++ b/src/mesa_pd/collision_detection/BroadPhase.h @@ -38,8 +38,7 @@ bool isInInteractionDistance(const size_t idx1, const size_t idx2, Accessor& ac) if (isSet(ac.getFlags(idx2), INFINITE)) return true; auto separationDist = ac.getInteractionRadius(idx1) + ac.getInteractionRadius(idx2); auto realDist2 = (ac.getPosition(idx1) - ac.getPosition(idx2)).sqrLength(); - if (realDist2 < separationDist*separationDist) return true; - return false; + return realDist2 < separationDist*separationDist; } } //namespace collision_detection diff --git a/src/mesa_pd/collision_detection/GeneralContactDetection.h b/src/mesa_pd/collision_detection/GeneralContactDetection.h index 69a95e50805119bfae9a15dcc703823a23b416b2..9564916c02a97432793a09f5805bf9f9072f73ac 100644 --- a/src/mesa_pd/collision_detection/GeneralContactDetection.h +++ b/src/mesa_pd/collision_detection/GeneralContactDetection.h @@ -199,13 +199,7 @@ bool GeneralContactDetection::collideGJKEPA(Support& geom0, Support& geom1) { EPA epa; epa.useSphereOptimization(false); - if (epa.doEPAmargin(geom0, geom1, gjk, contactNormal_, contactPoint_, penetrationDepth_, margin)) - { - return true; - } else - { - return false; - } + return epa.doEPAmargin(geom0, geom1, gjk, contactNormal_, contactPoint_, penetrationDepth_, margin); } else { return false; diff --git a/src/mesa_pd/data/ContactAccessor.h b/src/mesa_pd/data/ContactAccessor.h index dfa293bc984abd75d42f54a368c8f8d13e609aa5..a33d4e804c55b7544ded7b86a01c6352c12d8cef 100644 --- a/src/mesa_pd/data/ContactAccessor.h +++ b/src/mesa_pd/data/ContactAccessor.h @@ -47,7 +47,7 @@ class ContactAccessor : public IContactAccessor { public: ContactAccessor(const std::shared_ptr<data::ContactStorage>& ps) : ps_(ps) {} - virtual ~ContactAccessor() = default; + ~ContactAccessor() override = default; const walberla::id_t& getUid(const size_t p_idx) const {return ps_->getUid(p_idx);} walberla::id_t& getUidRef(const size_t p_idx) {return ps_->getUidRef(p_idx);} void setUid(const size_t p_idx, const walberla::id_t& v) { ps_->setUid(p_idx, v);} @@ -156,7 +156,7 @@ inline size_t ContactAccessor::find(const id_t& uid) class SingleContactAccessor : public IAccessor { public: - virtual ~SingleContactAccessor() = default; + ~SingleContactAccessor() override = default; const walberla::id_t& getUid(const size_t /*p_idx*/) const {return uid_;} void setUid(const size_t /*p_idx*/, const walberla::id_t& v) { uid_ = v;} walberla::id_t& getUidRef(const size_t /*p_idx*/) {return uid_;} diff --git a/src/mesa_pd/data/ParticleAccessor.h b/src/mesa_pd/data/ParticleAccessor.h index 4ebdcd135cc07827d47cb45e769b4f79b9909d07..62c61f6f7cf4ab0b8591deeb3661de4ac2a9ac8e 100644 --- a/src/mesa_pd/data/ParticleAccessor.h +++ b/src/mesa_pd/data/ParticleAccessor.h @@ -47,7 +47,7 @@ class ParticleAccessor : public IAccessor { public: ParticleAccessor(const std::shared_ptr<data::ParticleStorage>& ps) : ps_(ps) {} - virtual ~ParticleAccessor() = default; + ~ParticleAccessor() override = default; walberla::id_t const & getUid(const size_t p_idx) const {return ps_->getUid(p_idx);} walberla::id_t& getUidRef(const size_t p_idx) {return ps_->getUidRef(p_idx);} void setUid(const size_t p_idx, walberla::id_t const & v) { ps_->setUid(p_idx, v);} @@ -220,7 +220,7 @@ inline size_t ParticleAccessor::find(const id_t& uid) class SingleParticleAccessor : public IAccessor { public: - virtual ~SingleParticleAccessor() = default; + ~SingleParticleAccessor() override = default; walberla::id_t const & getUid(const size_t /*p_idx*/) const {return uid_;} void setUid(const size_t /*p_idx*/, walberla::id_t const & v) { uid_ = v;} walberla::id_t& getUidRef(const size_t /*p_idx*/) {return uid_;} diff --git a/src/mesa_pd/domain/BlockForestDataHandling.h b/src/mesa_pd/domain/BlockForestDataHandling.h index 2fae4d1191ee13e49414de77e5f8de8a49f82937..7f0e4172e43f6061051821764c3113156727eeec 100644 --- a/src/mesa_pd/domain/BlockForestDataHandling.h +++ b/src/mesa_pd/domain/BlockForestDataHandling.h @@ -68,22 +68,22 @@ class BlockForestDataHandling: public blockforest::BlockDataHandling<internal::P { public: BlockForestDataHandling(const std::shared_ptr<data::ParticleStorage>& ps) : ps_(ps) {} - virtual ~BlockForestDataHandling() {} + ~BlockForestDataHandling() override = default; - virtual internal::ParticleDeleter* initialize( IBlock * const block ) override; + internal::ParticleDeleter* initialize( IBlock * const block ) override; - virtual void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; - virtual internal::ParticleDeleter* deserialize( IBlock * const block ) override; - virtual void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; + void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; + internal::ParticleDeleter* deserialize( IBlock * const block ) override; + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; - virtual void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override; - virtual void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; + void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override; + void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; - virtual internal::ParticleDeleter* deserializeCoarseToFine( Block * const block ) override; - virtual internal::ParticleDeleter* deserializeFineToCoarse( Block * const block ) override; + internal::ParticleDeleter* deserializeCoarseToFine( Block * const block ) override; + internal::ParticleDeleter* deserializeFineToCoarse( Block * const block ) override; - virtual void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; - virtual void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override; + void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; + void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override; private: void deserializeImpl( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ); diff --git a/src/mesa_pd/kernel/ParticleSelector.h b/src/mesa_pd/kernel/ParticleSelector.h index 85d8b81b253fd2859d881c60ecd522d1d88124a2..9ac4392f568aa8a78730b664fe9b8fc28583e3de 100644 --- a/src/mesa_pd/kernel/ParticleSelector.h +++ b/src/mesa_pd/kernel/ParticleSelector.h @@ -59,8 +59,7 @@ public: bool operator()(const size_t idx, Accessor& ac) const { using namespace walberla::mesa_pd::data::particle_flags; - if (isSet(ac.getFlags(idx), GHOST)) return true; - return false; + return isSet(ac.getFlags(idx), GHOST); } }; @@ -71,8 +70,7 @@ public: bool operator()(const size_t idx, const size_t jdx, Accessor& ac) const { using namespace walberla::mesa_pd::data::particle_flags; - if (isSet(ac.getFlags(idx), INFINITE) && isSet(ac.getFlags(jdx), INFINITE)) return false; - return true; + return !(isSet(ac.getFlags(idx), INFINITE) && isSet(ac.getFlags(jdx), INFINITE)); } }; diff --git a/src/mesa_pd/vtk/OutputSelector.h b/src/mesa_pd/vtk/OutputSelector.h index 32ceb5dbdaa031ac2c231ac135402a14b9c2cb88..03665d48ef76fb409a793981df8d3561050c6736 100644 --- a/src/mesa_pd/vtk/OutputSelector.h +++ b/src/mesa_pd/vtk/OutputSelector.h @@ -38,7 +38,7 @@ class IOutputSelector { public: IOutputSelector( char const * const ts, const uint_t c) : type_string(ts), components(c) {} - virtual ~IOutputSelector() {} + virtual ~IOutputSelector() = default; virtual void push( std::ostream& os , const data::Particle&& p, const uint_t component ) = 0; virtual void push( walberla::vtk::Base64Writer& b64, const data::Particle&& p, const uint_t component ) = 0; diff --git a/src/pde/sweeps/Jacobi.h b/src/pde/sweeps/Jacobi.h index 89f3e52779b30f78c621ed235eb27f349fd7ea8f..9f8b4e714d2f94be4038ffbe36d38d6ab6c3172c 100644 --- a/src/pde/sweeps/Jacobi.h +++ b/src/pde/sweeps/Jacobi.h @@ -55,10 +55,10 @@ public: template< typename Stencil_T > void Jacobi< Stencil_T >::operator()( IBlock * const block ) { - Field_T * sf( NULL ); - Field_T * df( NULL ); - Field_T * ff( NULL ); - StencilField_T * stencil( NULL ); + Field_T * sf( nullptr ); + Field_T * df( nullptr ); + Field_T * ff( nullptr ); + StencilField_T * stencil( nullptr ); this->getFields( block, sf, df, ff, stencil ); WALBERLA_ASSERT_GREATER_EQUAL( sf->nrOfGhostLayers(), 1 ); diff --git a/src/pde/sweeps/JacobiFixedStencil.h b/src/pde/sweeps/JacobiFixedStencil.h index eb1367aae7f5f1a3f9dccce8202e70453e641bf7..4efc6fc5e8c9b7726ee5adae50c2207873648410 100644 --- a/src/pde/sweeps/JacobiFixedStencil.h +++ b/src/pde/sweeps/JacobiFixedStencil.h @@ -55,9 +55,9 @@ public: template< typename Stencil_T > void JacobiFixedStencil< Stencil_T >::operator()( IBlock * const block ) { - Field_T * sf( NULL ); - Field_T * df( NULL ); - Field_T * ff( NULL ); + Field_T * sf( nullptr ); + Field_T * df( nullptr ); + Field_T * ff( nullptr ); this->getFields( block, sf, df, ff ); WALBERLA_ASSERT_GREATER_EQUAL( sf->nrOfGhostLayers(), 1 ); diff --git a/src/pde/sweeps/RBGS.h b/src/pde/sweeps/RBGS.h index 69f7245fac91a5e77ec5bdddb2b25fa92d45d253..e8d800aa5fcad9a6181ac4fa1f01b60115bbe4d1 100644 --- a/src/pde/sweeps/RBGS.h +++ b/src/pde/sweeps/RBGS.h @@ -77,9 +77,9 @@ void RBGS< Stencil_T >::update( IBlock * const block, const bool rb ) WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); #endif - Field_T * uf( NULL ); - Field_T * ff( NULL ); - StencilField_T * stencil( NULL ); + Field_T * uf( nullptr ); + Field_T * ff( nullptr ); + StencilField_T * stencil( nullptr ); this->getFields( block, uf, ff, stencil ); WALBERLA_ASSERT_GREATER_EQUAL( uf->nrOfGhostLayers(), 1 ); diff --git a/src/pde/sweeps/RBGSFixedStencil.h b/src/pde/sweeps/RBGSFixedStencil.h index 75196987f18a941a716661f95873c8c960276904..5b57cc351de611f8046f9b3edf82aab084b5f5be 100644 --- a/src/pde/sweeps/RBGSFixedStencil.h +++ b/src/pde/sweeps/RBGSFixedStencil.h @@ -76,8 +76,8 @@ void RBGSFixedStencil< Stencil_T >::update( IBlock * const block, const bool rb WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); #endif - Field_T * uf( NULL ); - Field_T * ff( NULL ); + Field_T * uf( nullptr ); + Field_T * ff( nullptr ); this->getFields( block, uf, ff ); WALBERLA_ASSERT_GREATER_EQUAL( uf->nrOfGhostLayers(), 1 ); diff --git a/src/pde/sweeps/SOR.h b/src/pde/sweeps/SOR.h index 4997b40d6af610f7e995ae7229339dbb08e97b93..48a0b56e35561d06f5112fad685e12600da6a586 100644 --- a/src/pde/sweeps/SOR.h +++ b/src/pde/sweeps/SOR.h @@ -77,9 +77,9 @@ void SOR< Stencil_T >::update( IBlock * const block, const bool rb ) WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); #endif - Field_T * uf( NULL ); - Field_T * ff( NULL ); - StencilField_T * stencil( NULL ); + Field_T * uf( nullptr ); + Field_T * ff( nullptr ); + StencilField_T * stencil( nullptr ); this->getFields( block, uf, ff, stencil ); WALBERLA_ASSERT_GREATER_EQUAL( uf->nrOfGhostLayers(), 1 ); diff --git a/src/pde/sweeps/SORFixedStencil.h b/src/pde/sweeps/SORFixedStencil.h index d3983ab1861c856c388d7c2feb3601c654f0e58f..0e9387309fe0e7009aabd9b21d87347f9b0a9254 100644 --- a/src/pde/sweeps/SORFixedStencil.h +++ b/src/pde/sweeps/SORFixedStencil.h @@ -76,8 +76,8 @@ void SORFixedStencil< Stencil_T >::update( IBlock * const block, const bool rb ) WALBERLA_ASSERT( realIsIdentical( dir.length(), real_t(1) ) ); #endif - Field_T * uf( NULL ); - Field_T * ff( NULL ); + Field_T * uf( nullptr ); + Field_T * ff( nullptr ); this->getFields( block, uf, ff ); WALBERLA_ASSERT_GREATER_EQUAL( uf->nrOfGhostLayers(), 1 ); diff --git a/src/pe/bg/IBG.h b/src/pe/bg/IBG.h index 8c956b5675bb57fd2b02e701dedb39d7beb78d54..fa7ec0662a0a3699434a936de9580a454f1f0e94 100644 --- a/src/pe/bg/IBG.h +++ b/src/pe/bg/IBG.h @@ -29,7 +29,7 @@ namespace bg { class IBG : private NonCopyable { public: - virtual ~IBG() {}; + virtual ~IBG() = default; }; //************************************************************************************************* diff --git a/src/pe/bg/SimpleBGDataHandling.h b/src/pe/bg/SimpleBGDataHandling.h index 7b31e020ba98d5622486e35bbdba5d108e7c32e4..79535c82bf4cf537c3db9edf28f7c011c602de58 100644 --- a/src/pe/bg/SimpleBGDataHandling.h +++ b/src/pe/bg/SimpleBGDataHandling.h @@ -30,7 +30,7 @@ namespace bg { class SimpleBGDataHandling : public blockforest::AlwaysInitializeBlockDataHandling<SimpleBG>{ public: - SimpleBG * initialize( IBlock * const /*block*/ ) {return new SimpleBG();} + SimpleBG * initialize( IBlock * const /*block*/ ) override {return new SimpleBG();} }; inline diff --git a/src/pe/ccd/HashGrids.h b/src/pe/ccd/HashGrids.h index 24ecec304fea6ee52f02ae52b5c6c13500d10303..15b2968e3907ca575a2ef6fa821f5080335b9756 100644 --- a/src/pe/ccd/HashGrids.h +++ b/src/pe/ccd/HashGrids.h @@ -277,7 +277,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - ~HashGrids(); + ~HashGrids() override; //@} //********************************************************************************************** @@ -286,7 +286,7 @@ public: //@{ inline void add ( BodyID body ); void remove( BodyID body ); - inline int getObservedBodyCount() const { return observedBodyCount_ + static_cast<int> (globalStorage_.size()); } + inline int getObservedBodyCount() const override { return observedBodyCount_ + static_cast<int> (globalStorage_.size()); } //@} //********************************************************************************************** @@ -294,13 +294,13 @@ public: /*!\name Utility functions */ //@{ void clear (); - void reloadBodies(); + void reloadBodies() override; //@} //********************************************************************************************** //**Implementation of ICCD interface ******************************************************** - virtual PossibleContacts& generatePossibleContacts( WcTimingTree* tt = NULL ); - void update(WcTimingTree* tt = NULL); + PossibleContacts& generatePossibleContacts( WcTimingTree* tt = nullptr ) override; + void update(WcTimingTree* tt = nullptr); bool active() const { return gridActive_; } @@ -423,7 +423,7 @@ size_t HashGrids::HashGrid::process( BodyID** gridBodies, Contacts& contacts ) c Cell* nbCell = (*cell) + (*cell)->neighborOffset_[i]; BodyVector* nbBodies = nbCell->bodies_; - if( nbBodies != NULL ) + if( nbBodies != nullptr ) { for( auto aIt = cellBodies->begin(); aIt < cellBodies->end(); ++aIt ) { auto endNeighbour = nbBodies->begin(); @@ -480,7 +480,7 @@ void HashGrids::HashGrid::processBodies( BodyID* bodies, size_t bodyCount, Conta Cell* nbCell = cell + cell->neighborOffset_[i]; BodyVector* nbBodies = nbCell->bodies_; - if( nbBodies != NULL ) { + if( nbBodies != nullptr ) { auto endNeighbour = nbBodies->begin(); if ((*aIt)->isFixed()) { @@ -521,7 +521,7 @@ BodyID HashGrids::HashGrid::getBodyIntersectionForBlockCell(const Vector3<int32_ std::function<bool (const BodyID body)> isBodyVisibleFunc) const { real_t t_local; Vec3 n_local; - BodyID body = NULL; + BodyID body = nullptr; raytracing::IntersectsFunctor intersectsFunc(ray, t_local, n_local); @@ -577,7 +577,7 @@ BodyID HashGrids::HashGrid::getBodyIntersectionForBlockCell(const Vector3<int32_ const Cell* nbCell = ¢erCell + centerCell.neighborOffset_[neighborIndex]; const BodyVector* nbBodies = nbCell->bodies_; - if (nbBodies != NULL) { + if (nbBodies != nullptr) { for (const BodyID& cellBody: *nbBodies) { if (cellBody->isRemote()) { continue; @@ -618,8 +618,8 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c std::function<bool (const BodyID body)> isBodyVisibleFunc) const { const real_t realMax = std::numeric_limits<real_t>::max(); - BodyID body_local = NULL; - BodyID body_closest = NULL; + BodyID body_local = nullptr; + BodyID body_closest = nullptr; int32_t blockXCellCountMin = int32_c(blockAABB.xMin() * inverseCellSpan_) - 1; int32_t blockXCellCountMax = int32_c(std::ceil(blockAABB.xMax() * inverseCellSpan_)) + 1; @@ -642,7 +642,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c firstPointCenteredInCell = firstPoint - firstPointNormal * (cellSpan_/real_t(2)); tRayOriginToGrid = (ray.getOrigin() - firstPoint).length(); } else { - return NULL; + return nullptr; } } @@ -679,7 +679,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c body_local = getBodyIntersectionForBlockCell<BodyTuple>(currentCell, BLOCKCELL_NORMAL_INDETERMINATE, 0, ray, t_closest, n_closest, isBodyVisibleFunc); - if (body_local != NULL) { + if (body_local != nullptr) { body_closest = body_local; } } @@ -749,7 +749,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c body_local = getBodyIntersectionForBlockCell<BodyTuple>(currentCell, blockCellNormalAxis, blockCellNormalDir, ray, t_closest, n_closest, isBodyVisibleFunc); - if (body_local != NULL) { + if (body_local != nullptr) { body_closest = body_local; } } @@ -771,7 +771,7 @@ BodyID HashGrids::getClosestBodyIntersectingWithRay(const raytracing::Ray& ray, std::function<bool (const BodyID body)> isBodyVisibleFunc) const { const real_t realMax = std::numeric_limits<real_t>::max(); - BodyID body_closest = NULL; + BodyID body_closest = nullptr; real_t t_closest = realMax; Vec3 n_closest; @@ -791,7 +791,7 @@ BodyID HashGrids::getClosestBodyIntersectingWithRay(const raytracing::Ray& ray, for(auto grid: gridList_) { body_local = grid->getRayIntersectingBody<BodyTuple>(ray, blockAABB, t_closest, n_closest, isBodyVisibleFunc); - if (body_local != NULL){ + if (body_local != nullptr){ body_closest = body_local; } } diff --git a/src/pe/ccd/HashGridsBodyTrait.h b/src/pe/ccd/HashGridsBodyTrait.h index 40ab2505ecaffd12710fe6116f87dd2fca404769..3e82abcecef147eada6364c0d0b5a42f4660150d 100644 --- a/src/pe/ccd/HashGridsBodyTrait.h +++ b/src/pe/ccd/HashGridsBodyTrait.h @@ -88,7 +88,7 @@ protected: * \param body The rigid body containing this bounding box. */ inline HashGridsBodyTrait::HashGridsBodyTrait( ) - : grid_ (0) // Pointer to the hash grid this rigid body is currently assigned to + : grid_ (nullptr) // Pointer to the hash grid this rigid body is currently assigned to , hash_ (0) // Current hash value of this rigid body , cellId_(0) // The body's index in the body container of the grid cell this rigid body is currently assigned to {} diff --git a/src/pe/ccd/HashGridsDataHandling.h b/src/pe/ccd/HashGridsDataHandling.h index 43aa61863d15d97bef36c1355721ae9b070698a3..7190343c398f5e7b1f78bc7c7f3ed0d2b33dca83 100644 --- a/src/pe/ccd/HashGridsDataHandling.h +++ b/src/pe/ccd/HashGridsDataHandling.h @@ -33,7 +33,7 @@ namespace ccd { class HashGridsDataHandling : public blockforest::AlwaysInitializeBlockDataHandling<HashGrids>{ public: HashGridsDataHandling(const shared_ptr<BodyStorage>& globalStorage, const BlockDataID& storageID) : globalStorage_(globalStorage), storageID_(storageID) {} - HashGrids * initialize( IBlock * const block ) + HashGrids * initialize( IBlock * const block ) override { Storage* storage = block->getData< Storage >( storageID_ ); return new HashGrids(*globalStorage_, (*storage)[0], (*storage)[1]); diff --git a/src/pe/ccd/ICCD.h b/src/pe/ccd/ICCD.h index b47a301e4f4515b90dd7b53a756f6e34822b5106..8aeb8d50ac9ede85a2729ed29a6f865444c329d1 100644 --- a/src/pe/ccd/ICCD.h +++ b/src/pe/ccd/ICCD.h @@ -33,11 +33,11 @@ namespace ccd { class ICCD : private NonCopyable { public: - virtual ~ICCD() {} + virtual ~ICCD() = default; /// Generates a list of possible contact pairs. /// This list is also stored in the member variable contacts_ for reuse lateron. - virtual PossibleContacts& generatePossibleContacts( WcTimingTree* tt = NULL ) = 0; + virtual PossibleContacts& generatePossibleContacts( WcTimingTree* tt = nullptr ) = 0; PossibleContacts& getPossibleContacts() {return contacts_;} virtual void reloadBodies() {} diff --git a/src/pe/ccd/SimpleCCD.h b/src/pe/ccd/SimpleCCD.h index 42a54f5993cf18bb5a9ee2073eb940d919660cfd..f00a0faee690cba756b980b38f15e13b627c3d69 100644 --- a/src/pe/ccd/SimpleCCD.h +++ b/src/pe/ccd/SimpleCCD.h @@ -29,11 +29,11 @@ namespace ccd { class SimpleCCD : public ICCD{ public: explicit SimpleCCD(BodyStorage& globalStorage, Storage& storage); - ~SimpleCCD(); + ~SimpleCCD() override; - virtual PossibleContacts& generatePossibleContacts( WcTimingTree* tt = NULL ); + PossibleContacts& generatePossibleContacts( WcTimingTree* tt = nullptr ) override; - int getObservedBodyCount() const; + int getObservedBodyCount() const override; private: //**Add/remove functions********************************************************************* /*!\name Add/remove functions */ diff --git a/src/pe/ccd/SimpleCCDDataHandling.h b/src/pe/ccd/SimpleCCDDataHandling.h index e6eba77091c6ea9a72aa8f5659f82d76d5f04116..2cf7756b7f6e6bee7ab5cab79b287200ca5f360e 100644 --- a/src/pe/ccd/SimpleCCDDataHandling.h +++ b/src/pe/ccd/SimpleCCDDataHandling.h @@ -33,7 +33,7 @@ namespace ccd { class SimpleCCDDataHandling : public blockforest::AlwaysInitializeBlockDataHandling<SimpleCCD>{ public: SimpleCCDDataHandling(const shared_ptr<BodyStorage>& globalStorage, const BlockDataID& storageID) : globalStorage_(globalStorage), storageID_(storageID) {} - SimpleCCD * initialize( IBlock * const block ) + SimpleCCD * initialize( IBlock * const block ) override { Storage* storage = block->getData< Storage >( storageID_ ); return new SimpleCCD(*globalStorage_, *storage); diff --git a/src/pe/cr/DEM.h b/src/pe/cr/DEM.h index f716157ef9f3302bf05195a3a280f534f9c280b1..21e1e16cf1088a2a1c53dcc7ca891bb439a6017a 100644 --- a/src/pe/cr/DEM.h +++ b/src/pe/cr/DEM.h @@ -51,7 +51,7 @@ public: , domain_decomposition::BlockDataID storageID , domain_decomposition::BlockDataID ccdID , domain_decomposition::BlockDataID fcdID - , WcTimingTree* tt = NULL); + , WcTimingTree* tt = nullptr); /// forwards to timestep /// Convenience operator to make class a functor. @@ -61,9 +61,9 @@ public: inline Integrator getIntegrator() const { return integrate_; } inline ContactResolver getContactResolver() const { return resolveContact_; } - virtual inline real_t getMaximumPenetration() const override { return maxPenetration_; } - virtual inline size_t getNumberOfContacts() const override { return numberOfContacts_; } - virtual inline size_t getNumberOfContactsTreated() const override { return numberOfContactsTreated_; } + inline real_t getMaximumPenetration() const override { return maxPenetration_; } + inline size_t getNumberOfContacts() const override { return numberOfContacts_; } + inline size_t getNumberOfContactsTreated() const override { return numberOfContactsTreated_; } private: Integrator integrate_; ContactResolver resolveContact_; @@ -87,7 +87,7 @@ public: , domain_decomposition::BlockDataID storageID , domain_decomposition::BlockDataID ccdID , domain_decomposition::BlockDataID fcdID - , WcTimingTree* tt = NULL) + , WcTimingTree* tt = nullptr) : DEMSolver<IntegrateImplicitEuler, ResolveContactSpringDashpotHaffWerner>( IntegrateImplicitEuler(), ResolveContactSpringDashpotHaffWerner(), globalBodyStorage, blockStorage, storageID, ccdID, fcdID, tt ) diff --git a/src/pe/cr/DEM.impl.h b/src/pe/cr/DEM.impl.h index a3560e50fd94ba9daf71b71032deaa4ad3a9ec58..792f59bb3cd8ca2d7d21a78af36f6a84a4e9038f 100644 --- a/src/pe/cr/DEM.impl.h +++ b/src/pe/cr/DEM.impl.h @@ -77,9 +77,9 @@ void DEMSolver<Integrator,ContactResolver>::timestep( real_t dt ) ccd::ICCD* ccd = currentBlock.getData< ccd::ICCD >( ccdID_ ); fcd::IFCD* fcd = currentBlock.getData< fcd::IFCD >( fcdID_ ); ccd->generatePossibleContacts( tt_ ); - if (tt_ != NULL) tt_->start("FCD"); + if (tt_ != nullptr) tt_->start("FCD"); Contacts& cont = fcd->generateContacts( ccd->getPossibleContacts() ); - if (tt_ != NULL) tt_->stop("FCD"); + if (tt_ != nullptr) tt_->stop("FCD"); for (auto cIt = cont.begin(); cIt != cont.end(); ++cIt){ const real_t overlap( -cIt->getDistance() ); @@ -100,9 +100,9 @@ void DEMSolver<Integrator,ContactResolver>::timestep( real_t dt ) // if (numContacts > 0) // WALBERLA_LOG_DEVEL_ON_ROOT("#Contacts: " << numContacts << "." ); - if (tt_ != NULL) tt_->start("ForceSync"); + if (tt_ != nullptr) tt_->start("ForceSync"); reduceForces( *blockStorage_, storageID_, *globalBodyStorage_); - if (tt_ != NULL) tt_->stop("ForceSync"); + if (tt_ != nullptr) tt_->stop("ForceSync"); for (auto it = blockStorage_->begin(); it != blockStorage_->end(); ++it) { @@ -114,7 +114,7 @@ void DEMSolver<Integrator,ContactResolver>::timestep( real_t dt ) // Updating the positions and velocities of all locally owned and global rigid bodies (but not shadow copies). WALBERLA_LOG_DETAIL( "Time integration starts...\n" ); - if (tt_ != NULL) tt_->start("Integration"); + if (tt_ != nullptr) tt_->start("Integration"); for( auto bodyIt = localStorage.begin(); bodyIt != localStorage.end(); ++bodyIt ) { @@ -140,7 +140,7 @@ void DEMSolver<Integrator,ContactResolver>::timestep( real_t dt ) bodyIt->resetForceAndTorque(); } - if (tt_ != NULL) tt_->stop("Integration"); + if (tt_ != nullptr) tt_->stop("Integration"); // Reset forces of shadow copies for( auto& body : shadowStorage ) { diff --git a/src/pe/cr/HCSITS.h b/src/pe/cr/HCSITS.h index 742799f0833916273632ea816bfa9ff548c59427..8cf803c466fb0ec96d1af889802f44551dd216db 100644 --- a/src/pe/cr/HCSITS.h +++ b/src/pe/cr/HCSITS.h @@ -117,22 +117,22 @@ public: domain_decomposition::BlockDataID storageID, domain_decomposition::BlockDataID ccdID, domain_decomposition::BlockDataID fcdID, - WcTimingTree* tt = NULL ); + WcTimingTree* tt = nullptr ); //@} //********************************************************************************************** //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - ~HardContactSemiImplicitTimesteppingSolvers(); + ~HardContactSemiImplicitTimesteppingSolvers() override; //@} //********************************************************************************************** //**Get functions******************************************************************************* /*!\name Get functions */ //@{ - virtual inline real_t getMaximumPenetration() const override; - virtual inline size_t getNumberOfContacts() const override; - virtual inline size_t getNumberOfContactsTreated() const override; + inline real_t getMaximumPenetration() const override; + inline size_t getNumberOfContacts() const override; + inline size_t getNumberOfContactsTreated() const override; inline const std::map<IBlockID::IDType, ContactCache> getContactCache() const { return blockToContactCache_; } inline real_t getSpeedLimitFactor() const; inline size_t getMaxIterations() const { return maxIterations_; } diff --git a/src/pe/cr/HCSITS.impl.h b/src/pe/cr/HCSITS.impl.h index 7218b4580519cd623a74976c678a5786eba69184..25cccf846670b51e57300aa82a6fad088a242da9 100644 --- a/src/pe/cr/HCSITS.impl.h +++ b/src/pe/cr/HCSITS.impl.h @@ -157,7 +157,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d numContactsTreated_ = 0; maximumPenetration_ = 0; - if (tt_ != NULL) tt_->start("Simulation Step"); + if (tt_ != nullptr) tt_->start("Simulation Step"); for (auto it = blockStorage_->begin(); it != blockStorage_->end(); ++it) { @@ -176,13 +176,13 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d // Detect all collisions WALBERLA_LOG_DETAIL( "Detecting contacts..."); - if (tt_ != NULL) tt_->start("Collision Detection"); + if (tt_ != nullptr) tt_->start("Collision Detection"); ccd->generatePossibleContacts( tt_ ); - if (tt_ != NULL) tt_->start("Fine"); + if (tt_ != nullptr) tt_->start("Fine"); Contacts& contacts = fcd->generateContacts( ccd->getPossibleContacts() ); - if (tt_ != NULL) tt_->stop("Fine"); + if (tt_ != nullptr) tt_->stop("Fine"); - if (tt_ != NULL) tt_->start("Filtering"); + if (tt_ != nullptr) tt_->start("Filtering"); // Filter out contacts size_t numContacts( contacts.size() ); size_t numContactsMasked( 0 ); @@ -204,10 +204,10 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d numContactsTreated_ += numContactsMasked; // WALBERLA_LOG_DEVEL("contact filtering: " << numContactsMasked << "/" << contacts.size()); - if (tt_ != NULL) tt_->stop("Filtering"); - if (tt_ != NULL) tt_->stop("Collision Detection"); + if (tt_ != nullptr) tt_->stop("Filtering"); + if (tt_ != nullptr) tt_->stop("Collision Detection"); - if (tt_ != NULL) tt_->start("Collision Response Contact Caching"); + if (tt_ != nullptr) tt_->start("Collision Response Contact Caching"); // Cache contact properties contactCache.resize( numContactsMasked ); @@ -277,8 +277,8 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d } } - if (tt_ != NULL) tt_->stop("Collision Response Contact Caching"); - if (tt_ != NULL) tt_->start("Collision Response Body Caching"); + if (tt_ != nullptr) tt_->stop("Collision Response Contact Caching"); + if (tt_ != nullptr) tt_->start("Collision Response Body Caching"); // Cache body properties (and time integrate v and w to the end of the time step by applying external forces, torques and accelerations) size_t numBodies( globalBodyStorage_->size() + localStorage.size() + shadowStorage.size() ); @@ -331,10 +331,10 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d #endif } - if (tt_ != NULL) tt_->stop("Collision Response Body Caching"); + if (tt_ != nullptr) tt_->stop("Collision Response Body Caching"); } - if (blockStorage_->size() == 0) + if (blockStorage_->empty()) { // create artificial block to handle global bodies even on processes where there are no blocks BodyCache& bodyCache = blockToBodyCache_[0]; @@ -357,7 +357,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d } } - if (tt_ != NULL) tt_->start("Collision Response Resolution"); + if (tt_ != nullptr) tt_->start("Collision Response Resolution"); const real_t rp = relaxationParam_; relaxationParam_ = real_c(1); // must be set to 1.0 such that dv and dw caused by external forces and torques are not falsely altered synchronizeVelocities( ); @@ -372,7 +372,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d iteration_ = it; - if (tt_ != NULL) tt_->start("Collision Response Solving"); + if (tt_ != nullptr) tt_->start("Collision Response Solving"); for (auto blkIt = blockStorage_->begin(); blkIt != blockStorage_->end(); ++blkIt) { IBlock& currentBlock = *blkIt; @@ -410,7 +410,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d } } - if (tt_ != NULL) tt_->stop("Collision Response Solving"); + if (tt_ != nullptr) tt_->stop("Collision Response Solving"); synchronizeVelocities( ); @@ -438,8 +438,8 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d #endif } - if (tt_ != NULL) tt_->stop("Collision Response Resolution"); - if (tt_ != NULL) tt_->start("Collision Response Integration"); + if (tt_ != nullptr) tt_->stop("Collision Response Resolution"); + if (tt_ != nullptr) tt_->start("Collision Response Integration"); // WARNING: Even though bodyCache.dv_[j] and bodyCache.dw_[j] _should_ be exactly 0 at all times for // bodies with infinite mass/inertia, this is not the case if the simulation breaks. @@ -504,12 +504,12 @@ inline void HardContactSemiImplicitTimesteppingSolvers::timestep( const real_t d // NOTE: We might still need shadow copy updates if the user sets velocities or positions. Thus we might have to split up synchronize() again. It doesn't break anything if we still communicate the shadow copy updates though. } - if (tt_ != NULL) tt_->stop("Collision Response Integration"); + if (tt_ != nullptr) tt_->stop("Collision Response Integration"); blockToBodyCache_.clear(); blockToContactCache_.clear(); - if (tt_ != NULL) tt_->stop("Simulation Step"); + if (tt_ != nullptr) tt_->stop("Simulation Step"); } //************************************************************************************************* @@ -1506,8 +1506,8 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) if ((mpi::MPIManager::instance()->numProcesses() <= 1) && (blockStorage_->size() <= 1)) return; - if (tt_ != NULL) tt_->start("Velocity Sync"); - if (tt_ != NULL) tt_->start("Velocity Sync Correction Assembling"); + if (tt_ != nullptr) tt_->start("Velocity Sync"); + if (tt_ != nullptr) tt_->start("Velocity Sync Correction Assembling"); // Sending local force contributions of shadow copies to owner. WALBERLA_LOG_DETAIL( "Assembling of velocity correction message starts...\n" ); @@ -1558,12 +1558,12 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) } } - if (tt_ != NULL) tt_->stop("Velocity Sync Correction Assembling"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Correction Assembling"); // for( ProcessIterator process = processstorage_.begin(); process != processstorage_.end(); ++process ) // sentVelocitiesSyncCorrections_.transfered( process->getSendBuffer().size() ); - if (tt_ != NULL) tt_->start("Velocity Sync Correction Communicate"); + if (tt_ != nullptr) tt_->start("Velocity Sync Correction Communicate"); WALBERLA_LOG_DETAIL( "Communication of velocity correction message starts..." ); @@ -1573,12 +1573,12 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) syncVelBS.setReceiverInfo(recvRanks, true); syncVelBS.sendAll(); - if (tt_ != NULL) tt_->stop("Velocity Sync Correction Communicate"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Correction Communicate"); // for( ProcessIterator process = processstorage_.begin(); process != processstorage_.end(); ++process ) // receivedVelocitiesSyncCorrections_.transfered( process->getRecvBuffer().size() ); - if (tt_ != NULL) tt_->start("Velocity Sync Correction Parsing"); + if (tt_ != nullptr) tt_->start("Velocity Sync Correction Parsing"); // Receiving force and torque contributions WALBERLA_LOG_DETAIL( "Parsing of velocity correction message starts..."); @@ -1595,7 +1595,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) // it.buffer() >> sender; it.buffer() >> receiver; auto blk = blockStorage_->getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); IBlock& block = *blk; Storage* storage = block.uncheckedFastGetData< Storage >( storageID_ ); BodyStorage& localStorage = (*storage)[0]; @@ -1606,9 +1606,9 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) // if (tt_ != NULL) tt_->stop("Inside Loop"); } - if (tt_ != NULL) tt_->stop("Velocity Sync Correction Parsing"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Correction Parsing"); - if (tt_ != NULL) tt_->start("Velocity Sync Update Assembling"); + if (tt_ != nullptr) tt_->start("Velocity Sync Update Assembling"); WALBERLA_LOG_DETAIL( "Assembling of velocity update message starts..."); //========================================================== @@ -1657,24 +1657,24 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) } } - if (tt_ != NULL) tt_->stop("Velocity Sync Update Assembling"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Update Assembling"); // for( ProcessIterator process = processstorage_.begin(); process != processstorage_.end(); ++process ) // sentVelocitiesSyncUpdates_.transfered( process->getSendBuffer().size() ); - if (tt_ != NULL) tt_->start("Velocity Sync Update Communincate"); + if (tt_ != nullptr) tt_->start("Velocity Sync Update Communincate"); WALBERLA_LOG_DETAIL( "Communication of velocity update message starts..."); syncVelBS.setReceiverInfo(recvRanks, true); syncVelBS.sendAll(); - if (tt_ != NULL) tt_->stop("Velocity Sync Update Communincate"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Update Communincate"); // for( ProcessIterator process = processstorage_.begin(); process != processstorage_.end(); ++process ) // receivedVelocitiesSyncUpdates_.transfered( process->getRecvBuffer().size() ); - if (tt_ != NULL) tt_->start("Velocity Sync Update Processing"); + if (tt_ != nullptr) tt_->start("Velocity Sync Update Processing"); // Receiving velocity updates WALBERLA_LOG_DETAIL( "Parsing of velocity update message starts..."); @@ -1691,7 +1691,7 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) // it.buffer() >> sender; it.buffer() >> receiver; auto blk = blockStorage_->getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); IBlock& block = *blk; Storage* storage = block.uncheckedFastGetData< Storage >( storageID_ ); // BodyStorage& localStorage = (*storage)[0]; @@ -1702,9 +1702,9 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) // if (tt_ != NULL) tt_->stop("Inside Loop"); } - if (tt_ != NULL) tt_->stop("Velocity Sync Update Processing"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Update Processing"); - if (tt_ != NULL) tt_->start("Velocity Sync Globals"); + if (tt_ != nullptr) tt_->start("Velocity Sync Globals"); /* { size_t i; @@ -1743,8 +1743,8 @@ inline void HardContactSemiImplicitTimesteppingSolvers::synchronizeVelocities( ) } }*/ - if (tt_ != NULL) tt_->stop("Velocity Sync Globals"); - if (tt_ != NULL) tt_->stop("Velocity Sync"); + if (tt_ != nullptr) tt_->stop("Velocity Sync Globals"); + if (tt_ != nullptr) tt_->stop("Velocity Sync"); } //************************************************************************************************* diff --git a/src/pe/cr/ICR.h b/src/pe/cr/ICR.h index 73d1868d3be50e43269ce044052bc32fedcadacd..7c86a9fa0c21e666b6345988e62137d5c6947795 100644 --- a/src/pe/cr/ICR.h +++ b/src/pe/cr/ICR.h @@ -31,7 +31,7 @@ namespace cr { class ICR { public: ICR() : /*globalLinearDrag_(0),*/ globalLinearAcceleration_(0) {} - virtual ~ICR() {} + virtual ~ICR() = default; virtual void timestep( const real_t dt ) = 0; diff --git a/src/pe/cr/PlainIntegrator.h b/src/pe/cr/PlainIntegrator.h index 92abbbfb3746b59f08927fb9222b4b72bd00045f..c2284eff2e0c9400430eda5d6cb29be068e8a153 100644 --- a/src/pe/cr/PlainIntegrator.h +++ b/src/pe/cr/PlainIntegrator.h @@ -46,13 +46,13 @@ public: const shared_ptr<BodyStorage>& globalBodyStorage, const shared_ptr<BlockStorage>& blockStorage, domain_decomposition::BlockDataID storageID, - WcTimingTree* tt = NULL ); + WcTimingTree* tt = nullptr ); /// forwards to timestep /// Convenience operator to make class a functor. void operator()(const real_t dt) { timestep(dt); } /// Advances the simulation dt seconds. - void timestep( const real_t dt ); + void timestep( const real_t dt ) override; private: const Integrator integrate_; shared_ptr<BodyStorage> globalBodyStorage_; @@ -67,7 +67,7 @@ public: PlainIntegrator( const shared_ptr<BodyStorage>& globalBodyStorage , const shared_ptr<BlockStorage>& blockStorage , domain_decomposition::BlockDataID storageID - , WcTimingTree* tt = NULL) + , WcTimingTree* tt = nullptr) : PlainIntegratorSolver<IntegrateImplicitEuler>( IntegrateImplicitEuler(), globalBodyStorage, blockStorage, storageID, tt ) { diff --git a/src/pe/cr/PlainIntegrator.impl.h b/src/pe/cr/PlainIntegrator.impl.h index e2a45b2f8eda5405f858db551101d17f545e6537..cd071eb7f7e5986415f3dae5889dd8243c28d995 100644 --- a/src/pe/cr/PlainIntegrator.impl.h +++ b/src/pe/cr/PlainIntegrator.impl.h @@ -57,8 +57,8 @@ PlainIntegratorSolver<Integrator>::PlainIntegratorSolver( const Integrator & int template< typename Integrator > void PlainIntegratorSolver<Integrator>::timestep( const real_t dt ) { - if (tt_!=NULL) tt_->start("PlainIntegrator"); - if (tt_!=NULL) tt_->start("Integrate Bodies"); + if (tt_!=nullptr) tt_->start("PlainIntegrator"); + if (tt_!=nullptr) tt_->start("Integrate Bodies"); for (auto it = blockStorage_->begin(); it != blockStorage_->end(); ++it){ IBlock & currentBlock = *it; Storage * storage = currentBlock.getData< Storage >( storageID_ ); @@ -80,8 +80,8 @@ void PlainIntegratorSolver<Integrator>::timestep( const real_t dt ) WALBERLA_ASSERT( bd->checkInvariants(), "Invalid body state detected" ); } } - if (tt_!=NULL) tt_->stop("Integrate Bodies"); - if (tt_!=NULL) tt_->stop("PlainIntegrator"); + if (tt_!=nullptr) tt_->stop("Integrate Bodies"); + if (tt_!=nullptr) tt_->stop("PlainIntegrator"); } } // namespace cr diff --git a/src/pe/fcd/GenericFCD.h b/src/pe/fcd/GenericFCD.h index 27a311f3c3bdb48552103bed3c47c18f7d05e0d0..c054ae55ca2deb66bb4f3174c82e4f52f83c894e 100644 --- a/src/pe/fcd/GenericFCD.h +++ b/src/pe/fcd/GenericFCD.h @@ -36,7 +36,7 @@ namespace fcd { template <typename BodyTypeTuple, template <typename Container> class CollisionFunctor > class GenericFCD : public IFCD{ public: - virtual Contacts& generateContacts(PossibleContacts& possibleContacts) + Contacts& generateContacts(PossibleContacts& possibleContacts) override { contacts_.clear(); CollisionFunctor<decltype(contacts_)> func(contacts_); diff --git a/src/pe/fcd/IFCD.h b/src/pe/fcd/IFCD.h index 0fb86fc595ce0c4bfedb3096a4ddaf5b6a325c66..e34592b3df6320c97a0fa6104f438d5464fe2f2f 100644 --- a/src/pe/fcd/IFCD.h +++ b/src/pe/fcd/IFCD.h @@ -35,7 +35,7 @@ namespace fcd { class IFCD : private NonCopyable{ public: - virtual ~IFCD() {}; + virtual ~IFCD() = default; /// /// \brief generates a list of actual collisions diff --git a/src/pe/fcd/SimpleFCD.h b/src/pe/fcd/SimpleFCD.h index 6f38ec19067a54641867b2315048af3af2a0937f..0527459aab63d93d6c10660c14fb3e7223dbd452 100644 --- a/src/pe/fcd/SimpleFCD.h +++ b/src/pe/fcd/SimpleFCD.h @@ -32,7 +32,7 @@ namespace fcd { template <typename BodyTypeTuple> class SimpleFCD : public GenericFCD<BodyTypeTuple, AnalyticCollideFunctor>{ public: - virtual ~SimpleFCD(){} + ~SimpleFCD() override = default; }; } diff --git a/src/pe/raytracing/Intersects.h b/src/pe/raytracing/Intersects.h index 3746ce6d01ccb4f47b4e1d4584aacf610496dee3..ea7c6f8507b52b20e03d21a6d2400e0078f60ec1 100644 --- a/src/pe/raytracing/Intersects.h +++ b/src/pe/raytracing/Intersects.h @@ -45,7 +45,7 @@ inline bool intersects(const EllipsoidID ellipsoid, const Ray& ray, real_t& t, V inline bool intersects(const BodyID body, const Ray& ray, real_t& t, Vec3& n); -inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t padding = real_t(0.0), Vec3* n = NULL); +inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t padding = real_t(0.0), Vec3* n = nullptr); inline bool intersectsSphere(const Vec3& gpos, real_t radius, const Ray& ray, real_t& t0, real_t& t1); struct IntersectsFunctor @@ -430,14 +430,14 @@ inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t paddi tmax = tzmax; } - if (n != NULL) { + if (n != nullptr) { (*n)[0] = (*n)[1] = (*n)[2] = real_t(0); } real_t t_; if (tmin > 0) { // ray hit box from outside t_ = tmin; - if (n != NULL) { + if (n != nullptr) { (*n)[tminAxis] = real_t(1); } } else if (tmax < 0) { @@ -447,12 +447,12 @@ inline bool intersects(const AABB& aabb, const Ray& ray, real_t& t, real_t paddi } else { // ray origin within box t_ = tmax; - if (n != NULL) { + if (n != nullptr) { (*n)[tmaxAxis] = real_t(1); } } - if (n != NULL) { + if (n != nullptr) { if (ray.getDirection() * (*n) > 0) { *n = -(*n); } diff --git a/src/pe/raytracing/Lighting.h b/src/pe/raytracing/Lighting.h index 451cfe3357ca80dad10613a79251ed75da366898..1d64cbc87aba6b71032b807a92d586ab0b277214 100644 --- a/src/pe/raytracing/Lighting.h +++ b/src/pe/raytracing/Lighting.h @@ -39,9 +39,7 @@ struct Lighting { /*!\brief Instantiation constructor for the Lighting struct. */ - Lighting () { - - } + Lighting () = default; /*!\brief Instantiation constructor for the Lighting struct. * \param pointLightOrigin Origin of the point light. diff --git a/src/pe/raytracing/Raytracer.h b/src/pe/raytracing/Raytracer.h index 39c42aa213a0af99570f9faccb64d2b5e33ee57c..f531527608950ec9a43ccac11a930e55bd6007b3 100644 --- a/src/pe/raytracing/Raytracer.h +++ b/src/pe/raytracing/Raytracer.h @@ -183,7 +183,7 @@ public: /*!\name Functions */ //@{ template <typename BodyTypeTuple> - void generateImage(const size_t timestep, WcTimingTree* tt = NULL ); + void generateImage(const size_t timestep, WcTimingTree* tt = nullptr ); void setupView_(); void setupFilenameRankWidth_(); @@ -191,9 +191,9 @@ public: private: void localOutput(const std::vector<BodyIntersectionInfo>& intersectionsBuffer, size_t timestep, - WcTimingTree* tt = NULL); + WcTimingTree* tt = nullptr); void output(const std::vector<BodyIntersectionInfo>& intersectionsBuffer, size_t timestep, - WcTimingTree* tt = NULL); + WcTimingTree* tt = nullptr); std::string getOutputFilename(const std::string& base, size_t timestep, bool isGlobalImage) const; void writeImageToFile(const std::vector<BodyIntersectionInfo>& intersectionsBuffer, @@ -201,9 +201,9 @@ private: void writeImageToFile(const std::vector<BodyIntersectionInfo>& intersectionsBuffer, const std::string& fileName) const; - void syncImageUsingMPIReduce(std::vector<BodyIntersectionInfo>& intersectionsBuffer, WcTimingTree* tt = NULL); + void syncImageUsingMPIReduce(std::vector<BodyIntersectionInfo>& intersectionsBuffer, WcTimingTree* tt = nullptr); void syncImageUsingMPIGather(std::vector<BodyIntersectionInfo>& intersections, - std::vector<BodyIntersectionInfo>& intersectionsBuffer, WcTimingTree* tt = NULL); + std::vector<BodyIntersectionInfo>& intersectionsBuffer, WcTimingTree* tt = nullptr); inline bool isPlaneVisible(const PlaneID plane, const Ray& ray) const; inline size_t coordinateToArrayIndex(size_t x, size_t y) const; @@ -502,7 +502,7 @@ inline void Raytracer::traceRayInHashGrids(const Ray& ray, BodyID& body_closest, const ccd::HashGrids* hashgrids = blockIt->uncheckedFastGetData<ccd::HashGrids>(ccdID_); BodyID body = hashgrids->getClosestBodyIntersectingWithRay<BodyTypeTuple>(ray, blockAABB, t, n, isBodyVisibleFunc_); - if (body != NULL && t < t_closest) { + if (body != nullptr && t < t_closest) { t_closest = t; body_closest = body; n_closest = n; @@ -519,7 +519,7 @@ inline void Raytracer::traceRayInHashGrids(const Ray& ray, BodyID& body_closest, */ template <typename BodyTypeTuple> void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { - if (tt != NULL) tt->start("Raytracing"); + if (tt != nullptr) tt->start("Raytracing"); const real_t realMax = std::numeric_limits<real_t>::max(); std::vector<BodyIntersectionInfo> intersections; @@ -529,25 +529,25 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { if (raytracingAlgorithm_ == RAYTRACE_HASHGRIDS || raytracingAlgorithm_ == RAYTRACE_COMPARE_BOTH || raytracingAlgorithm_ == RAYTRACE_COMPARE_BOTH_STRICTLY) { - if (tt != NULL) tt->start("HashGrids Update"); + if (tt != nullptr) tt->start("HashGrids Update"); for (auto blockIt = forest_->begin(); blockIt != forest_->end(); ++blockIt) { ccd::HashGrids* hashgrids = blockIt->getData<ccd::HashGrids>(ccdID_); hashgrids->update(); } - if (tt != NULL) tt->stop("HashGrids Update"); + if (tt != nullptr) tt->stop("HashGrids Update"); } real_t t, t_closest; Vec3 n; Vec3 n_closest; - BodyID body_closest = NULL; + BodyID body_closest = nullptr; Ray ray(cameraPosition_, Vec3(1,0,0)); IntersectsFunctor func(ray, t, n); bool isErrorneousPixel = false; uint_t pixelErrors = 0; std::map<BodyID, std::unordered_set<BodyID>> correctToIncorrectBodyIDsMap; - if (tt != NULL) tt->start("Intersection Testing"); + if (tt != nullptr) tt->start("Intersection Testing"); for (size_t x = 0; x < pixelsHorizontal_*antiAliasFactor_; x++) { for (size_t y = 0; y < pixelsVertical_*antiAliasFactor_; y++) { Vec3 pixelLocation = viewingPlaneOrigin_ + u_*(real_c(x)+real_t(0.5))*pixelWidth_ + v_*(real_c(y)+real_t(0.5))*pixelHeight_; @@ -556,7 +556,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { n.reset(); t_closest = realMax; - body_closest = NULL; + body_closest = nullptr; if (raytracingAlgorithm_ == RAYTRACE_HASHGRIDS) { traceRayInHashGrids<BodyTypeTuple>(ray, body_closest, t_closest, n_closest); @@ -567,7 +567,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { BodyID hashgrids_body_closest = body_closest; t_closest = realMax; - body_closest = NULL; + body_closest = nullptr; traceRayNaively<BodyTypeTuple>(ray, body_closest, t_closest, n_closest); if (body_closest != hashgrids_body_closest) { @@ -583,7 +583,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { intersectionInfo.imageX = uint32_t(x); intersectionInfo.imageY = uint32_t(y); - if (!realIsIdentical(t_closest, realMax) && body_closest != NULL) { + if (!realIsIdentical(t_closest, realMax) && body_closest != nullptr) { Color color = getColor(body_closest, ray, t_closest, n_closest); if (isErrorneousPixel) { color = Color(1,0,0); @@ -606,7 +606,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { } } } - if (tt != NULL) tt->stop("Intersection Testing"); + if (tt != nullptr) tt->stop("Intersection Testing"); if (raytracingAlgorithm_ == RAYTRACE_COMPARE_BOTH || raytracingAlgorithm_ == RAYTRACE_COMPARE_BOTH_STRICTLY) { if (pixelErrors > 0) { @@ -615,7 +615,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { std::stringstream ss; for (auto it: correctToIncorrectBodyIDsMap) { const BodyID correctBody = it.first; - if (it.first != NULL) { + if (it.first != nullptr) { ss << " correct body: " << correctBody->getID() << "(" << correctBody->getHash() << ")"; } else { ss << " no body naively found"; @@ -623,7 +623,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { ss << ", hashgrids found:"; for (auto incorrectBody: it.second) { ss << " "; - if (incorrectBody != NULL) { + if (incorrectBody != nullptr) { ss << incorrectBody->getID() << "(" << incorrectBody->getHash(); } else { ss << "NULL"; @@ -662,7 +662,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { output(intersectionsBuffer, timestep, tt); - if (tt != NULL) tt->stop("Raytracing"); + if (tt != nullptr) tt->stop("Raytracing"); } /*!\brief Computes the color for a certain intersection. diff --git a/src/pe/raytracing/ShadingParameters.h b/src/pe/raytracing/ShadingParameters.h index 7e476527d1bd665c4017780f8858dbd39aff8876..c6a7eb16c23930a40292684ab6f8654699b8f214 100644 --- a/src/pe/raytracing/ShadingParameters.h +++ b/src/pe/raytracing/ShadingParameters.h @@ -36,9 +36,7 @@ struct ShadingParameters { /*!\brief Instantiation constructor for the Shading struct. */ - ShadingParameters () { - - } + ShadingParameters () = default; /*!\brief Instantiation constructor for the Shading struct. * \param diffuseColor Primary color of the material. diff --git a/src/pe/rigidbody/BodyIterators.h b/src/pe/rigidbody/BodyIterators.h index 903a1195bb596929a501a9c55a722b54245b3806..1948465f634c5aeea2bd22906e567965843843f1 100644 --- a/src/pe/rigidbody/BodyIterators.h +++ b/src/pe/rigidbody/BodyIterators.h @@ -51,14 +51,7 @@ public: { if (ended_ || rhs.ended_) { - if (ended_ == rhs.ended_) - { - return true; - } - else - { - return false; - } + return ended_ == rhs.ended_; } //std::vector::iterator cannot be compared between different instances (assert!) @@ -169,14 +162,7 @@ public: { if (ended_ || rhs.ended_) { - if (ended_ == rhs.ended_) - { - return true; - } - else - { - return false; - } + return ended_ == rhs.ended_; } return it_ == rhs.it_; @@ -265,14 +251,7 @@ public: { if (ended_ || rhs.ended_) { - if (ended_ == rhs.ended_) - { - return true; - } - else - { - return false; - } + return ended_ == rhs.ended_; } return it_ == rhs.it_; diff --git a/src/pe/rigidbody/Box.h b/src/pe/rigidbody/Box.h index 266aead5d9d9f4e1dfb1a6ebce1dad29a2d31544..883739868f995502cf292bee6540e4d3f5136a58 100644 --- a/src/pe/rigidbody/Box.h +++ b/src/pe/rigidbody/Box.h @@ -74,7 +74,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Box(); + ~Box() override; //@} //********************************************************************************************** @@ -83,7 +83,7 @@ public: /*!\name Get functions */ //@{ inline const Vec3& getLengths() const; - virtual inline real_t getVolume() const; + inline real_t getVolume() const override; //@} //********************************************************************************************** @@ -119,15 +119,15 @@ public: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual Vec3 support( const Vec3& d ) const; - inline virtual Vec3 supportContactThreshold( const Vec3& d ) const; + inline Vec3 support( const Vec3& d ) const override; + inline Vec3 supportContactThreshold( const Vec3& d ) const override; //@} //********************************************************************************************** //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** @@ -135,15 +135,15 @@ protected: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const; - virtual bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual void calcBoundingBox(); // Calculation of the axis-aligned bounding box + void calcBoundingBox() override; // Calculation of the axis-aligned bounding box //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/Capsule.h b/src/pe/rigidbody/Capsule.h index 937aadcda652d09631d4ecb0702eda7a27acafcb..52311a2041fb06096bf89dea32bd9bb401865bd4 100644 --- a/src/pe/rigidbody/Capsule.h +++ b/src/pe/rigidbody/Capsule.h @@ -79,7 +79,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Capsule(); + ~Capsule() override; //@} //********************************************************************************************** @@ -89,14 +89,14 @@ public: //@{ inline real_t getRadius() const; inline real_t getLength() const; - inline real_t getVolume() const; + inline real_t getVolume() const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual Vec3 support( const Vec3& d ) const; + inline Vec3 support( const Vec3& d ) const override; //@} //********************************************************************************************** @@ -128,18 +128,18 @@ public: //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** protected: - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const; - virtual bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const override; //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual void calcBoundingBox(); // Calculation of the axis-aligned bounding box + void calcBoundingBox() override; // Calculation of the axis-aligned bounding box //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/CylindricalBoundary.h b/src/pe/rigidbody/CylindricalBoundary.h index c56582c20094d26ab85c5b00b6adff489b8b9f3c..0dc9312dc19187c34f51fe65e3675599b8407d59 100644 --- a/src/pe/rigidbody/CylindricalBoundary.h +++ b/src/pe/rigidbody/CylindricalBoundary.h @@ -62,7 +62,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~CylindricalBoundary(); + ~CylindricalBoundary() override; //@} //********************************************************************************************** @@ -85,7 +85,7 @@ public: //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** @@ -93,10 +93,10 @@ protected: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const; - virtual bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const override; - virtual void calcBoundingBox(); // Calculation of the axis-aligned bounding box + void calcBoundingBox() override; // Calculation of the axis-aligned bounding box //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/Ellipsoid.h b/src/pe/rigidbody/Ellipsoid.h index 958c78ab31f474f99c5bdc310023fa0ca79edc31..e9a73305f0646a39fbaf82259f3967ba86b60332 100644 --- a/src/pe/rigidbody/Ellipsoid.h +++ b/src/pe/rigidbody/Ellipsoid.h @@ -77,7 +77,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Ellipsoid(); + ~Ellipsoid() override; //@} //********************************************************************************************** //********************************************************************************************** @@ -87,7 +87,7 @@ public: /*!\name Get functions */ //@{ inline const Vec3& getSemiAxes() const; - virtual inline real_t getVolume() const; + inline real_t getVolume() const override; //@} //********************************************************************************************** @@ -99,14 +99,14 @@ public: //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual Vec3 support( const Vec3& d ) const; + inline Vec3 support( const Vec3& d ) const override; //@} //********************************************************************************************** @@ -124,15 +124,15 @@ protected: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const; - virtual bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual void calcBoundingBox(); // Calculation of the axis-aligned bounding box + inline void calcBoundingBox() override; // Calculation of the axis-aligned bounding box //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/GeomPrimitive.h b/src/pe/rigidbody/GeomPrimitive.h index 2fa2f059d78d303c7df34748860eca66f070363a..359a7856f44fa73c1dbc8efd6ee746cbba59b203 100644 --- a/src/pe/rigidbody/GeomPrimitive.h +++ b/src/pe/rigidbody/GeomPrimitive.h @@ -68,7 +68,7 @@ protected: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~GeomPrimitive() = 0; + ~GeomPrimitive() override = 0; //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/MPIRigidBodyTrait.h b/src/pe/rigidbody/MPIRigidBodyTrait.h index 022bc2dbc7c8c1f670ac868ea06685a9009981c4..a8a055e1eeae6de8df7a6188a43d5c453b712d27 100644 --- a/src/pe/rigidbody/MPIRigidBodyTrait.h +++ b/src/pe/rigidbody/MPIRigidBodyTrait.h @@ -68,7 +68,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~MPIRigidBodyTrait() {}; + virtual ~MPIRigidBodyTrait() = default; //@} //********************************************************************************************** @@ -178,9 +178,7 @@ inline void MPIRigidBodyTrait::deregisterShadowOwner( const Owner& owner ) */ inline bool MPIRigidBodyTrait::isShadowOwnerRegistered( const Owner& owner ) const { - if( std::find( shadowOwners_.begin(), shadowOwners_.end(), owner ) == shadowOwners_.end() ) - return false; - else return true; + return std::find( shadowOwners_.begin(), shadowOwners_.end(), owner ) != shadowOwners_.end(); } //************************************************************************************************* diff --git a/src/pe/rigidbody/Plane.h b/src/pe/rigidbody/Plane.h index 94368f79fcba13971c0541e1bc8f60cbc848b4bf..1e8bd0966ed922e06735c722384330918a5a3e08 100644 --- a/src/pe/rigidbody/Plane.h +++ b/src/pe/rigidbody/Plane.h @@ -79,7 +79,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Plane(); + ~Plane() override; //@} //********************************************************************************************** @@ -87,7 +87,7 @@ public: //**Get functions******************************************************************************* /*!\name Get functions */ //@{ - virtual inline real_t getVolume() const; + inline real_t getVolume() const override; inline const Vec3& getNormal() const; inline real_t getDisplacement() const; //@} @@ -112,7 +112,7 @@ public: //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** @@ -120,21 +120,21 @@ protected: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual void setPositionImpl ( real_t px, real_t py, real_t pz ); - virtual void setOrientationImpl ( real_t r, real_t i, real_t j, real_t k ); - virtual void translateImpl ( real_t dx, real_t dy, real_t dz ); - virtual void rotateImpl ( const Quat& dq ); - virtual void rotateAroundOriginImpl( const Quat& dq ); - virtual void rotateAroundPointImpl ( const Vec3& point, const Quat& dq ); - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const; - virtual bool isSurfaceRelPointImpl ( real_t px, real_t py, real_t pz ) const; + void setPositionImpl ( real_t px, real_t py, real_t pz ) override; + void setOrientationImpl ( real_t r, real_t i, real_t j, real_t k ) override; + void translateImpl ( real_t dx, real_t dy, real_t dz ) override; + void rotateImpl ( const Quat& dq ) override; + void rotateAroundOriginImpl( const Quat& dq ) override; + void rotateAroundPointImpl ( const Vec3& point, const Quat& dq ) override; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl ( real_t px, real_t py, real_t pz ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual void calcBoundingBox(); // Calculation of the axis-aligned bounding box + void calcBoundingBox() override; // Calculation of the axis-aligned bounding box //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/RigidBody.h b/src/pe/rigidbody/RigidBody.h index 440abac642f2e9f018dcd59c519dd931bcc76f9a..eaecb02dabdb773b29f55f95a8695b9af7664f61 100644 --- a/src/pe/rigidbody/RigidBody.h +++ b/src/pe/rigidbody/RigidBody.h @@ -498,7 +498,7 @@ inline void RigidBody::calcMotion() */ inline bool RigidBody::hasManager() const { - return manager_ != 0; + return manager_ != nullptr; } //************************************************************************************************* diff --git a/src/pe/rigidbody/RigidBodyCastIterator.h b/src/pe/rigidbody/RigidBodyCastIterator.h index 7241baa63ce3b6eac5bafb20be5571016f992526..3486472b4e501d577edd594b784fbf28d1061b3b 100644 --- a/src/pe/rigidbody/RigidBodyCastIterator.h +++ b/src/pe/rigidbody/RigidBodyCastIterator.h @@ -60,7 +60,7 @@ public: //**Constructors******************************************************************************** /*!\name Constructors */ //@{ - inline RigidBodyCastIterator() {} + inline RigidBodyCastIterator() = default; explicit inline RigidBodyCastIterator( const typename ContainerType::iterator& begin, const typename ContainerType::iterator& end ); RigidBodyCastIterator( const RigidBodyCastIterator<C>& it) = default; @@ -207,7 +207,7 @@ public: //**Constructors******************************************************************************** /*!\name Constructors */ //@{ - inline ConstRigidBodyCastIterator() {} + inline ConstRigidBodyCastIterator() = default; explicit inline ConstRigidBodyCastIterator( const typename ContainerType::const_iterator& begin, const typename ContainerType::const_iterator& end ); diff --git a/src/pe/rigidbody/RigidBodyIterator.h b/src/pe/rigidbody/RigidBodyIterator.h index 8e2be67d2f299dde26ebb313b4a17e4c22642301..ffa60d2c69a948e037c99dd407d95490a178741f 100644 --- a/src/pe/rigidbody/RigidBodyIterator.h +++ b/src/pe/rigidbody/RigidBodyIterator.h @@ -58,7 +58,7 @@ public: //**Constructors******************************************************************************** /*!\name Constructors */ //@{ - inline RigidBodyIterator() {} + inline RigidBodyIterator() = default; explicit inline RigidBodyIterator( const typename ContainerType::iterator& it ) : it_(it) {} RigidBodyIterator( const RigidBodyIterator& it) = default; @@ -226,7 +226,7 @@ public: //**Constructors******************************************************************************** /*!\name Constructors */ //@{ - inline ConstRigidBodyIterator() {} + inline ConstRigidBodyIterator() = default; inline ConstRigidBodyIterator( const RigidBodyIterator& it ) : it_(it.get()) {} explicit inline ConstRigidBodyIterator( const typename ContainerType::iterator& it ) : it_(it) {} explicit inline ConstRigidBodyIterator( const typename ContainerType::const_iterator& it ) : it_(it) {} diff --git a/src/pe/rigidbody/Sphere.h b/src/pe/rigidbody/Sphere.h index 669cf07bcb15805f80c45f7992a4c31c7233678d..a7400fdb7d93d899b6fa686c9e663cacf0a1062b 100644 --- a/src/pe/rigidbody/Sphere.h +++ b/src/pe/rigidbody/Sphere.h @@ -75,7 +75,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Sphere(); + ~Sphere() override; //@} //********************************************************************************************** //********************************************************************************************** @@ -85,7 +85,7 @@ public: /*!\name Get functions */ //@{ inline real_t getRadius() const; - virtual inline real_t getVolume() const; + inline real_t getVolume() const override; //@} //********************************************************************************************** @@ -107,14 +107,14 @@ public: //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual Vec3 support( const Vec3& d ) const; + inline Vec3 support( const Vec3& d ) const override; //@} //********************************************************************************************** @@ -132,15 +132,15 @@ protected: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const; - virtual bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl( real_t px, real_t py, real_t pz ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual void calcBoundingBox(); // Calculation of the axis-aligned bounding box + inline void calcBoundingBox() override; // Calculation of the axis-aligned bounding box //@} //********************************************************************************************** diff --git a/src/pe/rigidbody/Squirmer.h b/src/pe/rigidbody/Squirmer.h index 41a27c9a78474ff82a677d45bb4a5e4af65da3ff..69270d006f0ed64a296b6cadfa6ea6b9dea5f2f5 100644 --- a/src/pe/rigidbody/Squirmer.h +++ b/src/pe/rigidbody/Squirmer.h @@ -41,7 +41,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Squirmer(); + ~Squirmer() override; //@} //********************************************************************************************** //********************************************************************************************** diff --git a/src/pe/rigidbody/StorageDataHandling.h b/src/pe/rigidbody/StorageDataHandling.h index 12495a01b0b56bd80e1a26d062b9edbd9098c00c..4260f5278572206dddb39b36ce25148d28ad9446 100644 --- a/src/pe/rigidbody/StorageDataHandling.h +++ b/src/pe/rigidbody/StorageDataHandling.h @@ -40,32 +40,32 @@ namespace pe{ template<typename BodyTuple> class StorageDataHandling : public blockforest::BlockDataHandling<Storage>{ public: - virtual ~StorageDataHandling() {} + ~StorageDataHandling() override = default; /// must be thread-safe ! - virtual Storage * initialize( IBlock * const block ) override; + Storage * initialize( IBlock * const block ) override; /// must be thread-safe ! - virtual void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; + void serialize( IBlock * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; /// must be thread-safe ! - virtual Storage * deserialize( IBlock * const block ) override; + Storage * deserialize( IBlock * const block ) override; /// must be thread-safe ! - virtual void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; + void deserialize( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; /// must be thread-safe ! - virtual void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override; + void serializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer, const uint_t child ) override; /// must be thread-safe ! - virtual void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; + void serializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::SendBuffer & buffer ) override; /// must be thread-safe ! - virtual Storage * deserializeCoarseToFine( Block * const block ) override; + Storage * deserializeCoarseToFine( Block * const block ) override; /// must be thread-safe ! - virtual Storage * deserializeFineToCoarse( Block * const block ) override; + Storage * deserializeFineToCoarse( Block * const block ) override; /// must be thread-safe ! - virtual void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; + void deserializeCoarseToFine( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ) override; /// must be thread-safe ! - virtual void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override; + void deserializeFineToCoarse( Block * const block, const BlockDataID & id, mpi::RecvBuffer & buffer, const uint_t child ) override; private: void deserializeImpl( IBlock * const block, const BlockDataID & id, mpi::RecvBuffer & buffer ); diff --git a/src/pe/rigidbody/Union.h b/src/pe/rigidbody/Union.h index e9337e069d82375ffcbc48b605cfb4b8c71fc461..31a224d2602df0e7339307a191f3c144faf67be9 100644 --- a/src/pe/rigidbody/Union.h +++ b/src/pe/rigidbody/Union.h @@ -87,7 +87,7 @@ public: //**Destructor********************************************************************************** /*!\name Destructor */ //@{ - virtual ~Union(); + ~Union() override; //@} //********************************************************************************************** //********************************************************************************************** @@ -121,23 +121,23 @@ public: //@} //********************************************************************************************** - virtual inline real_t getVolume() const override; + inline real_t getVolume() const override; //**Set functions******************************************************************************* /*!\name Set functions */ //@{ - virtual void setRemote( bool remote ) override; + void setRemote( bool remote ) override; //@} //********************************************************************************************** - virtual inline bool hasSubBodies() const override { return true; } + inline bool hasSubBodies() const override { return true; } //**Signal functions*************************************************************************** /*!\name Signal functions */ //@{ - virtual void handleModification() override; - virtual void handleTranslation() override; - virtual void handleRotation() override; + void handleModification() override; + void handleTranslation() override; + void handleRotation() override; //@} //********************************************************************************************** @@ -158,7 +158,7 @@ public: //**Output functions**************************************************************************** /*!\name Output functions */ //@{ - virtual void print( std::ostream& os, const char* tab ) const override; + void print( std::ostream& os, const char* tab ) const override; //@} //********************************************************************************************** @@ -166,21 +166,21 @@ protected: //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - virtual void setPositionImpl ( real_t px, real_t py, real_t pz ) override; - virtual void setOrientationImpl ( real_t r, real_t i, real_t j, real_t k ) override; - virtual void translateImpl ( real_t dx, real_t dy, real_t dz ) override; - virtual void rotateImpl ( const Quat& dq ) override; - virtual void rotateAroundOriginImpl( const Quat& dq ) override; - virtual void rotateAroundPointImpl ( const Vec3& point, const Quat& dq ) override; - virtual bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; - virtual bool isSurfaceRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + void setPositionImpl ( real_t px, real_t py, real_t pz ) override; + void setOrientationImpl ( real_t r, real_t i, real_t j, real_t k ) override; + void translateImpl ( real_t dx, real_t dy, real_t dz ) override; + void rotateImpl ( const Quat& dq ) override; + void rotateAroundOriginImpl( const Quat& dq ) override; + void rotateAroundPointImpl ( const Vec3& point, const Quat& dq ) override; + bool containsRelPointImpl ( real_t px, real_t py, real_t pz ) const override; + bool isSurfaceRelPointImpl ( real_t px, real_t py, real_t pz ) const override; //@} //********************************************************************************************** //**Utility functions*************************************************************************** /*!\name Utility functions */ //@{ - inline virtual void calcBoundingBox() override; // Calculation of the axis-aligned bounding box + inline void calcBoundingBox() override; // Calculation of the axis-aligned bounding box inline void calcCenterOfMass(); // Compute mass and center of gravity inline void calcInertia(); // Calculation of the moment of inertia //@} diff --git a/src/pe/rigidbody/UnionFactory.h b/src/pe/rigidbody/UnionFactory.h index 6ad1d934e5a8391c1c44f6e4f513d15342b2c677..04090a61dfa8e06d05a4f1275ae0bd4270ea28da 100644 --- a/src/pe/rigidbody/UnionFactory.h +++ b/src/pe/rigidbody/UnionFactory.h @@ -133,7 +133,7 @@ BoxID createBox( Union<BodyTypes...>* un, throw std::runtime_error("Box TypeID not initalized!"); // union not on this process/block -> terminate creation - if (un == NULL) + if (un == nullptr) throw std::invalid_argument( "createBox: Union argument is NULL" ); // main union not on this process/block -> terminate creation @@ -159,7 +159,7 @@ BoxID createBox( Union<BodyTypes...>* un, std::unique_ptr<Box> box = std::make_unique<Box>(sid, uid, gpos, Quat(), lengths, material, global, communicating, infiniteMass); box->MPITrait.setOwner( un->MPITrait.getOwner() ); - if (box != NULL) + if (box != nullptr) { // Logging the successful creation of the box WALBERLA_LOG_DETAIL( @@ -199,7 +199,7 @@ CapsuleID createCapsule( Union<BodyTypes...>* un, throw std::runtime_error("Capsule TypeID not initalized!"); // union not on this process/block -> terminate creation - if (un == NULL) + if (un == nullptr) throw std::invalid_argument( "createCapsule: Union argument is NULL" ); // main union not on this process/block -> terminate creation @@ -229,7 +229,7 @@ CapsuleID createCapsule( Union<BodyTypes...>* un, std::unique_ptr<Capsule> capsule = std::make_unique<Capsule>(sid, uid, gpos, Quat(), radius, length, material, global, communicating, infiniteMass); capsule->MPITrait.setOwner( un->MPITrait.getOwner() ); - if (capsule != NULL) + if (capsule != nullptr) { WALBERLA_LOG_DETAIL("Created capsule " << capsule->getSystemID() << "\n" << *capsule); } @@ -260,7 +260,7 @@ SphereID createSphere( Union<BodyTypes...>* un, throw std::runtime_error("Sphere TypeID not initalized!"); // union not on this process/block -> terminate creation - if (un == NULL) + if (un == nullptr) throw std::invalid_argument( "createSphere: Union argument is NULL" ); // main union not on this process/block -> terminate creation @@ -287,7 +287,7 @@ SphereID createSphere( Union<BodyTypes...>* un, std::unique_ptr<Sphere> sphere = std::make_unique<Sphere>(sid, uid, gpos, Quat(), radius, material, global, communicating, infiniteMass); sphere->MPITrait.setOwner( un->MPITrait.getOwner() ); - if (sphere != NULL) + if (sphere != nullptr) { // Logging the successful creation of the sphere WALBERLA_LOG_DETAIL( diff --git a/src/pe/synchronization/SyncForces.h b/src/pe/synchronization/SyncForces.h index b28fb837ab365264a78bef4a1812962f707967d3..a990719436cf811c15d6074534c7437bb0b4b805 100644 --- a/src/pe/synchronization/SyncForces.h +++ b/src/pe/synchronization/SyncForces.h @@ -110,7 +110,7 @@ void reduceForces( BlockStorage& blocks, BlockDataID storageID ) it.buffer() >> sender; it.buffer() >> receiver; auto blk = blocks.getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); IBlock& block = *blk; Storage* storage = block.getData< Storage >( storageID ); BodyStorage& localStorage = (*storage)[0]; @@ -231,7 +231,7 @@ void distributeForces( BlockStorage& blocks, BlockDataID storageID ) it.buffer() >> sender; it.buffer() >> receiver; auto blk = blocks.getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); IBlock& block = *blk; Storage* storage = block.getData< Storage >( storageID ); BodyStorage& localStorage = (*storage)[0]; diff --git a/src/pe/synchronization/SyncNextNeighbors.h b/src/pe/synchronization/SyncNextNeighbors.h index 83ad74ac0a839491f1d8023696354b61fa7f3cba..4fd166011d6756241972612723d7f074a0c8d7db 100644 --- a/src/pe/synchronization/SyncNextNeighbors.h +++ b/src/pe/synchronization/SyncNextNeighbors.h @@ -250,10 +250,10 @@ void generateSynchonizationMessages(mpi::BufferSystem& bs, const Block& block, B } template <typename BodyTypeTuple> -void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = NULL, const real_t dx = real_t(0), const bool syncNonCommunicatingBodies = false ) +void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = nullptr, const real_t dx = real_t(0), const bool syncNonCommunicatingBodies = false ) { - if (tt != NULL) tt->start("Sync"); - if (tt != NULL) tt->start("Assembling Body Synchronization"); + if (tt != nullptr) tt->start("Sync"); + if (tt != nullptr) tt->start("Assembling Body Synchronization"); mpi::BufferSystem bs( mpi::MPIManager::instance()->comm() ); for (auto it = forest.begin(); it != forest.end(); ++it) @@ -274,13 +274,13 @@ void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree } generateSynchonizationMessages<BodyTypeTuple>(bs, *block, *localStorage, *shadowStorage, dx, syncNonCommunicatingBodies); } - if (tt != NULL) tt->stop("Assembling Body Synchronization"); + if (tt != nullptr) tt->stop("Assembling Body Synchronization"); // size of buffer is unknown and changes with each send bs.setReceiverInfoFromSendBufferState(false, true); bs.sendAll(); - if (tt != NULL) tt->start("Parsing Body Synchronization"); + if (tt != nullptr) tt->start("Parsing Body Synchronization"); // Receiving the updates for the remote rigid bodies from the connected processes WALBERLA_LOG_DETAIL( "Parsing of body synchronization response starts..." ); for( auto it = bs.begin(); it != bs.end(); ++it ) @@ -294,7 +294,7 @@ void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree it.buffer() >> sender; it.buffer() >> receiver; auto blk = forest.getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); IBlock& block = *blk; Storage* storage = block.getData< Storage >( storageID ); BodyStorage& localStorage = (*storage)[0]; @@ -303,8 +303,8 @@ void syncNextNeighbors( BlockForest& forest, BlockDataID storageID, WcTimingTree } } WALBERLA_LOG_DETAIL( "Parsing of body synchronization response ended." ); - if (tt != NULL) tt->stop("Parsing Body Synchronization"); - if (tt != NULL) tt->stop("Sync"); + if (tt != nullptr) tt->stop("Parsing Body Synchronization"); + if (tt != nullptr) tt->stop("Sync"); } } // namespace pe diff --git a/src/pe/synchronization/SyncShadowOwners.h b/src/pe/synchronization/SyncShadowOwners.h index 89716ed2877a300fb0d29dcb34680f59a031a851..32669e30349f6c4e72be0ffde47cce56d08b412f 100644 --- a/src/pe/synchronization/SyncShadowOwners.h +++ b/src/pe/synchronization/SyncShadowOwners.h @@ -193,7 +193,7 @@ void updateAndMigrate( BlockForest& forest, BlockDataID storageID, const bool sy it.buffer() >> sender; it.buffer() >> receiver; auto blk = forest.getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); Block * block = dynamic_cast< Block * >( blk ); Storage* storage = block->getData< Storage >( storageID ); BodyStorage& localStorage = (*storage)[0]; @@ -360,7 +360,7 @@ void checkAndResolveOverlap( BlockForest& forest, BlockDataID storageID, const r it.buffer() >> sender; it.buffer() >> receiver; auto blk = forest.getBlock(receiver); - WALBERLA_CHECK(blk != NULL, receiver << " not on this process!"); + WALBERLA_CHECK(blk != nullptr, receiver << " not on this process!"); Block * block = dynamic_cast< Block * >( blk ); Storage* storage = block->getData< Storage >( storageID ); BodyStorage& localStorage = (*storage)[0]; @@ -372,25 +372,25 @@ void checkAndResolveOverlap( BlockForest& forest, BlockDataID storageID, const r } template <typename BodyTypeTuple> -void syncShadowOwners( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = NULL, const real_t dx = real_t(0), const bool syncNonCommunicatingBodies = false ) +void syncShadowOwners( BlockForest& forest, BlockDataID storageID, WcTimingTree* tt = nullptr, const real_t dx = real_t(0), const bool syncNonCommunicatingBodies = false ) { - if (tt != NULL) tt->start("Sync"); + if (tt != nullptr) tt->start("Sync"); //========================================================== // STEP1: Update & Migrate //========================================================== - if (tt != NULL) tt->start("Update&Migrate"); + if (tt != nullptr) tt->start("Update&Migrate"); updateAndMigrate<BodyTypeTuple>( forest, storageID, syncNonCommunicatingBodies); - if (tt != NULL) tt->stop("Update&Migrate"); + if (tt != nullptr) tt->stop("Update&Migrate"); //========================================================== // STEP2: Check & Resolve //========================================================== - if (tt != NULL) tt->start("Check&Resolve"); + if (tt != nullptr) tt->start("Check&Resolve"); checkAndResolveOverlap<BodyTypeTuple>( forest, storageID, dx, syncNonCommunicatingBodies); - if (tt != NULL) tt->stop("Check&Resolve"); + if (tt != nullptr) tt->stop("Check&Resolve"); - if (tt != NULL) tt->stop("Sync"); + if (tt != nullptr) tt->stop("Sync"); } } diff --git a/src/pe/utility/BodyCast.h b/src/pe/utility/BodyCast.h index ebd6574b7c0cf3d49d978f73474c38ae3f5dae77..f3f6e1ca82114feba8db8b0006a1009b64ef5175 100644 --- a/src/pe/utility/BodyCast.h +++ b/src/pe/utility/BodyCast.h @@ -39,7 +39,7 @@ public: static_assert(std::is_base_of<RigidBody, CastBodyType>::value, "only downcasting allowed!"); if (CastBodyType::getStaticTypeID() == typeID) { - CastBodyType* bd = NULL; + CastBodyType* bd = nullptr; return func( static_cast<CastBodyType *>( bd ) ); } else { diff --git a/src/pe/vtk/BodyVtkOutput.h b/src/pe/vtk/BodyVtkOutput.h index 3898f6f10b86f17cbba3e965fcf7e45dadad4561..4a91a88933d523f30ab7a79bd16c8061638114c1 100644 --- a/src/pe/vtk/BodyVtkOutput.h +++ b/src/pe/vtk/BodyVtkOutput.h @@ -42,14 +42,14 @@ public: : storageID_( storageID ) , blockStorage_( blockStorage ) { } - std::vector< Attributes > getAttributes() const; + std::vector< Attributes > getAttributes() const override; - void configure(); + void configure() override; - std::vector< Vector3< real_t > > getPoints(); + std::vector< Vector3< real_t > > getPoints() override; - inline void push( std::ostream& os , const uint_t /*data*/, const uint_t point, const uint_t component ); - inline void push( vtk::Base64Writer& b64, const uint_t /*data*/, const uint_t point, const uint_t component ); + inline void push( std::ostream& os , const uint_t /*data*/, const uint_t point, const uint_t component ) override; + inline void push( vtk::Base64Writer& b64, const uint_t /*data*/, const uint_t point, const uint_t component ) override; private: diff --git a/src/pe/vtk/EllipsoidVtkOutput.h b/src/pe/vtk/EllipsoidVtkOutput.h index 767c1b9783d47bac4a11b32401f082067346cee1..b4ab6c2415a95ccd87c92c0b61bac3f036bbd4b1 100644 --- a/src/pe/vtk/EllipsoidVtkOutput.h +++ b/src/pe/vtk/EllipsoidVtkOutput.h @@ -46,14 +46,14 @@ public: : storageID_( storageID ) , blockStorage_( blockStorage ) { } - std::vector< Attributes > getAttributes() const; + std::vector< Attributes > getAttributes() const override; - void configure(); + void configure() override; - std::vector< Vector3< real_t > > getPoints(); + std::vector< Vector3< real_t > > getPoints() override; - inline void push( std::ostream& os , const uint_t /*data*/, const uint_t point, const uint_t component ); - inline void push( vtk::Base64Writer& b64, const uint_t /*data*/, const uint_t point, const uint_t component ); + inline void push( std::ostream& os , const uint_t /*data*/, const uint_t point, const uint_t component ) override; + inline void push( vtk::Base64Writer& b64, const uint_t /*data*/, const uint_t point, const uint_t component ) override; private: diff --git a/src/pe/vtk/SphereVtkOutput.h b/src/pe/vtk/SphereVtkOutput.h index 655faec083d49e8adbb9397dcb9d9b043b84694c..db307c2738bbef22d42c2b2eec89dd10a859cde1 100755 --- a/src/pe/vtk/SphereVtkOutput.h +++ b/src/pe/vtk/SphereVtkOutput.h @@ -46,14 +46,14 @@ public: : storageID_( storageID ) , blockStorage_( blockStorage ) { } - std::vector< Attributes > getAttributes() const; + std::vector< Attributes > getAttributes() const override; - void configure(); + void configure() override; - std::vector< Vector3< real_t > > getPoints(); + std::vector< Vector3< real_t > > getPoints() override; - inline void push( std::ostream& os , const uint_t /*data*/, const uint_t point, const uint_t component ); - inline void push( vtk::Base64Writer& b64, const uint_t /*data*/, const uint_t point, const uint_t component ); + inline void push( std::ostream& os , const uint_t /*data*/, const uint_t point, const uint_t component ) override; + inline void push( vtk::Base64Writer& b64, const uint_t /*data*/, const uint_t point, const uint_t component ) override; private: diff --git a/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h b/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h index 72649668d966772116e30af5f1d8ae2e8a33937d..7c62ccb5b44ddf2217e76951f332dbadb993444d 100644 --- a/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h +++ b/src/pe_coupling/discrete_particle_methods/gns_lbm/GNSSweep.h @@ -121,7 +121,7 @@ void GNSSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut { PdfField_T * src( NULL ); PdfField_T * dst( NULL ); - ScalarField_T * solidVolumeFractionField( NULL ); + ScalarField_T * solidVolumeFractionField( nullptr ); getFields( block, src, dst, solidVolumeFractionField ); @@ -187,8 +187,8 @@ template< typename LatticeModel_T, typename Filter_T, typename DensityVelocityIn void GNSSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); lbm::SweepBase<LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T>::getFields( block, src, dst ); lbm::StreamPull< LatticeModel_T >::execute( src, dst, block, this->filter_, numberOfGhostLayersToInclude ); } diff --git a/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h b/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h index 78676106bfee4fde3bd3550fd129c72fe749b807..66992d54d1b0298efee12c172ad833b45452c02d 100644 --- a/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h +++ b/src/pe_coupling/partially_saturated_cells_method/PSMSweep.h @@ -133,9 +133,9 @@ template< typename LatticeModel_T, typename Filter_T, typename DensityVelocityIn void PSMSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T, SolidCollision_T, Weighting_T >::streamCollide( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); - BodyAndVolumeFractionField_T * bodyAndVolumeFractionField( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); + BodyAndVolumeFractionField_T * bodyAndVolumeFractionField( nullptr ); getFields( block, src, dst, bodyAndVolumeFractionField ); @@ -282,8 +282,8 @@ template< typename LatticeModel_T, typename Filter_T, typename DensityVelocityIn void PSMSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T, SolidCollision_T, Weighting_T >::stream( IBlock * const block, const uint_t numberOfGhostLayersToInclude ) { - PdfField_T * src( NULL ); - PdfField_T * dst( NULL ); + PdfField_T * src( nullptr ); + PdfField_T * dst( nullptr ); lbm::SweepBase<LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T>::getFields( block, src, dst ); lbm::StreamPull< LatticeModel_T >::execute( src, dst, block, this->filter_, numberOfGhostLayersToInclude ); } diff --git a/src/timeloop/ITimeloop.h b/src/timeloop/ITimeloop.h index cc43aec38a0256b27a18bc474c913707edd68752..3a77ca9951fe543cbf21247f73e37fe346cca45d 100644 --- a/src/timeloop/ITimeloop.h +++ b/src/timeloop/ITimeloop.h @@ -31,7 +31,7 @@ namespace timeloop { class ITimeloop { public: - virtual ~ITimeloop() {}; + virtual ~ITimeloop() = default; virtual void run() = 0; virtual void singleStep() = 0; diff --git a/src/timeloop/SelectableFunctionCreators.h b/src/timeloop/SelectableFunctionCreators.h index 4deaa2ce49eea46714205b7198935b105a9d7b1b..e3a29325cab6d0b78b17c96e94a686b792c073eb 100644 --- a/src/timeloop/SelectableFunctionCreators.h +++ b/src/timeloop/SelectableFunctionCreators.h @@ -55,7 +55,7 @@ namespace timeloop { template <typename FuncType> struct SelectableFunction { - SelectableFunction() {} + SelectableFunction() = default; SelectableFunction ( std::function< FuncType > fct, const std::string& identifier = std::string(), @@ -77,7 +77,7 @@ namespace timeloop { struct BeforeFunction : public SelectableFunction< void () > { - BeforeFunction() {} + BeforeFunction() = default; BeforeFunction(std::function< void () > fct, const std::string& id = std::string(), const Set<SUID>& req = Set<SUID>::emptySet(), @@ -95,7 +95,7 @@ namespace timeloop { struct AfterFunction : public SelectableFunction< void () > { - AfterFunction() {} + AfterFunction() = default; AfterFunction(std::function< void () > fct, const std::string& id = std::string(), const Set<SUID>& req = Set<SUID>::emptySet(), diff --git a/src/timeloop/SweepTimeloop.h b/src/timeloop/SweepTimeloop.h index a9b4d6d2ad88692a1c86e674e82a1c2f80cd897d..3bd6c1488092c6f8528db3f73417600828599e11 100644 --- a/src/timeloop/SweepTimeloop.h +++ b/src/timeloop/SweepTimeloop.h @@ -129,7 +129,7 @@ namespace timeloop { nextId_(0), firstRun_(true) {} - virtual ~SweepTimeloop() + ~SweepTimeloop() override { for ( auto i = sweeps_.begin(); i != sweeps_.end(); ++i ) delete i->second; @@ -166,8 +166,8 @@ namespace timeloop { sweeps_.erase( *it ); } - virtual void doTimeStep(const Set<SUID> &selectors); - virtual void doTimeStep(const Set<SUID> &selectors, WcTimingPool &tp); + void doTimeStep(const Set<SUID> &selectors) override; + void doTimeStep(const Set<SUID> &selectors, WcTimingPool &tp) override; uint_t nextId_; std::vector<uint_t> sweepsToDelete_; diff --git a/src/timeloop/Timeloop.h b/src/timeloop/Timeloop.h index e2cc5500191eab290607be954d4cc6306ae84560..f1430ec63778173d0f6248ca9410763697695fa1 100644 --- a/src/timeloop/Timeloop.h +++ b/src/timeloop/Timeloop.h @@ -58,7 +58,7 @@ private: { public: LoggingStamp( const Timeloop & timeloop ) : timeloop_( timeloop ) {} - std::string stamp() + std::string stamp() override { std::ostringstream oss; int indention; @@ -74,7 +74,7 @@ private: << std::setfill(' ') << std::right << timeloop_.curTimeStep_; return std::string("[") + oss.str() + std::string("]"); } - uint_t maxStampWidth() + uint_t maxStampWidth() override { if( timeloop_.nrOfTimeSteps_ > 0 ) return uint_c( std::ceil( std::log10( real_c( timeloop_.nrOfTimeSteps_ ) ) ) ) + uint_c(2); @@ -111,7 +111,7 @@ public: //@{ Timeloop( uint_t nrOfTimeSteps ); - virtual ~Timeloop() {} + ~Timeloop() override = default; //@} //**************************************************************************************************************** @@ -119,19 +119,19 @@ public: //** Execution Control ******************************************************************************************* /*! \name Execution Control*/ //@{ - virtual void run() { run(true); } + void run() override { run(true); } void run( const bool logTimeStep ); void run( WcTimingPool & timing, const bool logTimeStep = true ); - virtual void singleStep() { singleStep(true); } + void singleStep() override { singleStep(true); } void singleStep( const bool logTimeStep ); void singleStep( WcTimingPool & timing, const bool logTimeStep = true ); - void stop(); - void synchronizedStop( bool stop ); + void stop() override; + void synchronizedStop( bool stop ) override; void setCurrentTimeStepToZero() { curTimeStep_ = 0; } - void setCurrentTimeStep( uint_t ts) { curTimeStep_ = ts; } + void setCurrentTimeStep( uint_t ts) override { curTimeStep_ = ts; } //@} //**************************************************************************************************************** @@ -173,8 +173,8 @@ public: //** Timestep **************************************************************************************************** /*! \name Timestep */ //@{ - uint_t getCurrentTimeStep() const { return curTimeStep_; } - uint_t getNrOfTimeSteps() const { return nrOfTimeSteps_; } + uint_t getCurrentTimeStep() const override { return curTimeStep_; } + uint_t getNrOfTimeSteps() const override { return nrOfTimeSteps_; } //@} //**************************************************************************************************************** diff --git a/src/vtk/BlockCellDataWriter.h b/src/vtk/BlockCellDataWriter.h index d0eabef2ca4b3bf06a58363794b1985f45786d1d..cac2599c72c83cda8dcdf8820448813b8221d8ea 100644 --- a/src/vtk/BlockCellDataWriter.h +++ b/src/vtk/BlockCellDataWriter.h @@ -110,8 +110,8 @@ namespace internal { class BlockCellDataWriter { public: - BlockCellDataWriter( const std::string& id ) : block_( NULL ), blockStorage_( NULL ), identifier_( id ) {} - virtual ~BlockCellDataWriter() {} + BlockCellDataWriter( const std::string& id ) : block_( nullptr ), blockStorage_( nullptr ), identifier_( id ) {} + virtual ~BlockCellDataWriter() = default; void configure( const IBlock& block, const StructuredBlockStorage& sbs ) { block_ = █ blockStorage_ = &sbs; configure(); } @@ -171,7 +171,7 @@ protected: private: - BlockCellDataWriter() {} + BlockCellDataWriter() = default; }; // class BlockCellDataWriter @@ -224,14 +224,14 @@ public: static const uint_t F_SIZE = F_SIZE_ARG; BlockCellDataWriter( const std::string & id ) : BlockCellDataWriterInterface( id ) {} - virtual ~BlockCellDataWriter() {} + ~BlockCellDataWriter() override = default; - void push( std::ostream & os, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + void push( std::ostream & os, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { vtk::toStream( os, evaluate( x, y, z, f ) ); } - void push( vtk::Base64Writer & b64, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) + void push( vtk::Base64Writer & b64, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) override { b64 << evaluate( x, y, z, f ); } @@ -239,7 +239,7 @@ public: void push( std::ostream& os, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f, const real_t localXCell, const real_t localYCell, const real_t localZCell, const real_t globalX, const real_t globalY, const real_t globalZ, - const real_t samplingDx, const real_t samplingDy, const real_t samplingDz ) + const real_t samplingDx, const real_t samplingDy, const real_t samplingDz ) override { vtk::toStream( os, evaluate( x, y, z, f, localXCell, localYCell, localZCell, globalX, globalY, globalZ, samplingDx, samplingDy, samplingDz ) ); @@ -248,14 +248,14 @@ public: void push( Base64Writer& b64, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f, const real_t localXCell, const real_t localYCell, const real_t localZCell, const real_t globalX, const real_t globalY, const real_t globalZ, - const real_t samplingDx, const real_t samplingDy, const real_t samplingDz ) + const real_t samplingDx, const real_t samplingDy, const real_t samplingDz ) override { b64 << evaluate( x, y, z, f, localXCell, localYCell, localZCell, globalX, globalY, globalZ, samplingDx, samplingDy, samplingDz ); } - uint_t fSize() const { return F_SIZE; } + uint_t fSize() const override { return F_SIZE; } - std::string typeString() const { return vtk::typeToString< T >(); } + std::string typeString() const override { return vtk::typeToString< T >(); } protected: virtual T evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t f ) = 0; diff --git a/src/vtk/DumpBlockStructureLevel.h b/src/vtk/DumpBlockStructureLevel.h index 5d0b8953b01504d79ed71c33199c000e25ecece3..6c0e8932b21007cad71d73c7a93c38fbfe4cc772 100644 --- a/src/vtk/DumpBlockStructureLevel.h +++ b/src/vtk/DumpBlockStructureLevel.h @@ -37,9 +37,9 @@ public: protected: - void configure() { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); WALBERLA_ASSERT_NOT_NULLPTR( this->blockStorage_ ); level_ = uint8_c( this->blockStorage_->getLevel( *(this->block_) ) ); } + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); WALBERLA_ASSERT_NOT_NULLPTR( this->blockStorage_ ); level_ = uint8_c( this->blockStorage_->getLevel( *(this->block_) ) ); } - uint8_t evaluate( const cell_idx_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) { return level_; } + uint8_t evaluate( const cell_idx_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) override { return level_; } uint8_t level_; diff --git a/src/vtk/DumpBlockStructureProcess.h b/src/vtk/DumpBlockStructureProcess.h index 3bdd64e6cbb22c4da9d5e4d099568461d0fa1eab..0887b824395c806655087447e7ad149667af7f89 100644 --- a/src/vtk/DumpBlockStructureProcess.h +++ b/src/vtk/DumpBlockStructureProcess.h @@ -38,9 +38,9 @@ public: protected: - void configure() {} + void configure() override {} - int evaluate( const cell_idx_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) { return MPIManager::instance()->rank(); } + int evaluate( const cell_idx_t, const cell_idx_t, const cell_idx_t, const cell_idx_t ) override { return MPIManager::instance()->rank(); } }; // DumpBlockStructureProcess diff --git a/src/vtk/Initialization.h b/src/vtk/Initialization.h index 22e5902180b3934dd2b39a40caaecb1fe3f2cbda..50fd523c360e25eaaaf1004d25e4bd8f942fad24 100644 --- a/src/vtk/Initialization.h +++ b/src/vtk/Initialization.h @@ -41,7 +41,7 @@ typedef std::function< void () > OutputFunction; struct SelectableOutputFunction { - SelectableOutputFunction() {} + SelectableOutputFunction() = default; SelectableOutputFunction( OutputFunction of, const Set<SUID>& rgs, const Set<SUID>& igs ) : outputFunction( of ), requiredGlobalStates( rgs ), incompatibleGlobalStates( igs ) {} diff --git a/src/vtk/PointDataSource.h b/src/vtk/PointDataSource.h index 382e0e79d82a292ed6c3d4edf957b2a7aa389458..af959aafee3388eedf288cc0d76e6c852a10e248 100644 --- a/src/vtk/PointDataSource.h +++ b/src/vtk/PointDataSource.h @@ -49,7 +49,7 @@ public: uint_t components; }; - virtual ~PointDataSource() {} + virtual ~PointDataSource() = default; virtual std::vector< Attributes > getAttributes() const = 0; diff --git a/src/vtk/PolylineDataSource.h b/src/vtk/PolylineDataSource.h index 59048019fe7dcb36069aafd2813a25f64e2618a7..c3b39a18d806cec201e736dc9f2ea5aadf184091 100644 --- a/src/vtk/PolylineDataSource.h +++ b/src/vtk/PolylineDataSource.h @@ -51,7 +51,7 @@ public: typedef std::vector< Vector3< real_t > > Polyline; - virtual ~PolylineDataSource() {} + virtual ~PolylineDataSource() = default; virtual std::vector< Attributes > getAttributes() const = 0; diff --git a/src/vtk/VTKOutput.h b/src/vtk/VTKOutput.h index a9c9ec12df53300279fb05d019e4ba4d4a35b3ab..dc36ae003f322ac667f64d8e0d24041705e1fe67 100644 --- a/src/vtk/VTKOutput.h +++ b/src/vtk/VTKOutput.h @@ -62,11 +62,9 @@ private: struct VertexCompare { bool operator()( const Vertex& lhs, const Vertex& rhs ) const { - if( std::get<0>(lhs) < std::get<0>(rhs) || + return std::get<0>(lhs) < std::get<0>(rhs) || ( std::get<0>(lhs) == std::get<0>(rhs) && std::get<1>(lhs) < std::get<1>(rhs) ) || - ( std::get<0>(lhs) == std::get<0>(rhs) && std::get<1>(lhs) == std::get<1>(rhs) && std::get<2>(lhs) < std::get<2>(rhs) ) ) - return true; - return false; + ( std::get<0>(lhs) == std::get<0>(rhs) && std::get<1>(lhs) == std::get<1>(rhs) && std::get<2>(lhs) < std::get<2>(rhs) ); } }; @@ -353,7 +351,7 @@ inline void VTKOutput::addAABBInclusionFilter( const AABB & aabb ) if( pointDataSource_ || polylineDataSource_ ) aabbInclusionFilters_.push_back( aabb ); else - cellInclusionFunctions_.push_back( AABBCellFilter(aabb) ); + cellInclusionFunctions_.emplace_back(AABBCellFilter(aabb) ); } @@ -370,7 +368,7 @@ inline void VTKOutput::addAABBExclusionFilter( const AABB & aabb ) if( pointDataSource_ || polylineDataSource_ ) aabbExclusionFilters_.push_back( aabb ); else - cellExclusionFunctions_.push_back( AABBCellFilter(aabb) ); + cellExclusionFunctions_.emplace_back(AABBCellFilter(aabb) ); } diff --git a/tests/core/FunctionTraitsTest.cpp b/tests/core/FunctionTraitsTest.cpp index 4124fb6bfc00e8e1b140c5d9bd766027c88d6c4a..8c378eceaa7f16bf08a8400f31a35ffa028f6a9d 100644 --- a/tests/core/FunctionTraitsTest.cpp +++ b/tests/core/FunctionTraitsTest.cpp @@ -30,7 +30,7 @@ template< typename F> struct SomeClass { template< typename T> - static bool checkParameter1( typename std::enable_if< (FunctionTraits<F>::arity > 1 ), T >::type * = 0) { + static bool checkParameter1( typename std::enable_if< (FunctionTraits<F>::arity > 1 ), T >::type * = nullptr) { // The keyword "template" before "argument<1>" is crucial when these functions are inside a class. If the // keyword is dropped, compilers interpret "<1" as an arithmetic expression and therefore throw errors. diff --git a/tests/core/mpi/ReduceTest.cpp b/tests/core/mpi/ReduceTest.cpp index fa376b8d70f2ddab3a7c751cb0d2d6fc3c4f0b53..9093d63f36bf8a9880537ba5253655b94c439423 100644 --- a/tests/core/mpi/ReduceTest.cpp +++ b/tests/core/mpi/ReduceTest.cpp @@ -140,8 +140,8 @@ void runTestAllReduceBool() const bool allTrue = true; const bool allFalse = false; - const bool oneTrue = rank == 0 ? true: false; - const bool mixed = ( rank % 2 ) ? true : false; + const bool oneTrue = rank == 0; + const bool mixed = ( rank % 2 ) != 0; WALBERLA_CHECK_EQUAL( mpi::allReduce( allTrue, mpi::LOGICAL_AND ), true ); WALBERLA_CHECK_EQUAL( mpi::allReduce( allFalse, mpi::LOGICAL_AND ), false ); @@ -212,8 +212,8 @@ void runTestAllReduceBool() std::vector<bool> bools( 4u ); bools[0] = true; bools[1] = false; - bools[2] = rank == 0 ? true : false; - bools[3] = ( rank % 2 ) ? true : false; + bools[2] = rank == 0; + bools[3] = ( rank % 2 ) != 0; { std::vector<bool> result( bools ); @@ -255,8 +255,8 @@ void runTestReduceBool( int recvRank ) const bool allTrue = true; const bool allFalse = false; - const bool oneTrue = rank == 0 ? true: false; - const bool mixed = ( rank % 2 ) ? true : false; + const bool oneTrue = rank == 0; + const bool mixed = ( rank % 2 ) != 0; { bool result0 = mpi::reduce( allTrue, mpi::LOGICAL_AND, recvRank ); @@ -387,8 +387,8 @@ void runTestReduceBool( int recvRank ) std::vector<bool> bools( 4u ); bools[0] = true; bools[1] = false; - bools[2] = rank == 0 ? true : false; - bools[3] = ( rank % 2 ) ? true : false; + bools[2] = rank == 0; + bools[3] = ( rank % 2 ) != 0; { std::vector<bool> result( bools ); diff --git a/tests/mesa_pd/domain/BlockForestDomain.cpp b/tests/mesa_pd/domain/BlockForestDomain.cpp index 297cbd5fe973b45bf1b8da58f98ba49daf4d33ca..6997297c7795b46c129a7c31356287887e8680d7 100644 --- a/tests/mesa_pd/domain/BlockForestDomain.cpp +++ b/tests/mesa_pd/domain/BlockForestDomain.cpp @@ -66,8 +66,8 @@ void main( int argc, char ** argv ) WALBERLA_CHECK(domain.isContainedInProcessSubdomain(0, Vec3(2,2,2))); WALBERLA_CHECK(domain.isContainedInProcessSubdomain(1, Vec3(7,7,7))); - WALBERLA_CHECK_EQUAL(domain.isContainedInProcessSubdomain(Vec3(2,2,2), real_t(1)), rank == 0 ? true : false); - WALBERLA_CHECK_EQUAL(domain.isContainedInProcessSubdomain(Vec3(7,7,7), real_t(1)), rank == 0 ? false : true); + WALBERLA_CHECK_EQUAL(domain.isContainedInProcessSubdomain(Vec3(2,2,2), real_t(1)), rank == 0); + WALBERLA_CHECK_EQUAL(domain.isContainedInProcessSubdomain(Vec3(7,7,7), real_t(1)), rank != 0); WALBERLA_CHECK_EQUAL(domain.isContainedInProcessSubdomain(Vec3(real_t(4.5),2,2), real_t(1)), rank == 0 ? false : false); WALBERLA_CHECK_EQUAL(domain.isContainedInProcessSubdomain(Vec3(real_t(5.5),7,7), real_t(1)), rank == 0 ? false : false); diff --git a/tests/mesa_pd/kernel/interfaces/ExplicitEulerInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/ExplicitEulerInterfaceCheck.cpp index 51ef473f2bd885dd827dade98b76eedb5850afa6..741d3ab6976744b4f2edd0ad083171d7d9b2472d 100644 --- a/tests/mesa_pd/kernel/interfaces/ExplicitEulerInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/ExplicitEulerInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} void setPosition(const size_t /*p_idx*/, const walberla::mesa_pd::Vec3& v) { position_ = v;} diff --git a/tests/mesa_pd/kernel/interfaces/ExplicitEulerWithShapeInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/ExplicitEulerWithShapeInterfaceCheck.cpp index 8a5b5e91702f2cb8d25b4c000f8c97fbc4ad0b97..db83474b4ff801832004045124b2fa7759a5245f 100644 --- a/tests/mesa_pd/kernel/interfaces/ExplicitEulerWithShapeInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/ExplicitEulerWithShapeInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} void setPosition(const size_t /*p_idx*/, const walberla::mesa_pd::Vec3& v) { position_ = v;} diff --git a/tests/mesa_pd/kernel/interfaces/ForceLJInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/ForceLJInterfaceCheck.cpp index 53edabb3259299c1b776ebdc67b15b46ffc61ce2..26c5152b05881ca729351793b247943b958a0199 100644 --- a/tests/mesa_pd/kernel/interfaces/ForceLJInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/ForceLJInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} walberla::mesa_pd::Vec3& getForceRef(const size_t /*p_idx*/) {return force_;} diff --git a/tests/mesa_pd/kernel/interfaces/HeatConductionInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/HeatConductionInterfaceCheck.cpp index c204acc86895af64e6bea4d87dd04764726f8586..26d5ecd9672dedd38d088a238e5dcc70253264bf 100644 --- a/tests/mesa_pd/kernel/interfaces/HeatConductionInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/HeatConductionInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::real_t& getTemperature(const size_t /*p_idx*/) const {return temperature_;} const walberla::real_t& getHeatFlux(const size_t /*p_idx*/) const {return heatFlux_;} diff --git a/tests/mesa_pd/kernel/interfaces/PFCDampingInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/PFCDampingInterfaceCheck.cpp index d60c39fe6fe3a4174060b65e030b5f230ce11c12..bcb55bdcc21c55016a3cd5f793de21644557c51c 100644 --- a/tests/mesa_pd/kernel/interfaces/PFCDampingInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/PFCDampingInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getLinearVelocity(const size_t /*p_idx*/) const {return linearVelocity_;} void setLinearVelocity(const size_t /*p_idx*/, const walberla::mesa_pd::Vec3& v) { linearVelocity_ = v;} diff --git a/tests/mesa_pd/kernel/interfaces/SemiImplicitEulerInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/SemiImplicitEulerInterfaceCheck.cpp index b73f71a3dc1d83070c356d2b0dbf5de93fd15892..5b287377b68bdea2ec67e2a1127f09d528ba3d69 100644 --- a/tests/mesa_pd/kernel/interfaces/SemiImplicitEulerInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/SemiImplicitEulerInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} void setPosition(const size_t /*p_idx*/, const walberla::mesa_pd::Vec3& v) { position_ = v;} diff --git a/tests/mesa_pd/kernel/interfaces/SpringDashpotInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/SpringDashpotInterfaceCheck.cpp index 80837e900606d7bef809856ba1fd4d7204e3ab1b..2095004ede17783c87ec8bc0885328206720e4ff 100644 --- a/tests/mesa_pd/kernel/interfaces/SpringDashpotInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/SpringDashpotInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} const walberla::mesa_pd::Vec3& getLinearVelocity(const size_t /*p_idx*/) const {return linearVelocity_;} diff --git a/tests/mesa_pd/kernel/interfaces/TemperatureIntegrationInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/TemperatureIntegrationInterfaceCheck.cpp index d0cdb6099d02528e7277d32e6354b4a4a14b444a..e85086212ff81d94da2805135a18e7056cbb235c 100644 --- a/tests/mesa_pd/kernel/interfaces/TemperatureIntegrationInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/TemperatureIntegrationInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::real_t& getTemperature(const size_t /*p_idx*/) const {return temperature_;} void setTemperature(const size_t /*p_idx*/, const walberla::real_t& v) { temperature_ = v;} diff --git a/tests/mesa_pd/kernel/interfaces/VelocityVerletInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/VelocityVerletInterfaceCheck.cpp index 1f59101667a095f8865369d046c156d1e5652b9c..869b4bb897cec19d051e2d46727c2f7cb1a9408d 100644 --- a/tests/mesa_pd/kernel/interfaces/VelocityVerletInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/VelocityVerletInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} void setPosition(const size_t /*p_idx*/, const walberla::mesa_pd::Vec3& v) { position_ = v;} diff --git a/tests/mesa_pd/kernel/interfaces/VelocityVerletWithShapeInterfaceCheck.cpp b/tests/mesa_pd/kernel/interfaces/VelocityVerletWithShapeInterfaceCheck.cpp index 1f59101667a095f8865369d046c156d1e5652b9c..869b4bb897cec19d051e2d46727c2f7cb1a9408d 100644 --- a/tests/mesa_pd/kernel/interfaces/VelocityVerletWithShapeInterfaceCheck.cpp +++ b/tests/mesa_pd/kernel/interfaces/VelocityVerletWithShapeInterfaceCheck.cpp @@ -37,7 +37,7 @@ namespace mesa_pd { class Accessor : public data::IAccessor { public: - virtual ~Accessor() = default; + ~Accessor() override = default; const walberla::mesa_pd::Vec3& getPosition(const size_t /*p_idx*/) const {return position_;} void setPosition(const size_t /*p_idx*/, const walberla::mesa_pd::Vec3& v) { position_ = v;} diff --git a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp index 67ce8c233fcc0d50a0c579fcf7d76255f9f071b0..2fad6814a2a32c8644fbfe8998a55e9dc0b1669a 100644 --- a/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp +++ b/tests/pe_coupling/momentum_exchange_method/TaylorCouetteFlowMEM.cpp @@ -247,7 +247,7 @@ int main( int argc, char **argv ) WALBERLA_ABORT("Unrecognized command line argument found: " << argv[i]); } - bool vtkIO = (vtkIOFreq == 0 ) ? false : true; + bool vtkIO = vtkIOFreq != 0; /////////////////////////// // SIMULATION PROPERTIES //