From 85be0096a6d4387212aba463162e3598c8bf66d5 Mon Sep 17 00:00:00 2001 From: Sebastian Eibl <sebastian.eibl@fau.de> Date: Tue, 9 Feb 2021 18:00:21 +0100 Subject: [PATCH] extend clang-tidy coverage --- .clang-tidy | 3 +- src/blockforest/AABBRefinementSelection.h | 18 ++-- src/blockforest/Block.h | 8 +- src/blockforest/BlockDataHandling.h | 58 ++++++------ src/blockforest/BlockForest.h | 90 +++++++++--------- src/blockforest/BlockID.h | 10 +- src/blockforest/BlockReconstruction.h | 2 +- src/blockforest/GlobalLoadBalancing.h | 26 +++--- src/blockforest/Initialization.h | 4 +- src/blockforest/PhantomBlock.h | 2 +- src/blockforest/SetupBlock.h | 4 +- src/blockforest/SetupBlockForest.h | 22 ++--- src/blockforest/StructuredBlockForest.h | 32 +++---- .../communication/NonUniformPackInfo.h | 4 +- src/blockforest/loadbalancing/Cartesian.h | 2 +- src/boundary/Boundary.h | 2 +- src/boundary/BoundaryHandling.h | 10 +- src/boundary/communication/HandlingPackInfo.h | 12 +-- src/communication/ReducePackInfo.h | 2 +- src/communication/UniformMPIDatatypeInfo.h | 4 +- src/communication/UniformPackInfo.h | 4 +- src/core/Abort.h | 2 +- src/core/Array.h | 4 +- src/core/ConcatIterator.h | 9 +- src/core/NonCopyable.h | 4 +- src/core/Set.h | 4 +- src/core/StringUtility.impl.h | 4 +- src/core/cell/Cell.h | 2 +- src/core/cell/CellArray.h | 4 +- src/core/cell/CellInterval.h | 7 +- src/core/cell/CellVector.h | 6 +- src/core/config/Config.h | 4 +- src/core/config/Iterator.h | 4 +- src/core/debug/CheckFunctions.h | 2 +- src/core/debug/CheckFunctions.impl.h | 4 +- src/core/debug/demangle.h | 2 +- src/core/logging/Logging.h | 2 +- src/core/math/Matrix2.h | 28 ++---- src/core/math/Matrix3.h | 58 ++++-------- src/core/math/MatrixMxN.h | 2 +- src/core/math/Quaternion.h | 14 +-- src/core/math/Vector2.h | 21 +---- src/core/math/Vector3.h | 16 +--- src/core/math/equation_system/Operator.h | 18 ++-- src/core/mpi/BufferSystem.h | 2 +- src/core/mpi/BufferSystemHelper.h | 42 ++++----- src/core/mpi/Gather.h | 2 +- src/core/mpi/Gatherv.h | 10 +- src/core/mpi/MPIWrapper.h | 6 +- src/core/mpi/RecvBuffer.h | 12 +-- src/core/mpi/Reduce.h | 20 ++-- src/core/selectable/SelectableObject.h | 10 +- src/core/selectable/SetSelectableObject.h | 6 +- src/core/singleton/Singleton.h | 4 +- src/core/timing/TimingNode.h | 14 +-- src/core/timing/TimingPool.h | 2 +- src/core/timing/TimingTree.h | 4 +- src/domain_decomposition/BlockDataHandling.h | 34 +++---- src/domain_decomposition/BlockStorage.h | 10 +- src/domain_decomposition/IBlock.h | 30 +++--- src/domain_decomposition/IBlockID.h | 2 +- .../StructuredBlockStorage.h | 16 ++-- src/executiontree/ExecutionTree.h | 6 +- src/field/EvaluationFilter.h | 2 +- src/field/Field.impl.h | 14 +-- src/field/FlagField.h | 4 +- src/field/GhostLayerField.h | 12 +-- src/field/GhostLayerField.impl.h | 7 +- src/field/StabilityChecker.h | 12 +-- src/field/SymmetryCheck.h | 4 +- src/field/adaptors/AdaptorCreators.h | 2 +- src/field/adaptors/GhostLayerFieldAdaptor.h | 2 +- src/field/allocation/FieldAllocator.h | 20 ++-- src/field/blockforest/BlockDataHandling.h | 32 +++---- src/field/blockforest/GradientRefinement.h | 2 +- src/field/communication/PackInfo.h | 12 +-- src/field/communication/ReducePackInfo.h | 10 +- .../StencilRestrictedMPIDatatypeInfo.h | 10 +- .../communication/StencilRestrictedPackInfo.h | 12 +-- .../communication/UniformMPIDatatypeInfo.h | 10 +- .../UniformPullReductionPackInfo.h | 12 +-- src/field/distributors/DistributorCreators.h | 2 +- .../interpolators/FieldInterpolatorCreators.h | 2 +- src/field/iterators/FieldIterator.impl.h | 12 +-- src/field/refinement/PackInfo.h | 24 ++--- src/field/vtk/FlagFieldMapping.h | 6 +- src/field/vtk/VTKWriter.h | 6 +- src/gather/CellGatherPackInfo.h | 8 +- src/gather/CurveGatherPackInfo.h | 10 +- src/gather/GatherPackInfo.h | 2 +- src/gather/GnuPlotGraphWriter.h | 2 +- src/geometry/bodies/DynamicBody.h | 6 +- .../IndeterminateLeafNode.h | 2 +- .../containment_octree/InsideLeafNode.h | 2 +- src/geometry/containment_octree/LeafNode.h | 2 +- src/geometry/containment_octree/Node.h | 2 +- .../containment_octree/OutsideLeafNode.h | 2 +- src/geometry/initializer/BoundaryFromBody.h | 2 +- .../initializer/BoundaryFromCellInterval.h | 2 +- .../initializer/BoundaryFromDomainBorder.h | 2 +- src/geometry/initializer/BoundaryFromImage.h | 2 +- .../initializer/BoundaryFromVoxelFile.h | 2 +- .../BoundarySetterFlagFieldSpecialization.h | 2 +- src/geometry/initializer/Initializer.h | 2 +- .../initializer/OverlapFieldFromBody.h | 2 +- .../initializer/ScalarFieldFromBody.h | 2 +- .../ScalarFieldFromGrayScaleImage.h | 2 +- .../structured/BasicVoxelFileReader.impl.h | 2 +- src/geometry/structured/GrayScaleImage.h | 2 +- src/geometry/structured/RGBAImage.h | 2 +- src/geometry/structured/extern/lodepng.h | 4 +- src/gui/PropertyTree.h | 4 +- src/gui/PropertyTree.impl.h | 2 +- src/lbm/PerformanceLogger.h | 2 +- src/lbm/blockforest/PostProcessing.h | 22 ++--- src/lbm/boundary/Curved.h | 2 +- src/lbm/boundary/DiffusionDirichlet.h | 4 +- src/lbm/boundary/UBB.h | 4 +- src/lbm/boundary/VelocityBoundary.h | 2 +- src/lbm/field/AddToStorage.h | 16 ++-- src/lbm/field/Density.h | 2 +- src/lbm/field/DensityVelocityCallback.h | 2 +- src/lbm/field/PdfField.h | 4 +- .../initializer/PoiseuilleInitializer.h | 2 +- src/lbm/lattice_model/CollisionModel.h | 2 +- src/lbm/lattice_model/D2Q9.h | 4 +- src/lbm/lattice_model/D3Q15.h | 4 +- src/lbm/lattice_model/D3Q19.h | 4 +- src/lbm/lattice_model/D3Q27.h | 4 +- src/lbm/lattice_model/ForceModel.h | 4 +- src/lbm/lattice_model/LatticeModelBase.h | 2 +- src/lbm/refinement/PdfFieldPackInfo.h | 92 +++++++++---------- src/lbm/refinement/TimeStep.h | 16 ++-- src/lbm/srt/SplitPureSweep.impl.h | 16 ++-- src/lbm/srt/SplitSweep.impl.h | 32 +++---- src/lbm/sweeps/ActiveCellSweep.h | 2 +- src/lbm/trt/SplitPureSweep.impl.h | 16 ++-- src/lbm/trt/SplitSweep.impl.h | 32 +++---- src/lbm/vtk/Density.h | 6 +- src/lbm/vtk/NonEquilibrium.h | 6 +- src/lbm/vtk/VTKOutput.h | 2 +- src/lbm/vtk/Velocity.h | 12 +-- .../utility/SubCyclingManager.h | 2 +- .../AnalyticContactDetection.h | 2 +- src/mesa_pd/collision_detection/BroadPhase.h | 3 +- .../GeneralContactDetection.h | 8 +- src/mesa_pd/data/ContactAccessor.h | 4 +- src/mesa_pd/data/ParticleAccessor.h | 4 +- src/mesa_pd/domain/BlockForestDataHandling.h | 22 ++--- src/mesa_pd/kernel/ParticleSelector.h | 6 +- src/mesa_pd/vtk/OutputSelector.h | 2 +- src/pde/sweeps/Jacobi.h | 8 +- src/pde/sweeps/JacobiFixedStencil.h | 6 +- src/pde/sweeps/RBGS.h | 6 +- src/pde/sweeps/RBGSFixedStencil.h | 4 +- src/pde/sweeps/SOR.h | 6 +- src/pde/sweeps/SORFixedStencil.h | 4 +- src/pe/bg/IBG.h | 2 +- src/pe/bg/SimpleBGDataHandling.h | 2 +- src/pe/ccd/HashGrids.h | 32 +++---- src/pe/ccd/HashGridsBodyTrait.h | 2 +- src/pe/ccd/HashGridsDataHandling.h | 2 +- src/pe/ccd/ICCD.h | 4 +- src/pe/ccd/SimpleCCD.h | 6 +- src/pe/ccd/SimpleCCDDataHandling.h | 2 +- src/pe/cr/DEM.h | 10 +- src/pe/cr/DEM.impl.h | 12 +-- src/pe/cr/HCSITS.h | 10 +- src/pe/cr/HCSITS.impl.h | 74 +++++++-------- src/pe/cr/ICR.h | 2 +- src/pe/cr/PlainIntegrator.h | 6 +- src/pe/cr/PlainIntegrator.impl.h | 8 +- src/pe/fcd/GenericFCD.h | 2 +- src/pe/fcd/IFCD.h | 2 +- src/pe/fcd/SimpleFCD.h | 2 +- src/pe/raytracing/Intersects.h | 10 +- src/pe/raytracing/Lighting.h | 4 +- src/pe/raytracing/Raytracer.h | 36 ++++---- src/pe/raytracing/ShadingParameters.h | 4 +- src/pe/rigidbody/BodyIterators.h | 27 +----- src/pe/rigidbody/Box.h | 16 ++-- src/pe/rigidbody/Capsule.h | 14 +-- src/pe/rigidbody/CylindricalBoundary.h | 10 +- src/pe/rigidbody/Ellipsoid.h | 14 +-- src/pe/rigidbody/GeomPrimitive.h | 2 +- src/pe/rigidbody/MPIRigidBodyTrait.h | 6 +- src/pe/rigidbody/Plane.h | 24 ++--- src/pe/rigidbody/RigidBody.h | 2 +- src/pe/rigidbody/RigidBodyCastIterator.h | 4 +- src/pe/rigidbody/RigidBodyIterator.h | 4 +- src/pe/rigidbody/Sphere.h | 14 +-- src/pe/rigidbody/Squirmer.h | 2 +- src/pe/rigidbody/StorageDataHandling.h | 22 ++--- src/pe/rigidbody/Union.h | 34 +++---- src/pe/rigidbody/UnionFactory.h | 12 +-- src/pe/synchronization/SyncForces.h | 4 +- src/pe/synchronization/SyncNextNeighbors.h | 16 ++-- src/pe/synchronization/SyncShadowOwners.h | 18 ++-- src/pe/utility/BodyCast.h | 2 +- src/pe/vtk/BodyVtkOutput.h | 10 +- src/pe/vtk/EllipsoidVtkOutput.h | 10 +- src/pe/vtk/SphereVtkOutput.h | 10 +- .../gns_lbm/GNSSweep.h | 6 +- .../PSMSweep.h | 10 +- src/timeloop/ITimeloop.h | 2 +- src/timeloop/SelectableFunctionCreators.h | 6 +- src/timeloop/SweepTimeloop.h | 6 +- src/timeloop/Timeloop.h | 20 ++-- src/vtk/BlockCellDataWriter.h | 20 ++-- src/vtk/DumpBlockStructureLevel.h | 4 +- src/vtk/DumpBlockStructureProcess.h | 4 +- src/vtk/Initialization.h | 2 +- src/vtk/PointDataSource.h | 2 +- src/vtk/PolylineDataSource.h | 2 +- src/vtk/VTKOutput.h | 10 +- tests/core/FunctionTraitsTest.cpp | 2 +- tests/core/mpi/ReduceTest.cpp | 16 ++-- tests/mesa_pd/domain/BlockForestDomain.cpp | 4 +- .../ExplicitEulerInterfaceCheck.cpp | 2 +- .../ExplicitEulerWithShapeInterfaceCheck.cpp | 2 +- .../interfaces/ForceLJInterfaceCheck.cpp | 2 +- .../HeatConductionInterfaceCheck.cpp | 2 +- .../interfaces/PFCDampingInterfaceCheck.cpp | 2 +- .../SemiImplicitEulerInterfaceCheck.cpp | 2 +- .../SpringDashpotInterfaceCheck.cpp | 2 +- .../TemperatureIntegrationInterfaceCheck.cpp | 2 +- .../VelocityVerletInterfaceCheck.cpp | 2 +- .../VelocityVerletWithShapeInterfaceCheck.cpp | 2 +- .../TaylorCouetteFlowMEM.cpp | 2 +- 229 files changed, 1009 insertions(+), 1122 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 00ffd56f0..7127535c8 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 fc454bedc..45847dca5 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 39d958b7e..caf87d623 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 c947b3e03..be978d3a8 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 b0731c115..bd66ced43 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 ff64a5b19..d4efc6bcc 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 68a2aba2f..c41689b94 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 521af77de..ca7c687a9 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 3a87f2811..aecdd20ad 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 0df698690..2d6c2b6ee 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 bd391aac8..64b7b89ca 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 a9192cac2..2dac1578f 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 ac021fe66..04b61a94f 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 a653169a5..0b32369c6 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 261473a9d..a147f1c98 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 8d83aea92..d7b3679f8 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 cf724cdc1..0910be455 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 d730bf2ad..460ec60e4 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 d353d6f37..141dd9828 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 be8689441..8f8e0d6c4 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 d2737a19c..5ec6db29d 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 8c52f6783..23b1ef1ff 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 1c5f8c2b2..42ab4efe5 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 f76c79f62..9b0ad071d 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 c01b4faf3..59b7773d2 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 3b77f42e7..7f094ad96 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 ddc5f7482..730bf5928 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 8fc8ef14e..3df78ce5b 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 3f26ee61c..732b2b853 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 10dfb0d9b..10f2529aa 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 0d9fe9f81..aa0fdefbd 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 9837b870c..056661251 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 3b9759426..9796f59bf 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 04444255c..4431b654d 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 023d5f7d3..e1932fdda 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 2e317436e..55334b550 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 1a4377851..8d174df51 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 f8310899c..a9377506d 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 665c6529e..e8253b4ad 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 be490da34..1d633e74e 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 90fd652de..9ca8c6f53 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 b0decf8ec..c69f7bcc7 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 8bc4e3233..72b6a45fa 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 b0dcd809b..e9a6a75e1 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 8be65ea4a..ea1037b13 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 661e46358..78b77c5ed 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 5cad16189..976981f9f 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 7ffda280a..7a9de2652 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 14e72cc5d..233baa6bb 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 c35b0c2aa..b3dacb3db 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 f60502868..c93e9443f 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 7f317c115..6a282536d 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 8c88a3f23..e43740aef 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 ead687d0c..f1e5975df 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 acd33ecd2..a99dfe05b 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 5e8fd7104..b927151ac 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 b4f4e736b..7fe833b1e 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 4bd96dae0..4b07594e0 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 e00f3ee86..0d6dfc6c1 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 c25c55ee9..27c0b894f 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 c30f83fdf..e73a50101 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 752107f47..8a44ebfd8 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 f9c838ec6..b9d39d798 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 b4ef168ef..7c9ac2c1e 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 4856de7ee..a70bdf813 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 62f9deef5..ebf17fb39 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 e6c8b454c..9a1a57704 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 5a8c6cc7a..8e122c36a 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 8a6e80b28..85a29e725 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 8aa914352..ec9237b54 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 1c410ca91..56bfff201 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 f26f87b0a..3b22ae6ef 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 f78771e15..781cda4bc 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 dc6328a66..e0caa9869 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 b05b8d1df..fb7f8b466 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 0c74f604f..a8e95ce75 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 81a142612..135574dcd 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 1150c76ff..64421ee77 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 72e405845..45527cadf 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 4734344c1..e7042ab57 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 71ceb7e8e..4233a3d23 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 e87b907ce..ab555911c 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 560df7879..760db9b7c 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 0a132ae01..a643984c8 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 bfc485289..bc4f68344 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 8b25ce58e..e496657df 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 c83033fe8..a86d8fa52 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 0055a2ba0..e12e5ab6f 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 112f018b3..6bdd3bab0 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 a4688bc0e..640866581 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 c8a70fbfe..48d09f61a 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 8a0ecfd52..1ebd1670e 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 349d18369..977c0a1cb 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 f291a5c37..b673d61e1 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 57c1b6553..47223f8b5 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 0a0d03ce6..a1bc9325f 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 2144b4e4d..b5fc61813 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 0c5c696a9..1eb9e06b7 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 80355b49f..f2245274c 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 9fa993781..9329a72ad 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 9db375940..d19f4dcbe 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 6bef2c8c3..3b0640e33 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 1ae6a04e2..f731a37f0 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 a724baacf..88336d0ec 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 b12b9e2bc..0438b85e8 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 ba8b72f9b..97ef3cc95 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 f570c0f11..2664fba72 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 4dbdc8ad8..9bebb8345 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 a32c22548..3361cc90e 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 4c7be3188..4e2871659 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 404ae1ec4..2d4b383cc 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 f6a5ae179..df1965d7e 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 a4c705355..f7d6dae8d 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 956b4a7da..7e7f183b7 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 23644cddc..361303cc1 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 d5f7aa08f..045a02398 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 4f07d41b8..96a560085 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 5ce5fcc06..e2621fb2f 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 8b470021b..0673f5a28 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 3cf80dc43..287673ad4 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 a7c346e13..3555e7981 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 3c7c69087..d7c76c5ca 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 5b4429877..a9438e42b 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 4315bed9c..8f8898556 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 df97cc3c5..c3077e97f 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 a4080f3bc..4fe777ead 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 e969749a4..a946fce3d 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 e196e4ede..d8cfc3dbc 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 72b5188f5..fb8289cbf 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 9b01b48b2..b82f05634 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 385e9abcc..82039ee3a 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 6fbfb9221..7117c64cd 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 1be6a470d..84189ba4b 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 b193c8636..3c716216c 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 b7e630c22..e86dc16b2 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 e191b785d..cfc3b6d35 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 695cebccf..84104e092 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 fadc10b48..4439727ca 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 387086fe6..6b7e4ee51 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 c8699c43e..3754c58dd 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 1c00b11ff..e42fb6bd9 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 6fb513745..10957ee4a 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 d1f198916..d001a43ba 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 ce8149c1e..36941efc1 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 a3fcb2640..f98658836 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 69a95e508..9564916c0 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 dfa293bc9..a33d4e804 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 4ebdcd135..62c61f6f7 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 2fae4d119..7f0e4172e 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 85d8b81b2..9ac4392f5 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 32ceb5dbd..03665d48e 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 89f3e5277..9f8b4e714 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 eb1367aae..4efc6fc5e 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 69f7245fa..e8d800aa5 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 75196987f..5b57cc351 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 4997b40d6..48a0b56e3 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 d3983ab18..0e9387309 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 8c956b567..fa7ec0662 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 7b31e020b..79535c82b 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 24ecec304..15b2968e3 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 40ab2505e..3e82abcec 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 43aa61863..7190343c3 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 b47a301e4..8aeb8d50a 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 42a54f599..f00a0faee 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 e6eba7709..2cf7756b7 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 f716157ef..21e1e16cf 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 a3560e50f..792f59bb3 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 742799f08..8cf803c46 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 7218b4580..25cccf846 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 73d1868d3..7c86a9fa0 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 92abbbfb3..c2284eff2 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 e2a45b2f8..cd071eb7f 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 27a311f3c..c054ae55c 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 0fb86fc59..e34592b3d 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 6f38ec190..0527459aa 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 3746ce6d0..ea7c6f850 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 451cfe335..1d64cbc87 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 39c42aa21..f53152760 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 7e476527d..c6a7eb16c 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 903a1195b..1948465f6 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 266aead5d..883739868 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 937aadcda..52311a204 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 c56582c20..0dc9312dc 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 958c78ab3..e9a73305f 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 2fa2f059d..359a7856f 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 022bc2dbc..a8a055e1e 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 94368f79f..1e8bd0966 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 440abac64..eaecb02da 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 7241baa63..3486472b4 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 8e2be67d2..ffa60d2c6 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 669cf07bc..a7400fdb7 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 41a27c9a7..69270d006 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 12495a01b..4260f5278 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 e9337e069..31a224d26 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 6ad1d934e..04090a61d 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 b28fb837a..a99071943 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 83ad74ac0..4fd166011 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 89716ed28..32669e303 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 ebd6574b7..f3f6e1ca8 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 3898f6f10..4a91a8893 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 767c1b978..b4ab6c241 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 655faec08..db307c273 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 72649668d..7c62ccb5b 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 78676106b..66992d54d 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 cc43aec38..3a77ca995 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 4deaa2ce4..e3a29325c 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 a9b4d6d2a..3bd6c1488 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 e2cc55001..f1430ec63 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 d0eabef2c..cac2599c7 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 5d0b8953b..6c0e8932b 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 3bdd64e6c..0887b8243 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 22e590218..50fd523c3 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 382e0e79d..af959aafe 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 59048019f..c3b39a18d 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 a9c9ec12d..dc36ae003 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 4124fb6bf..8c378ecea 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 fa376b8d7..9093d63f3 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 297cbd5fe..6997297c7 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 51ef473f2..741d3ab69 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 8a5b5e917..db83474b4 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 53edabb32..26c5152b0 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 c204acc86..26d5ecd96 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 d60c39fe6..bcb55bdcc 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 b73f71a3d..5b287377b 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 80837e900..2095004ed 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 d0cdb6099..e85086212 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 1f5910166..869b4bb89 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 1f5910166..869b4bb89 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 67ce8c233..2fad6814a 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 // -- GitLab