From 4166eb8aff350302c726c894f367a172ad3683d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 13 Nov 2024 19:14:42 +0100 Subject: [PATCH 01/13] Fix Clang 20 compiler error --- src/core/math/extern/exprtk.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index afa862bf..c125d7fd 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -6360,7 +6360,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -6420,7 +6420,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -6483,7 +6483,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -6527,7 +6527,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -7802,7 +7802,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(index_, node_delete_list); + expression_node::ndb_t::template collect<>(index_, node_delete_list); } std::size_t node_depth() const @@ -12012,7 +12012,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -15303,7 +15303,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -15359,7 +15359,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -15426,7 +15426,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -15493,7 +15493,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const @@ -16060,7 +16060,7 @@ namespace exprtk void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) { - expression_node::ndb_t::template collect(branch_, node_delete_list); + expression_node::ndb_t::template collect<>(branch_, node_delete_list); } std::size_t node_depth() const From b1ff3493265bec3817135a8cd57f3c38d66b9074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 13 Nov 2024 19:40:04 +0100 Subject: [PATCH 02/13] clang-tidy -checks=-*,modernize-use-override --- .../templates/CpuPackInfo.tmpl.h | 12 +- .../templates/GpuPackInfo.tmpl.h | 2 +- .../UniformToNonUniformPackInfoAdapter.h | 24 +- src/core/math/extern/exprtk.h | 980 +++++++++--------- .../FreeSurfaceBoundaryHandling.impl.h | 8 +- .../free_surface/dynamics/PdfRefillingSweep.h | 4 +- src/lbm/vtk/CurlMagnitude.h | 4 +- src/lbm/vtk/QCriterion.h | 4 +- src/lbm/vtk/Vorticity.h | 4 +- .../overlapping/shapes/BoxWithOverlap.h | 2 +- .../shapes/CylindricalBoundaryWithOverlap.h | 2 +- .../overlapping/shapes/EllipsoidWithOverlap.h | 2 +- .../overlapping/shapes/HalfSpaceWithOverlap.h | 2 +- .../overlapping/shapes/SphereWithOverlap.h | 2 +- src/python_coupling/export/FieldExport.impl.h | 4 +- 15 files changed, 528 insertions(+), 528 deletions(-) diff --git a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h index 716da044..f4644a28 100644 --- a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h @@ -47,12 +47,12 @@ class {{class_name}} : public ::walberla::communication::UniformPackInfo {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} {}; - virtual ~{{class_name}}() {} + ~{{class_name}}() override {} - 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 { const auto dataSize = size(dir, receiver); auto bufferSize = dataSize + sizeof({{dtype}}); auto bufferPtr = reinterpret_cast(buffer.skip(bufferSize)); @@ -60,7 +60,7 @@ class {{class_name}} : public ::walberla::communication::UniformPackInfo unpack(dir, reinterpret_cast(bufferPtr), receiver); } - void communicateLocal(const IBlock * sender, IBlock * receiver, stencil::Direction dir) { + void communicateLocal(const IBlock * sender, IBlock * receiver, stencil::Direction dir) override { //TODO: optimize by generating kernel for this case mpi::SendBuffer sBuffer; packData( sender, dir, sBuffer ); @@ -68,7 +68,7 @@ class {{class_name}} : public ::walberla::communication::UniformPackInfo unpackData( receiver, stencil::inverseDir[dir], rBuffer ); } - 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 auto dataSize = size(dir, sender); auto bufferSize = dataSize + sizeof({{dtype}}); auto bufferPtr = reinterpret_cast(outBuffer.forward(bufferSize)); diff --git a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h index cd5b2367..db880eaa 100644 --- a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h @@ -54,7 +54,7 @@ class {{class_name}} : public ::walberla::gpu::GeneratedGPUPackInfo {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} {}; - virtual ~{{class_name}}() {} + ~{{class_name}}() override {} void pack (stencil::Direction dir, unsigned char * buffer, IBlock * block, gpuStream_t stream) override; void communicateLocal ( stencil::Direction /*dir*/, const IBlock* /* sender */, IBlock* /* receiver */, gpuStream_t /* stream */ ) override diff --git a/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h b/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h index f0e5838b..1f68ec76 100644 --- a/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h +++ b/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h @@ -44,7 +44,7 @@ class UniformToNonUniformPackInfoAdapter : public NonUniformPackInfo /*! \name Construction & Destruction */ //@{ UniformToNonUniformPackInfoAdapter( const shared_ptr & uniformPackInfo ) : uniformPackInfo_( uniformPackInfo ) { } - virtual ~UniformToNonUniformPackInfoAdapter() { } + ~UniformToNonUniformPackInfoAdapter() override { } //@} //**************************************************************************************************************** @@ -55,7 +55,7 @@ class UniformToNonUniformPackInfoAdapter : public NonUniformPackInfo * Falsely return true will lead to errors! However, if the data can be guaranteed to remain * constant over time, returning true enables performance optimizations during the communication. */ - virtual bool constantDataExchange() const { return uniformPackInfo_->constantDataExchange(); } + bool constantDataExchange() const override { return uniformPackInfo_->constantDataExchange(); } /** * Must return false if calling `unpackData*()` and/or `communicateLocal*()` methods is not thread-safe. @@ -64,29 +64,29 @@ class UniformToNonUniformPackInfoAdapter : public NonUniformPackInfo * Falsely return true will most likely lead to errors! However, if both `unpackData*()` AND * `communicateLocal*()` are thread-safe, returning true can lead to performance improvements. */ - virtual bool threadsafeReceiving() const { return uniformPackInfo_->threadsafeReceiving(); } + bool threadsafeReceiving() const override { return uniformPackInfo_->threadsafeReceiving(); } /// If NOT thread-safe, \ref threadsafeReceiving must return false! - virtual void unpackDataEqualLevel( Block * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) { uniformPackInfo_->unpackData( receiver, dir, buffer ); } + void unpackDataEqualLevel( Block * receiver, stencil::Direction dir, mpi::RecvBuffer & buffer ) override { uniformPackInfo_->unpackData( receiver, dir, buffer ); } /// If NOT thread-safe, \ref threadsafeReceiving must return false! - virtual void communicateLocalEqualLevel( const Block * sender, Block * receiver, stencil::Direction dir ) { uniformPackInfo_->communicateLocal( sender, receiver, dir ); } + void communicateLocalEqualLevel( const Block * sender, Block * receiver, stencil::Direction dir ) override { uniformPackInfo_->communicateLocal( sender, receiver, dir ); } - virtual void unpackDataCoarseToFine( Block * /*fineReceiver*/, const BlockID & /*coarseSender*/, stencil::Direction /*dir*/, mpi::RecvBuffer & /*buffer*/ ) { } - virtual 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 { } - virtual void unpackDataFineToCoarse( Block * /*coarseReceiver*/, const BlockID & /*fineSender*/, stencil::Direction /*dir*/, mpi::RecvBuffer & /*buffer*/ ) { } - virtual 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: shared_ptr uniformPackInfo_; /// Must be thread-safe! - virtual void packDataEqualLevelImpl( const Block * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const { uniformPackInfo_->packData( sender, dir, buffer ); } + void packDataEqualLevelImpl( const Block * sender, stencil::Direction dir, mpi::SendBuffer & buffer ) const override { uniformPackInfo_->packData( sender, dir, buffer ); } - virtual void packDataCoarseToFineImpl( const Block * /*coarseSender*/, const BlockID & /*fineReceiver*/, stencil::Direction /*dir*/, mpi::SendBuffer & /*buffer*/ ) const { } - virtual void packDataFineToCoarseImpl( const Block * /*fineSender*/, const BlockID & /*coarseReceiver*/, stencil::Direction /*dir*/, mpi::SendBuffer & /*buffer*/ ) const { } + 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 { } }; diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index c125d7fd..73321af7 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -2958,7 +2958,7 @@ namespace exprtk { public: - virtual ~token_scanner() + ~token_scanner() override {} explicit token_scanner(const std::size_t& stride) @@ -2970,7 +2970,7 @@ namespace exprtk } } - inline std::size_t process(generator& g) + inline std::size_t process(generator& g) override { if (g.token_list_.size() >= stride_) { @@ -3065,7 +3065,7 @@ namespace exprtk { public: - inline std::size_t process(generator& g) + inline std::size_t process(generator& g) override { std::size_t changes = 0; @@ -3093,7 +3093,7 @@ namespace exprtk } } - inline std::size_t process(generator& g) + inline std::size_t process(generator& g) override { if (g.token_list_.empty()) return 0; @@ -3197,7 +3197,7 @@ namespace exprtk : stride_(stride) {} - inline std::size_t process(generator& g) + inline std::size_t process(generator& g) override { if (g.token_list_.empty()) return 0; @@ -3330,7 +3330,7 @@ namespace exprtk ignore_set_.insert(symbol); } - inline int insert(const lexer::token& t0, const lexer::token& t1, lexer::token& new_token) + inline int insert(const lexer::token& t0, const lexer::token& t1, lexer::token& new_token) override { bool match = false; new_token.type = lexer::token::e_mul; @@ -3385,7 +3385,7 @@ namespace exprtk : token_joiner(stride) {} - inline bool join(const lexer::token& t0, const lexer::token& t1, lexer::token& t) + inline bool join(const lexer::token& t0, const lexer::token& t1, lexer::token& t) override { // ': =' --> ':=' if ((t0.type == lexer::token::e_colon) && (t1.type == lexer::token::e_eq)) @@ -3530,7 +3530,7 @@ namespace exprtk return false; } - inline bool join(const lexer::token& t0, const lexer::token& t1, const lexer::token& t2, lexer::token& t) + inline bool join(const lexer::token& t0, const lexer::token& t1, const lexer::token& t2, lexer::token& t) override { // '[ * ]' --> '[*]' if ( @@ -3561,7 +3561,7 @@ namespace exprtk state_(true) {} - bool result() + bool result() override { if (!stack_.empty()) { @@ -3582,7 +3582,7 @@ namespace exprtk return error_token_; } - void reset() + void reset() override { // Why? because msvc doesn't support swap properly. stack_ = std::stack >(); @@ -3590,7 +3590,7 @@ namespace exprtk error_token_.clear(); } - bool operator() (const lexer::token& t) + bool operator() (const lexer::token& t) override { if ( !t.value.empty() && @@ -3646,18 +3646,18 @@ namespace exprtk current_index_(0) {} - bool result() + bool result() override { return error_list_.empty(); } - void reset() + void reset() override { error_list_.clear(); current_index_ = 0; } - bool operator() (const lexer::token& t) + bool operator() (const lexer::token& t) override { if (token::e_number == t.type) { @@ -3741,7 +3741,7 @@ namespace exprtk private: - bool modify(lexer::token& t) + bool modify(lexer::token& t) override { if (lexer::token::e_symbol == t.type) { @@ -3804,12 +3804,12 @@ namespace exprtk add_invalid_set1(lexer::token::e_ternary); } - bool result() + bool result() override { return error_list_.empty(); } - bool operator() (const lexer::token& t0, const lexer::token& t1) + bool operator() (const lexer::token& t0, const lexer::token& t1) override { const set_t::value_type p = std::make_pair(t0.type,t1.type); @@ -3971,12 +3971,12 @@ namespace exprtk add_invalid(lexer::token::e_pow , lexer::token::e_mod , lexer::token::e_pow ); } - bool result() + bool result() override { return error_list_.empty(); } - bool operator() (const lexer::token& t0, const lexer::token& t1, const lexer::token& t2) + bool operator() (const lexer::token& t0, const lexer::token& t1, const lexer::token& t2) override { const set_t::value_type p = std::make_pair(t0.type,std::make_pair(t1.type,t2.type)); @@ -5202,7 +5202,7 @@ namespace exprtk typedef typename nci_t::noderef_list_t noderef_list_t; typedef node_depth_base > ndb_t; - virtual ~expression_node() + ~expression_node() override {} inline virtual T value() const @@ -5851,7 +5851,7 @@ namespace exprtk protected: - value_ptr value_at(const std::size_t& index) const + value_ptr value_at(const std::size_t& index) const override { if (index < size_) return const_cast(vec_ + index); @@ -5859,7 +5859,7 @@ namespace exprtk return const_value_ptr(0); } - std::size_t vector_size() const + std::size_t vector_size() const override { return size_; } @@ -5886,12 +5886,12 @@ namespace exprtk protected: - value_ptr value_at(const std::size_t& index) const + value_ptr value_at(const std::size_t& index) const override { return (index < sequence_.size()) ? (&sequence_[index]) : const_value_ptr(0); } - std::size_t vector_size() const + std::size_t vector_size() const override { return sequence_.size(); } @@ -5913,24 +5913,24 @@ namespace exprtk : vec_view_(vec_view) {} - void set_ref(value_ptr* ref) + void set_ref(value_ptr* ref) override { vec_view_.set_ref(ref); } - virtual inline bool rebaseable() const + inline bool rebaseable() const override { return true; } protected: - value_ptr value_at(const std::size_t& index) const + value_ptr value_at(const std::size_t& index) const override { return (index < vec_view_.size()) ? (&vec_view_[index]) : const_value_ptr(0); } - std::size_t vector_size() const + std::size_t vector_size() const override { return vec_view_.size(); } @@ -5999,12 +5999,12 @@ namespace exprtk { public: - inline T value() const + inline T value() const override { return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_null; } @@ -6069,7 +6069,7 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); @@ -6082,7 +6082,7 @@ namespace exprtk return (equality_) ? T(0) : T(1); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_nulleq; } @@ -6092,17 +6092,17 @@ namespace exprtk return details::e_eq; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_,node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -6122,17 +6122,17 @@ namespace exprtk : value_(v) {} - inline T value() const + inline T value() const override { return value_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_constant; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return reinterpret_cast*>(0); } @@ -6202,42 +6202,42 @@ namespace exprtk rp_.cache.second = rp_.n1_c.second; } - inline T value() const + inline T value() const override { return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_stringconst; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return reinterpret_cast*>(0); } - std::string str() const + std::string str() const override { return value_; } - char_cptr base() const + char_cptr base() const override { return value_.data(); } - std::size_t size() const + std::size_t size() const override { return value_.size(); } - range_t& range_ref() + range_t& range_ref() override { return rp_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return rp_; } @@ -6266,7 +6266,7 @@ namespace exprtk construct_branch_pair(branch_,branch); } - inline T value() const + inline T value() const override { assert(branch_.first); @@ -6275,7 +6275,7 @@ namespace exprtk return numeric::process(operation_,arg); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_unary; } @@ -6285,7 +6285,7 @@ namespace exprtk return operation_; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } @@ -6295,12 +6295,12 @@ namespace exprtk branch_.second = false; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -6327,7 +6327,7 @@ namespace exprtk init_branches<2>(branch_, branch0, branch1); } - inline T value() const + inline T value() const override { assert(branch_[0].first); assert(branch_[1].first); @@ -6338,7 +6338,7 @@ namespace exprtk return numeric::process(operation_,arg0,arg1); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_binary; } @@ -6348,7 +6348,7 @@ namespace exprtk return operation_; } - inline expression_node* branch(const std::size_t& index = 0) const + inline expression_node* branch(const std::size_t& index = 0) const override { if (0 == index) return branch_[0].first; @@ -6358,12 +6358,12 @@ namespace exprtk return reinterpret_cast(0); } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::template compute_node_depth<2>(branch_); } @@ -6387,7 +6387,7 @@ namespace exprtk init_branches<2>(branch_, branch0, branch1); } - inline T value() const + inline T value() const override { assert(branch_[0].first); assert(branch_[1].first); @@ -6398,7 +6398,7 @@ namespace exprtk return Operation::process(arg0,arg1); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_binary_ext; } @@ -6408,7 +6408,7 @@ namespace exprtk return Operation::operation(); } - inline expression_node* branch(const std::size_t& index = 0) const + inline expression_node* branch(const std::size_t& index = 0) const override { if (0 == index) return branch_[0].first; @@ -6418,12 +6418,12 @@ namespace exprtk return reinterpret_cast(0); } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::template compute_node_depth<2>(branch_); } @@ -6450,7 +6450,7 @@ namespace exprtk init_branches<3>(branch_, branch0, branch1, branch2); } - inline T value() const + inline T value() const override { assert(branch_[0].first); assert(branch_[1].first); @@ -6476,17 +6476,17 @@ namespace exprtk } } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_trinary; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::template compute_node_depth<3>(branch_); } @@ -6515,22 +6515,22 @@ namespace exprtk init_branches<4>(branch_, branch0, branch1, branch2, branch3); } - inline T value() const + inline T value() const override { return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_quaternary; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::template compute_node_depth<4>(branch_); } @@ -6558,7 +6558,7 @@ namespace exprtk construct_branch_pair(alternative_, alternative); } - inline T value() const + inline T value() const override { assert(condition_ .first); assert(consequent_ .first); @@ -6570,19 +6570,19 @@ namespace exprtk return alternative_.first->value(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_conditional; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(condition_ , node_delete_list); expression_node::ndb_t::collect(consequent_ , node_delete_list); expression_node::ndb_t::collect(alternative_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth (condition_, consequent_, alternative_); @@ -6611,7 +6611,7 @@ namespace exprtk construct_branch_pair(consequent_, consequent); } - inline T value() const + inline T value() const override { assert(condition_ .first); assert(consequent_.first); @@ -6622,18 +6622,18 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_conditional; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(condition_ , node_delete_list); expression_node::ndb_t::collect(consequent_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t:: compute_node_depth(condition_, consequent_); @@ -6674,7 +6674,7 @@ namespace exprtk construct_branch_pair(return_, ret); } - inline T value() const + inline T value() const override { throw break_exception(return_.first ? return_.first->value() : std::numeric_limits::quiet_NaN()); #ifndef _MSC_VER @@ -6682,17 +6682,17 @@ namespace exprtk #endif } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_break; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(return_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(return_); } @@ -6707,7 +6707,7 @@ namespace exprtk { public: - inline T value() const + inline T value() const override { throw continue_exception(); #ifndef _MSC_VER @@ -6715,7 +6715,7 @@ namespace exprtk #endif } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_break; } @@ -6794,7 +6794,7 @@ namespace exprtk construct_branch_pair(loop_body_, loop_body); } - inline T value() const + inline T value() const override { assert(condition_.first); assert(loop_body_.first); @@ -6811,18 +6811,18 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_while; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(condition_, node_delete_list); expression_node::ndb_t::collect(loop_body_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(condition_, loop_body_); } @@ -6851,7 +6851,7 @@ namespace exprtk construct_branch_pair(loop_body_, loop_body); } - inline T value() const + inline T value() const override { assert(condition_.first); assert(loop_body_.first); @@ -6869,18 +6869,18 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_repeat; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(condition_, node_delete_list); expression_node::ndb_t::collect(loop_body_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(condition_, loop_body_); } @@ -6913,7 +6913,7 @@ namespace exprtk construct_branch_pair(loop_body_ , loop_body ); } - inline T value() const + inline T value() const override { assert(condition_.first); assert(loop_body_.first); @@ -6944,12 +6944,12 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_for; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(initialiser_, node_delete_list); expression_node::ndb_t::collect(condition_ , node_delete_list); @@ -6957,7 +6957,7 @@ namespace exprtk expression_node::ndb_t::collect(loop_body_ , node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth (initialiser_, condition_, incrementor_, loop_body_); @@ -6990,7 +6990,7 @@ namespace exprtk construct_branch_pair(loop_body_, loop_body); } - inline T value() const + inline T value() const override { assert(condition_.first); assert(loop_body_.first); @@ -7016,18 +7016,18 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_while; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(condition_, node_delete_list); expression_node::ndb_t::collect(loop_body_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(condition_, loop_body_); } @@ -7056,7 +7056,7 @@ namespace exprtk construct_branch_pair(loop_body_, loop_body); } - inline T value() const + inline T value() const override { assert(condition_.first); assert(loop_body_.first); @@ -7083,18 +7083,18 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_repeat; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(condition_, node_delete_list); expression_node::ndb_t::collect(loop_body_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(condition_, loop_body_); } @@ -7127,7 +7127,7 @@ namespace exprtk construct_branch_pair(loop_body_ , loop_body ); } - inline T value() const + inline T value() const override { assert(condition_.first); assert(loop_body_.first); @@ -7177,12 +7177,12 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_for; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(initialiser_, node_delete_list); expression_node::ndb_t::collect(condition_ , node_delete_list); @@ -7190,7 +7190,7 @@ namespace exprtk expression_node::ndb_t::collect(loop_body_ , node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth (initialiser_, condition_, incrementor_, loop_body_); @@ -7236,7 +7236,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (!arg_list_.empty()) { @@ -7259,17 +7259,17 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_switch; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(arg_list_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(arg_list_); } @@ -7292,7 +7292,7 @@ namespace exprtk : switch_node(arg_list) {} - inline T value() const + inline T value() const override { return Switch_N::process(switch_node::arg_list_); } @@ -7329,7 +7329,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { T result = T(0); @@ -7354,17 +7354,17 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_mswitch; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(arg_list_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(arg_list_); } @@ -7407,22 +7407,22 @@ namespace exprtk return this < (&v); } - inline T value() const + inline T value() const override { return (*value_); } - inline T& ref() + inline T& ref() override { return (*value_); } - inline const T& ref() const + inline const T& ref() const override { return (*value_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_variable; } @@ -7649,37 +7649,37 @@ namespace exprtk vds_(vds) {} - inline T value() const + inline T value() const override { return vds().data()[0]; } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return const_cast(this); } - vector_node_ptr vec() + vector_node_ptr vec() override { return this; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vector; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -7713,22 +7713,22 @@ namespace exprtk construct_branch_pair(index_, index); } - inline T value() const + inline T value() const override { return *(vector_base_ + static_cast(details::numeric::to_int64(index_.first->value()))); } - inline T& ref() + inline T& ref() override { return *(vector_base_ + static_cast(details::numeric::to_int64(index_.first->value()))); } - inline const T& ref() const + inline const T& ref() const override { return *(vector_base_ + static_cast(details::numeric::to_int64(index_.first->value()))); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecelem; } @@ -7738,12 +7738,12 @@ namespace exprtk return (*vec_holder_); } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(index_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(index_); } @@ -7775,22 +7775,22 @@ namespace exprtk construct_branch_pair(index_, index); } - inline T value() const + inline T value() const override { return *(vds_.data() + static_cast(details::numeric::to_int64(index_.first->value()))); } - inline T& ref() + inline T& ref() override { return *(vds_.data() + static_cast(details::numeric::to_int64(index_.first->value()))); } - inline const T& ref() const + inline const T& ref() const override { return *(vds_.data() + static_cast(details::numeric::to_int64(index_.first->value()))); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_rbvecelem; } @@ -7800,12 +7800,12 @@ namespace exprtk return (*vector_holder_); } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(index_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(index_); } @@ -7836,22 +7836,22 @@ namespace exprtk vector_holder_->set_ref(&vds_.ref()); } - inline T value() const + inline T value() const override { return *(vds_.data() + index_); } - inline T& ref() + inline T& ref() override { return *(vds_.data() + index_); } - inline const T& ref() const + inline const T& ref() const override { return *(vds_.data() + index_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_rbveccelem; } @@ -7885,7 +7885,7 @@ namespace exprtk single_value_initialse_(single_value_initialse) {} - inline T value() const + inline T value() const override { if (single_value_initialse_) { @@ -7915,17 +7915,17 @@ namespace exprtk return *(vector_base_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecdefass; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(initialiser_list_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(initialiser_list_); } @@ -7953,13 +7953,13 @@ namespace exprtk var1_(var1) {} - inline T value() const + inline T value() const override { std::swap(var0_->ref(),var1_->ref()); return var1_->ref(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_swap; } @@ -7984,13 +7984,13 @@ namespace exprtk var1_(dynamic_cast(var1)) {} - inline T value() const + inline T value() const override { std::swap(var0_->ref(),var1_->ref()); return var1_->ref(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_swap; } @@ -8049,7 +8049,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { assert(binary_node::branch_[0].first); assert(binary_node::branch_[1].first); @@ -8073,32 +8073,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return vec0_node_ptr_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return vec0_node_ptr_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecvecswap; } - std::size_t size() const + std::size_t size() const override { return vec_size_; } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -8142,7 +8142,7 @@ namespace exprtk return this < (&v); } - inline T value() const + inline T value() const override { rp_.n1_c.second = (*value_).size() - 1; rp_.cache.second = rp_.n1_c.second; @@ -8150,17 +8150,17 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return ref(); } - char_cptr base() const + char_cptr base() const override { return &(*value_)[0]; } - std::size_t size() const + std::size_t size() const override { return ref().size(); } @@ -8175,17 +8175,17 @@ namespace exprtk return (*value_); } - range_t& range_ref() + range_t& range_ref() override { return rp_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return rp_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_stringvar; } @@ -8215,7 +8215,7 @@ namespace exprtk rp_(rp) {} - virtual ~string_range_node() + ~string_range_node() override { rp_.free(); } @@ -8225,22 +8225,22 @@ namespace exprtk return this < (&v); } - inline T value() const + inline T value() const override { return std::numeric_limits::quiet_NaN(); } - inline std::string str() const + inline std::string str() const override { return (*value_); } - char_cptr base() const + char_cptr base() const override { return &(*value_)[0]; } - std::size_t size() const + std::size_t size() const override { return ref().size(); } @@ -8260,17 +8260,17 @@ namespace exprtk return (*value_); } - inline range_t& range_ref() + inline range_t& range_ref() override { return rp_; } - inline const range_t& range_ref() const + inline const range_t& range_ref() const override { return rp_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_stringvarrng; } @@ -8298,27 +8298,27 @@ namespace exprtk rp_(rp) {} - ~const_string_range_node() + ~const_string_range_node() override { rp_.free(); } - inline T value() const + inline T value() const override { return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return value_; } - char_cptr base() const + char_cptr base() const override { return value_.data(); } - std::size_t size() const + std::size_t size() const override { return value_.size(); } @@ -8328,17 +8328,17 @@ namespace exprtk return rp_; } - range_t& range_ref() + range_t& range_ref() override { return rp_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return rp_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_cstringvarrng; } @@ -8397,12 +8397,12 @@ namespace exprtk initialised_ = (str_base_ptr_ && str_range_ptr_); } - ~generic_string_range_node() + ~generic_string_range_node() override { base_range_.free(); } - inline T value() const + inline T value() const override { if (initialised_) { @@ -8437,42 +8437,42 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return value_; } - char_cptr base() const + char_cptr base() const override { return &value_[0]; } - std::size_t size() const + std::size_t size() const override { return value_.size(); } - range_t& range_ref() + range_t& range_ref() override { return range_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return range_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strgenrange; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -8550,7 +8550,7 @@ namespace exprtk str1_range_ptr_ ; } - inline T value() const + inline T value() const override { if (initialised_) { @@ -8588,32 +8588,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return value_; } - char_cptr base() const + char_cptr base() const override { return &value_[0]; } - std::size_t size() const + std::size_t size() const override { return value_.size(); } - range_t& range_ref() + range_t& range_ref() override { return range_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return range_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strconcat; } @@ -8663,7 +8663,7 @@ namespace exprtk initialised_ = (str0_node_ptr_ && str1_node_ptr_); } - inline T value() const + inline T value() const override { if (initialised_) { @@ -8679,32 +8679,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return str0_node_ptr_->str(); } - char_cptr base() const + char_cptr base() const override { return str0_node_ptr_->base(); } - std::size_t size() const + std::size_t size() const override { return str0_node_ptr_->size(); } - range_t& range_ref() + range_t& range_ref() override { return str0_node_ptr_->range_ref(); } - const range_t& range_ref() const + const range_t& range_ref() const override { return str0_node_ptr_->range_ref(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strswap; } @@ -8773,7 +8773,7 @@ namespace exprtk str1_range_ptr_ ; } - inline T value() const + inline T value() const override { if (initialised_) { @@ -8856,7 +8856,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strswap; } @@ -8888,12 +8888,12 @@ namespace exprtk : value_(&v) {} - inline T value() const + inline T value() const override { return T((*value_).size()); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_stringvarsize; } @@ -8930,7 +8930,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { T result = std::numeric_limits::quiet_NaN(); @@ -8943,17 +8943,17 @@ namespace exprtk return result; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_stringsize; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -9029,7 +9029,7 @@ namespace exprtk str1_range_ptr_ ; } - inline T value() const + inline T value() const override { if (initialised_) { @@ -9056,32 +9056,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return str0_node_ptr_->str(); } - char_cptr base() const + char_cptr base() const override { return str0_node_ptr_->base(); } - std::size_t size() const + std::size_t size() const override { return str0_node_ptr_->size(); } - range_t& range_ref() + range_t& range_ref() override { return str0_node_ptr_->range_ref(); } - const range_t& range_ref() const + const range_t& range_ref() const override { return str0_node_ptr_->range_ref(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strass; } @@ -9158,7 +9158,7 @@ namespace exprtk str1_range_ptr_ ; } - inline T value() const + inline T value() const override { if (initialised_) { @@ -9193,32 +9193,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return str0_base_ptr_->str(); } - char_cptr base() const + char_cptr base() const override { return str0_base_ptr_->base(); } - std::size_t size() const + std::size_t size() const override { return str0_base_ptr_->size(); } - range_t& range_ref() + range_t& range_ref() override { return str0_rng_node_ptr_->range_ref(); } - const range_t& range_ref() const + const range_t& range_ref() const override { return str0_rng_node_ptr_->range_ref(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strass; } @@ -9299,7 +9299,7 @@ namespace exprtk } - inline T value() const + inline T value() const override { if (initialised_) { @@ -9351,32 +9351,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return value_; } - char_cptr base() const + char_cptr base() const override { return &value_[0]; } - std::size_t size() const + std::size_t size() const override { return value_.size(); } - range_t& range_ref() + range_t& range_ref() override { return range_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return range_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strcondition; } @@ -9441,7 +9441,7 @@ namespace exprtk initialised_ = str0_base_ptr_ && str0_range_ptr_ ; } - inline T value() const + inline T value() const override { if (initialised_) { @@ -9474,32 +9474,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return value_; } - char_cptr base() const + char_cptr base() const override { return &value_[0]; } - std::size_t size() const + std::size_t size() const override { return value_.size(); } - range_t& range_ref() + range_t& range_ref() override { return range_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return range_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strccondition; } @@ -9578,7 +9578,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (!arg_list_.empty()) { @@ -9590,43 +9590,43 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - std::string str() const + std::string str() const override { return str_base_ptr_->str(); } - char_cptr base() const + char_cptr base() const override { return str_base_ptr_->base(); } - std::size_t size() const + std::size_t size() const override { return str_base_ptr_->size(); } - range_t& range_ref() + range_t& range_ref() override { return str_range_ptr_->range_ref(); } - const range_t& range_ref() const + const range_t& range_ref() const override { return str_range_ptr_->range_ref(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_stringvararg; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(final_node_, node_delete_list); expression_node::ndb_t::collect(arg_list_ , node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return std::max( expression_node::ndb_t::compute_node_depth(final_node_), @@ -9881,7 +9881,7 @@ namespace exprtk : trinary_node(opr, branch0, branch1, branch2) {} - inline T value() const + inline T value() const override { assert(trinary_node::branch_[0].first); assert(trinary_node::branch_[1].first); @@ -9910,7 +9910,7 @@ namespace exprtk : quaternary_node(opr, branch0, branch1, branch2, branch3) {} - inline T value() const + inline T value() const override { assert(quaternary_node::branch_[0].first); assert(quaternary_node::branch_[1].first); @@ -9939,12 +9939,12 @@ namespace exprtk v2_(v2) {} - inline T value() const + inline T value() const override { return SpecialFunction::process(v0_, v1_, v2_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_trinary; } @@ -9973,12 +9973,12 @@ namespace exprtk v3_(v3) {} - inline T value() const + inline T value() const override { return SpecialFunction::process(v0_, v1_, v2_, v3_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_trinary; } @@ -10022,22 +10022,22 @@ namespace exprtk } } - inline T value() const + inline T value() const override { return VarArgFunction::process(arg_list_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vararg; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(arg_list_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(arg_list_); } @@ -10075,7 +10075,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (!arg_list_.empty()) return VarArgFunction::process(arg_list_); @@ -10083,7 +10083,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vararg; } @@ -10114,7 +10114,7 @@ namespace exprtk ivec_ptr_ = 0; } - inline T value() const + inline T value() const override { if (ivec_ptr_) { @@ -10128,17 +10128,17 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecfunc; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(v_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(v_); } @@ -10168,7 +10168,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (var_node_ptr_) { @@ -10208,7 +10208,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (vec_node_ptr_) { @@ -10248,7 +10248,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (rbvec_node_ptr_) { @@ -10288,7 +10288,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (rbvec_node_ptr_) { @@ -10332,7 +10332,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (vec_node_ptr_) { @@ -10392,32 +10392,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return vec_node_ptr_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return vec_node_ptr_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecvalass; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -10479,7 +10479,7 @@ namespace exprtk initialised_ = (vec0_node_ptr_ && vec1_node_ptr_); } - inline T value() const + inline T value() const override { if (initialised_) { @@ -10544,32 +10544,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return vec0_node_ptr_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return vec0_node_ptr_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecvecass; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -10602,7 +10602,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (var_node_ptr_) { @@ -10641,7 +10641,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (vec_node_ptr_) { @@ -10680,7 +10680,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (rbvec_node_ptr_) { @@ -10719,7 +10719,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (rbvec_node_ptr_) { @@ -10762,7 +10762,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if (vec_node_ptr_) { @@ -10823,37 +10823,37 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return vec_node_ptr_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return vec_node_ptr_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecopvalass; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } - bool side_effect() const + bool side_effect() const override { return true; } @@ -10909,7 +10909,7 @@ namespace exprtk initialised_ = (vec0_node_ptr_ && vec1_node_ptr_); } - inline T value() const + inline T value() const override { if (initialised_) { @@ -10975,37 +10975,37 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return vec0_node_ptr_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return vec0_node_ptr_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecopvecass; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } - bool side_effect() const + bool side_effect() const override { return true; } @@ -11091,13 +11091,13 @@ namespace exprtk } } - ~vec_binop_vecvec_node() + ~vec_binop_vecvec_node() override { delete temp_; delete temp_vec_node_; } - inline T value() const + inline T value() const override { if (initialised_) { @@ -11165,32 +11165,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return temp_vec_node_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return temp_vec_node_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecvecarith; } - std::size_t size() const + std::size_t size() const override { return vds_.size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -11253,13 +11253,13 @@ namespace exprtk } } - ~vec_binop_vecval_node() + ~vec_binop_vecval_node() override { delete temp_; delete temp_vec_node_; } - inline T value() const + inline T value() const override { if (vec0_node_ptr_) { @@ -11325,32 +11325,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return temp_vec_node_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return temp_vec_node_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecvalarith; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -11411,13 +11411,13 @@ namespace exprtk } } - ~vec_binop_valvec_node() + ~vec_binop_valvec_node() override { delete temp_; delete temp_vec_node_; } - inline T value() const + inline T value() const override { if (vec1_node_ptr_) { @@ -11483,32 +11483,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return temp_vec_node_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return temp_vec_node_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecvalarith; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -11567,13 +11567,13 @@ namespace exprtk } } - ~unary_vector_node() + ~unary_vector_node() override { delete temp_; delete temp_vec_node_; } - inline T value() const + inline T value() const override { assert(unary_node::branch_.first); @@ -11637,32 +11637,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - vector_node_ptr vec() const + vector_node_ptr vec() const override { return temp_vec_node_; } - vector_node_ptr vec() + vector_node_ptr vec() override { return temp_vec_node_; } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vecunaryop; } - std::size_t size() const + std::size_t size() const override { return vds().size(); } - vds_t& vds() + vds_t& vds() override { return vds_; } - const vds_t& vds() const + const vds_t& vds() const override { return vds_; } @@ -11688,7 +11688,7 @@ namespace exprtk : binary_node(opr, branch0, branch1) {} - inline T value() const + inline T value() const override { assert(binary_node::branch_[0].first); assert(binary_node::branch_[1].first); @@ -11715,7 +11715,7 @@ namespace exprtk : binary_node(opr, branch0, branch1) {} - inline T value() const + inline T value() const override { assert(binary_node::branch_[0].first); assert(binary_node::branch_[1].first); @@ -11775,7 +11775,7 @@ namespace exprtk return this < (&fn); } - inline T value() const + inline T value() const override { // Needed for incompetent and broken msvc compiler versions #ifdef _MSC_VER @@ -12005,17 +12005,17 @@ namespace exprtk { return f(v[0]); } }; - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_function; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::template compute_node_depth(branch_); } @@ -12044,7 +12044,7 @@ namespace exprtk return this < (&fn); } - inline T value() const + inline T value() const override { if (function_) return (*function_)(); @@ -12052,7 +12052,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_function; } @@ -12082,7 +12082,7 @@ namespace exprtk return this < (&fn); } - inline T value() const + inline T value() const override { if (function_) { @@ -12093,12 +12093,12 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_vafunction; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { for (std::size_t i = 0; i < arg_list_.size(); ++i) { @@ -12109,7 +12109,7 @@ namespace exprtk } } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(arg_list_); } @@ -12155,15 +12155,15 @@ namespace exprtk arg_list_(arg_list) {} - virtual ~generic_function_node() + ~generic_function_node() override {} - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -12259,7 +12259,7 @@ namespace exprtk return this < (&fn); } - inline T value() const + inline T value() const override { if (function_) { @@ -12274,7 +12274,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_genfunction; } @@ -12355,7 +12355,7 @@ namespace exprtk return this < (&fn); } - inline T value() const + inline T value() const override { if (gen_function_t::function_) { @@ -12379,32 +12379,32 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strfunction; } - std::string str() const + std::string str() const override { return ret_string_; } - char_cptr base() const + char_cptr base() const override { return &ret_string_[0]; } - std::size_t size() const + std::size_t size() const override { return ret_string_.size(); } - range_t& range_ref() + range_t& range_ref() override { return range_; } - const range_t& range_ref() const + const range_t& range_ref() const override { return range_; } @@ -12431,7 +12431,7 @@ namespace exprtk param_seq_index_(param_seq_index) {} - inline T value() const + inline T value() const override { if (gen_function_t::function_) { @@ -12450,7 +12450,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_genfunction; } @@ -12476,7 +12476,7 @@ namespace exprtk param_seq_index_(param_seq_index) {} - inline T value() const + inline T value() const override { if (str_function_t::function_) { @@ -12501,7 +12501,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_strfunction; } @@ -12549,7 +12549,7 @@ namespace exprtk results_context_(&rc) {} - inline T value() const + inline T value() const override { if ( (0 != results_context_) && @@ -12567,7 +12567,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_return; } @@ -12593,7 +12593,7 @@ namespace exprtk construct_branch_pair(body_, body); } - inline T value() const + inline T value() const override { assert(body_.first); @@ -12611,7 +12611,7 @@ namespace exprtk } } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_retenv; } @@ -12621,12 +12621,12 @@ namespace exprtk return &return_invoked_; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(body_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(body_); } @@ -13869,7 +13869,7 @@ namespace exprtk { public: - virtual ~vov_base_node() + ~vov_base_node() override {} inline virtual operator_type operation() const @@ -13887,7 +13887,7 @@ namespace exprtk { public: - virtual ~cov_base_node() + ~cov_base_node() override {} inline virtual operator_type operation() const @@ -13905,7 +13905,7 @@ namespace exprtk { public: - virtual ~voc_base_node() + ~voc_base_node() override {} inline virtual operator_type operation() const @@ -13923,7 +13923,7 @@ namespace exprtk { public: - virtual ~vob_base_node() + ~vob_base_node() override {} virtual const T& v() const = 0; @@ -13934,7 +13934,7 @@ namespace exprtk { public: - virtual ~bov_base_node() + ~bov_base_node() override {} virtual const T& v() const = 0; @@ -13945,7 +13945,7 @@ namespace exprtk { public: - virtual ~cob_base_node() + ~cob_base_node() override {} inline virtual operator_type operation() const @@ -13965,7 +13965,7 @@ namespace exprtk { public: - virtual ~boc_base_node() + ~boc_base_node() override {} inline virtual operator_type operation() const @@ -13985,7 +13985,7 @@ namespace exprtk { public: - virtual ~uv_base_node() + ~uv_base_node() override {} inline virtual operator_type operation() const @@ -14001,7 +14001,7 @@ namespace exprtk { public: - virtual ~sos_base_node() + ~sos_base_node() override {} inline virtual operator_type operation() const @@ -14015,7 +14015,7 @@ namespace exprtk { public: - virtual ~sosos_base_node() + ~sosos_base_node() override {} inline virtual operator_type operation() const @@ -14029,7 +14029,7 @@ namespace exprtk { public: - virtual ~T0oT1oT2_base_node() + ~T0oT1oT2_base_node() override {} virtual std::string type_id() const = 0; @@ -14040,7 +14040,7 @@ namespace exprtk { public: - virtual ~T0oT1oT2oT3_base_node() + ~T0oT1oT2oT3_base_node() override {} virtual std::string type_id() const = 0; @@ -14058,22 +14058,22 @@ namespace exprtk : v_(var) {} - inline T value() const + inline T value() const override { return Operation::process(v_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } - inline const T& v() const + inline const T& v() const override { return v_; } @@ -14107,12 +14107,12 @@ namespace exprtk f_ (bf ) {} - inline T value() const + inline T value() const override { return f_(u0_(v0_),u1_(v1_)); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_uvouv; } @@ -14173,12 +14173,12 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { return Operation::process(branch_.first->value()); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } @@ -14188,7 +14188,7 @@ namespace exprtk return Operation::operation(); } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } @@ -14198,12 +14198,12 @@ namespace exprtk branch_.second = false; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -14478,7 +14478,7 @@ namespace exprtk f_ (p2) {} - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { static const typename expression_node::node_type result = nodetype_T0oT1::result; return result; @@ -14489,7 +14489,7 @@ namespace exprtk return e_default; } - inline T value() const + inline T value() const override { return f_(t0_,t1_); } @@ -14548,7 +14548,7 @@ namespace exprtk f1_(p4) {} - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { static const typename expression_node::node_type result = nodetype_T0oT1oT2::result; return result; @@ -14559,7 +14559,7 @@ namespace exprtk return e_default; } - inline T value() const + inline T value() const override { return ProcessMode::process(t0_, t1_, t2_, f0_, f1_); } @@ -14589,7 +14589,7 @@ namespace exprtk return f1_; } - std::string type_id() const + std::string type_id() const override { return id(); } @@ -14644,7 +14644,7 @@ namespace exprtk f2_(p6) {} - inline T value() const + inline T value() const override { return ProcessMode::process(t0_, t1_, t2_, t3_, f0_, f1_, f2_); } @@ -14684,7 +14684,7 @@ namespace exprtk return f2_; } - inline std::string type_id() const + inline std::string type_id() const override { return id(); } @@ -14735,7 +14735,7 @@ namespace exprtk f_ (p3) {} - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { static const typename expression_node::node_type result = nodetype_T0oT1oT2::result; return result; @@ -14746,7 +14746,7 @@ namespace exprtk return e_default; } - inline T value() const + inline T value() const override { return f_(t0_, t1_, t2_); } @@ -14771,7 +14771,7 @@ namespace exprtk return f_; } - std::string type_id() const + std::string type_id() const override { return id(); } @@ -14805,7 +14805,7 @@ namespace exprtk { public: - virtual ~sf3ext_type_node() + ~sf3ext_type_node() override {} virtual T0 t0() const = 0; @@ -14831,7 +14831,7 @@ namespace exprtk t2_(p2) {} - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { static const typename expression_node::node_type result = nodetype_T0oT1oT2::result; return result; @@ -14842,27 +14842,27 @@ namespace exprtk return e_default; } - inline T value() const + inline T value() const override { return SF3Operation::process(t0_, t1_, t2_); } - T0 t0() const + T0 t0() const override { return t0_; } - T1 t1() const + T1 t1() const override { return t1_; } - T2 t2() const + T2 t2() const override { return t2_; } - std::string type_id() const + std::string type_id() const override { return id(); } @@ -14922,7 +14922,7 @@ namespace exprtk f_ (p4) {} - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { static const typename expression_node::node_type result = nodetype_T0oT1oT2oT3::result; return result; @@ -14933,7 +14933,7 @@ namespace exprtk return e_default; } - inline T value() const + inline T value() const override { return f_(t0_, t1_, t2_, t3_); } @@ -14963,7 +14963,7 @@ namespace exprtk return f_; } - std::string type_id() const + std::string type_id() const override { return id(); } @@ -15010,7 +15010,7 @@ namespace exprtk t3_(p3) {} - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { static const typename expression_node::node_type result = nodetype_T0oT1oT2oT3::result; return result; @@ -15021,7 +15021,7 @@ namespace exprtk return e_default; } - inline T value() const + inline T value() const override { return SF4Operation::process(t0_, t1_, t2_, t3_); } @@ -15046,7 +15046,7 @@ namespace exprtk return t3_; } - std::string type_id() const + std::string type_id() const override { return id(); } @@ -15133,27 +15133,27 @@ namespace exprtk v1_(var1) {} - inline T value() const + inline T value() const override { return Operation::process(v0_,v1_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } - inline const T& v0() const + inline const T& v0() const override { return v0_; } - inline const T& v1() const + inline const T& v1() const override { return v1_; } @@ -15183,27 +15183,27 @@ namespace exprtk v_(var) {} - inline T value() const + inline T value() const override { return Operation::process(c_,v_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } - inline const T c() const + inline const T c() const override { return c_; } - inline const T& v() const + inline const T& v() const override { return v_; } @@ -15233,22 +15233,22 @@ namespace exprtk c_(const_var) {} - inline T value() const + inline T value() const override { return Operation::process(v_,c_); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } - inline const T c() const + inline const T c() const override { return c_; } - inline const T& v() const + inline const T& v() const override { return v_; } @@ -15280,7 +15280,7 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); return Operation::process(v_,branch_.first->value()); @@ -15291,22 +15291,22 @@ namespace exprtk return Operation::operation(); } - inline const T& v() const + inline const T& v() const override { return v_; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -15336,7 +15336,7 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); return Operation::process(branch_.first->value(),v_); @@ -15347,22 +15347,22 @@ namespace exprtk return Operation::operation(); } - inline const T& v() const + inline const T& v() const override { return v_; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -15392,44 +15392,44 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); return Operation::process(c_,branch_.first->value()); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } - inline const T c() const + inline const T c() const override { return c_; } - inline void set_c(const T new_c) + inline void set_c(const T new_c) override { (*const_cast(&c_)) = new_c; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } - inline expression_node* move_branch(const std::size_t&) + inline expression_node* move_branch(const std::size_t&) override { branch_.second = false; return branch_.first; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -15459,44 +15459,44 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); return Operation::process(branch_.first->value(),c_); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } - inline const T c() const + inline const T c() const override { return c_; } - inline void set_c(const T new_c) + inline void set_c(const T new_c) override { (*const_cast(&c_)) = new_c; } - inline expression_node* branch(const std::size_t&) const + inline expression_node* branch(const std::size_t&) const override { return branch_.first; } - inline expression_node* move_branch(const std::size_t&) + inline expression_node* move_branch(const std::size_t&) override { branch_.second = false; return branch_.first; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -15525,17 +15525,17 @@ namespace exprtk s1_(p1) {} - inline T value() const + inline T value() const override { return Operation::process(s0_,s1_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } @@ -15576,12 +15576,12 @@ namespace exprtk rp0_(rp0) {} - ~str_xrox_node() + ~str_xrox_node() override { rp0_.free(); } - inline T value() const + inline T value() const override { std::size_t r0 = 0; std::size_t r1 = 0; @@ -15592,12 +15592,12 @@ namespace exprtk return T(0); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } @@ -15639,12 +15639,12 @@ namespace exprtk rp1_(rp1) {} - ~str_xoxr_node() + ~str_xoxr_node() override { rp1_.free(); } - inline T value() const + inline T value() const override { std::size_t r0 = 0; std::size_t r1 = 0; @@ -15655,12 +15655,12 @@ namespace exprtk return T(0); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } @@ -15703,13 +15703,13 @@ namespace exprtk rp1_(rp1) {} - ~str_xroxr_node() + ~str_xroxr_node() override { rp0_.free(); rp1_.free(); } - inline T value() const + inline T value() const override { std::size_t r0_0 = 0; std::size_t r0_1 = 0; @@ -15730,12 +15730,12 @@ namespace exprtk return T(0); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } @@ -15815,7 +15815,7 @@ namespace exprtk } } - inline T value() const + inline T value() const override { if ( str0_base_ptr_ && @@ -15851,7 +15851,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } @@ -15887,17 +15887,17 @@ namespace exprtk s2_(p2) {} - inline T value() const + inline T value() const override { return Operation::process(s0_,s1_,s2_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return Operation::type(); } - inline operator_type operation() const + inline operator_type operation() const override { return Operation::operation(); } @@ -15942,12 +15942,12 @@ namespace exprtk : v_(v) {} - inline T value() const + inline T value() const override { return PowOp::result(v_); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_ipow; } @@ -15974,23 +15974,23 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); return PowOp::result(branch_.first->value()); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_ipow; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::collect(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -16015,12 +16015,12 @@ namespace exprtk : v_(v) {} - inline T value() const + inline T value() const override { return (T(1) / PowOp::result(v_)); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_ipowinv; } @@ -16047,23 +16047,23 @@ namespace exprtk construct_branch_pair(branch_, branch); } - inline T value() const + inline T value() const override { assert(branch_.first); return (T(1) / PowOp::result(branch_.first->value())); } - inline typename expression_node::node_type type() const + inline typename expression_node::node_type type() const override { return expression_node::e_ipowinv; } - void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) + void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { expression_node::ndb_t::template collect<>(branch_, node_delete_list); } - std::size_t node_depth() const + std::size_t node_depth() const override { return expression_node::ndb_t::compute_node_depth(branch_); } @@ -37080,7 +37080,7 @@ namespace exprtk disable_has_side_effects(*this); } - virtual ~polynomial() + ~polynomial() override {} #define poly_rtrn(NN) \ @@ -37286,7 +37286,7 @@ namespace exprtk v.resize(pc); } - virtual ~base_func() + ~base_func() override {} inline void update(const T& v0) diff --git a/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h b/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h index 1fdb69f9..7a498511 100644 --- a/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h +++ b/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h @@ -60,7 +60,7 @@ class BoundaryBlockDataHandling {} // initialize standard waLBerla boundary handling - BoundaryHandling_T* initialize(IBlock* const block) + BoundaryHandling_T* initialize(IBlock* const block) override { using B = FreeSurfaceBoundaryHandling< LatticeModel_T, FlagField_T, ScalarField_T >; using flag_t = typename B::flag_t; @@ -91,16 +91,16 @@ class BoundaryBlockDataHandling pressureOutflow, outlet, freeSlip); } - void serialize(IBlock* const block, const BlockDataID& id, mpi::SendBuffer& buffer) + void serialize(IBlock* const block, const BlockDataID& id, mpi::SendBuffer& buffer) override { BoundaryHandling_T* const boundaryHandlingPtr = block->getData< BoundaryHandling_T >(id); CellInterval everyCell = boundaryHandlingPtr->getFlagField()->xyzSizeWithGhostLayer(); boundaryHandlingPtr->pack(buffer, everyCell, true); } - BoundaryHandling_T* deserialize(IBlock* const block) { return initialize(block); } + BoundaryHandling_T* deserialize(IBlock* const block) override { return initialize(block); } - void deserialize(IBlock* const block, const BlockDataID& id, mpi::RecvBuffer& buffer) + void deserialize(IBlock* const block, const BlockDataID& id, mpi::RecvBuffer& buffer) override { BoundaryHandling_T* const boundaryHandlingPtr = block->getData< BoundaryHandling_T >(id); CellInterval everyCell = boundaryHandlingPtr->getFlagField()->xyzSizeWithGhostLayer(); diff --git a/src/lbm/free_surface/dynamics/PdfRefillingSweep.h b/src/lbm/free_surface/dynamics/PdfRefillingSweep.h index 8c1c7451..7cc5ef22 100644 --- a/src/lbm/free_surface/dynamics/PdfRefillingSweep.h +++ b/src/lbm/free_surface/dynamics/PdfRefillingSweep.h @@ -121,9 +121,9 @@ class ExtrapolationRefillingSweepBase : public RefillingSweepBase< LatticeModel_ extrapolationOrder_(extrapolationOrder) {} - virtual ~ExtrapolationRefillingSweepBase() = default; + ~ExtrapolationRefillingSweepBase() override = default; - virtual void operator()(IBlock* const block) = 0; + void operator()(IBlock* const block) override = 0; /******************************************************************************************************************** * Find the lattice direction in the given stencil that corresponds best to the provided direction. diff --git a/src/lbm/vtk/CurlMagnitude.h b/src/lbm/vtk/CurlMagnitude.h index 0aa89fea..6f80fbbc 100644 --- a/src/lbm/vtk/CurlMagnitude.h +++ b/src/lbm/vtk/CurlMagnitude.h @@ -47,12 +47,12 @@ class CurlMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 > protected: - void configure() { + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); velocityField_ = this->block_->template getData< VelocityField_T >(velocityFieldId_ ); } - 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(velocityField_ ); diff --git a/src/lbm/vtk/QCriterion.h b/src/lbm/vtk/QCriterion.h index e3b2748e..946f8f7e 100644 --- a/src/lbm/vtk/QCriterion.h +++ b/src/lbm/vtk/QCriterion.h @@ -42,12 +42,12 @@ class QCriterionVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 > protected: - void configure() { + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); velocityField_ = this->block_->template getData< VelocityField_T >(velocityFieldId_ ); } - 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(velocityField_ ); diff --git a/src/lbm/vtk/Vorticity.h b/src/lbm/vtk/Vorticity.h index 237b711d..1119846c 100644 --- a/src/lbm/vtk/Vorticity.h +++ b/src/lbm/vtk/Vorticity.h @@ -48,12 +48,12 @@ class VorticityComponentVTKWriter : public vtk::BlockCellDataWriter< OutputType, protected: - void configure() { + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); velocityField_ = this->block_->template getData< VelocityField_T >(velocityFieldId_ ); } - 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(velocityField_ ); const real_t dx = blockStorage_->dx(blockStorage_->getLevel(*this->block_)); diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h index 6bf00ca3..9f6e5235 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h @@ -46,7 +46,7 @@ class BoxWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), box_(box) {} - bool contains(const Vector3< real_t >& point) const + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideBoxBF(mesa_pd::transformPositionFromWFtoBF(idx_, ac_, point), box_.getEdgeLength()); } diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h index 56a14bfe..de42d005 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h @@ -47,7 +47,7 @@ class CylindricalBoundaryWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), cylindricalBoundary_(cylindricalBoundary) {} - bool contains(const Vector3< real_t >& point) const + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideCylindricalBoundary(point, ac_->getPosition(idx_), cylindricalBoundary_.getRadius(), cylindricalBoundary_.getAxis()); diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h index 3c8ffe18..0430419a 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h @@ -46,7 +46,7 @@ class EllipsoidWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), ellipsoid_(ellipsoid) {} - bool contains(const Vector3< real_t >& point) const + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideEllipsoidBF(mesa_pd::transformPositionFromWFtoBF(idx_, ac_, point), ellipsoid_.getSemiAxes()); diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h index 9f50d6d3..3cc6ce13 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h @@ -46,7 +46,7 @@ class HalfSpaceWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), halfSpace_(halfSpace) {} - bool contains(const Vector3< real_t >& point) const + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideHalfSpace(point, ac_->getPosition(idx_), halfSpace_.getNormal()); } diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h index 1db48699..84a0db6f 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h @@ -45,7 +45,7 @@ class SphereWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), sphere_(sphere) {} - bool contains(const Vector3< real_t >& point) const + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideSphere(point, ac_->getPosition(idx_), sphere_.getRadius()); } diff --git a/src/python_coupling/export/FieldExport.impl.h b/src/python_coupling/export/FieldExport.impl.h index 60ba3fd1..3cff65b0 100644 --- a/src/python_coupling/export/FieldExport.impl.h +++ b/src/python_coupling/export/FieldExport.impl.h @@ -129,7 +129,7 @@ class GhostLayerFieldDataHandling : public field::BlockDataHandling< GhostLayerF alignment_(alignment) {} - 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 'AlwaysInitializeBlockDataHandling' for a block " @@ -140,7 +140,7 @@ class GhostLayerFieldDataHandling : public field::BlockDataHandling< GhostLayerF return field; } - GhostLayerField_T* reallocate(IBlock* const block) { return allocate(block); } + GhostLayerField_T* reallocate(IBlock* const block) override { return allocate(block); } private: weak_ptr< StructuredBlockStorage > blocks_; From e43929ff5f3379deb89d216f2efed601d1e7c144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 13 Nov 2024 19:49:03 +0100 Subject: [PATCH 03/13] clang-tidy -checks=-*,modernize-use-equals-default --- .../templates/CpuPackInfo.tmpl.h | 2 +- .../templates/GpuPackInfo.tmpl.h | 2 +- .../UniformToNonUniformPackInfoAdapter.h | 2 +- src/core/math/extern/exprtk.h | 107 +++++++----------- src/gather/CurveGatherPackInfo.h | 2 +- 5 files changed, 43 insertions(+), 72 deletions(-) diff --git a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h index f4644a28..137f4da6 100644 --- a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h @@ -47,7 +47,7 @@ class {{class_name}} : public ::walberla::communication::UniformPackInfo {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} {}; - ~{{class_name}}() override {} + ~{{class_name}}() override = default; bool constantDataExchange() const override { return true; } bool threadsafeReceiving() const override { return true; } diff --git a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h index db880eaa..fd8fbd90 100644 --- a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h @@ -54,7 +54,7 @@ class {{class_name}} : public ::walberla::gpu::GeneratedGPUPackInfo {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} {}; - ~{{class_name}}() override {} + ~{{class_name}}() override = default; void pack (stencil::Direction dir, unsigned char * buffer, IBlock * block, gpuStream_t stream) override; void communicateLocal ( stencil::Direction /*dir*/, const IBlock* /* sender */, IBlock* /* receiver */, gpuStream_t /* stream */ ) override diff --git a/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h b/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h index 1f68ec76..6c792bd6 100644 --- a/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h +++ b/src/blockforest/communication/UniformToNonUniformPackInfoAdapter.h @@ -44,7 +44,7 @@ class UniformToNonUniformPackInfoAdapter : public NonUniformPackInfo /*! \name Construction & Destruction */ //@{ UniformToNonUniformPackInfoAdapter( const shared_ptr & uniformPackInfo ) : uniformPackInfo_( uniformPackInfo ) { } - ~UniformToNonUniformPackInfoAdapter() override { } + ~UniformToNonUniformPackInfoAdapter() override = default; //@} //**************************************************************************************************************** diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index 73321af7..b3b0070a 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -769,16 +769,16 @@ namespace exprtk namespace details { - struct unknown_type_tag { unknown_type_tag() {} }; - struct real_type_tag { real_type_tag () {} }; - struct complex_type_tag { complex_type_tag() {} }; - struct int_type_tag { int_type_tag () {} }; + struct unknown_type_tag { unknown_type_tag() = default; }; + struct real_type_tag { real_type_tag () = default; }; + struct complex_type_tag { complex_type_tag() = default; }; + struct int_type_tag { int_type_tag () = default; }; template struct number_type { typedef unknown_type_tag type; - number_type() {} + number_type() = default; }; #define exprtk_register_real_type_tag(T) \ @@ -2083,7 +2083,7 @@ namespace exprtk throw std::runtime_error("ExprTk Loop run-time violation."); } - virtual ~loop_runtime_check() {} + virtual ~loop_runtime_check() = default; }; typedef loop_runtime_check* loop_runtime_check_ptr; @@ -2951,15 +2951,14 @@ namespace exprtk virtual void reset() { } virtual bool result() { return true; } virtual std::size_t process(generator&) { return 0; } - virtual ~helper_interface() { } + virtual ~helper_interface() = default; }; class token_scanner : public helper_interface { public: - ~token_scanner() override - {} + ~token_scanner() override = default; explicit token_scanner(const std::size_t& stride) : stride_(stride) @@ -5141,7 +5140,7 @@ namespace exprtk typedef Node** node_pp_t; typedef std::vector noderef_list_t; - virtual ~node_collector_interface() {} + virtual ~node_collector_interface() = default; virtual void collect_nodes(noderef_list_t&) {} }; @@ -5202,8 +5201,7 @@ namespace exprtk typedef typename nci_t::noderef_list_t noderef_list_t; typedef node_depth_base > ndb_t; - ~expression_node() override - {} + ~expression_node() override = default; inline virtual T value() const { @@ -5593,7 +5591,7 @@ namespace exprtk depth(0) {} - virtual ~node_depth_base() {} + virtual ~node_depth_base() = default; virtual std::size_t node_depth() const { return 1; } @@ -5810,7 +5808,7 @@ namespace exprtk { public: - virtual ~vector_holder_base() {} + virtual ~vector_holder_base() = default; inline value_ptr operator[](const std::size_t& index) const { @@ -6158,8 +6156,7 @@ namespace exprtk typedef range_pack range_t; - virtual ~range_interface() - {} + virtual ~range_interface() = default; virtual range_t& range_ref() = 0; @@ -6174,8 +6171,7 @@ namespace exprtk typedef range_data_type range_data_type_t; - virtual ~string_base_node() - {} + virtual ~string_base_node() = default; virtual std::string str () const = 0; @@ -7379,8 +7375,7 @@ namespace exprtk { public: - virtual ~ivariable() - {} + virtual ~ivariable() = default; virtual T& ref() = 0; virtual const T& ref() const = 0; @@ -7610,8 +7605,7 @@ namespace exprtk typedef vector_node* vector_node_ptr; typedef vec_data_store vds_t; - virtual ~vector_interface() - {} + virtual ~vector_interface() = default; virtual std::size_t size () const = 0; @@ -12155,8 +12149,7 @@ namespace exprtk arg_list_(arg_list) {} - ~generic_function_node() override - {} + ~generic_function_node() override = default; void collect_nodes(typename expression_node::noderef_list_t& node_delete_list) override { @@ -12520,8 +12513,7 @@ namespace exprtk { public: - virtual ~null_igenfunc() - {} + virtual ~null_igenfunc() = default; typedef type_store generic_type; typedef typename generic_type::parameter_list parameter_list_t; @@ -13869,8 +13861,7 @@ namespace exprtk { public: - ~vov_base_node() override - {} + ~vov_base_node() override = default; inline virtual operator_type operation() const { @@ -13887,8 +13878,7 @@ namespace exprtk { public: - ~cov_base_node() override - {} + ~cov_base_node() override = default; inline virtual operator_type operation() const { @@ -13905,8 +13895,7 @@ namespace exprtk { public: - ~voc_base_node() override - {} + ~voc_base_node() override = default; inline virtual operator_type operation() const { @@ -13923,8 +13912,7 @@ namespace exprtk { public: - ~vob_base_node() override - {} + ~vob_base_node() override = default; virtual const T& v() const = 0; }; @@ -13934,8 +13922,7 @@ namespace exprtk { public: - ~bov_base_node() override - {} + ~bov_base_node() override = default; virtual const T& v() const = 0; }; @@ -13945,8 +13932,7 @@ namespace exprtk { public: - ~cob_base_node() override - {} + ~cob_base_node() override = default; inline virtual operator_type operation() const { @@ -13965,8 +13951,7 @@ namespace exprtk { public: - ~boc_base_node() override - {} + ~boc_base_node() override = default; inline virtual operator_type operation() const { @@ -13985,8 +13970,7 @@ namespace exprtk { public: - ~uv_base_node() override - {} + ~uv_base_node() override = default; inline virtual operator_type operation() const { @@ -14001,8 +13985,7 @@ namespace exprtk { public: - ~sos_base_node() override - {} + ~sos_base_node() override = default; inline virtual operator_type operation() const { @@ -14015,8 +13998,7 @@ namespace exprtk { public: - ~sosos_base_node() override - {} + ~sosos_base_node() override = default; inline virtual operator_type operation() const { @@ -14029,8 +14011,7 @@ namespace exprtk { public: - ~T0oT1oT2_base_node() override - {} + ~T0oT1oT2_base_node() override = default; virtual std::string type_id() const = 0; }; @@ -14040,8 +14021,7 @@ namespace exprtk { public: - ~T0oT1oT2oT3_base_node() override - {} + ~T0oT1oT2oT3_base_node() override = default; virtual std::string type_id() const = 0; }; @@ -14805,8 +14785,7 @@ namespace exprtk { public: - ~sf3ext_type_node() override - {} + ~sf3ext_type_node() override = default; virtual T0 t0() const = 0; @@ -16755,8 +16734,7 @@ namespace exprtk : param_count(pc) {} - virtual ~ifunction() - {} + virtual ~ifunction() = default; #define empty_method_body(N) \ { \ @@ -16847,8 +16825,7 @@ namespace exprtk { public: - virtual ~ivararg_function() - {} + virtual ~ivararg_function() = default; inline virtual T operator() (const std::vector&) { @@ -16878,8 +16855,7 @@ namespace exprtk rtrn_type(rtr_type) {} - virtual ~igeneric_function() - {} + virtual ~igeneric_function() = default; #define igeneric_function_empty_body(N) \ { \ @@ -20051,8 +20027,7 @@ namespace exprtk : mode(m) {} - virtual ~unknown_symbol_resolver() - {} + virtual ~unknown_symbol_resolver() = default; virtual bool process(const std::string& /*unknown_symbol*/, usr_symbol_type& st, @@ -20922,8 +20897,7 @@ namespace exprtk expression_generator_.set_strength_reduction_state(settings_.strength_reduction_enabled()); } - ~parser() - {} + ~parser() = default; inline void init_precompilation() { @@ -37080,8 +37054,7 @@ namespace exprtk disable_has_side_effects(*this); } - ~polynomial() override - {} + ~polynomial() override = default; #define poly_rtrn(NN) \ return (NN != N) ? std::numeric_limits::quiet_NaN() : @@ -37176,8 +37149,7 @@ namespace exprtk struct function { - function() - {} + function() = default; function(const std::string& n) : name_(n) @@ -37286,8 +37258,7 @@ namespace exprtk v.resize(pc); } - ~base_func() override - {} + ~base_func() override = default; inline void update(const T& v0) { diff --git a/src/gather/CurveGatherPackInfo.h b/src/gather/CurveGatherPackInfo.h index ea42f21d..05af4398 100644 --- a/src/gather/CurveGatherPackInfo.h +++ b/src/gather/CurveGatherPackInfo.h @@ -106,7 +106,7 @@ class CurveGatherPackInfo : public GatherPackInfo const shared_ptr & dp); - ~CurveGatherPackInfo() override {} + ~CurveGatherPackInfo() override = default; //@} //**************************************************************************************************************** From 3db998642e454b685bb115fd5c6ebcd98c555fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 14 Nov 2024 14:41:26 +0100 Subject: [PATCH 04/13] clang-tidy -checks=-*,modernize-use-nullptr --- extern/lodepng/lodepng.cpp | 186 +++++++++---------- src/blockforest/GlobalLoadBalancing.h | 18 +- src/boundary/BoundaryHandling.h | 10 +- src/core/Array.h | 6 +- src/core/math/extern/exprtk.h | 3 + src/domain_decomposition/BlockStorage.h | 10 +- src/domain_decomposition/IBlock.h | 2 +- src/field/Field.impl.h | 4 +- src/field/FieldClone.h | 4 +- src/field/vtk/FlagFieldMapping.h | 4 +- src/geometry/containment_octree/BranchNode.h | 2 +- src/lbm/PerformanceEvaluation.h | 2 +- src/lbm/boundary/DiffusionDirichlet.h | 2 +- src/lbm/boundary/ParserUBB.h | 2 +- src/lbm/boundary/Pressure.h | 4 +- src/lbm/boundary/VelocityBoundary.h | 4 +- src/lbm/field/DensityVelocityCallback.h | 14 +- src/lbm/lattice_model/ForceModel.h | 4 +- src/lbm/sweeps/ActiveCellSweep.h | 6 +- src/lbm/sweeps/CellwiseSweep.h | 8 +- src/lbm/vtk/CurlMagnitude.h | 2 +- src/lbm/vtk/Density.h | 2 +- src/lbm/vtk/PressureTensor.h | 2 +- src/lbm/vtk/Velocity.h | 4 +- src/lbm/vtk/Vorticity.h | 2 +- src/mesh_common/distance_octree/BranchNode.h | 2 +- src/vtk/VTKOutput.cpp | 4 +- 27 files changed, 158 insertions(+), 155 deletions(-) diff --git a/extern/lodepng/lodepng.cpp b/extern/lodepng/lodepng.cpp index 51492b88..3cf94e59 100644 --- a/extern/lodepng/lodepng.cpp +++ b/extern/lodepng/lodepng.cpp @@ -224,7 +224,7 @@ typedef struct uivector { static void uivector_cleanup(void* p) { ((uivector*)p)->size = ((uivector*)p)->allocsize = 0; lodepng_free(((uivector*)p)->data); - ((uivector*)p)->data = NULL; + ((uivector*)p)->data = nullptr; } /*returns 1 if success, 0 if failure ==> nothing done*/ @@ -244,7 +244,7 @@ static unsigned uivector_resize(uivector* p, size_t size) { } static void uivector_init(uivector* p) { - p->data = NULL; + p->data = nullptr; p->size = p->allocsize = 0; } @@ -296,7 +296,7 @@ static ucvector ucvector_init(unsigned char* buffer, size_t size) { /*free string pointer and set it to NULL*/ static void string_cleanup(char** out) { lodepng_free(*out); - *out = NULL; + *out = nullptr; } /*also appends null termination character*/ @@ -665,10 +665,10 @@ typedef struct HuffmanTree { } HuffmanTree; static void HuffmanTree_init(HuffmanTree* tree) { - tree->codes = 0; - tree->lengths = 0; - tree->table_len = 0; - tree->table_value = 0; + tree->codes = nullptr; + tree->lengths = nullptr; + tree->table_len = nullptr; + tree->table_value = nullptr; } static void HuffmanTree_cleanup(HuffmanTree* tree) { @@ -897,8 +897,8 @@ static BPMNode* bpmnode_create(BPMLists* lists, int weight, unsigned index, BPMN for(i = 0; i != lists->memsize; ++i) lists->memory[i].in_use = 0; for(i = 0; i != lists->listsize; ++i) { BPMNode* node; - for(node = lists->chains0[i]; node != 0; node = node->tail) node->in_use = 1; - for(node = lists->chains1[i]; node != 0; node = node->tail) node->in_use = 1; + for(node = lists->chains0[i]; node != nullptr; node = node->tail) node->in_use = 1; + for(node = lists->chains1[i]; node != nullptr; node = node->tail) node->in_use = 1; } /*collect those that are free*/ lists->numfree = 0; @@ -945,7 +945,7 @@ static void boundaryPM(BPMLists* lists, BPMNode* leaves, size_t numpresent, int if(c == 0) { if(lastindex >= numpresent) return; lists->chains0[c] = lists->chains1[c]; - lists->chains1[c] = bpmnode_create(lists, leaves[lastindex].weight, lastindex + 1, 0); + lists->chains1[c] = bpmnode_create(lists, leaves[lastindex].weight, lastindex + 1, nullptr); } else { /*sum of the weights of the head nodes of the previous lookahead chains.*/ int sum = lists->chains0[c - 1]->weight + lists->chains1[c - 1]->weight; @@ -1016,8 +1016,8 @@ unsigned lodepng_huffman_code_lengths(unsigned* lengths, const unsigned* frequen if(!error) { for(i = 0; i != lists.memsize; ++i) lists.freelist[i] = &lists.memory[i]; - bpmnode_create(&lists, leaves[0].weight, 1, 0); - bpmnode_create(&lists, leaves[1].weight, 2, 0); + bpmnode_create(&lists, leaves[0].weight, 1, nullptr); + bpmnode_create(&lists, leaves[1].weight, 2, nullptr); for(i = 0; i != lists.listsize; ++i) { lists.chains0[i] = &lists.memory[0]; @@ -1134,10 +1134,10 @@ static unsigned getTreeInflateDynamic(HuffmanTree* tree_ll, HuffmanTree* tree_d, unsigned n, HLIT, HDIST, HCLEN, i; /*see comments in deflateDynamic for explanation of the context and these variables, it is analogous*/ - unsigned* bitlen_ll = 0; /*lit,len code lengths*/ - unsigned* bitlen_d = 0; /*dist code lengths*/ + unsigned* bitlen_ll = nullptr; /*lit,len code lengths*/ + unsigned* bitlen_d = nullptr; /*dist code lengths*/ /*code length code lengths ("clcl"), the bit lengths of the huffman tree used to compress bitlen_ll and bitlen_d*/ - unsigned* bitlen_cl = 0; + unsigned* bitlen_cl = nullptr; HuffmanTree tree_cl; /*the code tree for code length codes (the huffman tree for compressed huffman trees)*/ if(!ensureBits17(reader, 14)) return 49; /*error: the bit pointer is or will go past the memory*/ @@ -1825,11 +1825,11 @@ static unsigned deflateDynamic(LodePNGBitWriter* writer, Hash* hash, HuffmanTree tree_ll; /*tree for lit,len values*/ HuffmanTree tree_d; /*tree for distance codes*/ HuffmanTree tree_cl; /*tree for encoding the code lengths representing tree_ll and tree_d*/ - unsigned* frequencies_ll = 0; /*frequency of lit,len codes*/ - unsigned* frequencies_d = 0; /*frequency of dist codes*/ - unsigned* frequencies_cl = 0; /*frequency of code length codes*/ - unsigned* bitlen_lld = 0; /*lit,len,dist code lengths (int bits), literally (without repeat codes).*/ - unsigned* bitlen_lld_e = 0; /*bitlen_lld encoded with repeat codes (this is a rudimentary run length compression)*/ + unsigned* frequencies_ll = nullptr; /*frequency of lit,len codes*/ + unsigned* frequencies_d = nullptr; /*frequency of dist codes*/ + unsigned* frequencies_cl = nullptr; /*frequency of code length codes*/ + unsigned* bitlen_lld = nullptr; /*lit,len,dist code lengths (int bits), literally (without repeat codes).*/ + unsigned* bitlen_lld_e = nullptr; /*bitlen_lld encoded with repeat codes (this is a rudimentary run length compression)*/ size_t datasize = dataend - datapos; /* @@ -2256,12 +2256,12 @@ unsigned lodepng_zlib_compress(unsigned char** out, size_t* outsize, const unsig size_t insize, const LodePNGCompressSettings* settings) { size_t i; unsigned error; - unsigned char* deflatedata = 0; + unsigned char* deflatedata = nullptr; size_t deflatesize = 0; error = deflate(&deflatedata, &deflatesize, in, insize, settings); - *out = NULL; + *out = nullptr; *outsize = 0; if(!error) { *outsize = deflatesize + 6; @@ -2339,12 +2339,12 @@ void lodepng_compress_settings_init(LodePNGCompressSettings* settings) { settings->nicematch = 128; settings->lazymatching = 1; - settings->custom_zlib = 0; - settings->custom_deflate = 0; - settings->custom_context = 0; + settings->custom_zlib = nullptr; + settings->custom_deflate = nullptr; + settings->custom_context = nullptr; } -const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, 0, 0, 0}; +const LodePNGCompressSettings lodepng_default_compress_settings = {2, 1, DEFAULT_WINDOWSIZE, 3, 128, 1, nullptr, nullptr, nullptr}; #endif /*LODEPNG_COMPILE_ENCODER*/ @@ -2356,12 +2356,12 @@ void lodepng_decompress_settings_init(LodePNGDecompressSettings* settings) { settings->ignore_nlen = 0; settings->max_output_size = 0; - settings->custom_zlib = 0; - settings->custom_inflate = 0; - settings->custom_context = 0; + settings->custom_zlib = nullptr; + settings->custom_inflate = nullptr; + settings->custom_context = nullptr; } -const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, 0, 0, 0}; +const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, nullptr, nullptr, nullptr}; #endif /*LODEPNG_COMPILE_DECODER*/ @@ -2547,7 +2547,7 @@ const unsigned char* lodepng_chunk_next_const(const unsigned char* chunk, const unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, const char type[5]) { for(;;) { - if(chunk >= end || end - chunk < 12) return 0; /* past file end: chunk + 12 > end */ + if(chunk >= end || end - chunk < 12) return nullptr; /* past file end: chunk + 12 > end */ if(lodepng_chunk_type_equals(chunk, type)) return chunk; chunk = lodepng_chunk_next(chunk, end); } @@ -2555,7 +2555,7 @@ unsigned char* lodepng_chunk_find(unsigned char* chunk, unsigned char* end, cons const unsigned char* lodepng_chunk_find_const(const unsigned char* chunk, const unsigned char* end, const char type[5]) { for(;;) { - if(chunk >= end || end - chunk < 12) return 0; /* past file end: chunk + 12 > end */ + if(chunk >= end || end - chunk < 12) return nullptr; /* past file end: chunk + 12 > end */ if(lodepng_chunk_type_equals(chunk, type)) return chunk; chunk = lodepng_chunk_next_const(chunk, end); } @@ -2669,7 +2669,7 @@ void lodepng_color_mode_init(LodePNGColorMode* info) { info->key_r = info->key_g = info->key_b = 0; info->colortype = LCT_RGBA; info->bitdepth = 8; - info->palette = 0; + info->palette = nullptr; info->palettesize = 0; } @@ -2733,7 +2733,7 @@ static int lodepng_color_mode_equal(const LodePNGColorMode* a, const LodePNGColo void lodepng_palette_clear(LodePNGColorMode* info) { if(info->palette) lodepng_free(info->palette); - info->palette = 0; + info->palette = nullptr; info->palettesize = 0; } @@ -2846,7 +2846,7 @@ static int lodepng_pixel_overflow(unsigned w, unsigned h, static void LodePNGUnknownChunks_init(LodePNGInfo* info) { unsigned i; - for(i = 0; i != 3; ++i) info->unknown_chunks_data[i] = 0; + for(i = 0; i != 3; ++i) info->unknown_chunks_data[i] = nullptr; for(i = 0; i != 3; ++i) info->unknown_chunks_size[i] = 0; } @@ -2877,8 +2877,8 @@ static unsigned LodePNGUnknownChunks_copy(LodePNGInfo* dest, const LodePNGInfo* static void LodePNGText_init(LodePNGInfo* info) { info->text_num = 0; - info->text_keys = NULL; - info->text_strings = NULL; + info->text_keys = nullptr; + info->text_strings = nullptr; } static void LodePNGText_cleanup(LodePNGInfo* info) { @@ -2893,8 +2893,8 @@ static void LodePNGText_cleanup(LodePNGInfo* info) { static unsigned LodePNGText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; - dest->text_keys = NULL; - dest->text_strings = NULL; + dest->text_keys = nullptr; + dest->text_strings = nullptr; dest->text_num = 0; for(i = 0; i != source->text_num; ++i) { CERROR_TRY_RETURN(lodepng_add_text(dest, source->text_keys[i], source->text_strings[i])); @@ -2931,10 +2931,10 @@ void lodepng_clear_text(LodePNGInfo* info) { static void LodePNGIText_init(LodePNGInfo* info) { info->itext_num = 0; - info->itext_keys = NULL; - info->itext_langtags = NULL; - info->itext_transkeys = NULL; - info->itext_strings = NULL; + info->itext_keys = nullptr; + info->itext_langtags = nullptr; + info->itext_transkeys = nullptr; + info->itext_strings = nullptr; } static void LodePNGIText_cleanup(LodePNGInfo* info) { @@ -2953,10 +2953,10 @@ static void LodePNGIText_cleanup(LodePNGInfo* info) { static unsigned LodePNGIText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; - dest->itext_keys = NULL; - dest->itext_langtags = NULL; - dest->itext_transkeys = NULL; - dest->itext_strings = NULL; + dest->itext_keys = nullptr; + dest->itext_langtags = nullptr; + dest->itext_transkeys = nullptr; + dest->itext_strings = nullptr; dest->itext_num = 0; for(i = 0; i != source->itext_num; ++i) { CERROR_TRY_RETURN(lodepng_add_itext(dest, source->itext_keys[i], source->itext_langtags[i], @@ -3023,7 +3023,7 @@ unsigned lodepng_set_icc(LodePNGInfo* info, const char* name, const unsigned cha void lodepng_clear_icc(LodePNGInfo* info) { string_cleanup(&info->iccp_name); lodepng_free(info->iccp_profile); - info->iccp_profile = NULL; + info->iccp_profile = nullptr; info->iccp_profile_size = 0; info->iccp_defined = 0; } @@ -3048,8 +3048,8 @@ void lodepng_info_init(LodePNGInfo* info) { info->chrm_defined = 0; info->srgb_defined = 0; info->iccp_defined = 0; - info->iccp_name = NULL; - info->iccp_profile = NULL; + info->iccp_name = nullptr; + info->iccp_profile = nullptr; LodePNGUnknownChunks_init(info); #endif /*LODEPNG_COMPILE_ANCILLARY_CHUNKS*/ @@ -4038,7 +4038,7 @@ unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize) { unsigned width, height; LodePNGInfo* info = &state->info_png; - if(insize == 0 || in == 0) { + if(insize == 0 || in == nullptr) { CERROR_RETURN_ERROR(state->error, 48); /*error: the given data is empty*/ } if(insize < 33) { @@ -4205,7 +4205,7 @@ static unsigned unfilter(unsigned char* out, const unsigned char* in, unsigned w */ unsigned y; - unsigned char* prevline = 0; + unsigned char* prevline = nullptr; /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ size_t bytewidth = (bpp + 7u) / 8u; @@ -4430,7 +4430,7 @@ static unsigned readChunk_bKGD(LodePNGInfo* info, const unsigned char* data, siz /*text chunk (tEXt)*/ static unsigned readChunk_tEXt(LodePNGInfo* info, const unsigned char* data, size_t chunkLength) { unsigned error = 0; - char *key = 0, *str = 0; + char *key = nullptr, *str = nullptr; while(!error) /*not really a while loop, only used to break on error*/ { unsigned length, string2_begin; @@ -4476,8 +4476,8 @@ static unsigned readChunk_zTXt(LodePNGInfo* info, const LodePNGDecoderSettings* LodePNGDecompressSettings zlibsettings = decoder->zlibsettings; unsigned length, string2_begin; - char *key = 0; - unsigned char* str = 0; + char *key = nullptr; + unsigned char* str = nullptr; size_t size = 0; while(!error) /*not really a while loop, only used to break on error*/ { @@ -4524,7 +4524,7 @@ static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecoderSettings* LodePNGDecompressSettings zlibsettings = decoder->zlibsettings; unsigned length, begin, compressed; - char *key = 0, *langtag = 0, *transkey = 0; + char *key = nullptr, *langtag = nullptr, *transkey = nullptr; while(!error) /*not really a while loop, only used to break on error*/ { /*Quick check if the chunk length isn't too small. Even without check @@ -4577,7 +4577,7 @@ static unsigned readChunk_iTXt(LodePNGInfo* info, const LodePNGDecoderSettings* length = (unsigned)chunkLength < begin ? 0 : (unsigned)chunkLength - begin; if(compressed) { - unsigned char* str = 0; + unsigned char* str = nullptr; size_t size = 0; zlibsettings.max_output_size = decoder->max_text_size; /*will fail if zlib error, e.g. if length is too small*/ @@ -4761,7 +4761,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, const unsigned char* chunk; unsigned char* idat; /*the data from idat chunks, zlib compressed*/ size_t idatsize = 0; - unsigned char* scanlines = 0; + unsigned char* scanlines = nullptr; size_t scanlines_size = 0, expected_size = 0; size_t outsize = 0; @@ -4773,7 +4773,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, /* safe output values in case error happens */ - *out = 0; + *out = nullptr; *w = *h = 0; state->error = lodepng_inspect(w, h, state, in, insize); /*reads header and resets other parameters in state->info_png*/ @@ -4951,7 +4951,7 @@ static void decodeGeneric(unsigned char** out, unsigned* w, unsigned* h, unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize) { - *out = 0; + *out = nullptr; decodeGeneric(out, w, h, state, in, insize); if(state->error) return state->error; if(!state->decoder.color_convert || lodepng_color_mode_equal(&state->info_raw, &state->info_png.color)) { @@ -5013,11 +5013,11 @@ unsigned lodepng_decode24(unsigned char** out, unsigned* w, unsigned* h, const u #ifdef LODEPNG_COMPILE_DISK unsigned lodepng_decode_file(unsigned char** out, unsigned* w, unsigned* h, const char* filename, LodePNGColorType colortype, unsigned bitdepth) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize; unsigned error; /* safe output values in case error happens */ - *out = 0; + *out = nullptr; *w = *h = 0; error = lodepng_load_file(&buffer, &buffersize, filename); if(!error) error = lodepng_decode_memory(out, w, h, buffer, buffersize, colortype, bitdepth); @@ -5133,7 +5133,7 @@ static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) { } static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) { - unsigned char* chunk = 0; + unsigned char* chunk = nullptr; if(info->colortype == LCT_PALETTE) { size_t i, amount = info->palettesize; @@ -5172,7 +5172,7 @@ static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) { static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t datasize, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* zlib = 0; + unsigned char* zlib = nullptr; size_t zlibsize = 0; error = zlib_compress(&zlib, &zlibsize, data, datasize, zlibsettings); @@ -5184,13 +5184,13 @@ static unsigned addChunk_IDAT(ucvector* out, const unsigned char* data, size_t d } static unsigned addChunk_IEND(ucvector* out) { - return lodepng_chunk_createv(out, 0, "IEND", 0); + return lodepng_chunk_createv(out, 0, "IEND", nullptr); } #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring) { - unsigned char* chunk = 0; + unsigned char* chunk = nullptr; size_t keysize = lodepng_strlen(keyword), textsize = lodepng_strlen(textstring); size_t size = keysize + 1 + textsize; if(keysize < 1 || keysize > 79) return 89; /*error: invalid keyword size*/ @@ -5205,8 +5205,8 @@ static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* te static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* textstring, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* chunk = 0; - unsigned char* compressed = 0; + unsigned char* chunk = nullptr; + unsigned char* compressed = nullptr; size_t compressedsize = 0; size_t textsize = lodepng_strlen(textstring); size_t keysize = lodepng_strlen(keyword); @@ -5233,8 +5233,8 @@ static unsigned addChunk_zTXt(ucvector* out, const char* keyword, const char* te static unsigned addChunk_iTXt(ucvector* out, unsigned compress, const char* keyword, const char* langtag, const char* transkey, const char* textstring, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* chunk = 0; - unsigned char* compressed = 0; + unsigned char* chunk = nullptr; + unsigned char* compressed = nullptr; size_t compressedsize = 0; size_t textsize = lodepng_strlen(textstring); size_t keysize = lodepng_strlen(keyword), langsize = lodepng_strlen(langtag), transsize = lodepng_strlen(transkey); @@ -5275,7 +5275,7 @@ static unsigned addChunk_iTXt(ucvector* out, unsigned compress, const char* keyw } static unsigned addChunk_bKGD(ucvector* out, const LodePNGInfo* info) { - unsigned char* chunk = 0; + unsigned char* chunk = nullptr; if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA) { CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 2, "bKGD")); chunk[8] = (unsigned char)(info->background_r >> 8); @@ -5350,8 +5350,8 @@ static unsigned addChunk_sRGB(ucvector* out, const LodePNGInfo* info) { static unsigned addChunk_iCCP(ucvector* out, const LodePNGInfo* info, LodePNGCompressSettings* zlibsettings) { unsigned error = 0; - unsigned char* chunk = 0; - unsigned char* compressed = 0; + unsigned char* chunk = nullptr; + unsigned char* compressed = nullptr; size_t compressedsize = 0; size_t keysize = lodepng_strlen(info->iccp_name); @@ -5455,7 +5455,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, /*bytewidth is used for filtering, is 1 when bpp < 8, number of bytes per pixel otherwise*/ size_t bytewidth = (bpp + 7u) / 8u; - const unsigned char* prevline = 0; + const unsigned char* prevline = nullptr; unsigned x, y; unsigned error = 0; LodePNGFilterStrategy strategy = settings->filter_strategy; @@ -5600,8 +5600,8 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, zlibsettings.btype = 1; /*a custom encoder likely doesn't read the btype setting and is optimized for complete PNG images only, so disable it*/ - zlibsettings.custom_zlib = 0; - zlibsettings.custom_deflate = 0; + zlibsettings.custom_zlib = nullptr; + zlibsettings.custom_deflate = nullptr; for(type = 0; type != 5; ++type) { attempt[type] = (unsigned char*)lodepng_malloc(linebytes); if(!attempt[type]) error = 83; /*alloc fail*/ @@ -5614,7 +5614,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, filterScanline(attempt[type], &in[y * linebytes], prevline, linebytes, bytewidth, type); size[type] = 0; - dummy = 0; + dummy = nullptr; zlib_compress(&dummy, &size[type], attempt[type], testsize, &zlibsettings); lodepng_free(dummy); /*check if this is smallest size (or if type == 0 it's the first case so always store the values)*/ @@ -5814,16 +5814,16 @@ static unsigned isRGBICCProfile(const unsigned char* profile, unsigned size) { unsigned lodepng_encode(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h, LodePNGState* state) { - unsigned char* data = 0; /*uncompressed version of the IDAT chunk data*/ + unsigned char* data = nullptr; /*uncompressed version of the IDAT chunk data*/ size_t datasize = 0; - ucvector outv = ucvector_init(NULL, 0); + ucvector outv = ucvector_init(nullptr, 0); LodePNGInfo info; const LodePNGInfo* info_png = &state->info_png; lodepng_info_init(&info); /*provide some proper output values if error will happen*/ - *out = 0; + *out = nullptr; *outsize = 0; state->error = 0; @@ -6121,7 +6121,7 @@ void lodepng_encoder_settings_init(LodePNGEncoderSettings* settings) { settings->filter_strategy = LFS_MINSUM; settings->auto_convert = 1; settings->force_palette = 0; - settings->predefined_filters = 0; + settings->predefined_filters = nullptr; #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS settings->add_id = 0; settings->text_compression = 1; @@ -6282,7 +6282,7 @@ unsigned load_file(std::vector& buffer, const std::string& filena /*write given buffer to the file, overwriting the file, it doesn't append to it.*/ unsigned save_file(const std::vector& buffer, const std::string& filename) { - return lodepng_save_file(buffer.empty() ? 0 : &buffer[0], buffer.size(), filename.c_str()); + return lodepng_save_file(buffer.empty() ? nullptr : &buffer[0], buffer.size(), filename.c_str()); } #endif /* LODEPNG_COMPILE_DISK */ @@ -6290,7 +6290,7 @@ unsigned save_file(const std::vector& buffer, const std::string& #ifdef LODEPNG_COMPILE_DECODER unsigned decompress(std::vector& out, const unsigned char* in, size_t insize, const LodePNGDecompressSettings& settings) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize = 0; unsigned error = zlib_decompress(&buffer, &buffersize, 0, in, insize, &settings); if(buffer) { @@ -6302,14 +6302,14 @@ unsigned decompress(std::vector& out, const unsigned char* in, si unsigned decompress(std::vector& out, const std::vector& in, const LodePNGDecompressSettings& settings) { - return decompress(out, in.empty() ? 0 : &in[0], in.size(), settings); + return decompress(out, in.empty() ? nullptr : &in[0], in.size(), settings); } #endif /* LODEPNG_COMPILE_DECODER */ #ifdef LODEPNG_COMPILE_ENCODER unsigned compress(std::vector& out, const unsigned char* in, size_t insize, const LodePNGCompressSettings& settings) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; size_t buffersize = 0; unsigned error = zlib_compress(&buffer, &buffersize, in, insize, &settings); if(buffer) { @@ -6321,7 +6321,7 @@ unsigned compress(std::vector& out, const unsigned char* in, size unsigned compress(std::vector& out, const std::vector& in, const LodePNGCompressSettings& settings) { - return compress(out, in.empty() ? 0 : &in[0], in.size(), settings); + return compress(out, in.empty() ? nullptr : &in[0], in.size(), settings); } #endif /* LODEPNG_COMPILE_ENCODER */ #endif /* LODEPNG_COMPILE_ZLIB */ @@ -6351,7 +6351,7 @@ State& State::operator=(const State& other) { unsigned decode(std::vector& out, unsigned& w, unsigned& h, const unsigned char* in, size_t insize, LodePNGColorType colortype, unsigned bitdepth) { - unsigned char* buffer = 0; + unsigned char* buffer = nullptr; unsigned error = lodepng_decode_memory(&buffer, &w, &h, in, insize, colortype, bitdepth); if(buffer && !error) { State state; @@ -6366,13 +6366,13 @@ unsigned decode(std::vector& out, unsigned& w, unsigned& h, const unsigned decode(std::vector& out, unsigned& w, unsigned& h, const std::vector& in, LodePNGColorType colortype, unsigned bitdepth) { - return decode(out, w, h, in.empty() ? 0 : &in[0], (unsigned)in.size(), colortype, bitdepth); + return decode(out, w, h, in.empty() ? nullptr : &in[0], (unsigned)in.size(), colortype, bitdepth); } unsigned decode(std::vector& out, unsigned& w, unsigned& h, State& state, const unsigned char* in, size_t insize) { - unsigned char* buffer = NULL; + unsigned char* buffer = nullptr; unsigned error = lodepng_decode(&buffer, &w, &h, &state, in, insize); if(buffer && !error) { size_t buffersize = lodepng_get_raw_size(w, h, &state.info_raw); @@ -6385,7 +6385,7 @@ unsigned decode(std::vector& out, unsigned& w, unsigned& h, unsigned decode(std::vector& out, unsigned& w, unsigned& h, State& state, const std::vector& in) { - return decode(out, w, h, state, in.empty() ? 0 : &in[0], in.size()); + return decode(out, w, h, state, in.empty() ? nullptr : &in[0], in.size()); } #ifdef LODEPNG_COMPILE_DISK @@ -6418,7 +6418,7 @@ unsigned encode(std::vector& out, const std::vector& in, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode(out, in.empty() ? nullptr : &in[0], w, h, colortype, bitdepth); } unsigned encode(std::vector& out, @@ -6438,7 +6438,7 @@ unsigned encode(std::vector& out, const std::vector& in, unsigned w, unsigned h, State& state) { if(lodepng_get_raw_size(w, h, &state.info_raw) > in.size()) return 84; - return encode(out, in.empty() ? 0 : &in[0], w, h, state); + return encode(out, in.empty() ? nullptr : &in[0], w, h, state); } #ifdef LODEPNG_COMPILE_DISK @@ -6455,7 +6455,7 @@ unsigned encode(const std::string& filename, const std::vector& in, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { if(lodepng_get_raw_size_lct(w, h, colortype, bitdepth) > in.size()) return 84; - return encode(filename, in.empty() ? 0 : &in[0], w, h, colortype, bitdepth); + return encode(filename, in.empty() ? nullptr : &in[0], w, h, colortype, bitdepth); } #endif /* LODEPNG_COMPILE_DISK */ #endif /* LODEPNG_COMPILE_ENCODER */ diff --git a/src/blockforest/GlobalLoadBalancing.h b/src/blockforest/GlobalLoadBalancing.h index ba92b73f..ca150945 100644 --- a/src/blockforest/GlobalLoadBalancing.h +++ b/src/blockforest/GlobalLoadBalancing.h @@ -497,7 +497,7 @@ inline uint_t GlobalLoadBalancing::minimizeProcesses( const std::vector< BLOCK* #ifdef WALBERLA_BUILD_WITH_METIS - if( numberOfProcesses > 1 && metisConfig.includeMetis() && processesWork == NULL && processesMemory == NULL ) { + if( numberOfProcesses > 1 && metisConfig.includeMetis() && processesWork == nullptr && processesMemory == nullptr ) { uint_t max = numberOfProcesses; uint_t min = uint_c( real_c(0.5) + ( real_c( memorySum( blocks ) ) / memoryLimit ) ); @@ -819,8 +819,8 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me // first call to METIS: always try to balance the workload as good as possible, but allow large imbalances concerning the memory (-> ubvec[1]) - int ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, - &(ubvec[0]), NULL /*idx t *options*/, &objval, &(part[0]) ); + int ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), nullptr, &(adjwgt[0]), &nparts, nullptr, + &(ubvec[0]), nullptr /*idx t *options*/, &objval, &(part[0]) ); // if METIS was successful AND the memory limit of each process is not violated (which is highly unlikely due to a large value for ubvec[1]) // then the algorithm is finished @@ -844,8 +844,8 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me real_t minUbvec = real_t(1); ubvec[1] = minUbvec; - ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, - &(ubvec[0]), NULL /*idx t *options*/, &objval, &(part[0]) ); + ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), nullptr, &(adjwgt[0]), &nparts, nullptr, + &(ubvec[0]), nullptr /*idx t *options*/, &objval, &(part[0]) ); // ... if this doesn't work OR if the memory limit is still violated then METIS is unable to find a valid partitioning @@ -881,8 +881,8 @@ uint_t GlobalLoadBalancing::metis( const std::vector< BLOCK* >& blocks, const me ubvec[1] = ( maxUbvec + minUbvec ) / real_c(2); - ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), NULL, &(adjwgt[0]), &nparts, NULL, - &(ubvec[0]), NULL /*idx t *options*/, &objval, &(part[0]) ); + ret = core::METIS_PartGraphRecursive( &nvtxs, &ncon, &(xadj[0]), &(adjncy[0]), &(vwgt[0]), nullptr, &(adjwgt[0]), &nparts, nullptr, + &(ubvec[0]), nullptr /*idx t *options*/, &objval, &(part[0]) ); if( ret == core::METIS_OK && metisMaxMemory( blocks, numberOfProcesses, part ) <= memoryLimit ) { @@ -998,8 +998,8 @@ void GlobalLoadBalancing::metis2( const std::vector< BLOCK* >& blocks, const uin options[ core::METIS_OPTION_NSEPS ] = 100; options[ core::METIS_OPTION_NCUTS ] = 100; - int ret = core::METIS_PartGraphKway( &nvtxs, &ncon, &( xadj[ 0 ] ), &( adjncy[ 0 ] ), &( vwgt[ 0 ] ), NULL, &( adjwgt[0] ), - &nparts, NULL, NULL, options, &objval, &( part[ 0 ] ) ); + int ret = core::METIS_PartGraphKway( &nvtxs, &ncon, &( xadj[ 0 ] ), &( adjncy[ 0 ] ), &( vwgt[ 0 ] ), nullptr, &( adjwgt[0] ), + &nparts, nullptr, nullptr, options, &objval, &( part[ 0 ] ) ); if( ret != core::METIS_OK ) { diff --git a/src/boundary/BoundaryHandling.h b/src/boundary/BoundaryHandling.h index 9aa5a343..a3bff176 100644 --- a/src/boundary/BoundaryHandling.h +++ b/src/boundary/BoundaryHandling.h @@ -432,7 +432,7 @@ class BoundaryHandling WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); #ifdef __IBMCPP__ - return *(reinterpret_cast< Boundary_T * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< Boundary_T * >( nullptr )); // silencing incorrect IBM compiler warning #endif } @@ -457,7 +457,7 @@ class BoundaryHandling template< typename Boundary_T, typename BoundariesTuple, int N = std::tuple_size::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< Boundary_T, typename std::tuple_element::type >::value >::type* /*dummy*/ = 0 ) const + typename std::enable_if< std::is_same< Boundary_T, typename std::tuple_element::type >::value >::type* /*dummy*/ = nullptr ) const { if( uid == std::get( boundaryConditions ).getUID() ) return std::get( boundaryConditions ); @@ -475,7 +475,7 @@ class BoundaryHandling WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); #ifdef __IBMCPP__ - return *(reinterpret_cast< Boundary_T * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< Boundary_T * >( nullptr )); // silencing incorrect IBM compiler warning #endif } @@ -495,7 +495,7 @@ class BoundaryHandling WALBERLA_ABORT( "The requested boundary condition " << uid.getIdentifier() << " is not part of this boundary handling." ); #ifdef __IBMCPP__ - return *(reinterpret_cast< Boundary_T * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< Boundary_T * >( nullptr )); // silencing incorrect IBM compiler warning #endif } @@ -2501,7 +2501,7 @@ inline typename std::enable_if<(N==-1), BoundaryUID>::type BoundaryHandling< Fla "boundary handling " << uid_.getIdentifier() << "!" ); #ifdef __IBMCPP__ - return *(reinterpret_cast< BoundaryUID * >( NULL )); // silencing incorrect IBM compiler warning + return *(static_cast< BoundaryUID * >( nullptr )); // silencing incorrect IBM compiler warning #endif } diff --git a/src/core/Array.h b/src/core/Array.h index 42ab4efe..c047542d 100644 --- a/src/core/Array.h +++ b/src/core/Array.h @@ -78,7 +78,7 @@ class Array { template< typename T > -inline Array::Array( const uint_t n, const T& t ) : array_( n == 0 ? NULL : new T[n] ), size_( n ) +inline Array::Array( const uint_t n, const T& t ) : array_( n == 0 ? nullptr : new T[n] ), size_( n ) { for( uint_t i = 0; i != n; ++i ) array_[i] = t; @@ -89,7 +89,7 @@ inline Array::Array( const uint_t n, const T& t ) : array_( n == 0 ? NULL : n template< typename T > inline Array::Array( const std::vector& vector ) : - array_( vector.size() == 0 ? NULL : new T[ vector.size() ] ), size_( vector.size() ) + array_( vector.size() == 0 ? nullptr : new T[ vector.size() ] ), size_( vector.size() ) { for( uint_t i = 0; i != size_; ++i ) array_[i] = vector[i]; @@ -100,7 +100,7 @@ inline Array::Array( const std::vector& vector ) : template< typename T > inline Array::Array( const Array& array ) : - array_( array.size_ == 0 ? NULL : new T[ array.size_ ] ), size_( array.size_ ) + array_( array.size_ == 0 ? nullptr : new T[ array.size_ ] ), size_( array.size_ ) { for( uint_t i = 0; i != size_; ++i ) array_[i] = array.array_[i]; diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index b3b0070a..b415b4ba 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -56,6 +56,7 @@ #include #include +//NOLINTBEGIN(modernize-use-nullptr) namespace exprtk { @@ -40042,4 +40043,6 @@ namespace exprtk } // namespace exprtk +//NOLINTEND(modernize-use-nullptr) + #endif diff --git a/src/domain_decomposition/BlockStorage.h b/src/domain_decomposition/BlockStorage.h index 2f29acdb..551ff5f6 100644 --- a/src/domain_decomposition/BlockStorage.h +++ b/src/domain_decomposition/BlockStorage.h @@ -273,7 +273,7 @@ class BlockStorage : private NonCopyable { * \code * for( const_iterator block = begin(); block != end(); ++block ) * if( block->getId() == id ) return *block; - * return NULL; + * return nullptr; * \endcode */ //******************************************************************************************************************* @@ -294,7 +294,7 @@ class BlockStorage : private NonCopyable { * \code * for( iterator block = begin(); block != end(); ++block ) * if( block->getId() == id ) return *block; - * return NULL; + * return nullptr; * \endcode */ //******************************************************************************************************************* @@ -315,7 +315,7 @@ class BlockStorage : private NonCopyable { * \code * for( const_iterator block = begin(); block != end(); ++block ) * if( block->getAABB().contains(x,y,z) ) return *block; - * return NULL; + * return nullptr; * \endcode * * Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. @@ -332,7 +332,7 @@ class BlockStorage : private NonCopyable { * \code * for( iterator block = begin(); block != end(); ++block ) * if( block->getAABB().contains(x,y,z) ) return *block; - * return NULL; + * return nullptr; * \endcode * * Periodicity is not considered! For mapping points to the periodic simulation space see 'mapToPeriodicDomain'. @@ -716,7 +716,7 @@ inline BlockDataID BlockStorage::loadBlockData( const std::string & file, const /*! * This function can be used for removing all data that corresponds to block data ID 'id'. * Please note: The block data ID 'id' will still be valid, but blocks won't return anything anymore, -* they will only return NULL for 'id'. +* they will only return nullptr for 'id'. */ //********************************************************************************************************************** inline void BlockStorage::clearBlockData( const BlockDataID & id ) diff --git a/src/domain_decomposition/IBlock.h b/src/domain_decomposition/IBlock.h index ef563cc0..42f73cd4 100644 --- a/src/domain_decomposition/IBlock.h +++ b/src/domain_decomposition/IBlock.h @@ -359,7 +359,7 @@ inline T* IBlock::getData( const BlockDataID & index ) { //********************************************************************************************************************** /*! * Function for removing all data that corresponds to block data ID 'index'. -* Further calls to "getData" with 'index' will return NULL. +* Further calls to "getData" with 'index' will return nullptr. */ //********************************************************************************************************************** inline void IBlock::deleteData( const BlockDataID & index ) diff --git a/src/field/Field.impl.h b/src/field/Field.impl.h index af93706e..cfbd8d1b 100644 --- a/src/field/Field.impl.h +++ b/src/field/Field.impl.h @@ -103,7 +103,7 @@ namespace field { Field::Field( uint_t _xSize, uint_t _ySize, uint_t _zSize, const std::vector & fValues, const Layout & l, const shared_ptr > &alloc) - : values_( NULL ), valuesWithOffset_( NULL ) + : values_( nullptr ), valuesWithOffset_( nullptr ) { init(_xSize,_ySize,_zSize,l,alloc); set(fValues); @@ -301,7 +301,7 @@ namespace field { * \param _ySize size of y dimension * \param _zSize size of z dimension * \param l memory layout of the field (see Field::Layout) - * \param alloc the allocator to use. If a NULL shared pointer is given, a sensible default is selected, + * \param alloc the allocator to use. If a nullptr is given, a sensible default is selected, * depending on layout * \param innerGhostLayerSizeForAlignedAlloc * This parameter should be set to zero for field that have no ghost layers. diff --git a/src/field/FieldClone.h b/src/field/FieldClone.h index ebb6dddf..eb2a3a42 100644 --- a/src/field/FieldClone.h +++ b/src/field/FieldClone.h @@ -60,7 +60,7 @@ class FieldClone { public: - FieldClone( ConstBlockDataID fieldID ) : fieldID_( fieldID ), dstField_( NULL ){} + FieldClone( ConstBlockDataID fieldID ) : fieldID_( fieldID ), dstField_( nullptr ){} ~FieldClone(){ // Free allocated temporary fields @@ -126,7 +126,7 @@ class FieldCreator { public: - FieldCreator() : dstField_( NULL ){} + FieldCreator() : dstField_( nullptr ){} ~FieldCreator(){ // Free allocated temporary fields diff --git a/src/field/vtk/FlagFieldMapping.h b/src/field/vtk/FlagFieldMapping.h index f8cb572b..267cee26 100644 --- a/src/field/vtk/FlagFieldMapping.h +++ b/src/field/vtk/FlagFieldMapping.h @@ -38,7 +38,7 @@ class FlagFieldMapping : public vtk::BlockCellDataWriter public: FlagFieldMapping( const ConstBlockDataID flagId, const std::string& id ) : - vtk::BlockCellDataWriter( id ), flagId_( flagId ), flagField_( NULL ) {} + vtk::BlockCellDataWriter( id ), flagId_( flagId ), flagField_( nullptr ) {} FlagFieldMapping( const ConstBlockDataID flagId, const std::string& id, const std::map< FlagUID, T > mapping ) : vtk::BlockCellDataWriter( id ), flagId_( flagId ), flagField_( nullptr ), mapping_( mapping ) {} @@ -90,7 +90,7 @@ class BinarizationFieldWriter : public vtk::BlockCellDataWriter public: BinarizationFieldWriter( const ConstBlockDataID fieldID, const std::string& id, SrcType mask) : - vtk::BlockCellDataWriter( id ), fieldID_( fieldID ), field_( NULL ), mask_( mask ) {} + vtk::BlockCellDataWriter( id ), fieldID_( fieldID ), field_( nullptr ), mask_( mask ) {} protected: diff --git a/src/geometry/containment_octree/BranchNode.h b/src/geometry/containment_octree/BranchNode.h index 2b160ad5..742d0962 100644 --- a/src/geometry/containment_octree/BranchNode.h +++ b/src/geometry/containment_octree/BranchNode.h @@ -74,7 +74,7 @@ BranchNode::BranchNode( const shared_ptrtoPoint( aabb.center() ) ) { for( int i = 0; i < 8; ++i ) - children_[i] = NULL; + children_[i] = nullptr; const auto & min = aabb.minCorner(); const auto & max = aabb.maxCorner(); diff --git a/src/lbm/PerformanceEvaluation.h b/src/lbm/PerformanceEvaluation.h index d1deed9c..25bd5651 100644 --- a/src/lbm/PerformanceEvaluation.h +++ b/src/lbm/PerformanceEvaluation.h @@ -226,7 +226,7 @@ PerformanceEvaluationBase< CellCounter_T, FluidCellCounter_T >::PerformanceEvalu fluidCells_( fluidCellCounter ) { #ifdef _OPENMP - if( std::getenv( "OMP_NUM_THREADS" ) == NULL ) + if( std::getenv( "OMP_NUM_THREADS" ) == nullptr ) WALBERLA_ABORT( "If you are using a version of the program that was compiled with OpenMP you have to " "specify the environment variable \'OMP_NUM_THREADS\' accordingly!" ); threadsPerProcess_ = std::atoi( std::getenv( "OMP_NUM_THREADS" ) ); diff --git a/src/lbm/boundary/DiffusionDirichlet.h b/src/lbm/boundary/DiffusionDirichlet.h index 7ffa062a..a79292a0 100644 --- a/src/lbm/boundary/DiffusionDirichlet.h +++ b/src/lbm/boundary/DiffusionDirichlet.h @@ -82,7 +82,7 @@ class DiffusionDirichlet : public Boundary static shared_ptr createConfiguration( const Config::BlockHandle & config ) { return make_shared( config ); } - inline DiffusionDirichlet( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField * const flagField = NULL ); + inline DiffusionDirichlet( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } diff --git a/src/lbm/boundary/ParserUBB.h b/src/lbm/boundary/ParserUBB.h index 309b44c4..2a4d8e08 100644 --- a/src/lbm/boundary/ParserUBB.h +++ b/src/lbm/boundary/ParserUBB.h @@ -297,7 +297,7 @@ inline ParserUBB ( pdfField->xSize(), pdfField->ySize(), pdfField->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); velocityField_ = make_shared( pdfField->xSize(), pdfField->ySize(), pdfField->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); diff --git a/src/lbm/boundary/Pressure.h b/src/lbm/boundary/Pressure.h index 51dc64c2..0ac8e13b 100644 --- a/src/lbm/boundary/Pressure.h +++ b/src/lbm/boundary/Pressure.h @@ -72,7 +72,7 @@ class Pressure : public Boundary static shared_ptr createConfiguration( const Config::BlockHandle & config ) { return make_shared( config ); } - inline Pressure( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField * const flagField = NULL ); + inline Pressure( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } @@ -124,7 +124,7 @@ inline Pressure< LatticeModel_T, flag_t>::Pressure( const BoundaryUID & boundary WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); - if (flagField != NULL) + if (flagField != nullptr) latticeDensityField_ = make_shared( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); else latticeDensityField_ = make_shared( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), pdfField_->nrOfGhostLayers(), field::fzyx ); diff --git a/src/lbm/boundary/VelocityBoundary.h b/src/lbm/boundary/VelocityBoundary.h index 72901642..bfeb31f4 100644 --- a/src/lbm/boundary/VelocityBoundary.h +++ b/src/lbm/boundary/VelocityBoundary.h @@ -89,7 +89,7 @@ class VelocityBoundary : public Boundary - inline VelocityBoundary( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField * const flagField = NULL ); + inline VelocityBoundary( const BoundaryUID & boundaryUID, const FlagUID & uid, PDFField* const pdfField, FlagField * const flagField = nullptr ); void pushFlags( std::vector< FlagUID > & uids ) const { uids.push_back( uid_ ); } @@ -142,7 +142,7 @@ inline VelocityBoundary< LatticeModel_T, flag_t >::VelocityBoundary( const Bound Boundary( boundaryUID ), uid_( uid ), pdfField_( pdfField ) { WALBERLA_ASSERT_NOT_NULLPTR( pdfField_ ); - if (flagField != NULL) + if (flagField != nullptr) vel_ = make_shared( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), flagField->nrOfGhostLayers(), field::fzyx ); else vel_ = make_shared( pdfField_->xSize(), pdfField_->ySize(), pdfField_->zSize(), pdfField_->nrOfGhostLayers(), field::fzyx ); diff --git a/src/lbm/field/DensityVelocityCallback.h b/src/lbm/field/DensityVelocityCallback.h index acf99efb..925129f3 100644 --- a/src/lbm/field/DensityVelocityCallback.h +++ b/src/lbm/field/DensityVelocityCallback.h @@ -320,7 +320,7 @@ class VelocityCallback { public: - VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} + VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} void operator()( IBlock & block ) { @@ -349,7 +349,7 @@ template< typename VelocityField_T > class VelocityCallback >::value >::type > { public: - VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} + VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} void operator()( IBlock & block ) { @@ -377,7 +377,7 @@ class DensityCallback { public: - DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} + DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} void operator()( IBlock & block ) { @@ -407,7 +407,7 @@ class DensityVelocityCallback public: DensityVelocityCallback( const BlockDataID & velocityFieldId, const BlockDataID & densityFieldId ) : - vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( NULL ), dfield_( NULL ) {} + vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( nullptr ), dfield_( nullptr ) {} void operator()( IBlock & block ) { @@ -715,7 +715,7 @@ class DensityVelocityCallback //{ //public: // -// VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} +// VelocityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} // // void operator()( IBlock & block ) // { @@ -744,7 +744,7 @@ class DensityVelocityCallback //{ //public: // -// DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( NULL ) {} +// DensityCallback( const BlockDataID & fieldId ) : fieldId_( fieldId ), field_( nullptr ) {} // // void operator()( IBlock & block ) // { @@ -774,7 +774,7 @@ class DensityVelocityCallback //public: // // DensityVelocityCallback( const BlockDataID & velocityFieldId, const BlockDataID & densityFieldId ) : -// vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( NULL ), dfield_( NULL ) {} +// vId_( velocityFieldId ), dId_( densityFieldId ), vfield_( nullptr ), dfield_( nullptr ) {} // // void operator()( IBlock & block ) // { diff --git a/src/lbm/lattice_model/ForceModel.h b/src/lbm/lattice_model/ForceModel.h index 527b5f5f..aa1f3575 100644 --- a/src/lbm/lattice_model/ForceModel.h +++ b/src/lbm/lattice_model/ForceModel.h @@ -287,7 +287,7 @@ class EDMField static const bool constant = false; EDMField( const BlockDataID & forceDensityFieldId ) : - forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( NULL ) {} + forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( nullptr ) {} void pack( mpi::SendBuffer & buffer ) const { buffer << forceDensityFieldId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> forceDensityFieldId_; } @@ -414,7 +414,7 @@ class LuoField static const bool constant = false; LuoField( const BlockDataID & forceDensityFieldId ) : - forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( NULL ) {} + forceDensityFieldId_( forceDensityFieldId ), forceDensityField_( nullptr ) {} void pack( mpi::SendBuffer & buffer ) const { buffer << forceDensityFieldId_; } void unpack( mpi::RecvBuffer & buffer ) { buffer >> forceDensityFieldId_; } diff --git a/src/lbm/sweeps/ActiveCellSweep.h b/src/lbm/sweeps/ActiveCellSweep.h index 4874c36a..91fa31bc 100644 --- a/src/lbm/sweeps/ActiveCellSweep.h +++ b/src/lbm/sweeps/ActiveCellSweep.h @@ -84,9 +84,9 @@ class ActiveCellSweep : FlagFieldSweepBase< LatticeModel_T, FlagField_T > template< typename LatticeModel_T, typename FlagField_T, typename CellOperation > void ActiveCellSweep< LatticeModel_T, FlagField_T, CellOperation >::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 ); diff --git a/src/lbm/sweeps/CellwiseSweep.h b/src/lbm/sweeps/CellwiseSweep.h index e35e32f6..70f6bc89 100644 --- a/src/lbm/sweeps/CellwiseSweep.h +++ b/src/lbm/sweeps/CellwiseSweep.h @@ -139,8 +139,8 @@ class CellwiseSweep void CellwiseSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T, typename std::enable_if< specialization >::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 ); \ StreamPull< LatticeModel_T >::execute( src, dst, block, this->filter_, numberOfGhostLayersToInclude ); \ } @@ -152,8 +152,8 @@ class CellwiseSweep void CellwiseSweep< LatticeModel_T, Filter_T, DensityVelocityIn_T, DensityVelocityOut_T, typename std::enable_if< specialization >::type \ >::streamCollide( 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/vtk/CurlMagnitude.h b/src/lbm/vtk/CurlMagnitude.h index 6f80fbbc..473fc879 100644 --- a/src/lbm/vtk/CurlMagnitude.h +++ b/src/lbm/vtk/CurlMagnitude.h @@ -43,7 +43,7 @@ class CurlMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 > CurlMagnitudeVTKWriter(const shared_ptr blockStorage, Filter_T & filter, const ConstBlockDataID & velocityFieldId, const std::string & id, const real_t lengthScaleWeight = real_t(-1)) : vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter), - velocityFieldId_(velocityFieldId), velocityField_(NULL), lengthScaleWeight_(lengthScaleWeight) {} + velocityFieldId_(velocityFieldId), velocityField_(nullptr), lengthScaleWeight_(lengthScaleWeight) {} protected: diff --git a/src/lbm/vtk/Density.h b/src/lbm/vtk/Density.h index f40bc635..ba5b65d3 100644 --- a/src/lbm/vtk/Density.h +++ b/src/lbm/vtk/Density.h @@ -66,7 +66,7 @@ class DensitySIVTKWriter : public vtk::BlockCellDataWriter< OutputType > using PdfField_T = PdfField; DensitySIVTKWriter( const ConstBlockDataID & pdf, const real_t rho_SI, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( NULL ), rho_SI_( rho_SI ) {} + vtk::BlockCellDataWriter< OutputType >( id ), bdid_( pdf ), pdf_( nullptr ), rho_SI_( rho_SI ) {} protected: diff --git a/src/lbm/vtk/PressureTensor.h b/src/lbm/vtk/PressureTensor.h index 60c3afe5..0f43e04d 100644 --- a/src/lbm/vtk/PressureTensor.h +++ b/src/lbm/vtk/PressureTensor.h @@ -39,7 +39,7 @@ class PressureTensorVTKWriter : public vtk::BlockCellDataWriter< OutputType, 9 > using PdfField_T = PdfField; PressureTensorVTKWriter( const ConstBlockDataID & pdfFieldId, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 9 >( id ), bdid_( pdfFieldId ), pdf_( NULL ) {} + vtk::BlockCellDataWriter< OutputType, 9 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ) {} protected: diff --git a/src/lbm/vtk/Velocity.h b/src/lbm/vtk/Velocity.h index 8a31c07d..f208158b 100644 --- a/src/lbm/vtk/Velocity.h +++ b/src/lbm/vtk/Velocity.h @@ -93,7 +93,7 @@ class VelocitySIVTKWriter : public vtk::BlockCellDataWriter< OutputType, 3 > using PdfField_T = PdfField; VelocitySIVTKWriter( const ConstBlockDataID & pdfFieldId, const real_t dx_SI, const real_t dt_SI, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} + vtk::BlockCellDataWriter< OutputType, 3 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} protected: @@ -121,7 +121,7 @@ class VelocitySIMagnitudeVTKWriter : public vtk::BlockCellDataWriter< OutputType using PdfField_T = PdfField; VelocitySIMagnitudeVTKWriter( const ConstBlockDataID & pdfFieldId, const real_t dx_SI, const real_t dt_SI, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( NULL ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} + vtk::BlockCellDataWriter< OutputType, 1 >( id ), bdid_( pdfFieldId ), pdf_( nullptr ), dxDividedByDt_SI_( dx_SI / dt_SI ) {} protected: diff --git a/src/lbm/vtk/Vorticity.h b/src/lbm/vtk/Vorticity.h index 1119846c..13ac6454 100644 --- a/src/lbm/vtk/Vorticity.h +++ b/src/lbm/vtk/Vorticity.h @@ -40,7 +40,7 @@ class VorticityComponentVTKWriter : public vtk::BlockCellDataWriter< OutputType, const ConstBlockDataID & velocityFieldId, const uint_t componentIdx, const std::string & id, const real_t normalizationConstant = real_t(1)) : vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter), - velocityFieldId_(velocityFieldId), componentIdx_(componentIdx), velocityField_(NULL), + velocityFieldId_(velocityFieldId), componentIdx_(componentIdx), velocityField_(nullptr), normalizationConstant_(normalizationConstant) { WALBERLA_ASSERT(componentIdx < uint_t(3), "The vorticity vector only has three components, i.e. the highest possible component index is 2."); diff --git a/src/mesh_common/distance_octree/BranchNode.h b/src/mesh_common/distance_octree/BranchNode.h index cf2c2b19..e8682147 100644 --- a/src/mesh_common/distance_octree/BranchNode.h +++ b/src/mesh_common/distance_octree/BranchNode.h @@ -122,7 +122,7 @@ BranchNode::BranchNode( const shared_ptr< TriangleDistance > : Node( triDistance->getMesh(), beginFh, endFh ) { for( int i = 0; i < 8; ++i ) - children_[i] = NULL; + children_[i] = nullptr; const auto & min = this->aabb_.minCorner(); const auto & max = this->aabb_.maxCorner(); diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index 42d7d9ef..eb66d397 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -1784,8 +1784,8 @@ void VTKOutput::writeCollectors( const bool barrier ) } else { - writePVTU( *collector ); // also applies for outputDomainDecomposition_ == true and pointDataSource_ != NULL - // and polylineDataSource_ != NULL (uniformGrid_ will be false) + writePVTU( *collector ); // also applies for outputDomainDecomposition_ == true and pointDataSource_ != nullptr + // and polylineDataSource_ != nullptr (uniformGrid_ will be false) } } From c4249ac1dd56e0ed76f36b78cd2c52e251ef7d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Tue, 19 Nov 2024 21:20:15 +0100 Subject: [PATCH 05/13] clang-tidy -checks=-*,misc-definitions-in-headers --- .../Utility.h | 12 ++++++------ apps/benchmarks/GranularGas/check.h | 2 +- .../HeatConduction/ThermalExpansion.h | 2 +- src/lbm/MassEvaluation.h | 2 +- .../initializer/PdfFieldInitializer.impl.h | 4 ++-- src/lbm/free_surface/LoadBalancing.h | 8 ++++---- .../ReconstructInterfaceCellABB.h | 16 ++++++++-------- src/lbm_mesapd_coupling/amr/InfoCollection.h | 1 + .../mapping/ParticleBoundingBox.h | 6 +++--- .../utility/OmegaBulkAdaption.h | 6 +++--- .../GeneralContactDetection.h | 2 +- src/mesa_pd/common/AABBConversion.h | 2 +- src/mesa_pd/common/Contains.h | 6 ++++++ src/mesa_pd/common/RayParticleIntersection.h | 3 +++ src/mesa_pd/data/HashGrids.h | 18 +++++++++--------- src/mesa_pd/data/LinkedCells.h | 2 +- src/mesa_pd/data/SparseLinkedCells.h | 2 +- src/mesa_pd/kernel/ForceLJ.h | 2 +- src/mesa_pd/kernel/HeatConduction.h | 2 +- src/mesa_pd/kernel/LinearSpringDashpot.h | 2 +- src/mesa_pd/kernel/NonLinearSpringDashpot.h | 2 +- src/mesa_pd/kernel/SpringDashpot.h | 2 +- src/mesa_pd/kernel/SpringDashpotSpring.h | 2 +- src/mesa_pd/kernel/TemperatureIntegration.h | 2 +- src/mesa_pd/kernel/cnt/IsotropicVDWContact.h | 2 +- src/mesa_pd/mpi/ReduceContactHistory.h | 2 +- .../notifications/ContactHistoryNotification.h | 4 ++-- .../notifications/ForceTorqueNotification.h | 6 +++--- .../mpi/notifications/HeatFluxNotification.h | 6 +++--- .../HydrodynamicForceTorqueNotification.h | 6 +++--- .../VelocityCorrectionNotification.h | 4 ++-- .../notifications/VelocityUpdateNotification.h | 4 ++-- src/pde/sweeps/Multigrid.impl.h | 2 +- .../correlations/AddedMassForceCorrelations.h | 2 ++ .../correlations/DragForceCorrelations.h | 10 ++++++++-- .../correlations/LiftForceCorrelations.h | 3 ++- .../EffectiveViscosityFieldEvaluator.h | 6 +++--- .../evaluators/LubricationForceEvaluator.h | 10 +++++----- .../geometry/SphereEquivalentDiameter.h | 2 +- 39 files changed, 98 insertions(+), 79 deletions(-) diff --git a/apps/benchmarks/FluidParticleCouplingWithLoadBalancing/Utility.h b/apps/benchmarks/FluidParticleCouplingWithLoadBalancing/Utility.h index f9e4c05f..8a394f6b 100644 --- a/apps/benchmarks/FluidParticleCouplingWithLoadBalancing/Utility.h +++ b/apps/benchmarks/FluidParticleCouplingWithLoadBalancing/Utility.h @@ -10,21 +10,21 @@ namespace amr { * Result from the workload evaluation as described in * Rettinger, Ruede - "Dynamic Load Balancing Techniques for Particulate Flow Simulations", 2019, Computation */ -real_t fittedLBMWeightEvaluationFunction(const BlockInfo& blockInfo) +inline real_t fittedLBMWeightEvaluationFunction(const BlockInfo& blockInfo) { uint_t Ce = blockInfo.numberOfCells; uint_t F = blockInfo.numberOfFluidCells; real_t weight = real_t(7.597476065046571e-06) * real_c(Ce) + real_t(8.95723566283202e-05) * real_c(F) + real_t(-0.1526111388616016); return std::max(weight,real_t(0)); } -real_t fittedBHWeightEvaluationFunction(const BlockInfo& blockInfo) +inline real_t fittedBHWeightEvaluationFunction(const BlockInfo& blockInfo) { uint_t Ce = blockInfo.numberOfCells; uint_t NB = blockInfo.numberOfNearBoundaryCells; real_t weight = real_t(1.3067711379655123e-07) * real_c(Ce) + real_t(0.0007289549127205142) * real_c(NB) + real_t(-0.1575698071795788); return std::max(weight,real_t(0)); } -real_t fittedRPDWeightEvaluationFunction(const BlockInfo& blockInfo) +inline real_t fittedRPDWeightEvaluationFunction(const BlockInfo& blockInfo) { uint_t Pl = blockInfo.numberOfLocalParticles; uint_t Pg = blockInfo.numberOfGhostParticles; @@ -36,7 +36,7 @@ real_t fittedRPDWeightEvaluationFunction(const BlockInfo& blockInfo) real_t weight = real_c(Sc) * ( cPlPg2 * real_c(Pl+Pg) * real_c(Pl+Pg) + cPl * real_c(Pl) + cPg * real_c(Pg) + c ); return std::max(weight,real_t(0)); } -real_t fittedCoup1WeightEvaluationFunction(const BlockInfo& blockInfo) +inline real_t fittedCoup1WeightEvaluationFunction(const BlockInfo& blockInfo) { uint_t Ce = blockInfo.numberOfCells; uint_t F = blockInfo.numberOfFluidCells; @@ -45,7 +45,7 @@ real_t fittedCoup1WeightEvaluationFunction(const BlockInfo& blockInfo) real_t weight = real_t(5.610203409278647e-06) * real_c(Ce) + real_t(-7.257635845636656e-07) * real_c(F) + real_t(0.02049703546054693) * real_c(Pl) + real_t(0.04248208493809902) * real_c(Pg) + real_t(-0.26609470510074784); return std::max(weight,real_t(0)); } -real_t fittedCoup2WeightEvaluationFunction(const BlockInfo& blockInfo) +inline real_t fittedCoup2WeightEvaluationFunction(const BlockInfo& blockInfo) { uint_t Ce = blockInfo.numberOfCells; uint_t F = blockInfo.numberOfFluidCells; @@ -54,7 +54,7 @@ real_t fittedCoup2WeightEvaluationFunction(const BlockInfo& blockInfo) real_t weight = real_t(7.198479654682179e-06) * real_c(Ce) + real_t(1.178247475854302e-06) * real_c(F) + real_t(-0.0026401549115124628) * real_c(Pl) + real_t(0.008459646786179298) * real_c(Pg) + real_t(-0.001077320113275954); return std::max(weight,real_t(0)); } -real_t fittedTotalWeightEvaluationFunction(const BlockInfo& blockInfo) +inline real_t fittedTotalWeightEvaluationFunction(const BlockInfo& blockInfo) { return fittedLBMWeightEvaluationFunction(blockInfo) + fittedBHWeightEvaluationFunction(blockInfo) + fittedRPDWeightEvaluationFunction(blockInfo) + fittedCoup1WeightEvaluationFunction(blockInfo) + diff --git a/apps/benchmarks/GranularGas/check.h b/apps/benchmarks/GranularGas/check.h index 73c45759..71652dcd 100644 --- a/apps/benchmarks/GranularGas/check.h +++ b/apps/benchmarks/GranularGas/check.h @@ -27,7 +27,7 @@ namespace walberla { namespace mesa_pd { -void check( data::ParticleStorage& ps, blockforest::BlockForest& forest, real_t spacing, const Vec3& shift ) +inline void check( data::ParticleStorage& ps, blockforest::BlockForest& forest, real_t spacing, const Vec3& shift ) { WALBERLA_LOG_INFO_ON_ROOT("*** CHECKING RESULT - START ***"); auto pIt = ps.begin(); diff --git a/apps/showcases/HeatConduction/ThermalExpansion.h b/apps/showcases/HeatConduction/ThermalExpansion.h index c56ee073..0818d527 100644 --- a/apps/showcases/HeatConduction/ThermalExpansion.h +++ b/apps/showcases/HeatConduction/ThermalExpansion.h @@ -47,7 +47,7 @@ class ThermalExpansion std::vector linearExpansionCoefficient_ {}; }; -ThermalExpansion::ThermalExpansion(const uint_t numParticleTypes) +inline ThermalExpansion::ThermalExpansion(const uint_t numParticleTypes) { numParticleTypes_ = numParticleTypes; diff --git a/src/lbm/MassEvaluation.h b/src/lbm/MassEvaluation.h index 7efe2daa..0a02e1ea 100644 --- a/src/lbm/MassEvaluation.h +++ b/src/lbm/MassEvaluation.h @@ -33,7 +33,7 @@ namespace lbm { namespace internal { -Vector3 massEvaluationDomain( const shared_ptr< StructuredBlockStorage > & blocks, const uint_t level ) +inline Vector3 massEvaluationDomain( const shared_ptr< StructuredBlockStorage > & blocks, const uint_t level ) { return Vector3( real_c( blocks->getNumberOfXCells(level) ), real_c( blocks->getNumberOfYCells(level) ), diff --git a/src/lbm/field/initializer/PdfFieldInitializer.impl.h b/src/lbm/field/initializer/PdfFieldInitializer.impl.h index 757cb180..1a60e350 100644 --- a/src/lbm/field/initializer/PdfFieldInitializer.impl.h +++ b/src/lbm/field/initializer/PdfFieldInitializer.impl.h @@ -25,7 +25,7 @@ namespace lbm { namespace initializer { template<> -auto getCoordinates(const Cell& globalCell, const real_t dx) { +inline auto getCoordinates(const Cell& globalCell, const real_t dx) { Cell coords; for(uint_t d = 0; d < 3; ++d) { @@ -36,7 +36,7 @@ auto getCoordinates(const Cell& globalCell, const real_t dx) { } template<> -auto getCoordinates(const Cell& globalCell, const real_t dx) { +inline auto getCoordinates(const Cell& globalCell, const real_t dx) { Vector3 coords; for(uint_t d = 0; d < 3; ++d) { diff --git a/src/lbm/free_surface/LoadBalancing.h b/src/lbm/free_surface/LoadBalancing.h index c9df5447..f1638263 100644 --- a/src/lbm/free_surface/LoadBalancing.h +++ b/src/lbm/free_surface/LoadBalancing.h @@ -50,10 +50,10 @@ class ProcessLoadEvaluator; /*********************************************************************************************************************** * Create non-uniform block forest to be used for load balancing. **********************************************************************************************************************/ -std::shared_ptr< StructuredBlockForest > createNonUniformBlockForest(const Vector3< uint_t >& domainSize, - const Vector3< uint_t >& cellsPerBlock, - const Vector3< uint_t >& numBlocks, - const Vector3< bool >& periodicity) +inline std::shared_ptr< StructuredBlockForest > createNonUniformBlockForest(const Vector3< uint_t >& domainSize, + const Vector3< uint_t >& cellsPerBlock, + const Vector3< uint_t >& numBlocks, + const Vector3< bool >& periodicity) { WALBERLA_CHECK_EQUAL(domainSize[0], cellsPerBlock[0] * numBlocks[0], "The domain size is not divisible by the specified \"cellsPerBlock\" in x-direction."); diff --git a/src/lbm/free_surface/dynamics/functionality/ReconstructInterfaceCellABB.h b/src/lbm/free_surface/dynamics/functionality/ReconstructInterfaceCellABB.h index b0f45113..1172b721 100644 --- a/src/lbm/free_surface/dynamics/functionality/ReconstructInterfaceCellABB.h +++ b/src/lbm/free_surface/dynamics/functionality/ReconstructInterfaceCellABB.h @@ -38,12 +38,12 @@ namespace walberla namespace free_surface { // get index of largest entry in n_dot_ci with isInterfaceOrLiquid==true && isPdfAvailable==false -uint_t getIndexOfMaximum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, - const std::vector< real_t >& n_dot_ci); +inline uint_t getIndexOfMaximum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, + const std::vector< real_t >& n_dot_ci); // get index of smallest entry in n_dot_ci with isInterfaceOrLiquid==true && isPdfAvailable==false -uint_t getIndexOfMinimum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, - const std::vector< real_t >& n_dot_ci); +inline uint_t getIndexOfMinimum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, + const std::vector< real_t >& n_dot_ci); // reconstruct PDFs according to pressure anti bounce back boundary condition (page 31, equation 4.5 in dissertation of // N. Thuerey, 2007) @@ -384,8 +384,8 @@ void reconstructInterfaceCellLegacy(const FlagField_T* flagField, const ConstPdf } } -uint_t getIndexOfMaximum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, - const std::vector< real_t >& n_dot_ci) +inline uint_t getIndexOfMaximum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, + const std::vector< real_t >& n_dot_ci) { real_t maximum = -std::numeric_limits< real_t >::max(); uint_t index = std::numeric_limits< uint_t >::max(); @@ -411,8 +411,8 @@ uint_t getIndexOfMaximum(const std::vector< bool >& isInterfaceOrLiquid, const s return index; } -uint_t getIndexOfMinimum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, - const std::vector< real_t >& n_dot_ci) +inline uint_t getIndexOfMinimum(const std::vector< bool >& isInterfaceOrLiquid, const std::vector< bool >& isPdfAvailable, + const std::vector< real_t >& n_dot_ci) { real_t minimum = std::numeric_limits< real_t >::max(); uint_t index = std::numeric_limits< uint_t >::max(); diff --git a/src/lbm_mesapd_coupling/amr/InfoCollection.h b/src/lbm_mesapd_coupling/amr/InfoCollection.h index 621ab8f7..8783a945 100644 --- a/src/lbm_mesapd_coupling/amr/InfoCollection.h +++ b/src/lbm_mesapd_coupling/amr/InfoCollection.h @@ -115,6 +115,7 @@ void updateAndSyncInfoCollection(BlockForest& bf, const BlockDataID boundaryHand } } +inline void getBlockInfoFromInfoCollection( const PhantomBlock * block, const shared_ptr& ic, BlockInfo & blockInfo ) { diff --git a/src/lbm_mesapd_coupling/mapping/ParticleBoundingBox.h b/src/lbm_mesapd_coupling/mapping/ParticleBoundingBox.h index aa32158a..7c2f49a3 100644 --- a/src/lbm_mesapd_coupling/mapping/ParticleBoundingBox.h +++ b/src/lbm_mesapd_coupling/mapping/ParticleBoundingBox.h @@ -36,9 +36,9 @@ namespace lbm_mesapd_coupling { * Obtain a block-local cell bounding box from a given AABB (e.g. the particle's AABB) * If the given AABB is (partly) infinite, AABBIsInfinite should be set to true (e.g. for infinite particles) */ -CellInterval getCellBBFromAABB( const math::AABB & aabb, bool AABBIsInfinite, - const IBlock & block, StructuredBlockStorage & blockStorage, - const uint_t numberOfGhostLayersToInclude) +inline CellInterval getCellBBFromAABB( const math::AABB & aabb, bool AABBIsInfinite, + const IBlock & block, StructuredBlockStorage & blockStorage, + const uint_t numberOfGhostLayersToInclude) { CellInterval cellBB; diff --git a/src/lbm_mesapd_coupling/utility/OmegaBulkAdaption.h b/src/lbm_mesapd_coupling/utility/OmegaBulkAdaption.h index 226c03c2..f8a60c3a 100644 --- a/src/lbm_mesapd_coupling/utility/OmegaBulkAdaption.h +++ b/src/lbm_mesapd_coupling/utility/OmegaBulkAdaption.h @@ -29,20 +29,20 @@ namespace lbm_mesapd_coupling { // utility functions -real_t bulkViscosityFromOmegaBulk(real_t omegaBulk) +inline real_t bulkViscosityFromOmegaBulk(real_t omegaBulk) { return real_t(2) / real_t(9) * ( real_t(1) / omegaBulk - real_t(0.5) ); } -real_t omegaBulkFromBulkViscosity(real_t bulkViscosity) +inline real_t omegaBulkFromBulkViscosity(real_t bulkViscosity) { return real_t(2) / ( real_t(9) * bulkViscosity + real_t(1) ); } // see Khirevich et al. - Coarse- and fine-grid numerical behavior of MRT/TRT lattice-Boltzmann schemes in regular and random sphere packings // LambdaBulk is the "magic parameter" here, i.e. the ratio between Lambda_e and Lambda_nu, Eq. 19 -real_t omegaBulkFromOmega(real_t omega, real_t LambdaBulk = real_t(1)) +inline real_t omegaBulkFromOmega(real_t omega, real_t LambdaBulk = real_t(1)) { return real_t(1) / (LambdaBulk * ( real_t(1) / omega - real_t(1)/ real_t(2) ) + real_t(1)/ real_t(2) ); } diff --git a/src/mesa_pd/collision_detection/GeneralContactDetection.h b/src/mesa_pd/collision_detection/GeneralContactDetection.h index 9564916c..c9101312 100644 --- a/src/mesa_pd/collision_detection/GeneralContactDetection.h +++ b/src/mesa_pd/collision_detection/GeneralContactDetection.h @@ -191,7 +191,7 @@ bool GeneralContactDetection::operator()(const size_t idx1, return operator()(idx2, idx1, geo2, geo1, ac); } -bool GeneralContactDetection::collideGJKEPA(Support& geom0, Support& geom1) +inline bool GeneralContactDetection::collideGJKEPA(Support& geom0, Support& geom1) { real_t margin = real_t(1e-4); GJK gjk; diff --git a/src/mesa_pd/common/AABBConversion.h b/src/mesa_pd/common/AABBConversion.h index c105d1ed..be579b97 100644 --- a/src/mesa_pd/common/AABBConversion.h +++ b/src/mesa_pd/common/AABBConversion.h @@ -30,7 +30,7 @@ namespace walberla { namespace mesa_pd { -math::AABB getAABBFromInteractionRadius(const Vector3 & pos, const real_t interactionRadius ) +inline math::AABB getAABBFromInteractionRadius(const Vector3 & pos, const real_t interactionRadius ) { WALBERLA_ASSERT_GREATER(interactionRadius, 0_r, "Did you forget to set the interaction radius?"); return math::AABB( pos[0]-interactionRadius, pos[1]-interactionRadius, pos[2]-interactionRadius, diff --git a/src/mesa_pd/common/Contains.h b/src/mesa_pd/common/Contains.h index 00e74bb3..8c707388 100644 --- a/src/mesa_pd/common/Contains.h +++ b/src/mesa_pd/common/Contains.h @@ -42,18 +42,21 @@ namespace mesa_pd { * or in body frame coordinates (BF) which requires the point to be first transformed */ +inline bool isPointInsideSphere(const Vec3& point, const Vec3& spherePosition, const real_t sphereRadius ) { return !((point - spherePosition).sqrLength() > sphereRadius * sphereRadius); } +inline bool isPointInsideHalfSpace(const Vec3& point, const Vec3& halfSpacePosition, const Vec3& halfSpaceNormal ) { return !((point - halfSpacePosition) * halfSpaceNormal > real_t(0)); } +inline bool isPointInsideBoxBF(const Vec3& pointBF, const Vec3& edgeLengths ) { @@ -62,6 +65,7 @@ bool isPointInsideBoxBF(const Vec3& pointBF, std::fabs(pointBF[2]) <= real_t(0.5)*edgeLengths[2]; } +inline bool isPointInsideEllipsoidBF(const Vec3& pointBF, const Vec3& semiAxes ) { @@ -69,6 +73,7 @@ bool isPointInsideEllipsoidBF(const Vec3& pointBF, + (pointBF[2] * pointBF[2])/(semiAxes[2] * semiAxes[2]) <= 1_r ); } +inline bool isPointInsideCylindricalBoundary(const Vec3& point, const Vec3& cylindricalBoundaryPosition, const real_t radius, const Vec3& axis ) { @@ -77,6 +82,7 @@ bool isPointInsideCylindricalBoundary(const Vec3& point, } #ifdef WALBERLA_MESAPD_CONVEX_POLYHEDRON_AVAILABLE +inline bool isPointInsideConvexPolyhedronBF(const Vec3& point, const mesh::TriangleMesh& mesh) { WALBERLA_ASSERT(mesh.has_face_normals(), "Provided mesh has no face normals! E.g., call `mesh.request_face_normals(); mesh.update_face_normals();` to add them.") diff --git a/src/mesa_pd/common/RayParticleIntersection.h b/src/mesa_pd/common/RayParticleIntersection.h index b62306aa..79c7910a 100644 --- a/src/mesa_pd/common/RayParticleIntersection.h +++ b/src/mesa_pd/common/RayParticleIntersection.h @@ -38,6 +38,7 @@ namespace mesa_pd { * or in body frame coordinates (BF) which requires the point to be first transformed */ +inline real_t raySphereIntersectionRatio( const Vec3& rayOrigin, const Vec3& rayDirection, const Vec3& spherePosition, const real_t sphereRadius ) { @@ -62,6 +63,7 @@ real_t raySphereIntersectionRatio( const Vec3& rayOrigin, const Vec3& rayDirecti return delta; } +inline real_t rayHalfSpaceIntersectionRatio( const Vec3& rayOrigin, const Vec3& rayDirection, const Vec3& halfSpacePosition, const Vec3& halfSpaceNormal) { @@ -82,6 +84,7 @@ real_t rayHalfSpaceIntersectionRatio( const Vec3& rayOrigin, const Vec3& rayDire return delta; } +inline real_t rayEllipsoidIntersectionRatioBF( const Vec3& rayOriginBF, const Vec3& rayDirectionBF, const Vec3& ellipsoidSemiAxes) { diff --git a/src/mesa_pd/data/HashGrids.h b/src/mesa_pd/data/HashGrids.h index 83c210b6..d847aef6 100644 --- a/src/mesa_pd/data/HashGrids.h +++ b/src/mesa_pd/data/HashGrids.h @@ -351,7 +351,7 @@ class HashGrids // HashGrids::HashGrid member function implementations -HashGrids::HashGrid::HashGrid( real_t cellSpan ) +inline HashGrids::HashGrid::HashGrid( real_t cellSpan ) { // Initialization of all member variables and ... xCellCount_ = math::uintIsPowerOfTwo( xCellCount ) ? xCellCount : 16; @@ -386,7 +386,7 @@ HashGrids::HashGrid::HashGrid( real_t cellSpan ) particleCount_ = 0; } -HashGrids::HashGrid::~HashGrid() +inline HashGrids::HashGrid::~HashGrid() { clear(); @@ -396,7 +396,7 @@ HashGrids::HashGrid::~HashGrid() delete[] cell_; } -void HashGrids::HashGrid::clear() +inline void HashGrids::HashGrid::clear() { for( auto cellIt = occupiedCells_.begin(); cellIt < occupiedCells_.end(); ++cellIt ) { delete (*cellIt)->particles_; @@ -412,7 +412,7 @@ void HashGrids::HashGrid::clear() * This function is used to initialize the offset arrays of all grid cells. The offsets are required * for ensuring fast direct access to all directly adjacent cells for each cell in the hash grid. */ -void HashGrids::HashGrid::initializeNeighborOffsets() +inline void HashGrids::HashGrid::initializeNeighborOffsets() { offset_t xc = static_cast( xCellCount_ ); offset_t yc = static_cast( yCellCount_ ); @@ -516,7 +516,7 @@ void HashGrids::HashGrid::addParticle( size_t p_idx, Accessor& ac ) //************************************************************************************************* /*!\brief Adds a particle to a specific cell in this hash grid. */ -void HashGrids::HashGrid::addParticleToCell( size_t p_idx, Cell* cell ) +inline void HashGrids::HashGrid::addParticleToCell( size_t p_idx, Cell* cell ) { // If this cell is already occupied by other particles, which means the pointer to the particle // container holds a valid address and thus the container itself is properly initialized, then @@ -564,7 +564,7 @@ size_t HashGrids::HashGrid::hashOfParticle( size_t p_idx, Accessor& ac ) const * Note that the modulo calculations are replaced with fast bitwise AND operations - hence, the * spatial dimensions of the hash grid must be restricted to powers of two! */ -size_t HashGrids::HashGrid::hashPoint(real_t x, real_t y, real_t z) const { +inline size_t HashGrids::HashGrid::hashPoint(real_t x, real_t y, real_t z) const { size_t xHash; size_t yHash; size_t zHash; @@ -773,7 +773,7 @@ void HashGrids::HashGrid::checkAgainstVectorEachParticlePairHalf( const Particle //************************************************************************************************* // clear all particles and grids -void HashGrids::clearAll() +inline void HashGrids::clearAll() { gridList_.clear(); infiniteParticles_.clear(); @@ -781,7 +781,7 @@ void HashGrids::clearAll() // clear only all particles from the hash grids, but maintain the overall grid hierarchy // useful for "updating" the data structure in each time step, but also prevents clean-up of unnecessary grids -void HashGrids::clear() +inline void HashGrids::clear() { for( auto gridIt = gridList_.begin(); gridIt != gridList_.end(); ++gridIt ) { (*gridIt)->clear(); @@ -849,7 +849,7 @@ void HashGrids::operator()(const size_t p_idx, Accessor& ac) } } -void HashGrids::addInfiniteParticle(size_t p_idx) +inline void HashGrids::addInfiniteParticle(size_t p_idx) { infiniteParticles_.push_back(p_idx); } diff --git a/src/mesa_pd/data/LinkedCells.h b/src/mesa_pd/data/LinkedCells.h index 9ba699fd..26ac5c79 100644 --- a/src/mesa_pd/data/LinkedCells.h +++ b/src/mesa_pd/data/LinkedCells.h @@ -171,7 +171,7 @@ LinkedCells::LinkedCells(const math::AABB& domain, const Vec3& cellDiameter) std::fill(cells_.begin(), cells_.end(), -1); } -void LinkedCells::clear() +inline void LinkedCells::clear() { const uint64_t cellsSize = cells_.size(); //clear existing linked cells diff --git a/src/mesa_pd/data/SparseLinkedCells.h b/src/mesa_pd/data/SparseLinkedCells.h index 2c184de4..3e98b174 100644 --- a/src/mesa_pd/data/SparseLinkedCells.h +++ b/src/mesa_pd/data/SparseLinkedCells.h @@ -187,7 +187,7 @@ SparseLinkedCells::SparseLinkedCells(const math::AABB& domain, const Vec3& cellD std::fill(cells_.begin(), cells_.end(), -1); } -void SparseLinkedCells::clear() +inline void SparseLinkedCells::clear() { for (const auto v : nonEmptyCells_) { diff --git a/src/mesa_pd/kernel/ForceLJ.h b/src/mesa_pd/kernel/ForceLJ.h index 1affbc8f..14d08777 100644 --- a/src/mesa_pd/kernel/ForceLJ.h +++ b/src/mesa_pd/kernel/ForceLJ.h @@ -80,7 +80,7 @@ class ForceLJ std::vector sigma {}; }; -ForceLJ::ForceLJ(const uint_t numParticleTypes) +inline ForceLJ::ForceLJ(const uint_t numParticleTypes) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/HeatConduction.h b/src/mesa_pd/kernel/HeatConduction.h index e41d1170..efedff4e 100644 --- a/src/mesa_pd/kernel/HeatConduction.h +++ b/src/mesa_pd/kernel/HeatConduction.h @@ -81,7 +81,7 @@ class HeatConduction std::vector conductance_ {}; }; -HeatConduction::HeatConduction(const uint_t numParticleTypes) +inline HeatConduction::HeatConduction(const uint_t numParticleTypes) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/LinearSpringDashpot.h b/src/mesa_pd/kernel/LinearSpringDashpot.h index b4b35082..db9ca2e9 100644 --- a/src/mesa_pd/kernel/LinearSpringDashpot.h +++ b/src/mesa_pd/kernel/LinearSpringDashpot.h @@ -133,7 +133,7 @@ class LinearSpringDashpot std::vector frictionCoefficientDynamic_ {}; }; -LinearSpringDashpot::LinearSpringDashpot(const uint_t numParticleTypes) +inline LinearSpringDashpot::LinearSpringDashpot(const uint_t numParticleTypes) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/NonLinearSpringDashpot.h b/src/mesa_pd/kernel/NonLinearSpringDashpot.h index b5d732c6..fc1e0515 100644 --- a/src/mesa_pd/kernel/NonLinearSpringDashpot.h +++ b/src/mesa_pd/kernel/NonLinearSpringDashpot.h @@ -120,7 +120,7 @@ class NonLinearSpringDashpot std::vector frictionCoefficientDynamic_ {}; }; -NonLinearSpringDashpot::NonLinearSpringDashpot(const uint_t numParticleTypes, const real_t collisionTime) +inline NonLinearSpringDashpot::NonLinearSpringDashpot(const uint_t numParticleTypes, const real_t collisionTime) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/SpringDashpot.h b/src/mesa_pd/kernel/SpringDashpot.h index 7c59af5d..eecd2ee0 100644 --- a/src/mesa_pd/kernel/SpringDashpot.h +++ b/src/mesa_pd/kernel/SpringDashpot.h @@ -132,7 +132,7 @@ class SpringDashpot std::vector friction_ {}; }; -SpringDashpot::SpringDashpot(const uint_t numParticleTypes) +inline SpringDashpot::SpringDashpot(const uint_t numParticleTypes) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/SpringDashpotSpring.h b/src/mesa_pd/kernel/SpringDashpotSpring.h index 07eed815..ece97ace 100644 --- a/src/mesa_pd/kernel/SpringDashpotSpring.h +++ b/src/mesa_pd/kernel/SpringDashpotSpring.h @@ -116,7 +116,7 @@ class SpringDashpotSpring std::vector coefficientOfFriction_ {}; }; -SpringDashpotSpring::SpringDashpotSpring(const uint_t numParticleTypes) +inline SpringDashpotSpring::SpringDashpotSpring(const uint_t numParticleTypes) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/TemperatureIntegration.h b/src/mesa_pd/kernel/TemperatureIntegration.h index 8f8a771c..905973f8 100644 --- a/src/mesa_pd/kernel/TemperatureIntegration.h +++ b/src/mesa_pd/kernel/TemperatureIntegration.h @@ -81,7 +81,7 @@ class TemperatureIntegration std::vector invSpecificHeat_ {}; }; -TemperatureIntegration::TemperatureIntegration(const real_t dt, const uint_t numParticleTypes) +inline TemperatureIntegration::TemperatureIntegration(const real_t dt, const uint_t numParticleTypes) : dt_(dt) { numParticleTypes_ = numParticleTypes; diff --git a/src/mesa_pd/kernel/cnt/IsotropicVDWContact.h b/src/mesa_pd/kernel/cnt/IsotropicVDWContact.h index a92ecda0..c3ffbfff 100644 --- a/src/mesa_pd/kernel/cnt/IsotropicVDWContact.h +++ b/src/mesa_pd/kernel/cnt/IsotropicVDWContact.h @@ -95,7 +95,7 @@ void IsotropicVDWContact::operator()(const size_t p_idx1, addForceAtomic(p_idx2, ac, -force); } -real_t IsotropicVDWContact::equilibriumDistance() +inline real_t IsotropicVDWContact::equilibriumDistance() { return r * ( std::pow( (alpha*A)/(beta*B), 1_r/(alpha-beta)) + 2_r); } diff --git a/src/mesa_pd/mpi/ReduceContactHistory.h b/src/mesa_pd/mpi/ReduceContactHistory.h index efd4e9bd..a741c795 100644 --- a/src/mesa_pd/mpi/ReduceContactHistory.h +++ b/src/mesa_pd/mpi/ReduceContactHistory.h @@ -85,7 +85,7 @@ class ReduceContactHistory int numProcesses_ = walberla::mpi::MPIManager::instance()->numProcesses(); }; -void ReduceContactHistory::operator()(data::ParticleStorage& ps) const +inline void ReduceContactHistory::operator()(data::ParticleStorage& ps) const { //no need to reduce if run with only one process if (numProcesses_ != 1) diff --git a/src/mesa_pd/mpi/notifications/ContactHistoryNotification.h b/src/mesa_pd/mpi/notifications/ContactHistoryNotification.h index 3785f0ff..7d46c26d 100644 --- a/src/mesa_pd/mpi/notifications/ContactHistoryNotification.h +++ b/src/mesa_pd/mpi/notifications/ContactHistoryNotification.h @@ -58,12 +58,12 @@ class ContactHistoryNotification }; template <> -void reset(data::Particle& p) +inline void reset(data::Particle& p) { p.setNewContactHistory(std::map()); } -void reduce(data::Particle&& p, const ContactHistoryNotification::Parameters& objparam) +inline void reduce(data::Particle&& p, const ContactHistoryNotification::Parameters& objparam) { auto& ch = p.getNewContactHistoryRef(); for (auto& entry : objparam.contactHistory_) diff --git a/src/mesa_pd/mpi/notifications/ForceTorqueNotification.h b/src/mesa_pd/mpi/notifications/ForceTorqueNotification.h index 5c8ad6f7..54fe3902 100644 --- a/src/mesa_pd/mpi/notifications/ForceTorqueNotification.h +++ b/src/mesa_pd/mpi/notifications/ForceTorqueNotification.h @@ -57,19 +57,19 @@ class ForceTorqueNotification }; template <> -void reset(data::Particle& p) +inline void reset(data::Particle& p) { p.setForce( Vec3(real_t(0)) ); p.setTorque( Vec3(real_t(0)) ); } -void reduce(data::Particle&& p, const ForceTorqueNotification::Parameters& objparam) +inline void reduce(data::Particle&& p, const ForceTorqueNotification::Parameters& objparam) { p.getForceRef() += objparam.force_; p.getTorqueRef() += objparam.torque_; } -void update(data::Particle&& p, const ForceTorqueNotification::Parameters& objparam) +inline void update(data::Particle&& p, const ForceTorqueNotification::Parameters& objparam) { p.setForce( objparam.force_ ); p.setTorque( objparam.torque_ ); diff --git a/src/mesa_pd/mpi/notifications/HeatFluxNotification.h b/src/mesa_pd/mpi/notifications/HeatFluxNotification.h index 6b580a50..53ebde52 100644 --- a/src/mesa_pd/mpi/notifications/HeatFluxNotification.h +++ b/src/mesa_pd/mpi/notifications/HeatFluxNotification.h @@ -56,17 +56,17 @@ class HeatFluxNotification }; template <> -void reset(data::Particle& p) +inline void reset(data::Particle& p) { p.setHeatFlux( real_t(0) ); } -void reduce(data::Particle&& p, const HeatFluxNotification::Parameters& objparam) +inline void reduce(data::Particle&& p, const HeatFluxNotification::Parameters& objparam) { p.getHeatFluxRef() += objparam.heatFlux_; } -void update(data::Particle&& p, const HeatFluxNotification::Parameters& objparam) +inline void update(data::Particle&& p, const HeatFluxNotification::Parameters& objparam) { p.setHeatFlux( objparam.heatFlux_ ); } diff --git a/src/mesa_pd/mpi/notifications/HydrodynamicForceTorqueNotification.h b/src/mesa_pd/mpi/notifications/HydrodynamicForceTorqueNotification.h index ce874188..a8f1c337 100644 --- a/src/mesa_pd/mpi/notifications/HydrodynamicForceTorqueNotification.h +++ b/src/mesa_pd/mpi/notifications/HydrodynamicForceTorqueNotification.h @@ -57,19 +57,19 @@ class HydrodynamicForceTorqueNotification }; template <> -void reset(data::Particle& p) +inline void reset(data::Particle& p) { p.setHydrodynamicForce( Vec3(real_t(0)) ); p.setHydrodynamicTorque( Vec3(real_t(0)) ); } -void reduce(data::Particle&& p, const HydrodynamicForceTorqueNotification::Parameters& objparam) +inline void reduce(data::Particle&& p, const HydrodynamicForceTorqueNotification::Parameters& objparam) { p.getHydrodynamicForceRef() += objparam.hydrodynamicForce_; p.getHydrodynamicTorqueRef() += objparam.hydrodynamicTorque_; } -void update(data::Particle&& p, const HydrodynamicForceTorqueNotification::Parameters& objparam) +inline void update(data::Particle&& p, const HydrodynamicForceTorqueNotification::Parameters& objparam) { p.setHydrodynamicForce( objparam.hydrodynamicForce_ ); p.setHydrodynamicTorque( objparam.hydrodynamicTorque_ ); diff --git a/src/mesa_pd/mpi/notifications/VelocityCorrectionNotification.h b/src/mesa_pd/mpi/notifications/VelocityCorrectionNotification.h index 7f9347f9..6d4a8839 100644 --- a/src/mesa_pd/mpi/notifications/VelocityCorrectionNotification.h +++ b/src/mesa_pd/mpi/notifications/VelocityCorrectionNotification.h @@ -61,14 +61,14 @@ class VelocityCorrectionNotification // Reduce method for reduction (add up the velocity corrections) -void reduce(data::Particle&& p, const VelocityCorrectionNotification::Parameters& objparam) +inline void reduce(data::Particle&& p, const VelocityCorrectionNotification::Parameters& objparam) { p.getDvRef() += objparam.dv_; p.getDwRef() += objparam.dw_; } template<> -void reset(data::Particle& p ) +inline void reset(data::Particle& p ) { p.setDv( Vec3(real_t(0)) ); p.setDw( Vec3(real_t(0)) ); diff --git a/src/mesa_pd/mpi/notifications/VelocityUpdateNotification.h b/src/mesa_pd/mpi/notifications/VelocityUpdateNotification.h index f526d99c..7c2ef66d 100644 --- a/src/mesa_pd/mpi/notifications/VelocityUpdateNotification.h +++ b/src/mesa_pd/mpi/notifications/VelocityUpdateNotification.h @@ -66,7 +66,7 @@ class VelocityUpdateNotification real_t VelocityUpdateNotification::Parameters::relaxationParam = real_t(0.8); // Update method for broadcast -void update(data::Particle&& p, const VelocityUpdateNotification::Parameters& objparam) { +inline void update(data::Particle&& p, const VelocityUpdateNotification::Parameters& objparam) { // Reset the velocity corrections dv/dw of ghost particle p.getDvRef() = Vec3(); p.getDwRef() = Vec3(); @@ -75,7 +75,7 @@ void update(data::Particle&& p, const VelocityUpdateNotification::Parameters& ob } template<> -void reset(data::Particle& p ) +inline void reset(data::Particle& p ) { p.setDv( Vec3(real_t(0)) ); p.setDw( Vec3(real_t(0)) ); diff --git a/src/pde/sweeps/Multigrid.impl.h b/src/pde/sweeps/Multigrid.impl.h index da7c0ab6..47080ea6 100644 --- a/src/pde/sweeps/Multigrid.impl.h +++ b/src/pde/sweeps/Multigrid.impl.h @@ -168,7 +168,7 @@ void CoarsenStencilFieldsDCA::operator()( const std::vector -void CoarsenStencilFieldsGCA< stencil::D3Q7 >::operator()( const std::vector & stencilFieldId ) const +inline void CoarsenStencilFieldsGCA< stencil::D3Q7 >::operator()( const std::vector & stencilFieldId ) const { WALBERLA_ASSERT_EQUAL(numLvl_, stencilFieldId.size(), "This function can only be called when operating with stencil fields!"); diff --git a/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h b/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h index 4574cbc1..81651697 100644 --- a/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h +++ b/src/pe_coupling/discrete_particle_methods/correlations/AddedMassForceCorrelations.h @@ -36,6 +36,7 @@ namespace discrete_particle_methods { * const real_t & bodyVolume, const real_t & fluidDensity ) */ +inline Vector3 addedMassForceFinn( const Vector3 & timeDerivativeFluidVel, const Vector3 & timeDerivativeBodyVel, const real_t & bodyVolume, const real_t & fluidDensity ) { @@ -44,6 +45,7 @@ Vector3 addedMassForceFinn( const Vector3 & timeDerivativeFluidV return bodyVolume * fluidDensity * Coeffam * ( timeDerivativeFluidVel - timeDerivativeBodyVel ); } +inline Vector3 noAddedMassForce( const Vector3 &, const Vector3 &, const real_t &, const real_t & ) { return Vector3(real_t(0)); diff --git a/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h b/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h index 1db90c94..002be4a3 100644 --- a/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h +++ b/src/pe_coupling/discrete_particle_methods/correlations/DragForceCorrelations.h @@ -45,7 +45,7 @@ namespace discrete_particle_methods { // equation to calculate the drag coefficient on isolated spherical particle // Schiller, L., Naumann, A., 1935. A drag coefficient correlation. Vdi Zeitung 77, 318-320. -real_t dragCoeffSchillerNaumann( real_t reynoldsNumber ) +inline real_t dragCoeffSchillerNaumann( real_t reynoldsNumber ) { WALBERLA_ASSERT_GREATER_EQUAL( reynoldsNumber, real_t(0) ); @@ -55,7 +55,7 @@ real_t dragCoeffSchillerNaumann( real_t reynoldsNumber ) // Coefficient from Stokes' law for drag, only valid for Stokes regime (low Reynolds numbers) // = 3 * math::pi * mu * D * fluidVolumeFraction -real_t dragCoeffStokes ( real_t fluidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity ) +inline real_t dragCoeffStokes ( real_t fluidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity ) { return real_t(3) * math::pi * diameter * fluidDynamicViscosity * fluidVolumeFraction; } @@ -72,6 +72,7 @@ const real_t thresholdAbsoluteVelocityDifference = real_t(1e-10); ////////////////////// // Stokes drag law +inline Vector3 dragForceStokes( const Vector3 & fluidVel, const Vector3 & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t /*fluidDensity*/ ) { @@ -92,6 +93,7 @@ Vector3 dragForceStokes( const Vector3 & fluidVel, const Vector3 // S. Ergun, Fluid flow through packed columns. Chemical Engineering Progress 48 (1952), 89-94. // Y. C. Wen, Y.H. Yu, Mechanics of fluidization. Chemical Engineering Progress Symposium Series 62 (1966), 100-111. // see also Beetstra, van der Hoef, Kuipers, "Drag Force of Intermediate Reynolds Number Flow Past Mono- and Bidisperse Arrays of Spheres" (2007) +inline Vector3 dragForceErgunWenYu( const Vector3 & fluidVel, const Vector3 & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { @@ -123,6 +125,7 @@ Vector3 dragForceErgunWenYu( const Vector3 & fluidVel, const Ve // drag correlation proposed by Tang et al. - "A New Drag Correlation from Fully Resolved Simulations of Flow Past // Monodisperse Static Arrays of Spheres", AiChE, 2014 +inline Vector3 dragForceTang( const Vector3 & fluidVel, const Vector3 & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { @@ -151,6 +154,7 @@ Vector3 dragForceTang( const Vector3 & fluidVel, const Vector3 dragForceFelice( const Vector3 & fluidVel, const Vector3 & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { @@ -180,6 +184,7 @@ Vector3 dragForceFelice( const Vector3 & fluidVel, const Vector3 // drag correlation based on findings from Tenneti, Garg, Subramaniam (2011) // used e.g. in Finn, Li, Apte - Particle based modelling and simulation of natural sand dynamics in the wave bottom boundary layer (2016) // could be generalized also for non-spherical particles, see Finn et al (2016) +inline Vector3 dragForceTenneti( const Vector3 & fluidVel, const Vector3 & particleVel, real_t solidVolumeFraction, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { @@ -211,6 +216,7 @@ Vector3 dragForceTenneti( const Vector3 & fluidVel, const Vector } +inline Vector3 noDragForce( const Vector3 & /*fluidVel*/, const Vector3 & /*particleVel*/, real_t /*solidVolumeFraction*/, real_t /*diameter*/, real_t /*fluidDynamicViscosity*/, real_t /*fluidDensity*/ ) { diff --git a/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h b/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h index 8e66b93d..a5e762d2 100644 --- a/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h +++ b/src/pe_coupling/discrete_particle_methods/correlations/LiftForceCorrelations.h @@ -37,6 +37,7 @@ namespace discrete_particle_methods { */ // Saffman lift force +inline Vector3 liftForceSaffman ( const Vector3 & fluidVel, const Vector3 & curlFluidVel, const Vector3 & particleVel, real_t diameter, real_t fluidDynamicViscosity, real_t fluidDensity ) { @@ -53,7 +54,7 @@ Vector3 liftForceSaffman ( const Vector3 & fluidVel, const Vecto } -Vector3 noLiftForce ( const Vector3 &, const Vector3 &, const Vector3 &, real_t, real_t, real_t ) +inline Vector3 noLiftForce ( const Vector3 &, const Vector3 &, const Vector3 &, real_t, real_t, real_t ) { return Vector3(real_t(0)); } diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h index f8039c7e..10c85b12 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/EffectiveViscosityFieldEvaluator.h @@ -32,20 +32,20 @@ namespace discrete_particle_methods { // correlations for the viscosity // no change in viscosity -real_t calculateUnchangedEffectiveViscosity( real_t fluidViscosity, real_t /*porosity*/ ) +inline real_t calculateUnchangedEffectiveViscosity( real_t fluidViscosity, real_t /*porosity*/ ) { return fluidViscosity; } // see: Fattahi, Waluga, Wohlmuth - "Large scale lattice Boltzmann simulation for the coupling of free and porous media flow" -real_t calculateRescaledEffectiveViscosity( real_t fluidViscosity, real_t porosity ) +inline real_t calculateRescaledEffectiveViscosity( real_t fluidViscosity, real_t porosity ) { return fluidViscosity / porosity; } // see: J. R. Finn, M. Li, S. V. Apte - "Particle based modelling and simulation of natural sand dynamics in the wave // bottom boundary layer", Journal of Fluid Mechanics 796 (2016) 340–385. doi:10.1017/jfm.2016.246. -real_t calculateEilersEffectiveViscosity( real_t fluidViscosity, real_t porosity ) +inline real_t calculateEilersEffectiveViscosity( real_t fluidViscosity, real_t porosity ) { const real_t closePackingFraction = real_t(0.64); const real_t intrinsicViscosity = real_t(2.5); //for monosized spheres diff --git a/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h b/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h index 2de86148..7b40b3a5 100644 --- a/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h +++ b/src/pe_coupling/discrete_particle_methods/evaluators/LubricationForceEvaluator.h @@ -88,7 +88,7 @@ class LubricationForceEvaluator }; // class LubricationForceEvaluator -void LubricationForceEvaluator::operator ()() +inline void LubricationForceEvaluator::operator ()() { WALBERLA_LOG_PROGRESS( "Calculating Lubrication Force" ); @@ -142,7 +142,7 @@ void LubricationForceEvaluator::operator ()() } } -void LubricationForceEvaluator::treatLubricationSphrSphr( const pe::SphereID sphereI, const pe::SphereID sphereJ, const math::AABB & blockAABB ) +inline void LubricationForceEvaluator::treatLubricationSphrSphr( const pe::SphereID sphereI, const pe::SphereID sphereJ, const math::AABB & blockAABB ) { WALBERLA_ASSERT_UNEQUAL( sphereI->getSystemID(), sphereJ->getSystemID() ); @@ -182,7 +182,7 @@ void LubricationForceEvaluator::treatLubricationSphrSphr( const pe::SphereID sph } -void LubricationForceEvaluator::treatLubricationSphrPlane( const pe::SphereID sphereI, const pe::ConstPlaneID planeJ ) +inline void LubricationForceEvaluator::treatLubricationSphrPlane( const pe::SphereID sphereI, const pe::ConstPlaneID planeJ ) { real_t gap = pe::getSurfaceDistance( sphereI, planeJ ); @@ -207,7 +207,7 @@ void LubricationForceEvaluator::treatLubricationSphrPlane( const pe::SphereID sp } -pe::Vec3 LubricationForceEvaluator::compLubricationSphrSphr( real_t gap, const pe::SphereID sphereI, const pe::SphereID sphereJ) const +inline pe::Vec3 LubricationForceEvaluator::compLubricationSphrSphr( real_t gap, const pe::SphereID sphereI, const pe::SphereID sphereJ) const { const pe::Vec3 &posSphereI = sphereI->getPosition(); const pe::Vec3 &posSphereJ = sphereJ->getPosition(); @@ -260,7 +260,7 @@ pe::Vec3 LubricationForceEvaluator::compLubricationSphrSphr( real_t gap, const p return fLub; } -pe::Vec3 LubricationForceEvaluator::compLubricationSphrPlane( real_t gap, const pe::SphereID sphereI, const pe::ConstPlaneID planeJ) const +inline pe::Vec3 LubricationForceEvaluator::compLubricationSphrPlane( real_t gap, const pe::SphereID sphereI, const pe::ConstPlaneID planeJ) const { const pe::Vec3 &posSphereI( sphereI->getPosition() ); real_t radiusSphereI = sphereI->getRadius(); diff --git a/src/pe_coupling/geometry/SphereEquivalentDiameter.h b/src/pe_coupling/geometry/SphereEquivalentDiameter.h index 7e40a843..e32dc239 100644 --- a/src/pe_coupling/geometry/SphereEquivalentDiameter.h +++ b/src/pe_coupling/geometry/SphereEquivalentDiameter.h @@ -31,7 +31,7 @@ namespace pe_coupling { // calculates sphere-equivalent diameter (diameter of a sphere with same volume as given body) -real_t getSphereEquivalentDiameter( pe::RigidBody & body ) +inline real_t getSphereEquivalentDiameter( pe::RigidBody & body ) { if( body.getTypeID() == pe::Sphere::getStaticTypeID() || body.getTypeID() == pe::Squirmer::getStaticTypeID() ) { From 8d6ae315ff6d25e750c82e13435750848a2355d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 20 Nov 2024 00:24:43 +0100 Subject: [PATCH 06/13] clang-tidy -checks=-*,modernize-use-emplace --- src/blockforest/BlockForest.cpp | 6 ++-- src/core/config/Config.cpp | 12 +++---- src/gather/CellGatherPackInfo.impl.h | 2 +- src/gather/CurveGatherPackInfo.impl.h | 2 +- src/mesa_pd/collision_detection/EPA.cpp | 44 ++++++++++++------------- src/pe/ccd/SimpleCCD.cpp | 8 ++--- src/pe/collision/EPA.cpp | 44 ++++++++++++------------- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/blockforest/BlockForest.cpp b/src/blockforest/BlockForest.cpp index 50ebc8c2..495da585 100644 --- a/src/blockforest/BlockForest.cpp +++ b/src/blockforest/BlockForest.cpp @@ -74,7 +74,7 @@ void BlockForest::BlockInformation::getAllBlocks( std::vector< shared_ptr< IBloc std::stack< std::pair< const Node *, BlockID > > stack; - stack.push( std::make_pair( nodes_[i].get(), BlockID( i, treeIdMarker ) ) ); + stack.emplace( nodes_[i].get(), BlockID( i, treeIdMarker ) ); while( !stack.empty() ) { @@ -85,7 +85,7 @@ void BlockForest::BlockInformation::getAllBlocks( std::vector< shared_ptr< IBloc if( !node.first->children_.empty() ) { for( uint_t c = 8; c-- != 0; ) - stack.push( std::make_pair( node.first->children_[c].get(), BlockID( node.second, c ) ) ); + stack.emplace( node.first->children_[c].get(), BlockID( node.second, c ) ); } else { blocks.push_back( make_shared< BlockID >( node.second ) ); @@ -2540,7 +2540,7 @@ void BlockForest::update( PhantomBlockForest & phantomForest ) if( phantom->sourceBlockHasTheSameSize() || phantom->sourceBlockIsLarger() ) { WALBERLA_ASSERT( blocksToUnpack.find( block ) == blocksToUnpack.end() ); - blocksToUnpack[ block ].push_back( std::make_pair( state, &(*buffer) ) ); + blocksToUnpack[ block ].emplace_back( state, &(*buffer) ); } else { diff --git a/src/core/config/Config.cpp b/src/core/config/Config.cpp index 6b5899e9..75a9cf41 100644 --- a/src/core/config/Config.cpp +++ b/src/core/config/Config.cpp @@ -224,7 +224,7 @@ void Config::parseFromFile( const char* filename, Block& block, unsigned int lev } //Adding the line to the input string - lineNumbers.push_back( Pair( input.tellp(), lineCounter ) ); + lineNumbers.emplace_back( input.tellp(), lineCounter ); input << line << "\n"; } @@ -572,7 +572,7 @@ void Config::Block::getBlocks( const std::string& key, Blocks& blocks, size_t mi size_t c = 0; for( List::const_iterator it=blocks_.begin(); it!=blocks_.end(); ++it ) { if( string_icompare( key, it->getKey() ) == 0 ) { - blocks.push_back( BlockHandle( &*it ) ); + blocks.emplace_back( &*it ); ++c; } } @@ -595,7 +595,7 @@ void Config::Block::getBlocks( const std::string& key, Blocks& blocks, size_t mi void Config::Block::getBlocks( Blocks& blocks ) const { for( List::const_iterator it=blocks_.begin(); it!=blocks_.end(); ++it ) { - blocks.push_back( BlockHandle( &*it ) ); + blocks.emplace_back( &*it ); } } //********************************************************************************************************************** @@ -610,7 +610,7 @@ void Config::Block::getBlocks( Blocks& blocks ) const void Config::Block::getWritableBlocks( std::vector & blocks ) { for( List::iterator it=blocks_.begin(); it!=blocks_.end(); ++it ) { - blocks.push_back( &*it ); + blocks.emplace_back( &*it ); } } //********************************************************************************************************************** @@ -630,7 +630,7 @@ void Config::Block::getWritableBlocks( const std::string & key, std::vectorgetKey() ) == 0 ) { - blocks.push_back( &*it ); + blocks.emplace_back( &*it ); ++c; } } @@ -676,7 +676,7 @@ bool Config::Block::addParameter( const std::string& key, const std::string& val */ Config::Block& Config::Block::createBlock( const std::string& key ) { - blocks_.push_back( Block( key ) ); + blocks_.emplace_back( key ); return *blocks_.rbegin(); } //********************************************************************************************************************** diff --git a/src/gather/CellGatherPackInfo.impl.h b/src/gather/CellGatherPackInfo.impl.h index ff3e1dcd..0ff0f32e 100644 --- a/src/gather/CellGatherPackInfo.impl.h +++ b/src/gather/CellGatherPackInfo.impl.h @@ -99,7 +99,7 @@ void CellGatherPackInfo::unpackData( mpi::RecvBuffer & buffer ) for( size_t i=0; i< nrPoints; ++i ) { - receivedData.push_back(std::vector(fieldSize+1)); //+1 because we also store t value as first entry + receivedData.emplace_back(std::vector(fieldSize+1)); //+1 because we also store t value as first entry std::vector & pointVec = receivedData[receivedData.size()-1]; uint_t t; diff --git a/src/gather/CurveGatherPackInfo.impl.h b/src/gather/CurveGatherPackInfo.impl.h index 0039b2a0..10d48001 100644 --- a/src/gather/CurveGatherPackInfo.impl.h +++ b/src/gather/CurveGatherPackInfo.impl.h @@ -185,7 +185,7 @@ void CurveGatherPackInfo::unpackData( mpi::RecvBuffer & buffer ) for( size_t i=0; i< nrPoints; ++i ) { - receivedData.push_back(std::vector(fieldSize+1)); //+1 because we also store t value as first entry + receivedData.emplace_back(std::vector(fieldSize+1)); //+1 because we also store t value as first entry std::vector & pointVec = receivedData[receivedData.size()-1]; real_t t; diff --git a/src/mesa_pd/collision_detection/EPA.cpp b/src/mesa_pd/collision_detection/EPA.cpp index 70c39dae..240b3e93 100644 --- a/src/mesa_pd/collision_detection/EPA.cpp +++ b/src/mesa_pd/collision_detection/EPA.cpp @@ -142,7 +142,7 @@ void EPA::EPA_Triangle::silhouette( size_t index, const Vec3& w, if (!obsolete_) { real_t test = (closest_ * w); if (test < sqrDist_) { - edgeBuffer.push_back(EPA_Edge(this, index)); + edgeBuffer.emplace_back(this, index); } else { obsolete_ = true; // Facet is visible @@ -271,7 +271,7 @@ bool EPA::doEPA( Support &geom1, for(EPA_EntryBuffer::iterator it=entryBuffer.begin(); it != entryBuffer.end(); ++it) { if(it->isClosestInternal()) { - entryHeap.push_back(&(*it)); + entryHeap.emplace_back(&(*it)); } } @@ -402,7 +402,7 @@ bool EPA::doEPA( Support &geom1, } EPA_EdgeBuffer::const_iterator it = edgeBuffer.begin(); - entryBuffer.push_back(EPA_Triangle(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume)); + entryBuffer.emplace_back(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume); EPA_Triangle* firstTriangle = &(entryBuffer.back()); //if it is expanding candidate add to heap @@ -416,7 +416,7 @@ bool EPA::doEPA( Support &geom1, && firstTriangle->getSqrDist() > lowerBoundSqr && firstTriangle->getSqrDist() < upperBoundSqr) { - entryHeap.push_back(firstTriangle); + entryHeap.emplace_back(firstTriangle); std::push_heap(entryHeap.begin(), entryHeap.end(), EPA::EPA_TriangleComp()); } @@ -431,7 +431,7 @@ bool EPA::doEPA( Support &geom1, break; } - entryBuffer.push_back(EPA_Triangle(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume)); + entryBuffer.emplace_back(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume); EPA_Triangle* newTriangle = &(entryBuffer.back()); //std::cerr << "Considering Triangle (" << newTriangle->getSqrDist() << ") {" << (*newTriangle)[0] << "," << (*newTriangle)[1] << ","<< (*newTriangle)[2] << "} ("<< epaVolume[(*newTriangle)[0]] * newTriangle->getNormal() << ")" << std::endl; @@ -446,7 +446,7 @@ bool EPA::doEPA( Support &geom1, && newTriangle->getSqrDist() > lowerBoundSqr && newTriangle->getSqrDist() < upperBoundSqr) { - entryHeap.push_back(newTriangle); + entryHeap.emplace_back(newTriangle); std::push_heap(entryHeap.begin(), entryHeap.end(), EPA::EPA_TriangleComp()); } @@ -572,11 +572,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, //check for containment inside if(originInTetrahedron(epaVolume[0], epaVolume[2], epaVolume[3], epaVolume[4]) || originInTetrahedron(epaVolume[1], epaVolume[2], epaVolume[3], epaVolume[4]) ){ //insert triangle 1 - entryBuffer.push_back(EPA_Triangle(1, 2, 3, epaVolume)); //[0] up->ccw1->ccw2 + entryBuffer.emplace_back(1, 2, 3, epaVolume); //[0] up->ccw1->ccw2 //insert triangle 2 - entryBuffer.push_back(EPA_Triangle(1, 3, 4, epaVolume)); //[1] up->ccw2->ccw3 + entryBuffer.emplace_back(1, 3, 4, epaVolume); //[1] up->ccw2->ccw3 //insert triangle 3 - entryBuffer.push_back(EPA_Triangle(1, 4, 2, epaVolume)); //[2] up->ccw3->ccw1 + entryBuffer.emplace_back(1, 4, 2, epaVolume); //[2] up->ccw3->ccw1 //link these 3 triangles entryBuffer[0].link(2, &(entryBuffer[1]), 0); //edge up->ccw1 @@ -585,11 +585,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, //insert triangle 4 - entryBuffer.push_back(EPA_Triangle(0, 2, 4, epaVolume)); //[3] down->ccw1->ccw3 + entryBuffer.emplace_back(0, 2, 4, epaVolume); //[3] down->ccw1->ccw3 //insert triangle 5 - entryBuffer.push_back(EPA_Triangle(0, 4, 3, epaVolume)); //[4] down->ccw3->ccw2 + entryBuffer.emplace_back(0, 4, 3, epaVolume); //[4] down->ccw3->ccw2 //insert triangle 6 - entryBuffer.push_back(EPA_Triangle(0, 3, 2, epaVolume)); //[5] down->ccw2->ccw1 + entryBuffer.emplace_back(0, 3, 2, epaVolume); //[5] down->ccw2->ccw1 //link these 3 triangles entryBuffer[3].link(2, &(entryBuffer[4]), 0); //edge down->ccw3 @@ -643,11 +643,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, else { //Build the hexahedron as it is convex //insert triangle 1 - entryBuffer.push_back(EPA_Triangle(3, 2, 1, epaVolume)); //[0] support1->A->B + entryBuffer.emplace_back(3, 2, 1, epaVolume); //[0] support1->A->B //insert triangle 2 - entryBuffer.push_back(EPA_Triangle(3, 1, 0, epaVolume)); //[1] support1->B->C + entryBuffer.emplace_back(3, 1, 0, epaVolume); //[1] support1->B->C //insert triangle 3 - entryBuffer.push_back(EPA_Triangle(3, 0, 2, epaVolume)); //[2] support1->C->A + entryBuffer.emplace_back(3, 0, 2, epaVolume); //[2] support1->C->A //link these 3 triangles entryBuffer[0].link(2, &(entryBuffer[1]), 0); //edge support1->A @@ -656,11 +656,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, //insert triangle 4 - entryBuffer.push_back(EPA_Triangle(4, 2, 0, epaVolume)); //[3] support2->A->C + entryBuffer.emplace_back(4, 2, 0, epaVolume); //[3] support2->A->C //insert triangle 5 - entryBuffer.push_back(EPA_Triangle(4, 0, 1, epaVolume)); //[4] support2->C->B + entryBuffer.emplace_back(4, 0, 1, epaVolume); //[4] support2->C->B //insert triangle 6 - entryBuffer.push_back(EPA_Triangle(4, 1, 2, epaVolume)); //[5] support2->B->A + entryBuffer.emplace_back(4, 1, 2, epaVolume); //[5] support2->B->A //link these 3 triangles entryBuffer[3].link(2, &(entryBuffer[4]), 0); //edge support2->C @@ -768,13 +768,13 @@ inline void EPA::createInitialTetrahedron( size_t top, EPA_EntryBuffer& entryBuffer ) { //insert triangle 1 - entryBuffer.push_back(EPA_Triangle(top, frontLeft, frontRight, epaVolume)); //[0] vorne + entryBuffer.emplace_back(top, frontLeft, frontRight, epaVolume); //[0] vorne //insert triangle 2 - entryBuffer.push_back(EPA_Triangle(top, frontRight, back, epaVolume)); //[1] rechts hinten + entryBuffer.emplace_back(top, frontRight, back, epaVolume); //[1] rechts hinten //insert triangle 3 - entryBuffer.push_back(EPA_Triangle(top, back, frontLeft, epaVolume)); //[2] links hinten + entryBuffer.emplace_back(top, back, frontLeft, epaVolume); //[2] links hinten //insert triangle 4 - entryBuffer.push_back(EPA_Triangle(back, frontRight, frontLeft, epaVolume)); //[3] unten + entryBuffer.emplace_back(back, frontRight, frontLeft, epaVolume); //[3] unten //make links between the triangles entryBuffer[0].link(0, &(entryBuffer[2]), 2); //Kante vorne links diff --git a/src/pe/ccd/SimpleCCD.cpp b/src/pe/ccd/SimpleCCD.cpp index c9af4591..02cd8860 100644 --- a/src/pe/ccd/SimpleCCD.cpp +++ b/src/pe/ccd/SimpleCCD.cpp @@ -62,9 +62,9 @@ PossibleContacts& SimpleCCD::generatePossibleContacts( WcTimingTree* tt ){ if (!((*it1)->hasInfiniteMass() && (*it2)->hasInfiniteMass())) { if ( (*it1)->getSystemID() > (*it2)->getSystemID() ) - contacts_.push_back(std::make_pair(*it2, *it1)); + contacts_.emplace_back(*it2, *it1); else - contacts_.push_back(std::make_pair(*it1, *it2)); + contacts_.emplace_back(*it1, *it2); } } @@ -73,9 +73,9 @@ PossibleContacts& SimpleCCD::generatePossibleContacts( WcTimingTree* tt ){ if (!((*it1)->hasInfiniteMass() && it2->hasInfiniteMass())) { if ( (*it1)->getSystemID() > it2->getSystemID() ) - contacts_.push_back(std::make_pair(it2.getBodyID(), *it1)); + contacts_.emplace_back(it2.getBodyID(), *it1); else - contacts_.push_back(std::make_pair(*it1, it2.getBodyID())); + contacts_.emplace_back(*it1, it2.getBodyID()); } } } diff --git a/src/pe/collision/EPA.cpp b/src/pe/collision/EPA.cpp index e8d54f17..26264c27 100644 --- a/src/pe/collision/EPA.cpp +++ b/src/pe/collision/EPA.cpp @@ -150,7 +150,7 @@ void EPA::EPA_Triangle::silhouette( size_t index, const Vec3& w, if (!obsolete_) { real_t test = (closest_ * w); if (test < sqrDist_) { - edgeBuffer.push_back(EPA_Edge(this, index)); + edgeBuffer.emplace_back(this, index); } else { obsolete_ = true; // Facet is visible @@ -259,7 +259,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec for(EPA_EntryBuffer::iterator it=entryBuffer.begin(); it != entryBuffer.end(); ++it) { if(it->isClosestInternal()) { - entryHeap.push_back(&(*it)); + entryHeap.emplace_back(&(*it)); } } @@ -390,7 +390,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec } EPA_EdgeBuffer::const_iterator it = edgeBuffer.begin(); - entryBuffer.push_back(EPA_Triangle(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume)); + entryBuffer.emplace_back(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume); EPA_Triangle* firstTriangle = &(entryBuffer.back()); //if it is expanding candidate add to heap @@ -404,7 +404,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec && firstTriangle->getSqrDist() > lowerBoundSqr && firstTriangle->getSqrDist() < upperBoundSqr) { - entryHeap.push_back(firstTriangle); + entryHeap.emplace_back(firstTriangle); std::push_heap(entryHeap.begin(), entryHeap.end(), EPA::EPA_TriangleComp()); } @@ -419,7 +419,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec break; } - entryBuffer.push_back(EPA_Triangle(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume)); + entryBuffer.emplace_back(it->getEnd(), it->getStart(), epaVolume.size()-1, epaVolume); EPA_Triangle* newTriangle = &(entryBuffer.back()); //std::cerr << "Considering Triangle (" << newTriangle->getSqrDist() << ") {" << (*newTriangle)[0] << "," << (*newTriangle)[1] << ","<< (*newTriangle)[2] << "} ("<< epaVolume[(*newTriangle)[0]] * newTriangle->getNormal() << ")" << std::endl; @@ -434,7 +434,7 @@ bool EPA::doEPA( GeomPrimitive &geom1, GeomPrimitive &geom2, const GJK& gjk, Vec && newTriangle->getSqrDist() > lowerBoundSqr && newTriangle->getSqrDist() < upperBoundSqr) { - entryHeap.push_back(newTriangle); + entryHeap.emplace_back(newTriangle); std::push_heap(entryHeap.begin(), entryHeap.end(), EPA::EPA_TriangleComp()); } @@ -555,11 +555,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, GeomPrimitive &geom1, G //check for containment inside if(originInTetrahedron(epaVolume[0], epaVolume[2], epaVolume[3], epaVolume[4]) || originInTetrahedron(epaVolume[1], epaVolume[2], epaVolume[3], epaVolume[4]) ){ //insert triangle 1 - entryBuffer.push_back(EPA_Triangle(1, 2, 3, epaVolume)); //[0] up->ccw1->ccw2 + entryBuffer.emplace_back(1, 2, 3, epaVolume); //[0] up->ccw1->ccw2 //insert triangle 2 - entryBuffer.push_back(EPA_Triangle(1, 3, 4, epaVolume)); //[1] up->ccw2->ccw3 + entryBuffer.emplace_back(1, 3, 4, epaVolume); //[1] up->ccw2->ccw3 //insert triangle 3 - entryBuffer.push_back(EPA_Triangle(1, 4, 2, epaVolume)); //[2] up->ccw3->ccw1 + entryBuffer.emplace_back(1, 4, 2, epaVolume); //[2] up->ccw3->ccw1 //link these 3 triangles entryBuffer[0].link(2, &(entryBuffer[1]), 0); //edge up->ccw1 @@ -568,11 +568,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, GeomPrimitive &geom1, G //insert triangle 4 - entryBuffer.push_back(EPA_Triangle(0, 2, 4, epaVolume)); //[3] down->ccw1->ccw3 + entryBuffer.emplace_back(0, 2, 4, epaVolume); //[3] down->ccw1->ccw3 //insert triangle 5 - entryBuffer.push_back(EPA_Triangle(0, 4, 3, epaVolume)); //[4] down->ccw3->ccw2 + entryBuffer.emplace_back(0, 4, 3, epaVolume); //[4] down->ccw3->ccw2 //insert triangle 6 - entryBuffer.push_back(EPA_Triangle(0, 3, 2, epaVolume)); //[5] down->ccw2->ccw1 + entryBuffer.emplace_back(0, 3, 2, epaVolume); //[5] down->ccw2->ccw1 //link these 3 triangles entryBuffer[3].link(2, &(entryBuffer[4]), 0); //edge down->ccw3 @@ -626,11 +626,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, GeomPrimitive &geom1, G else { //Build the hexahedron as it is convex //insert triangle 1 - entryBuffer.push_back(EPA_Triangle(3, 2, 1, epaVolume)); //[0] support1->A->B + entryBuffer.emplace_back(3, 2, 1, epaVolume); //[0] support1->A->B //insert triangle 2 - entryBuffer.push_back(EPA_Triangle(3, 1, 0, epaVolume)); //[1] support1->B->C + entryBuffer.emplace_back(3, 1, 0, epaVolume); //[1] support1->B->C //insert triangle 3 - entryBuffer.push_back(EPA_Triangle(3, 0, 2, epaVolume)); //[2] support1->C->A + entryBuffer.emplace_back(3, 0, 2, epaVolume); //[2] support1->C->A //link these 3 triangles entryBuffer[0].link(2, &(entryBuffer[1]), 0); //edge support1->A @@ -639,11 +639,11 @@ inline void EPA::createInitialSimplex( size_t numPoints, GeomPrimitive &geom1, G //insert triangle 4 - entryBuffer.push_back(EPA_Triangle(4, 2, 0, epaVolume)); //[3] support2->A->C + entryBuffer.emplace_back(4, 2, 0, epaVolume); //[3] support2->A->C //insert triangle 5 - entryBuffer.push_back(EPA_Triangle(4, 0, 1, epaVolume)); //[4] support2->C->B + entryBuffer.emplace_back(4, 0, 1, epaVolume); //[4] support2->C->B //insert triangle 6 - entryBuffer.push_back(EPA_Triangle(4, 1, 2, epaVolume)); //[5] support2->B->A + entryBuffer.emplace_back(4, 1, 2, epaVolume); //[5] support2->B->A //link these 3 triangles entryBuffer[3].link(2, &(entryBuffer[4]), 0); //edge support2->C @@ -748,13 +748,13 @@ inline void EPA::createInitialTetrahedron( size_t top, size_t frontLeft, size_t EPA_EntryBuffer& entryBuffer ) { //insert triangle 1 - entryBuffer.push_back(EPA_Triangle(top, frontLeft, frontRight, epaVolume)); //[0] vorne + entryBuffer.emplace_back(top, frontLeft, frontRight, epaVolume); //[0] vorne //insert triangle 2 - entryBuffer.push_back(EPA_Triangle(top, frontRight, back, epaVolume)); //[1] rechts hinten + entryBuffer.emplace_back(top, frontRight, back, epaVolume); //[1] rechts hinten //insert triangle 3 - entryBuffer.push_back(EPA_Triangle(top, back, frontLeft, epaVolume)); //[2] links hinten + entryBuffer.emplace_back(top, back, frontLeft, epaVolume); //[2] links hinten //insert triangle 4 - entryBuffer.push_back(EPA_Triangle(back, frontRight, frontLeft, epaVolume)); //[3] unten + entryBuffer.emplace_back(back, frontRight, frontLeft, epaVolume); //[3] unten //make links between the triangles entryBuffer[0].link(0, &(entryBuffer[2]), 2); //Kante vorne links From e377ce463ddf5094372969ea6a9d0642cc7733cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 20 Nov 2024 14:02:10 +0100 Subject: [PATCH 07/13] Fix various Clang-Tidy diagnostics Address most occurrences of: bugprone-unused-local-non-trivial-variable bugprone-unhandled-self-assignment bugprone-misplaced-widening-cast bugprone-sizeof-expression performance-for-range-copy performance-faster-string-find performance-inefficient-vector-operation performance-noexcept-swap misc-unused-using-decls misc-header-include-cycle misc-include-cleaner readability-delete-null-pointer readability-container-size-empty readability-redundant-smartptr-get readability-else-after-return --- .clang-tidy | 30 +++++++++++++++--- .../templates/CpuPackInfo.tmpl.cpp | 6 ++-- .../templates/GpuPackInfo.tmpl.cpp | 7 +++++ .../templates/GpuPackInfo.tmpl.h | 1 - .../communication/NonUniformBufferedScheme.h | 4 +-- src/core/Array.h | 4 +-- src/core/Set.h | 2 +- src/core/StringUtility.impl.h | 2 -- src/core/cell/CellInterval.h | 1 + src/core/debug/PrintStacktrace.cpp | 7 +++-- src/core/math/Matrix2.h | 4 +-- src/core/math/extern/exprtk.h | 21 +++++++------ src/core/mpi/BufferSystem.impl.h | 31 ++++++++++--------- src/core/mpi/RecvBuffer.h | 4 +-- src/core/mpi/SendBuffer.h | 2 +- src/core/timing/TimingNode.h | 7 +++-- src/core/timing/TimingTree.h | 7 +++-- src/core/uid/UIDGenerators.h | 6 ++-- src/core/waLBerlaBuildInfo.in.cpp | 1 + src/domain_decomposition/IBlock.h | 12 ++++--- src/field/adaptors/GhostLayerFieldAdaptor.h | 4 +-- src/field/vtk/FlagFieldMapping.h | 4 +-- src/field/vtk/VTKWriter.h | 9 ++---- src/gather/CellGatherPackInfo.impl.h | 2 +- src/gather/CurveGatherPackInfo.impl.h | 2 +- .../BoundarySetterFlagFieldSpecialization.h | 4 +-- .../initializer/ScalarFieldFromBody.impl.h | 4 ++- src/gpu/DeviceWrapper.h | 2 ++ src/lbm/boundary/ParserUBB.h | 6 ++-- .../FreeSurfaceBoundaryHandling.impl.h | 2 ++ .../surface_geometry/CurvatureSweep.impl.h | 4 +-- src/lbm/vtk/QCriterion.h | 2 +- .../overlapping/shapes/BoxWithOverlap.h | 2 ++ .../shapes/CylindricalBoundaryWithOverlap.h | 2 ++ .../overlapping/shapes/EllipsoidWithOverlap.h | 2 ++ .../overlapping/shapes/HalfSpaceWithOverlap.h | 2 ++ .../overlapping/shapes/SphereWithOverlap.h | 2 ++ src/mesa_pd/vtk/ParticleVtkOutput.cpp | 1 + src/pe/Types.h | 1 + src/pe/raytracing/Raytracer.h | 2 +- src/pe/rigidbody/RigidBodyCastIterator.h | 4 +-- src/python_coupling/export/FieldExport.impl.h | 2 ++ src/stencil/Directions.h | 4 +-- src/vtk/Base64Writer.h | 2 +- src/vtk/VTKOutput.cpp | 2 +- tests/field/FieldOfCustomTypesTest.cpp | 6 ---- tests/field/FlagFieldTest.cpp | 10 ++---- tests/lbm/evaluations/PermeabilityTest.cpp | 2 -- tests/pe/MinMaxRefinement.cpp | 18 +++++------ tests/pe/Refinement.cpp | 4 +-- tests/pe/SyncEquivalence.cpp | 2 +- tests/postprocessing/SphereTriangulate.cpp | 10 ++---- tests/simd/SIMD_Equivalence.cpp | 2 +- tests/stencil/StencilTest.cpp | 3 -- 54 files changed, 163 insertions(+), 126 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index f0e5933a..74d1c6cf 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -4,16 +4,30 @@ Checks: ' -*, boost-*, +-boost-use-ranges, bugprone-*, -bugprone-branch-clone, -bugprone-exception-escape, -bugprone-easily-swappable-parameters, +-bugprone-crtp-constructor-accessibility, +-bugprone-implicit-widening-of-multiplication-result, +-bugprone-macro-parentheses, +-bugprone-narrowing-conversions, +-bugprone-switch-missing-default-case, +-bugprone-assignment-in-if-condition, +-bugprone-reserved-identifier, misc-*, -misc-misplaced-const, +-misc-const-correctness, +-misc-unused-parameters, -misc-no-recursion, -misc-non-private-member-variables-in-classes, +-misc-include-cleaner, +-misc-header-include-cycle, +-misc-use-internal-linkage, +-misc-use-anonymous-namespace, modernize-*, -modernize-use-auto, @@ -23,12 +37,18 @@ modernize-*, -modernize-use-using, -modernize-avoid-bind, -modernize-return-braced-init-list, +-modernize-min-max-use-initializer-list, -modernize-use-transparent-functors, -modernize-redundant-void-arg, -modernize-use-trailing-return-type, +-modernize-use-default-member-init, +-modernize-use-equals-delete, +-modernize-macro-to-enum, -modernize-avoid-c-arrays, -modernize-concat-nested-namespaces, -modernize-use-nodiscard, +-modernize-type-traits, +-modernize-make-shared, mpi-*, -mpi-type-mismatch, @@ -38,25 +58,25 @@ openmp-*, -openmp-use-default-none, performance-*, +-performance-enum-size, +-performance-noexcept-swap, +-performance-move-const-arg, +-performance-unnecessary-value-param, +-performance-avoid-endl, portability-*, -readability-const-return-type, readability-container-size-empty, readability-delete-null-pointer, readability-deleted-default, -readability-isolate-declaration, -readability-misleading-indentation, readability-misplaced-array-index, readability-non-const-parameter, -readability-redundant-access-specifiers, readability-redundant-control-flow, readability-redundant-declaration, readability-redundant-function-ptr-dereference, readability-redundant-preprocessor, readability-redundant-smartptr-get, readability-redundant-string-cstr, -readability-simplify-boolean-expr, readability-simplify-subscript-expr, readability-static-accessed-through-instance, readability-static-definition-in-anonymous-namespace, diff --git a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.cpp b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.cpp index 0191994f..15c5d7be 100644 --- a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.cpp +++ b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.cpp @@ -117,7 +117,7 @@ uint_t {{class_name}}::size(stencil::Direction dir, const IBlock * block) const CellInterval ci; {{field_name}}->getGhostRegion(dir, ci, 1, false); - uint_t elementsPerCell = 0; + uint_t elementsPerCell = uint_t{ 0u }; switch( dir ) { @@ -125,11 +125,11 @@ uint_t {{class_name}}::size(stencil::Direction dir, const IBlock * block) const {%- for dir in direction_set %} case stencil::{{dir}}: {%- endfor %} - elementsPerCell = {{elements}}; + elementsPerCell = uint_t{ {{elements}}u }; break; {% endfor %} default: - elementsPerCell = 0; + elementsPerCell = uint_t{ 0u }; } return ci.numCells() * elementsPerCell * sizeof( {{dtype}} ); } diff --git a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.cpp b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.cpp index 48440b5b..6a385fa8 100644 --- a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.cpp +++ b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.cpp @@ -17,6 +17,13 @@ //! \\author pystencils //====================================================================================================================== +#include "core/DataTypes.h" +#include "core/cell/CellInterval.h" + +#include "domain_decomposition/IBlock.h" + +#include "stencil/Directions.h" + #include "{{class_name}}.h" {% if target is equalto 'cpu' -%} diff --git a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h index fd8fbd90..820c6b8b 100644 --- a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h @@ -20,7 +20,6 @@ #pragma once #include "core/DataTypes.h" -#include "core/cell/CellInterval.h" #include "domain_decomposition/IBlock.h" diff --git a/src/blockforest/communication/NonUniformBufferedScheme.h b/src/blockforest/communication/NonUniformBufferedScheme.h index ff1d3ba3..0a6a453a 100644 --- a/src/blockforest/communication/NonUniformBufferedScheme.h +++ b/src/blockforest/communication/NonUniformBufferedScheme.h @@ -851,7 +851,7 @@ void NonUniformBufferedScheme::startCommunicationCoarseToFine( const ui resetBufferSystem( bufferSystem ); - for( auto sender : sendFunctions ) + for( auto const &sender : sendFunctions ) bufferSystem->addSendingFunction( int_c(sender.first), std::bind( NonUniformBufferedScheme::send, std::placeholders::_1, sender.second ) ); for(auto receiver : ranksToReceiveFrom) @@ -996,7 +996,7 @@ void NonUniformBufferedScheme::startCommunicationFineToCoarse( const ui resetBufferSystem( bufferSystem ); - for( auto sender : sendFunctions ) + for( auto const &sender : sendFunctions ) bufferSystem->addSendingFunction( int_c(sender.first), std::bind( NonUniformBufferedScheme::send, std::placeholders::_1, sender.second ) ); for(auto receiver : ranksToReceiveFrom) diff --git a/src/core/Array.h b/src/core/Array.h index c047542d..dcb69e89 100644 --- a/src/core/Array.h +++ b/src/core/Array.h @@ -46,7 +46,7 @@ class Array { inline Array( const std::vector& vector ); inline Array( const Array& array ); - ~Array() { if( array_ != nullptr ) delete[] array_; } + ~Array() { delete[] array_; } uint_t size() const { return size_; } bool empty() const { return size_ == 0; } @@ -89,7 +89,7 @@ inline Array::Array( const uint_t n, const T& t ) : array_( n == 0 ? nullptr template< typename T > inline Array::Array( const std::vector& vector ) : - array_( vector.size() == 0 ? nullptr : new T[ vector.size() ] ), size_( vector.size() ) + array_( vector.empty() ? nullptr : new T[ vector.size() ] ), size_( vector.size() ) { for( uint_t i = 0; i != size_; ++i ) array_[i] = vector[i]; diff --git a/src/core/Set.h b/src/core/Set.h index cbc0d5c1..de9ca784 100644 --- a/src/core/Set.h +++ b/src/core/Set.h @@ -130,7 +130,7 @@ class Set { inline size_t size() const { return set_.size(); } - inline void swap( Set& set ) { set_.swap( set.set_ ); } + inline void swap( Set& set ) noexcept { set_.swap( set.set_ ); } void toStream( std::ostream& os ) const; inline std::string toString() const; diff --git a/src/core/StringUtility.impl.h b/src/core/StringUtility.impl.h index 02b5f393..ac3b2988 100644 --- a/src/core/StringUtility.impl.h +++ b/src/core/StringUtility.impl.h @@ -21,8 +21,6 @@ #pragma once -#include "core/StringUtility.h" - #include #include #include diff --git a/src/core/cell/CellInterval.h b/src/core/cell/CellInterval.h index 7b766fa3..6019ac71 100644 --- a/src/core/cell/CellInterval.h +++ b/src/core/cell/CellInterval.h @@ -236,6 +236,7 @@ inline bool CellInterval::overlaps( const CellInterval& other ) const if( empty() || other.empty() ) return false; + // NOLINTNEXTLINE(readability-simplify-boolean-expr) 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/debug/PrintStacktrace.cpp b/src/core/debug/PrintStacktrace.cpp index 94f2aa89..6e0a4fef 100644 --- a/src/core/debug/PrintStacktrace.cpp +++ b/src/core/debug/PrintStacktrace.cpp @@ -42,6 +42,7 @@ void printStacktrace() #include WALBERLA_BACKTRACE_HEADER #include #include +#include namespace walberla { namespace debug { @@ -92,12 +93,12 @@ namespace debug { string appName = line.substr( 0, leftBracket ); string bracketPart = line.substr( leftBracket+1, rightBracket - leftBracket -1 ); - string rest = line.substr( rightBracket +1 ); + std::ignore = line.substr( rightBracket +1 ); /*rest*/ // split the bracketPart on plus sign size_t plusPos = bracketPart.find_first_of('+'); string functionName = bracketPart.substr(0, plusPos ); - string offset = bracketPart.substr( plusPos+1 ); + std::ignore = bracketPart.substr( plusPos+1 ); /*offset*/ #endif // try to demangle -> no return code if successful @@ -109,7 +110,7 @@ namespace debug { os << "\t" << appName << " \t " << demangled << endl; } - free (strings); + free (reinterpret_cast(strings)); } diff --git a/src/core/math/Matrix2.h b/src/core/math/Matrix2.h index 30810864..3827333a 100644 --- a/src/core/math/Matrix2.h +++ b/src/core/math/Matrix2.h @@ -323,7 +323,7 @@ inline Matrix2& Matrix2::operator=( Type set ) // Explicit definition of a copy assignment operator for performance reasons. */ template< typename Type > -inline Matrix2& Matrix2::operator=( const Matrix2& set ) +inline Matrix2& Matrix2::operator=( const Matrix2& set ) // NOLINT(bugprone-unhandled-self-assignment) { // This implementation is faster than the synthesized default copy assignment operator and // faster than an implementation with the C library function 'memcpy' in combination with a @@ -347,7 +347,7 @@ inline Matrix2& Matrix2::operator=( const Matrix2& set ) */ template< typename Type > template< typename Other > -inline Matrix2& Matrix2::operator=( const Matrix2& set ) +inline Matrix2& Matrix2::operator=( const Matrix2& set ) // NOLINT(bugprone-unhandled-self-assignment) { // This implementation is faster than the synthesized default copy assignment operator and // faster than an implementation with the C library function 'memcpy' in combination with a diff --git a/src/core/math/extern/exprtk.h b/src/core/math/extern/exprtk.h index b415b4ba..aab5062b 100644 --- a/src/core/math/extern/exprtk.h +++ b/src/core/math/extern/exprtk.h @@ -5209,7 +5209,7 @@ namespace exprtk return std::numeric_limits::quiet_NaN(); } - inline virtual expression_node* branch(const std::size_t& index = 0) const + inline virtual expression_node* branch([[maybe_unused]] const std::size_t& index = 0) const { return reinterpret_cast(index * 0); } @@ -14889,6 +14889,8 @@ namespace exprtk { public: + ~T0oT1oT2oT3_sf4() override = default; + typedef typename details::functor_t functor_t; typedef typename functor_t::qfunc_t qfunc_t; typedef T value_type; @@ -18085,7 +18087,7 @@ namespace exprtk return false; else if (symbol_exists(vector_name)) return false; - else if (0 == v.size()) + else if (v.empty()) return false; else return local_data().vector_store.add(vector_name,v); @@ -18099,7 +18101,7 @@ namespace exprtk return false; else if (symbol_exists(vector_name)) return false; - else if (0 == v.size()) + else if (v.empty()) return false; else return local_data().vector_store.add(vector_name,v); @@ -18585,10 +18587,7 @@ namespace exprtk } } - if (results) - { - delete results; - } + delete results; } static inline control_block* create(expression_ptr e) @@ -21419,7 +21418,9 @@ namespace exprtk end_token = current_token(); + #ifdef exprtk_enable_debugging const std::string sub_expr = construct_subexpr(begin_token, end_token); + #endif exprtk_debug(("parse_corpus(%02d) Subexpr: %s\n", static_cast(arg_list.size() - 1), @@ -24456,7 +24457,7 @@ namespace exprtk for (std::size_t i = 0; i < function_definition_list_.size(); ++i) { - if (std::string::npos != function_definition_list_[i].param_seq.find("Z")) + if (std::string::npos != function_definition_list_[i].param_seq.find('Z')) { return true; } @@ -38550,7 +38551,7 @@ namespace exprtk std::memcpy(reinterpret_cast(&fd), reinterpret_cast(&v), - sizeof(fd)); + sizeof(void*)); return fd; } @@ -38611,7 +38612,7 @@ namespace exprtk std::memcpy(reinterpret_cast(&t ), reinterpret_cast(&fd), - sizeof(fd)); + sizeof(void*)); return t; } else diff --git a/src/core/mpi/BufferSystem.impl.h b/src/core/mpi/BufferSystem.impl.h index 3715a7ea..b927d242 100644 --- a/src/core/mpi/BufferSystem.impl.h +++ b/src/core/mpi/BufferSystem.impl.h @@ -165,21 +165,24 @@ GenericBufferSystem & GenericBufferSystem::operator=( const Gene { WALBERLA_ASSERT( !communicationRunning_, "Can't copy GenericBufferSystem while communication is running" ) - sizeChangesEverytime_ = other.sizeChangesEverytime_; - communicationRunning_ = other.communicationRunning_; - recvInfos_ = other.recvInfos_; - sendInfos_ = other.sendInfos_; + if (&other != this) + { + sizeChangesEverytime_ = other.sizeChangesEverytime_; + communicationRunning_ = other.communicationRunning_; + recvInfos_ = other.recvInfos_; + sendInfos_ = other.sendInfos_; - if( other.currentComm_ == &other.knownSizeComm_ ) - currentComm_ = &knownSizeComm_; - else if ( other.currentComm_ == &other.unknownSizeComm_ ) - currentComm_ = &unknownSizeComm_; - else if ( other.currentComm_ == &other.unknownSizeCommIProbe_ ) - currentComm_ = &unknownSizeCommIProbe_; - else if ( other.currentComm_ == &other.noMPIComm_ ) - currentComm_ = &noMPIComm_; - else - currentComm_ = nullptr; // receiver information not yet set + if( other.currentComm_ == &other.knownSizeComm_ ) + currentComm_ = &knownSizeComm_; + else if ( other.currentComm_ == &other.unknownSizeComm_ ) + currentComm_ = &unknownSizeComm_; + else if ( other.currentComm_ == &other.unknownSizeCommIProbe_ ) + currentComm_ = &unknownSizeCommIProbe_; + else if ( other.currentComm_ == &other.noMPIComm_ ) + currentComm_ = &noMPIComm_; + else + currentComm_ = nullptr; // receiver information not yet set + } return *this; } diff --git a/src/core/mpi/RecvBuffer.h b/src/core/mpi/RecvBuffer.h index 0b3df4ab..69c0a26d 100644 --- a/src/core/mpi/RecvBuffer.h +++ b/src/core/mpi/RecvBuffer.h @@ -400,11 +400,11 @@ GenericRecvBuffer::get( V& value ) // Checking the validity of the read operation - WALBERLA_ASSERT_LESS_EQUAL( cur_ + (sizeof(V) / sizeof(T)), end_ ); + WALBERLA_ASSERT_LESS_EQUAL( cur_ + (sizeof(V) / sizeof(T)), end_ ); // NOLINT(bugprone-sizeof-expression) // Extracting the data value std::memcpy( &value, cur_, sizeof(V) ); - cur_ += sizeof(V) / sizeof(T); + cur_ += sizeof(V) / sizeof(T); // NOLINT(bugprone-sizeof-expression) // Invariants check WALBERLA_ASSERT_LESS_EQUAL( cur_, end_); diff --git a/src/core/mpi/SendBuffer.h b/src/core/mpi/SendBuffer.h index 3fac958a..f167a445 100644 --- a/src/core/mpi/SendBuffer.h +++ b/src/core/mpi/SendBuffer.h @@ -449,7 +449,7 @@ GenericSendBuffer::put( V value ) static_assert( sizeof(V) >= sizeof(T), "Type that is stored has to be bigger than T" ); static_assert( sizeof(V) % sizeof(T) == 0, "V has to be divisible by T "); - size_t count = sizeof(V) / sizeof(T) ; + size_t count = sizeof(V) / sizeof(T); // NOLINT(bugprone-sizeof-expression) const size_t rest = numeric_cast< size_t >( end_ - cur_ ); // Checking the size of the remaining memory diff --git a/src/core/timing/TimingNode.h b/src/core/timing/TimingNode.h index 0b6326e7..404feb7d 100644 --- a/src/core/timing/TimingNode.h +++ b/src/core/timing/TimingNode.h @@ -97,8 +97,11 @@ TimingNode::TimingNode(const TimingNode& tn) template< typename TP > // Timing policy TimingNode& TimingNode::operator=(const TimingNode& tn) { - TimingNode tmp (tn); - tmp.swap(*this); + if (&tn != this) + { + TimingNode tmp (tn); + tmp.swap(*this); + } return *this; } diff --git a/src/core/timing/TimingTree.h b/src/core/timing/TimingTree.h index 5cf06167..5584b2be 100644 --- a/src/core/timing/TimingTree.h +++ b/src/core/timing/TimingTree.h @@ -128,8 +128,11 @@ TimingTree::TimingTree(const TimingTree& tt) template< typename TP > // Timing policy TimingTree& TimingTree::operator=(const TimingTree& tt) { - TimingTree tmp (tt); - tmp.swap(*this); + if (&tt != this) + { + TimingTree tmp (tt); + tmp.swap(*this); + } return *this; } diff --git a/src/core/uid/UIDGenerators.h b/src/core/uid/UIDGenerators.h index 265beeaa..3d715c9d 100644 --- a/src/core/uid/UIDGenerators.h +++ b/src/core/uid/UIDGenerators.h @@ -275,11 +275,11 @@ class SingletonGenerator { static uint_type firstUID() { return 1; } - static uint_type nextUID( const uint_type /*uid*/ ) { WALBERLA_ASSERT( false ); return 1; } + static uint_type nextUID( [[maybe_unused]] const uint_type uid ) { WALBERLA_ASSERT( false ); return 1; } - static uint_type toIndex( const uint_type uid ) { WALBERLA_ASSERT_EQUAL( uid, 1 ); return 0; } + static uint_type toIndex( [[maybe_unused]] const uint_type uid ) { WALBERLA_ASSERT_EQUAL( uid, 1 ); return 0; } - static uint_type toBitMask( const uint_type uid ) { WALBERLA_ASSERT_EQUAL( uid, 1 ); return 1; } + static uint_type toBitMask( [[maybe_unused]] const uint_type uid ) { WALBERLA_ASSERT_EQUAL( uid, 1 ); return 1; } static const char* getType() { static const char* const type = "singleton generator"; return type; } diff --git a/src/core/waLBerlaBuildInfo.in.cpp b/src/core/waLBerlaBuildInfo.in.cpp index 65fa8887..29efeaa8 100644 --- a/src/core/waLBerlaBuildInfo.in.cpp +++ b/src/core/waLBerlaBuildInfo.in.cpp @@ -5,6 +5,7 @@ */ //====================================================================================================================== +#include "core/waLBerlaBuildInfo.h" namespace walberla { namespace core { diff --git a/src/domain_decomposition/IBlock.h b/src/domain_decomposition/IBlock.h index 42f73cd4..a1641d5a 100644 --- a/src/domain_decomposition/IBlock.h +++ b/src/domain_decomposition/IBlock.h @@ -100,8 +100,8 @@ class BlockData : private NonCopyable template< typename U > const U* get() const { try { thr_(ptr_); } - catch ( U* ptr ) { return ptr; } - catch (...) {} + catch ( U* ptr ) { return ptr; } // NOLINT(misc-throw-by-value-catch-by-reference) + catch (...) {} // NOLINT(bugprone-empty-catch) #ifndef NDEBUG WALBERLA_ABORT( "BlockData access type violation! (The block data you added is of a different type than the block data you are trying to access!)" "\nThe original data type was: " << debug::demangle( typeInfo_ ) << @@ -135,8 +135,8 @@ class BlockData : private NonCopyable template< typename U > bool isClassOrSubclassOf() const { try { thr_(ptr_); } - catch ( U* ) { return true; } - catch (...) {} + catch ( U* ) { return true; } // NOLINT(misc-throw-by-value-catch-by-reference) + catch (...) {} // NOLINT(bugprone-empty-catch) return false; } @@ -156,7 +156,9 @@ class BlockData : private NonCopyable # pragma warning( disable : 4670 ) # pragma warning( disable : 4673 ) #endif //_MSC_VER - template< typename T > static void thrower( void* ptr ) { throw static_cast< T* >( ptr ); } + template< typename T > static void thrower( void* ptr ) { + throw static_cast< T* >( ptr ); // NOLINT(misc-throw-by-value-catch-by-reference) + } #ifdef _MSC_VER # pragma warning(pop) #endif //_MSC_VER diff --git a/src/field/adaptors/GhostLayerFieldAdaptor.h b/src/field/adaptors/GhostLayerFieldAdaptor.h index 13ac8f0e..e7e4d630 100644 --- a/src/field/adaptors/GhostLayerFieldAdaptor.h +++ b/src/field/adaptors/GhostLayerFieldAdaptor.h @@ -302,7 +302,7 @@ typename GhostLayerFieldAdaptor::const_iterator GhostLayerFieldAdap template< typename Functor, uint_t glD > typename GhostLayerFieldAdaptor::const_iterator GhostLayerFieldAdaptor::beginGhostLayerOnlyXYZ( - stencil::Direction dir, cell_idx_t f ) const + stencil::Direction dir, cell_idx_t /*f*/ ) const { CellInterval ci; getGhostRegion(dir,ci); @@ -326,7 +326,7 @@ typename GhostLayerFieldAdaptor::const_iterator GhostLayerFieldAdap template< typename Functor, uint_t glD > typename GhostLayerFieldAdaptor::const_iterator GhostLayerFieldAdaptor::beginSliceBeforeGhostLayerXYZ( - stencil::Direction dir, cell_idx_t width, cell_idx_t f) const + stencil::Direction dir, cell_idx_t width, cell_idx_t /*f*/) const { CellInterval ci; getSliceBeforeGhostLayer(dir,ci,width); diff --git a/src/field/vtk/FlagFieldMapping.h b/src/field/vtk/FlagFieldMapping.h index 267cee26..e9bfe963 100644 --- a/src/field/vtk/FlagFieldMapping.h +++ b/src/field/vtk/FlagFieldMapping.h @@ -94,12 +94,12 @@ class BinarizationFieldWriter : public vtk::BlockCellDataWriter protected: - void configure() { + void configure() override { WALBERLA_ASSERT_NOT_NULLPTR( this->block_ ); field_ = this->block_->template getData< FieldType >( fieldID_ ); } - TargetType evaluate( const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const cell_idx_t /*f*/ ) + TargetType 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_ ); if (field_->get(x,y,z) & mask_) { diff --git a/src/field/vtk/VTKWriter.h b/src/field/vtk/VTKWriter.h index 9b223290..c9852b7f 100644 --- a/src/field/vtk/VTKWriter.h +++ b/src/field/vtk/VTKWriter.h @@ -126,13 +126,10 @@ class VTKWriter : public vtk::BlockCellDataWriter< OutputType, // common case that can be handled faster return numeric_cast( OutputTrait::get( field_->get(x,y,z,0), uint_c(f) ) ); } - else - { - const cell_idx_t fField = f / cell_idx_c( OutputTrait::F_SIZE ); - const cell_idx_t fType = f % cell_idx_c( OutputTrait::F_SIZE ); + const cell_idx_t fField = f / cell_idx_c( OutputTrait::F_SIZE ); + const cell_idx_t fType = f % cell_idx_c( OutputTrait::F_SIZE ); - return numeric_cast( OutputTrait::get( field_->get(x,y,z,fField), uint_c(fType) ) ); - } + return numeric_cast( OutputTrait::get( field_->get(x,y,z,fField), uint_c(fType) ) ); } const ConstBlockDataID bdid_; diff --git a/src/gather/CellGatherPackInfo.impl.h b/src/gather/CellGatherPackInfo.impl.h index 0ff0f32e..1dc7e14c 100644 --- a/src/gather/CellGatherPackInfo.impl.h +++ b/src/gather/CellGatherPackInfo.impl.h @@ -100,7 +100,7 @@ void CellGatherPackInfo::unpackData( mpi::RecvBuffer & buffer ) for( size_t i=0; i< nrPoints; ++i ) { receivedData.emplace_back(std::vector(fieldSize+1)); //+1 because we also store t value as first entry - std::vector & pointVec = receivedData[receivedData.size()-1]; + std::vector & pointVec = receivedData.back(); uint_t t; real_t val; diff --git a/src/gather/CurveGatherPackInfo.impl.h b/src/gather/CurveGatherPackInfo.impl.h index 10d48001..5c61a907 100644 --- a/src/gather/CurveGatherPackInfo.impl.h +++ b/src/gather/CurveGatherPackInfo.impl.h @@ -186,7 +186,7 @@ void CurveGatherPackInfo::unpackData( mpi::RecvBuffer & buffer ) for( size_t i=0; i< nrPoints; ++i ) { receivedData.emplace_back(std::vector(fieldSize+1)); //+1 because we also store t value as first entry - std::vector & pointVec = receivedData[receivedData.size()-1]; + std::vector & pointVec = receivedData.back(); real_t t; real_t val; diff --git a/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h b/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h index e154678f..dd5a376e 100644 --- a/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h +++ b/src/geometry/initializer/BoundarySetterFlagFieldSpecialization.h @@ -109,13 +109,13 @@ namespace initializer { } template - void BoundarySetter >::setBoundaryConfigBlock( const BoundaryUID & boundaryUID, const Config::BlockHandle & blockHandle ) + void BoundarySetter >::setBoundaryConfigBlock( [[maybe_unused]] const BoundaryUID & boundaryUID, [[maybe_unused]] const Config::BlockHandle & blockHandle ) { WALBERLA_ABORT("Passed boundary information to an initializer that sets up a pure flag field only"); } template - void BoundarySetter>::setBoundaryConfig( const BoundaryUID & boundaryUID, const shared_ptr & conf ) + void BoundarySetter>::setBoundaryConfig( [[maybe_unused]] const BoundaryUID & boundaryUID, [[maybe_unused]] const shared_ptr & conf ) { WALBERLA_ABORT("Passed boundary information to an initializer that sets up a pure flag field only"); } diff --git a/src/geometry/initializer/ScalarFieldFromBody.impl.h b/src/geometry/initializer/ScalarFieldFromBody.impl.h index 7c96eea7..95ade01e 100644 --- a/src/geometry/initializer/ScalarFieldFromBody.impl.h +++ b/src/geometry/initializer/ScalarFieldFromBody.impl.h @@ -32,6 +32,8 @@ #include "core/mpi/Reduce.h" #include "core/stringToNum.h" +#include + namespace walberla { namespace geometry { @@ -60,7 +62,7 @@ namespace initializer { addOrSet = false; auto id = subBlock.getParameter< std::vector::size_type > ( "id", 0 ); - std::string shape = subBlock.getParameter< std::string > ( "shape" ); + std::ignore = subBlock.getParameter< std::string > ( "shape" ); std::string expression = subBlock.getParameter< std::string > ( "value" ); try diff --git a/src/gpu/DeviceWrapper.h b/src/gpu/DeviceWrapper.h index 3bdf1be0..b5270a57 100644 --- a/src/gpu/DeviceWrapper.h +++ b/src/gpu/DeviceWrapper.h @@ -66,10 +66,12 @@ namespace gpustubs { "available and shouldn't be called!"); #ifndef __CUDACC__ + //NOLINTBEGIN(bugprone-reserved-identifier) #define __device__ #define __global__ #define __host__ #define __forceinline__ + //NOLINTEND(bugprone-reserved-identifier) #endif using gpuError_t = int; diff --git a/src/lbm/boundary/ParserUBB.h b/src/lbm/boundary/ParserUBB.h index 2a4d8e08..8559af95 100644 --- a/src/lbm/boundary/ParserUBB.h +++ b/src/lbm/boundary/ParserUBB.h @@ -220,19 +220,19 @@ template< typename LatticeModel_T, typename flag_t, bool AdaptVelocityToExternal inline ParserUBB::Parser::Parser( const std::array< std::string, 3 > & equations ) : parsers_(), equations_( equations ), timeDependent_( false ) { - if( equations_[0].length() > 0 ) + if( not equations_[0].empty() ) { parsers_[0].parse( equations_[0] ); if( parsers_[0].symbolExists( "t" ) ) timeDependent_ = true; } - if( equations_[1].length() > 0 ) + if( not equations_[1].empty() ) { parsers_[1].parse( equations_[1] ); if( parsers_[1].symbolExists( "t" ) ) timeDependent_ = true; } - if( equations_[2].length() > 0 ) + if( not equations_[2].empty() ) { parsers_[2].parse( equations_[2] ); if( parsers_[2].symbolExists( "t" ) ) diff --git a/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h b/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h index 7a498511..d9bd6420 100644 --- a/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h +++ b/src/lbm/free_surface/boundary/FreeSurfaceBoundaryHandling.impl.h @@ -59,6 +59,8 @@ class BoundaryBlockDataHandling : boundary_(boundary) {} + ~BoundaryBlockDataHandling() override = default; + // initialize standard waLBerla boundary handling BoundaryHandling_T* initialize(IBlock* const block) override { diff --git a/src/lbm/free_surface/surface_geometry/CurvatureSweep.impl.h b/src/lbm/free_surface/surface_geometry/CurvatureSweep.impl.h index f6d46d10..1e279596 100644 --- a/src/lbm/free_surface/surface_geometry/CurvatureSweep.impl.h +++ b/src/lbm/free_surface/surface_geometry/CurvatureSweep.impl.h @@ -327,8 +327,8 @@ void CurvatureSweepLocalTriangulation< Stencil_T, FlagField_T, ScalarField_T, Ve { const real_t diff = nIt1->dist2 - nIt2->dist2; - if (diff < real_c(1e-4)) { nIt1->valid = nIt1->wall ? true : false; } - if (diff > real_c(-1e-4)) { nIt2->valid = nIt2->wall ? true : false; } + if (diff < real_c(1e-4)) { nIt1->valid = nIt1->wall; } + if (diff > real_c(-1e-4)) { nIt2->valid = nIt2->wall; } } } } diff --git a/src/lbm/vtk/QCriterion.h b/src/lbm/vtk/QCriterion.h index 946f8f7e..5675c65d 100644 --- a/src/lbm/vtk/QCriterion.h +++ b/src/lbm/vtk/QCriterion.h @@ -38,7 +38,7 @@ class QCriterionVTKWriter : public vtk::BlockCellDataWriter< OutputType, 1 > public: QCriterionVTKWriter(const shared_ptr blockStorage, Filter_T & filter, const ConstBlockDataID & velocityFieldId, const std::string & id ) : - vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter), velocityFieldId_(velocityFieldId), velocityField_(NULL) {} + vtk::BlockCellDataWriter< OutputType, 1 >(id), blockStorage_(blockStorage), filter_(filter), velocityFieldId_(velocityFieldId), velocityField_(nullptr) {} protected: diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h index 9f6e5235..8ad69fce 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/BoxWithOverlap.h @@ -46,6 +46,8 @@ class BoxWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), box_(box) {} + ~BoxWithOverlap() override = default; + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideBoxBF(mesa_pd::transformPositionFromWFtoBF(idx_, ac_, point), box_.getEdgeLength()); diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h index de42d005..f6f5d597 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/CylindricalBoundaryWithOverlap.h @@ -47,6 +47,8 @@ class CylindricalBoundaryWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), cylindricalBoundary_(cylindricalBoundary) {} + ~CylindricalBoundaryWithOverlap() override = default; + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideCylindricalBoundary(point, ac_->getPosition(idx_), cylindricalBoundary_.getRadius(), diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h index 0430419a..295021fe 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/EllipsoidWithOverlap.h @@ -46,6 +46,8 @@ class EllipsoidWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), ellipsoid_(ellipsoid) {} + ~EllipsoidWithOverlap() override = default; + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideEllipsoidBF(mesa_pd::transformPositionFromWFtoBF(idx_, ac_, point), diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h index 3cc6ce13..555e5159 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/HalfSpaceWithOverlap.h @@ -46,6 +46,8 @@ class HalfSpaceWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), halfSpace_(halfSpace) {} + ~HalfSpaceWithOverlap() override = default; + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideHalfSpace(point, ac_->getPosition(idx_), halfSpace_.getNormal()); diff --git a/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h b/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h index 84a0db6f..ad80bdc0 100644 --- a/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h +++ b/src/lbm_mesapd_coupling/overlapping/shapes/SphereWithOverlap.h @@ -45,6 +45,8 @@ class SphereWithOverlap : public geometry::AbstractBody : idx_(idx), ac_(ac), sphere_(sphere) {} + ~SphereWithOverlap() override = default; + bool contains(const Vector3< real_t >& point) const override { return mesa_pd::isPointInsideSphere(point, ac_->getPosition(idx_), sphere_.getRadius()); diff --git a/src/mesa_pd/vtk/ParticleVtkOutput.cpp b/src/mesa_pd/vtk/ParticleVtkOutput.cpp index 6093eeb3..9731e1e6 100644 --- a/src/mesa_pd/vtk/ParticleVtkOutput.cpp +++ b/src/mesa_pd/vtk/ParticleVtkOutput.cpp @@ -27,6 +27,7 @@ namespace vtk { std::vector< ParticleVtkOutput::Attributes > ParticleVtkOutput::getAttributes() const { std::vector< Attributes > attributes; + attributes.reserve(selectors_.size()); for (const auto& s : selectors_) { attributes.emplace_back( s.second->type_string, s.first, s.second->components ); diff --git a/src/pe/Types.h b/src/pe/Types.h index 463aab78..7e45fff6 100644 --- a/src/pe/Types.h +++ b/src/pe/Types.h @@ -27,6 +27,7 @@ #include #include +#include #include namespace walberla{ diff --git a/src/pe/raytracing/Raytracer.h b/src/pe/raytracing/Raytracer.h index ed4c6c86..ad26fb23 100644 --- a/src/pe/raytracing/Raytracer.h +++ b/src/pe/raytracing/Raytracer.h @@ -614,7 +614,7 @@ void Raytracer::generateImage(const size_t timestep, WcTimingTree* tt) { WALBERLA_LOG_WARNING(pixelErrors << " pixel errors found!"); std::stringstream ss; - for (auto it: correctToIncorrectBodyIDsMap) { + for (auto const &it: correctToIncorrectBodyIDsMap) { const BodyID correctBody = it.first; if (it.first != nullptr) { ss << " correct body: " << correctBody->getID() << "(" << correctBody->getHash() << ")"; diff --git a/src/pe/rigidbody/RigidBodyCastIterator.h b/src/pe/rigidbody/RigidBodyCastIterator.h index 3486472b..6f3bda56 100644 --- a/src/pe/rigidbody/RigidBodyCastIterator.h +++ b/src/pe/rigidbody/RigidBodyCastIterator.h @@ -80,7 +80,7 @@ class RigidBodyCastIterator //**Access operators**************************************************************************** /*!\name Access operators */ //@{ - inline reference operator*() {return static_cast( *(cur_->get()) );} + inline reference operator*() {return static_cast( **cur_ );} inline pointer operator->() {return static_cast( cur_->get() );} //@} //********************************************************************************************** @@ -228,7 +228,7 @@ class ConstRigidBodyCastIterator //**Access operators**************************************************************************** /*!\name Access operators */ //@{ - inline reference operator*() {return static_cast( *(cur_->get()) );} + inline reference operator*() {return static_cast( **cur_ );} inline pointer operator->() {return static_cast( cur_->get() );} //@} //********************************************************************************************** diff --git a/src/python_coupling/export/FieldExport.impl.h b/src/python_coupling/export/FieldExport.impl.h index 3cff65b0..6d9916c7 100644 --- a/src/python_coupling/export/FieldExport.impl.h +++ b/src/python_coupling/export/FieldExport.impl.h @@ -129,6 +129,8 @@ class GhostLayerFieldDataHandling : public field::BlockDataHandling< GhostLayerF alignment_(alignment) {} + ~GhostLayerFieldDataHandling() override = default; + GhostLayerField_T* allocate(IBlock* const block) override { auto blocks = blocks_.lock(); diff --git a/src/stencil/Directions.h b/src/stencil/Directions.h index 5be0d722..9071405a 100644 --- a/src/stencil/Directions.h +++ b/src/stencil/Directions.h @@ -317,7 +317,7 @@ namespace stencil { else if ( axis==1 && !minOrMax ) return N; else if ( axis==2 && minOrMax ) return B; else if ( axis==2 && !minOrMax ) return T; - else return INVALID_DIR; + return INVALID_DIR; } /// Maps (direction,axis) pair to direction @@ -333,7 +333,7 @@ namespace stencil { else if ( axis==1 && !minOrMax ) return N; else if ( axis==2 && minOrMax ) return B; else if ( axis==2 && !minOrMax ) return T; - else return INVALID_DIR; + return INVALID_DIR; } diff --git a/src/vtk/Base64Writer.h b/src/vtk/Base64Writer.h index 43631d2a..c9af5528 100644 --- a/src/vtk/Base64Writer.h +++ b/src/vtk/Base64Writer.h @@ -75,7 +75,7 @@ class Base64Writer { private: - void encodeblock( unsigned char in[3], unsigned char out[4], int len ) + void encodeblock( unsigned char const in[3], unsigned char out[4], int len ) { static const unsigned char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/src/vtk/VTKOutput.cpp b/src/vtk/VTKOutput.cpp index eb66d397..1039abe5 100644 --- a/src/vtk/VTKOutput.cpp +++ b/src/vtk/VTKOutput.cpp @@ -1882,7 +1882,7 @@ void VTKOutput::writeVTHBSeries() { for( std::string line; std::getline(ofs, line); ) { - if( line.find("]") != std::string::npos ) + if( line.find(']') != std::string::npos ) { WALBERLA_ASSERT_GREATER( ofs.tellg(), 0 ); pvdEnd_ = ofs.tellg(); diff --git a/tests/field/FieldOfCustomTypesTest.cpp b/tests/field/FieldOfCustomTypesTest.cpp index 883d7951..4a7144a4 100644 --- a/tests/field/FieldOfCustomTypesTest.cpp +++ b/tests/field/FieldOfCustomTypesTest.cpp @@ -31,12 +31,6 @@ using namespace walberla; -using std::cout; -using std::endl; - - - - struct MyClass { MyClass() { diff --git a/tests/field/FlagFieldTest.cpp b/tests/field/FlagFieldTest.cpp index 97b9d382..4e91c68b 100644 --- a/tests/field/FlagFieldTest.cpp +++ b/tests/field/FlagFieldTest.cpp @@ -33,10 +33,6 @@ using namespace walberla; namespace wlb = walberla; -using std::vector; -using std::string; -using std::cout; -using std::endl; void registerTest() { @@ -64,7 +60,7 @@ void registerTest() } WALBERLA_CHECK(overFlow); - vector names; + std::vector names; names.emplace_back("Flag1"); names.emplace_back("Flag2"); names.emplace_back("Flag3"); @@ -82,7 +78,7 @@ void registerTest() WALBERLA_CHECK_EQUAL( ff.getFlagUID( numeric_cast::flag_t>( 1 << i ) ), FlagUID(names[i]) ); } - //ff.printRegistered(cout); + //ff.printRegistered(std::cout); } void accessTest() @@ -167,7 +163,7 @@ void printingTest() ff.addFlag(0,1,0,ob); ff.addFlag(1,0,0,ob); - //printSlice( cout,ff, 2,0 ); + //printSlice( std::cout,ff, 2,0 ); } void neighborhoodTest() diff --git a/tests/lbm/evaluations/PermeabilityTest.cpp b/tests/lbm/evaluations/PermeabilityTest.cpp index 2cc1fffa..887c524f 100644 --- a/tests/lbm/evaluations/PermeabilityTest.cpp +++ b/tests/lbm/evaluations/PermeabilityTest.cpp @@ -284,8 +284,6 @@ int main( int argc, char ** argv ) else WALBERLA_ABORT( "This app can only be executed with 1, 4, or 8 processes! Aborting ..." ); - std::string collisionModel( "TRT" ); - try { if( std::strcmp( setup.collisionModel.c_str(), "SRT" ) == 0 ) return setupAndExecute< lbm::D3Q19< lbm::collision_model::SRT , false > >( setup ); diff --git a/tests/pe/MinMaxRefinement.cpp b/tests/pe/MinMaxRefinement.cpp index 6cd56cb0..35c75825 100644 --- a/tests/pe/MinMaxRefinement.cpp +++ b/tests/pe/MinMaxRefinement.cpp @@ -109,14 +109,14 @@ int main( int argc, char ** argv ) blockforest.setRefreshPhantomBlockMigrationPreparationFunction( blockforest::DynamicCurveBalance< blockforest::WeightAssignmentFunctor::PhantomBlockWeight >( false, true, false ) ); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(1,1,1), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(1,1,3), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(1,3,1), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(1,3,3), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(3,1,1), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(3,1,3), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(3,3,1), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(3,3,3), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(1,1,1), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(1,1,3), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(1,3,1), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(1,3,3), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(3,1,1), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(3,1,3), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(3,3,1), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(3,3,3), 1); WALBERLA_MPI_BARRIER(); WALBERLA_LOG_DEVEL_ON_ROOT( "Refinement 1" ); @@ -152,7 +152,7 @@ int main( int argc, char ** argv ) for (unsigned int i = 0; i < 30; ++i) { - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(real_t(2.1), real_t(2.1), real_t(2.1)), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(real_t(2.1), real_t(2.1), real_t(2.1)), 1); } WALBERLA_MPI_BARRIER(); diff --git a/tests/pe/Refinement.cpp b/tests/pe/Refinement.cpp index 96900a62..5a8ab40a 100644 --- a/tests/pe/Refinement.cpp +++ b/tests/pe/Refinement.cpp @@ -164,8 +164,8 @@ int main( int argc, char ** argv ) blockforest.setRefreshPhantomBlockMigrationPreparationFunction( simpleLB ); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(5,5,5), 1); - createSphere(*globalStorage.get(), forest->getBlockStorage(), storageID, 0, Vec3(15,6,6), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(5,5,5), 1); + createSphere(*globalStorage, forest->getBlockStorage(), storageID, 0, Vec3(15,6,6), 1); SweepTimeloop timeloop( forest->getBlockStorage(), 1 ); timeloop.addFuncBeforeTimeStep( simpleLB, "refreshFunctorName" ); diff --git a/tests/pe/SyncEquivalence.cpp b/tests/pe/SyncEquivalence.cpp index 6c031801..1ad70b83 100644 --- a/tests/pe/SyncEquivalence.cpp +++ b/tests/pe/SyncEquivalence.cpp @@ -122,7 +122,7 @@ void createSimulation(math::AABB& simulationDomain, IBlock & currentBlock = *blkIt; for (auto it = grid_generator::HCPIterator(currentBlock.getAABB(), Vector3(-5,-5,-5), spacing); it != grid_generator::HCPIterator(); ++it) { - SphereID sp = pe::createSphere( *(info.globalBodyStorage.get()), info.forest->getBlockStorage(), info.storageID, static_cast(mpi::MPIManager::instance()->worldRank() * 1000000 + numParticles), *it, radius); + SphereID sp = pe::createSphere( *info.globalBodyStorage, info.forest->getBlockStorage(), info.storageID, static_cast(mpi::MPIManager::instance()->worldRank()) * 1000000u + static_cast(numParticles), *it, radius); Vec3 rndVel(math::realRandom(-vMax, vMax, generator), math::realRandom(-vMax, vMax, generator), math::realRandom(-vMax, vMax, generator)); if (sp != nullptr) sp->setLinearVel(rndVel); if (sp != nullptr) ++numParticles; diff --git a/tests/postprocessing/SphereTriangulate.cpp b/tests/postprocessing/SphereTriangulate.cpp index 325f0ad4..b7498546 100644 --- a/tests/postprocessing/SphereTriangulate.cpp +++ b/tests/postprocessing/SphereTriangulate.cpp @@ -38,10 +38,6 @@ using namespace postprocessing; using geometry::TriangleMesh; -using std::cout; -using std::endl; -using std::ofstream; - typedef GhostLayerField ScalarField; @@ -106,7 +102,7 @@ void singleField() TriangleMesh m; generateIsoSurface(f,0.5,m); - //ofstream file ("out.obj"); + //std::ofstream file ("out.obj"); //writeMeshObj(file,m); } @@ -143,11 +139,11 @@ void multipleFields() generateIsoSurface( **i, real_c(0.5), m, Vector3(real_t(1)), uint_t(0), offset ); } - //ofstream file1("meshWithDoubles.obj"); + //std::ofstream file1("meshWithDoubles.obj"); //writeMeshObj(file1,m); size_t verticesRemoved = m.removeDuplicateVertices(); WALBERLA_CHECK_EQUAL(verticesRemoved, expectedDoubles); - //ofstream file2("meshWithoutDoubles.obj"); + //std::ofstream file2("meshWithoutDoubles.obj"); //writeMeshObj(file2,m); } diff --git a/tests/simd/SIMD_Equivalence.cpp b/tests/simd/SIMD_Equivalence.cpp index f90c69f4..9a86ae0d 100644 --- a/tests/simd/SIMD_Equivalence.cpp +++ b/tests/simd/SIMD_Equivalence.cpp @@ -166,7 +166,7 @@ void print1( const is1::double4_t& vec) void checkVecEqual ( is0::double4_t a, is1::double4_t b, const std::string & description = "" ) { - if ( description.size() > 0) + if ( not description.empty() ) { double meanError = std::abs( is0::getComponent(a, 0 )- is1::getComponent(b,0 ) ) + std::abs( is0::getComponent(a, 1 )- is1::getComponent(b,1 ) ) + diff --git a/tests/stencil/StencilTest.cpp b/tests/stencil/StencilTest.cpp index 2e282ac6..3ddee03e 100644 --- a/tests/stencil/StencilTest.cpp +++ b/tests/stencil/StencilTest.cpp @@ -19,9 +19,6 @@ using namespace walberla; using namespace stencil; -using std::cout; -using std::endl; - template void stencilIteration() From 03e7f92700ca51a9dd7e74174ec5540551482f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Wed, 20 Nov 2024 20:49:07 +0100 Subject: [PATCH 08/13] Remove unused and untested utility functions Number formatting can be achieved with an imbued locale. --- src/blockforest/BlockForest.h | 1 + src/blockforest/CMakeLists.txt | 1 - src/blockforest/Utility.cpp | 65 ---------------------------------- src/blockforest/Utility.h | 24 ------------- src/core/all.h | 1 - 5 files changed, 1 insertion(+), 91 deletions(-) delete mode 100644 src/blockforest/Utility.cpp diff --git a/src/blockforest/BlockForest.h b/src/blockforest/BlockForest.h index 58df1ba4..c000ecff 100644 --- a/src/blockforest/BlockForest.h +++ b/src/blockforest/BlockForest.h @@ -27,6 +27,7 @@ #include "PhantomBlockForest.h" #include "Types.h" +#include "core/EndianIndependentSerialization.h" #include "core/debug/Debug.h" #include "core/math/Uint.h" #include "core/timing/TimingPool.h" diff --git a/src/blockforest/CMakeLists.txt b/src/blockforest/CMakeLists.txt index 5be89206..0c4e8f8b 100644 --- a/src/blockforest/CMakeLists.txt +++ b/src/blockforest/CMakeLists.txt @@ -45,7 +45,6 @@ target_sources( blockforest SetupBlock.cpp SetupBlockForest.cpp StructuredBlockForest.cpp - Utility.cpp ) add_subdirectory( communication ) diff --git a/src/blockforest/Utility.cpp b/src/blockforest/Utility.cpp deleted file mode 100644 index b31f4147..00000000 --- a/src/blockforest/Utility.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//====================================================================================================================== -// -// This file is part of waLBerla. waLBerla is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// waLBerla is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with waLBerla (see COPYING.txt). If not, see . -// -//! \file Utility.cpp -//! \ingroup blockforest -//! \author Florian Schornbaum -// -//====================================================================================================================== - -#include "Utility.h" - -#include -#include -#include - - -namespace walberla { -namespace blockforest { - - - -std::string naturalNumberToGroupedThousandsString( uint_t number, const char separator ) { // for the documentation see the header file - - std::ostringstream oss; - - std::stack< uint_t > numbers; - - while( true ) { - - numbers.push( number % 1000 ); - - if( number <= 999 ) break; - - number /= 1000; - } - - oss << numbers.top(); - numbers.pop(); - - while( !numbers.empty() ) { - - oss << separator << std::setfill( '0' ) << std::setw( 3 ) << numbers.top(); - oss << std::setw( 0 ); - numbers.pop(); - } - - return oss.str(); -} - - - -} // namespace blockforest -} // namespace walberla diff --git a/src/blockforest/Utility.h b/src/blockforest/Utility.h index 8a6f3046..842b9166 100644 --- a/src/blockforest/Utility.h +++ b/src/blockforest/Utility.h @@ -28,9 +28,7 @@ #include "core/math/Uint.h" #include -#include #include -#include namespace walberla { @@ -110,27 +108,5 @@ inline memory_t bytesToMiB( memory_t bytes ) { } - -//********************************************************************************************************************** -/*! -* \brief Returns the string representation of 'number', every three digits the character 'separator' is inserted -* (172408725 -> "172 408 725") -*/ -//********************************************************************************************************************** -std::string naturalNumberToGroupedThousandsString( const uint_t number, const char separator = ' ' ); - -inline std::string naturalNumberToGroupedThousandsString( const real_t number, const char separator = ' ' ) { - - return naturalNumberToGroupedThousandsString( static_cast< uint_t >( 0.5 + number ), separator ); -} - - - -inline void fillStream( std::ostream& ostream, const char fill, uint_t length ) { - while( length-- > 0 ) ostream << fill; -} - - - } // namespace blockforest } // namespace walberla diff --git a/src/core/all.h b/src/core/all.h index 2e804b55..0315463d 100644 --- a/src/core/all.h +++ b/src/core/all.h @@ -26,7 +26,6 @@ #include "AllSet.h" #include "Array.h" #include "DataTypes.h" -#include "EndianIndependentSerialization.h" #include "Environment.h" #include "FunctionTraits.h" #include "GetPID.h" From fef704c5b693a9f35315f146ad0bdf15c4196758 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 21 Nov 2024 11:34:10 +0100 Subject: [PATCH 09/13] Expose SIMD vector size decision tree Useful to design custom allocators. --- src/field/Field.impl.h | 18 +----------------- src/field/allocation/FieldAllocator.h | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/field/Field.impl.h b/src/field/Field.impl.h index cfbd8d1b..3eb80bd5 100644 --- a/src/field/Field.impl.h +++ b/src/field/Field.impl.h @@ -319,23 +319,7 @@ namespace field { // Automatically select allocator if none was given if ( alloc == nullptr ) { -#if defined(__ARM_FEATURE_SVE) && defined(__ARM_FEATURE_SVE_BITS) && __ARM_FEATURE_SVE_BITS > 0 - const uint_t alignment = __ARM_FEATURE_SVE_BITS/8; -#elif defined(__ARM_FEATURE_SVE) - const uint_t alignment = 64; -#elif defined(__ARM_NEON) - const uint_t alignment = 16; -#elif defined(__AVX512F__) - const uint_t alignment = 64; -#elif defined(__AVX__) - const uint_t alignment = 32; -#elif defined(__SSE__) || defined(_MSC_VER) - const uint_t alignment = 16; -#elif defined(__BIGGEST_ALIGNMENT__) - const uint_t alignment = __BIGGEST_ALIGNMENT__; -#else - const uint_t alignment = 64; -#endif + constexpr uint_t alignment = SIMDAlignment(); // aligned allocator only used (by default) if ... if ( l == fzyx && // ... we use a structure of arrays layout diff --git a/src/field/allocation/FieldAllocator.h b/src/field/allocation/FieldAllocator.h index 7a3164ed..eb93be11 100644 --- a/src/field/allocation/FieldAllocator.h +++ b/src/field/allocation/FieldAllocator.h @@ -351,6 +351,26 @@ namespace field { }; +constexpr uint_t SIMDAlignment() { +#if defined(__ARM_FEATURE_SVE) && defined(__ARM_FEATURE_SVE_BITS) && __ARM_FEATURE_SVE_BITS > 0 + return uint_c(__ARM_FEATURE_SVE_BITS / 8); +#elif defined(__ARM_FEATURE_SVE) + return 64u; +#elif defined(__ARM_NEON) + return 16u; +#elif defined(__AVX512F__) + return 64u; +#elif defined(__AVX__) + return 32u; +#elif defined(__SSE__) || defined(_MSC_VER) + return 16u; +#elif defined(__BIGGEST_ALIGNMENT__) + return uint_c(__BIGGEST_ALIGNMENT__); +#else + return 64u; +#endif +} + } // namespace field } // namespace walberla From 99923a7df7654bdd529dedd262c0671b1a7c9bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Fri, 22 Nov 2024 14:24:39 +0100 Subject: [PATCH 10/13] Fix compiler warnings in generated kernels --- python/lbmpy_walberla/templates/LatticeModel.tmpl.h | 4 ++-- python/pystencils_walberla/sweep.py | 4 ++-- python/pystencils_walberla/templates/Boundary.tmpl.h | 2 +- python/pystencils_walberla/templates/CpuPackInfo.tmpl.h | 2 +- python/pystencils_walberla/templates/GpuPackInfo.tmpl.h | 2 +- python/pystencils_walberla/templates/Sweep.tmpl.h | 8 +++++--- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/python/lbmpy_walberla/templates/LatticeModel.tmpl.h b/python/lbmpy_walberla/templates/LatticeModel.tmpl.h index 769ae027..9c417069 100644 --- a/python/lbmpy_walberla/templates/LatticeModel.tmpl.h +++ b/python/lbmpy_walberla/templates/LatticeModel.tmpl.h @@ -109,7 +109,7 @@ class {{class_name}} class Sweep { public: - Sweep( BlockDataID _pdfsID ) : pdfsID(_pdfsID) {}; + Sweep( BlockDataID _pdfsID ) : pdfsID(_pdfsID) {} //void stream ( IBlock * const block, const uint_t numberOfGhostLayersToInclude = uint_t(0) ); void collide ( IBlock * const block, const uint_t numberOfGhostLayersToInclude = uint_t(0) ); @@ -134,7 +134,7 @@ class {{class_name}} {{class_name}}( {{stream_collide_kernel|generate_constructor_parameters(lmIgnores+lmOffsets) }} ) : {{ stream_collide_kernel|generate_constructor_initializer_list(lmIgnores+lmOffsets) }}, currentLevel(0) - {}; + {} void configure( IBlock & block, StructuredBlockStorage & storage ) { configureBlock( &block, &storage ); } diff --git a/python/pystencils_walberla/sweep.py b/python/pystencils_walberla/sweep.py index f6e190fd..85de00f0 100644 --- a/python/pystencils_walberla/sweep.py +++ b/python/pystencils_walberla/sweep.py @@ -98,10 +98,10 @@ def generate_selective_sweep(generation_context, class_name, selection_tree, int ghost_layers_to_include: see documentation of `generate_sweep` cpu_vectorize_info: Dictionary containing information about CPU vectorization applied to the kernels cpu_openmp: Whether or not CPU kernels use OpenMP parallelization - max_threads: only relevant for GPU kernels. Will be argument of `__launch_bounds__ + max_threads: only relevant for GPU kernels. Will be argument of `__launch_bounds__` block_offset: A tuple of TypedSymbols that will function as internal variable to store storage.getBlockCellBB(block).min()) -` + """ def to_name(f): return f.name if isinstance(f, Field) else f diff --git a/python/pystencils_walberla/templates/Boundary.tmpl.h b/python/pystencils_walberla/templates/Boundary.tmpl.h index 43fd409e..8fcce482 100644 --- a/python/pystencils_walberla/templates/Boundary.tmpl.h +++ b/python/pystencils_walberla/templates/Boundary.tmpl.h @@ -204,7 +204,7 @@ class {{class_name}} auto createForceVector = []( IBlock * const , StructuredBlockStorage * const ) { return new ForceVector(); }; forceVectorID = blocks->addStructuredBlockData< ForceVector >( createForceVector, "forceVector_{{class_name}}"); {%- endif %} - }; + } void run ( {{- ["IBlock * block", kernel.kernel_selection_parameters, ["gpuStream_t stream = nullptr"] if target == 'gpu' else []] | type_identifier_list -}} diff --git a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h index 137f4da6..4e1f85fd 100644 --- a/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/CpuPackInfo.tmpl.h @@ -46,7 +46,7 @@ class {{class_name}} : public ::walberla::communication::UniformPackInfo public: {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} - {}; + {} ~{{class_name}}() override = default; bool constantDataExchange() const override { return true; } diff --git a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h index 820c6b8b..06312a14 100644 --- a/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h +++ b/python/pystencils_walberla/templates/GpuPackInfo.tmpl.h @@ -52,7 +52,7 @@ class {{class_name}} : public ::walberla::gpu::GeneratedGPUPackInfo public: {{class_name}}( {{fused_kernel|generate_constructor_parameters(parameters_to_ignore=['buffer'])}} ) : {{ fused_kernel|generate_constructor_initializer_list(parameters_to_ignore=['buffer']) }} - {}; + {} ~{{class_name}}() override = default; void pack (stencil::Direction dir, unsigned char * buffer, IBlock * block, gpuStream_t stream) override; diff --git a/python/pystencils_walberla/templates/Sweep.tmpl.h b/python/pystencils_walberla/templates/Sweep.tmpl.h index bebbe855..b146a848 100644 --- a/python/pystencils_walberla/templates/Sweep.tmpl.h +++ b/python/pystencils_walberla/templates/Sweep.tmpl.h @@ -32,7 +32,9 @@ #include "domain_decomposition/BlockDataID.h" #include "domain_decomposition/IBlock.h" #include "domain_decomposition/StructuredBlockStorage.h" -#include + +#include +#include {% for header in interface_spec.headers %} #include {{header}} @@ -60,8 +62,8 @@ class {{class_name}} { public: {{class_name}}( {{kernel|generate_constructor_parameters(parameters_to_ignore=parameters_to_ignore)}} {%if inner_outer_split%}, const Cell & outerWidth=Cell(1, 1, 1){% endif %}) - : {{ kernel|generate_constructor_initializer_list(parameters_to_ignore=parameters_to_ignore) }}{%if inner_outer_split%}{% if kernel|generate_constructor_initializer_list|length %},{% endif %} outerWidth_(outerWidth){% endif %}{%if block_offset%}, configured_(false){% endif %} - {}; + : {{ kernel|generate_constructor_initializer_list(parameters_to_ignore=parameters_to_ignore) }}{%if inner_outer_split%}{% if kernel|generate_constructor_initializer_list|length %},{% endif %} outerWidth_(outerWidth){% endif %}{%if block_offset%}{% for offset in block_offset -%}, {{offset[0]}}_({{offset[1]}}(0)) {% endfor -%}, configured_(false){% endif %} + {} {{ kernel| generate_destructor(class_name) |indent(3) }} From dad47e831a163c4a1be3b2f252184f01ba525a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 28 Nov 2024 10:45:00 +0100 Subject: [PATCH 11/13] Fix various Clang-Tidy diagnostics --- src/geometry/containment_octree/BranchNode.h | 2 +- .../containment_octree/IndeterminateLeafNode.h | 8 ++++---- src/geometry/containment_octree/InsideLeafNode.h | 8 ++++---- src/geometry/containment_octree/LeafNode.h | 10 +++++----- .../containment_octree/OutsideLeafNode.h | 8 ++++---- src/gpu/HostFieldAllocator.h | 16 ++++++++-------- src/lbm/communication/SparsePdfFieldPackInfo.h | 2 +- .../data_sources/FaceDataSource.h | 2 +- .../data_sources/OutputSelectorFaceDataSource.h | 16 ++++++++-------- .../data_sources/VertexDataSource.h | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/geometry/containment_octree/BranchNode.h b/src/geometry/containment_octree/BranchNode.h index 742d0962..cb10fdab 100644 --- a/src/geometry/containment_octree/BranchNode.h +++ b/src/geometry/containment_octree/BranchNode.h @@ -46,7 +46,7 @@ class BranchNode : public Node inline BranchNode( const shared_ptr & distanceObject, const AABB & aabb, const Scalar epsilon, const uint_t maxDepth, const Scalar minAABBVolume ); - virtual ~BranchNode() { for( int i = 0; i < 8; ++i ) delete children_[i]; } + ~BranchNode() override { for( int i = 0; i < 8; ++i ) delete children_[i]; } virtual inline bool contains( const Point & p ) const; diff --git a/src/geometry/containment_octree/IndeterminateLeafNode.h b/src/geometry/containment_octree/IndeterminateLeafNode.h index 382620f5..f21fa5a6 100644 --- a/src/geometry/containment_octree/IndeterminateLeafNode.h +++ b/src/geometry/containment_octree/IndeterminateLeafNode.h @@ -44,12 +44,12 @@ class IndeterminateLeafNode : public LeafNode IndeterminateLeafNode( const shared_ptr & distanceObject, const Scalar epsilon ) : distanceObject_( distanceObject ), sqEpsilon_( epsilon * epsilon ) { } - virtual ~IndeterminateLeafNode() = default; + ~IndeterminateLeafNode() override = default; - virtual bool contains( const Point & p ) const { return distanceObject_->sqSignedDistance(p) <= sqEpsilon_; } + bool contains( const Point & p ) const override { return distanceObject_->sqSignedDistance(p) <= sqEpsilon_; } - virtual void numNodes( uint_t & /*numInside*/, uint_t & /*numOutside*/, uint_t & numIndeterminate, uint_t & /*numBranch*/ ) const { ++numIndeterminate; } - virtual void volumes( KahanAccumulator & /*insideVolume*/, KahanAccumulator & /*outsideVolume*/, KahanAccumulator & indeterminateVolume, Scalar volume ) const { indeterminateVolume += volume; } + void numNodes( uint_t & /*numInside*/, uint_t & /*numOutside*/, uint_t & numIndeterminate, uint_t & /*numBranch*/ ) const override { ++numIndeterminate; } + void volumes( KahanAccumulator & /*insideVolume*/, KahanAccumulator & /*outsideVolume*/, KahanAccumulator & indeterminateVolume, Scalar volume ) const override { indeterminateVolume += volume; } protected: shared_ptr distanceObject_; diff --git a/src/geometry/containment_octree/InsideLeafNode.h b/src/geometry/containment_octree/InsideLeafNode.h index 0c46290f..30b83eb9 100644 --- a/src/geometry/containment_octree/InsideLeafNode.h +++ b/src/geometry/containment_octree/InsideLeafNode.h @@ -41,12 +41,12 @@ class InsideLeafNode : public LeafNode using KahanAccumulator = typename LeafNode::KahanAccumulator; - virtual ~InsideLeafNode() = default; + ~InsideLeafNode() override = default; - virtual bool contains( const Point & /*p*/ ) const { return true; } + bool contains( const Point & /*p*/ ) const override { return true; } - virtual void numNodes( uint_t & numInside, uint_t & /*numOutside*/, uint_t & /*numIndeterminate*/, uint_t & /*numBranch*/ ) const { ++numInside; } - virtual void volumes( KahanAccumulator & insideVolume, KahanAccumulator & /*outsideVolume*/, KahanAccumulator & /*indeterminateVolume*/, Scalar volume ) const { insideVolume += volume; } + void numNodes( uint_t & numInside, uint_t & /*numOutside*/, uint_t & /*numIndeterminate*/, uint_t & /*numBranch*/ ) const override { ++numInside; } + void volumes( KahanAccumulator & insideVolume, KahanAccumulator & /*outsideVolume*/, KahanAccumulator & /*indeterminateVolume*/, Scalar volume ) const override { insideVolume += volume; } }; diff --git a/src/geometry/containment_octree/LeafNode.h b/src/geometry/containment_octree/LeafNode.h index 177a352d..231ab108 100644 --- a/src/geometry/containment_octree/LeafNode.h +++ b/src/geometry/containment_octree/LeafNode.h @@ -42,13 +42,13 @@ class LeafNode : public Node using KahanAccumulator = typename Node::KahanAccumulator; - virtual ~LeafNode() = default; + ~LeafNode() override = default; - virtual uint_t height() const { return uint_t(0); } - virtual uint_t numNodes() const { return uint_t(0); } - virtual uint_t numChildren() const { return uint_t(0); } + uint_t height() const override { return uint_t(0); } + uint_t numNodes() const override { return uint_t(0); } + uint_t numChildren() const override { return uint_t(0); } - virtual const Node * getChild( const uint_t ) const { WALBERLA_ABORT("ContainmentOctree: You are requesting access to children of a Leaf Node!"); return 0; } + const Node * getChild( const uint_t ) const override { WALBERLA_ABORT("ContainmentOctree: You are requesting access to children of a Leaf Node!"); return 0; } }; diff --git a/src/geometry/containment_octree/OutsideLeafNode.h b/src/geometry/containment_octree/OutsideLeafNode.h index 6328ce59..782faaad 100644 --- a/src/geometry/containment_octree/OutsideLeafNode.h +++ b/src/geometry/containment_octree/OutsideLeafNode.h @@ -42,12 +42,12 @@ class OutsideLeafNode : public LeafNode using KahanAccumulator = typename LeafNode::KahanAccumulator; - virtual ~OutsideLeafNode() = default; + ~OutsideLeafNode() override = default; - virtual bool contains( const Point & /*p*/ ) const { return false; } + bool contains( const Point & /*p*/ ) const override { return false; } - virtual void numNodes( uint_t & /*numInside*/, uint_t & numOutside, uint_t & /*numIndeterminate*/, uint_t & /*numBranch*/ ) const { ++numOutside; } - virtual void volumes( KahanAccumulator & /*insideVolume*/, KahanAccumulator & outsideVolume, KahanAccumulator & /*indeterminateVolume*/, Scalar volume ) const { outsideVolume += volume; } + void numNodes( uint_t & /*numInside*/, uint_t & numOutside, uint_t & /*numIndeterminate*/, uint_t & /*numBranch*/ ) const override { ++numOutside; } + void volumes( KahanAccumulator & /*insideVolume*/, KahanAccumulator & outsideVolume, KahanAccumulator & /*indeterminateVolume*/, Scalar volume ) const override { outsideVolume += volume; } }; diff --git a/src/gpu/HostFieldAllocator.h b/src/gpu/HostFieldAllocator.h index 8b24c3a4..e6a97c06 100644 --- a/src/gpu/HostFieldAllocator.h +++ b/src/gpu/HostFieldAllocator.h @@ -34,10 +34,10 @@ namespace gpu //******************************************************************************************************************* /*! - * Allocator that allocates a CPU! field using gpuHostAlloc without padding + * Allocator that allocates a CPU! field using gpuHostAlloc without padding. * - * Uses gpuHostAlloc for the allocation - which allocates page-locked memory that is faster to transfer to the GPU - * This allocator should be used for CPU fields that are often transferred to GPU and back + * Uses gpuHostAlloc for the allocation - which allocates page-locked memory that is faster to transfer to the GPU. + * This allocator should be used for CPU fields that are often transferred to GPU and back. * * \ingroup gpu * @@ -47,10 +47,10 @@ namespace gpu class HostFieldAllocator : public field::FieldAllocator { public: - virtual ~HostFieldAllocator() = default; + ~HostFieldAllocator() override = default; - 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 { WALBERLA_NON_DEVICE_SECTION() { @@ -65,7 +65,7 @@ namespace gpu return (T*)(result); } - virtual T * allocateMemory ( uint_t size ) + T * allocateMemory ( uint_t size ) override { WALBERLA_NON_DEVICE_SECTION() { @@ -77,7 +77,7 @@ namespace gpu return (T*)(result); } - virtual void deallocate(T *& values) { + void deallocate(T *& values) override { WALBERLA_NON_DEVICE_SECTION() { WALBERLA_ABORT(__FUNCTION__ << "Using GPU method without WALBERLA_BUILD_WITH_GPU_SUPPORT being enabled.") } diff --git a/src/lbm/communication/SparsePdfFieldPackInfo.h b/src/lbm/communication/SparsePdfFieldPackInfo.h index 6b4a86af..aebdd204 100644 --- a/src/lbm/communication/SparsePdfFieldPackInfo.h +++ b/src/lbm/communication/SparsePdfFieldPackInfo.h @@ -68,7 +68,7 @@ class SparsePdfFieldPackInfo : public communication::UniformPackInfo SparsePdfFieldPackInfo( const BlockDataID & pdfFieldId, const BlockDataID & flagFieldId, FlagUID flag, bool flagFieldConstant ) : pdfFieldId_( pdfFieldId ), flagFieldId_( flagFieldId ), flag_( flag ), flagFieldConstant_( flagFieldConstant ) {} - virtual ~SparsePdfFieldPackInfo() {} + ~SparsePdfFieldPackInfo() override = default; bool constantDataExchange() const { return flagFieldConstant_; } bool threadsafeReceiving() const { return true; } diff --git a/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/FaceDataSource.h b/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/FaceDataSource.h index 4ab4de70..c9f0af18 100644 --- a/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/FaceDataSource.h +++ b/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/FaceDataSource.h @@ -40,7 +40,7 @@ class FaceDataSource { const ParticleIdxFacePropertyManager & faceToParticleIdxManager, shared_ptr ps) = 0; - virtual ~FaceDataSource() {} + virtual ~FaceDataSource() = default; protected: std::string name_; diff --git a/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/OutputSelectorFaceDataSource.h b/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/OutputSelectorFaceDataSource.h index 02c5fec6..c1de1ca5 100644 --- a/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/OutputSelectorFaceDataSource.h +++ b/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/OutputSelectorFaceDataSource.h @@ -44,14 +44,14 @@ class OutputSelectorFaceDataSource : public FaceDataSource { OutputSelectorFaceDataSource(const std::string& name, Selector selector) : Base(name), selector_(selector) { } - virtual uint_t numComponents() { + uint_t numComponents() override { return uint_t(1); } using Base::getData; - virtual void getData( const MeshType &, const Faces & faces, std::vector & data, - const ParticleIdxFacePropertyManager & faceToParticleIdxManager, - shared_ptr ps) { + void getData( const MeshType &, const Faces & faces, std::vector & data, + const ParticleIdxFacePropertyManager & faceToParticleIdxManager, + shared_ptr ps) override { for (const auto & face: faces) { size_t particleIdx = faceToParticleIdxManager[face]; auto p = (*ps)[particleIdx]; @@ -79,14 +79,14 @@ class OutputSelectorFaceDataSource> : public F OutputSelectorFaceDataSource(const std::string& name, Selector selector) : Base(name), selector_(selector) { } - virtual uint_t numComponents() { + uint_t numComponents() override { return uint_t(3); } using Base::getData; - virtual void getData( const MeshType &, const Faces & faces, std::vector & data, - const ParticleIdxFacePropertyManager & faceToParticleIdxManager, - shared_ptr ps) { + void getData( const MeshType &, const Faces & faces, std::vector & data, + const ParticleIdxFacePropertyManager & faceToParticleIdxManager, + shared_ptr ps) override { for (const auto & face: faces) { size_t particleIdx = faceToParticleIdxManager[face]; auto p = (*ps)[particleIdx]; diff --git a/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/VertexDataSource.h b/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/VertexDataSource.h index 41adedfd..cc852463 100644 --- a/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/VertexDataSource.h +++ b/src/mesa_pd/vtk/ConvexPolyhedron/data_sources/VertexDataSource.h @@ -39,7 +39,7 @@ class VertexDataSource { const ParticleIdxVertexPropertyManager & vertexToParticleIdxManager, shared_ptr ps) = 0; - virtual ~VertexDataSource() {} + virtual ~VertexDataSource() = default; protected: std::string name_; From 891bab946d53d66c512fe55e5f44a6e5413a49fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Tue, 10 Dec 2024 19:21:53 +0100 Subject: [PATCH 12/13] Re-enable Clang-Tidy in CI --- .clang-tidy | 1 + .gitlab-ci.yml | 35 +++++++++++++++++------------------ src/core/OpenMP.h | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 74d1c6cf..fffab0ce 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -63,6 +63,7 @@ performance-*, -performance-move-const-arg, -performance-unnecessary-value-param, -performance-avoid-endl, +-performance-no-int-to-ptr, portability-*, diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ee46ddc..0e0cc1e1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2035,24 +2035,23 @@ doc: ## ## ############################################################################### -#clang-tidy: -# image: i10git.cs.fau.de:5005/walberla/buildenvs/clang-15 -# script: -# - $CXX --version -# - clang-tidy -version -# - cmake --version -# - mkdir $CI_PROJECT_DIR/build -# - cd $CI_PROJECT_DIR/build -# - cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWALBERLA_BUFFER_DEBUG=ON -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_TOOLS=ON -DWALBERLA_BUILD_WITH_MPI=ON -DWALBERLA_BUILD_WITH_OPENMP=ON -DCMAKE_BUILD_TYPE=Debug -DWALBERLA_BUILD_WITH_METIS=ON -DWALBERLA_BUILD_WITH_PARMETIS=ON -DWALBERLA_BUILD_WITH_OPENMESH=ON -DWALBERLA_DOUBLE_ACCURACY=ON -DWALBERLA_LOGLEVEL=DETAIL -# - cmake . -LA -# - utilities/filterCompileCommands.py compile_commands.json -# - wget https://raw.githubusercontent.com/llvm/llvm-project/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -# - python3 run-clang-tidy.py -quiet | tee clang-tidy-output.txt -# artifacts: -# paths: -# - $CI_PROJECT_DIR/build/clang-tidy-output.txt -# tags: -# - docker +clang-tidy: + image: i10git.cs.fau.de:5005/walberla/buildenvs/clang-17 + script: + - $CXX --version + - clang-tidy -version + - cmake --version + - mkdir $CI_PROJECT_DIR/build + - cd $CI_PROJECT_DIR/build + - cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWALBERLA_BUFFER_DEBUG=ON -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_TOOLS=ON -DWALBERLA_BUILD_WITH_MPI=ON -DWALBERLA_BUILD_WITH_OPENMP=ON -DCMAKE_BUILD_TYPE=Debug -DWALBERLA_BUILD_WITH_METIS=ON -DWALBERLA_BUILD_WITH_PARMETIS=ON -DWALBERLA_BUILD_WITH_OPENMESH=ON -DWALBERLA_DOUBLE_ACCURACY=ON -DWALBERLA_LOGLEVEL=DETAIL + - cmake . -LA + - utilities/filterCompileCommands.py compile_commands.json + - run-clang-tidy -quiet | tee clang-tidy-output.txt + artifacts: + paths: + - $CI_PROJECT_DIR/build/clang-tidy-output.txt + tags: + - docker cppcheck: diff --git a/src/core/OpenMP.h b/src/core/OpenMP.h index b8ae3d60..5e454f37 100644 --- a/src/core/OpenMP.h +++ b/src/core/OpenMP.h @@ -131,7 +131,7 @@ inline int omp_get_num_teams (void) { WALBERLA_OPENMP_FUNCTION_ERROR } inline int omp_get_team_num (void) { WALBERLA_OPENMP_FUNCTION_ERROR } inline int omp_get_cancellation (void) { WALBERLA_OPENMP_FUNCTION_ERROR } -# include +# include // NOLINT(modernize-deprecated-headers) /* OpenMP 4.5 */ inline int omp_get_initial_device (void) { WALBERLA_OPENMP_FUNCTION_ERROR } inline void* omp_target_alloc(size_t, int) { WALBERLA_OPENMP_FUNCTION_ERROR } From bc2d4e6bf9b3c42e1a32b4f1e8525d34fad5be41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Tue, 10 Dec 2024 19:38:02 +0100 Subject: [PATCH 13/13] Make file filtering more flexible --- .gitlab-ci.yml | 2 +- utilities/filterCompileCommands.py | 58 +++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e0cc1e1..f3918112 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2045,7 +2045,7 @@ clang-tidy: - cd $CI_PROJECT_DIR/build - cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DWALBERLA_BUFFER_DEBUG=ON -DWALBERLA_BUILD_TESTS=ON -DWALBERLA_BUILD_BENCHMARKS=ON -DWALBERLA_BUILD_TUTORIALS=ON -DWALBERLA_BUILD_TOOLS=ON -DWALBERLA_BUILD_WITH_MPI=ON -DWALBERLA_BUILD_WITH_OPENMP=ON -DCMAKE_BUILD_TYPE=Debug -DWALBERLA_BUILD_WITH_METIS=ON -DWALBERLA_BUILD_WITH_PARMETIS=ON -DWALBERLA_BUILD_WITH_OPENMESH=ON -DWALBERLA_DOUBLE_ACCURACY=ON -DWALBERLA_LOGLEVEL=DETAIL - cmake . -LA - - utilities/filterCompileCommands.py compile_commands.json + - utilities/filterCompileCommands.py --file compile_commands.json --exclude "*" --include src/core src/field src/stencil src/blockforest src/domain_decomposition src/communication src/gpu src/vtk src/fft --exclude extern tests - run-clang-tidy -quiet | tee clang-tidy-output.txt artifacts: paths: diff --git a/utilities/filterCompileCommands.py b/utilities/filterCompileCommands.py index 361ee2f3..a8d7df72 100755 --- a/utilities/filterCompileCommands.py +++ b/utilities/filterCompileCommands.py @@ -1,11 +1,42 @@ #!/usr/bin/env python3 +import argparse +import pathlib import json import sys -def compileCommandSelector(x): - return not (("extern" in x["file"]) or ("tests" in x["file"])) +class QualifiedSequence(argparse.Action): + """Append qualified values from different arguments into the same destination.""" + def __call__(self, parser, namespace, values, option_string=None): + accumulator = getattr(namespace, self.dest, None) or [] + assert option_string is not None + mode = "include" if option_string in ("-i", "--include") else "exclude" + accumulator.append((mode, values)) + setattr(namespace, self.dest, accumulator) + + +parser = argparse.ArgumentParser(description="Filter out source files from CMake database.") +parser.add_argument("-f", "--file", action="store", type=str, required=True, + help="Database file to edit") +parser.add_argument("-i", "--include", action=QualifiedSequence, dest="filters", + nargs="+", help="Include paths containing these folder names") +parser.add_argument("-e", "--exclude", action=QualifiedSequence, dest="filters", + nargs="+", help="Exclude paths containing these folder names") + + +def compileCommandSelector(x, filters=None): + if filters is None: + filters = [("exclude", ("extern", "tests"))] + path = "/".join(pathlib.Path(x["file"]).parts)[1:] + keep = True + for mode, components in filters: + for component in components: + subpath = "/".join(("", ) + pathlib.Path(component).parts + ("", )) + if subpath in path or component == "*": + keep = (mode == "include") + break + return keep def removePrecompiler(x): @@ -17,25 +48,20 @@ def removePrecompiler(x): if __name__ == "__main__": - if len(sys.argv) != 2: - print("usage: ./filterCompileCommands.py compile_commands.json") - exit(-1) + args = parser.parse_args() - filename = sys.argv[1] - print("loading compile commands file: {}".format(filename)) + print(f"loading compile commands file: {args.file}") - fin = open(filename, "r") - cc = json.load(fin) - fin.close() + with open(args.file, "r") as f: + cc = json.load(f) - print("compile commands read: {}".format(len(cc))) + print(f"compile commands read: {len(cc)}") - cc_filtered = list(filter(compileCommandSelector, cc)) + cc_filtered = list(filter(lambda x: compileCommandSelector(x, args.filters), cc)) for x in cc_filtered: x["command"] = removePrecompiler(x["command"]) - print("compile commands filtered: {}".format(len(cc_filtered))) + print(f"compile commands filtered: {len(cc_filtered)}") - fout = open(filename, "w") - json.dump(cc_filtered, fout) - fout.close() + with open(args.file, "w") as f: + json.dump(cc_filtered, f, indent=2)