diff --git a/CMakeLists.txt b/CMakeLists.txt index 807d30f13fe5cba6b787c7f46cb3615fa459c6e5..02d061b2ca0d42e7c281ace0380a57266a5beac0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,23 @@ else () message(WARNING "clang-format no found!") endif() +#------------------------------------------------------ +# search for clang-format + +find_program(CLAZY_STANDALONE clazy-standalone) +if (CLAZY_STANDALONE) + add_custom_target(clazy-standalone + COMMAND ${CMAKE_COMMAND} + -DPUGS_SOURCE_DIR="${PUGS_SOURCE_DIR}" + -DPUGS_BINARY_DIR="${PUGS_BINARY_DIR}" + -DCLAZY_STANDALONE="${CLAZY_STANDALONE}" + -P ${PUGS_SOURCE_DIR}/cmake/ClazyStandaloneProcess.cmake + COMMENT "running ${CLAZY_STANDALONE} ..." + ) +else () + message(WARNING "clazy-standalone no found!") +endif() + #------------------------------------------------------ # C++ 17 flags if(${CMAKE_VERSION} VERSION_LESS "3.8.0") @@ -193,6 +210,7 @@ endif() add_subdirectory("${PUGS_SOURCE_DIR}/packages/kokkos") +# set as SYSTEM for static analysis include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/core/src) include_directories(SYSTEM ${KOKKOS_SOURCE_DIR}/containers/src) include_directories(SYSTEM ${KOKKOS_BINARY_DIR}) diff --git a/cmake/ClazyStandaloneProcess.cmake b/cmake/ClazyStandaloneProcess.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4804623e48bcbb0e12bfc2c72cef8571492df492 --- /dev/null +++ b/cmake/ClazyStandaloneProcess.cmake @@ -0,0 +1,62 @@ +# --------------- runs clazy-standalone --------------- + +if(PUGS_SOURCE_DIR AND CLAZY_STANDALONE) + # get C++ sources file list (ignoring packages) + file(GLOB_RECURSE ALL_SOURCE_FILES + ${PUGS_SOURCE_DIR}/src/**.[hc]pp + ${PUGS_SOURCE_DIR}/tests/**.[hc]pp) + + # ignore ${PUGS_SOURCE_DIR}/packages/* directories + set(ENV{CLAZY_IGNORE_DIRS} "${PUGS_SOURCE_DIR}/packages/.*") + + # checks if VERBOSE was set + set(ECHO_CMD_TO "NONE") + if (DEFINED ENV{VERBOSE}) + set(ECHO_CMD_TO "STDOUT") + endif() + + # Trick to continue on error using make + if(DEFINED ENV{MAKEFLAGS}) + string(FIND $ENV{MAKEFLAGS} "k" K_POSITION) + if (NOT(${K_POSITION} EQUAL "-1")) + set (CONTINUE_ON_ERROR "continue") + endif() + endif() + + list(LENGTH ALL_SOURCE_FILES LIST_SIZE) + + set(SOURCE_ID 1) + # apply style to the file list + foreach(SOURCE_FILE ${ALL_SOURCE_FILES}) + string(REGEX REPLACE "^${PUGS_SOURCE_DIR}/" "" BASE_SOURCE_FILE "${SOURCE_FILE}") + + math(EXPR PROGRESS "(100*${SOURCE_ID})/${LIST_SIZE}") + string(LENGTH ${PROGRESS} PROGRESS_SIZE ) + + math(EXPR NBSPC "3-${PROGRESS_SIZE}") + string(SUBSTRING " " 0 ${NBSPC} PRESPC) + + execute_process( + COMMAND "${CMAKE_COMMAND}" -E env CLICOLOR_FORCE=1 + "${CMAKE_COMMAND}" -E cmake_echo_color --no-newline "[${PRESPC}${PROGRESS}%] " --green "Analyzing ${BASE_SOURCE_FILE}") + execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "") + math(EXPR SOURCE_ID "${SOURCE_ID}+1") + + execute_process( + COMMAND "${CLAZY_STANDALONE}" "-p=${PUGS_BINARY_DIR}" "${SOURCE_FILE}" + COMMAND_ECHO ${ECHO_CMD_TO} + RESULT_VARIABLE CLAZY_RESULT) + + if (NOT ("${CLAZY_RESULT}" EQUAL "0")) + set(CLAZY_FAILED "1") + message("CLAZY_FAILED ${CLAZY_FAILED}") + if (NOT DEFINED CONTINUE_ON_ERROR) + break() + endif() + endif() + endforeach() + + if(CLAZY_FAILED) + message(FATAL_ERROR "Clazy encountered errors!") + endif() +endif() diff --git a/src/algebra/BiCGStab.hpp b/src/algebra/BiCGStab.hpp index fbcfa8103e3e929ed2042b0d92b733c239850333..c931385b214c91ca2807db4f07fca027ebd79b25 100644 --- a/src/algebra/BiCGStab.hpp +++ b/src/algebra/BiCGStab.hpp @@ -1,6 +1,7 @@ #ifndef BICG_STAB_HPP #define BICG_STAB_HPP +#include <cmath> #include <iomanip> #include <iostream> diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index 6cff7777f522c348c31ebf5eed9460f6adbfcd63..3ef5e180710d90e0b62e0cf8f8d222cb3a84ca14 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -22,7 +22,7 @@ class TinyMatrix PUGS_FORCEINLINE constexpr size_t - _index(const size_t& i, const size_t& j) const noexcept // LCOV_EXCL_LINE (due to forced inline) + _index(size_t i, size_t j) const noexcept // LCOV_EXCL_LINE (due to forced inline) { return i * N + j; } @@ -215,7 +215,7 @@ class TinyMatrix PUGS_INLINE constexpr T& - operator()(const size_t& i, const size_t& j) noexcept(NO_ASSERT) + operator()(size_t i, size_t j) noexcept(NO_ASSERT) { Assert((i < N) and (j < N)); return m_values[_index(i, j)]; @@ -223,15 +223,14 @@ class TinyMatrix PUGS_INLINE constexpr const T& - operator()(const size_t& i, const size_t& j) const noexcept(NO_ASSERT) + operator()(size_t i, size_t j) const noexcept(NO_ASSERT) { Assert((i < N) and (j < N)); return m_values[_index(i, j)]; } PUGS_INLINE - constexpr TinyMatrix& - operator=(const ZeroType&) noexcept + constexpr TinyMatrix& operator=(ZeroType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot assign 'zero' value for non-arithmetic types"); for (size_t i = 0; i < N * N; ++i) { @@ -241,8 +240,7 @@ class TinyMatrix } PUGS_INLINE - constexpr TinyMatrix& - operator=(const IdentityType&) noexcept + constexpr TinyMatrix& operator=(IdentityType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot assign 'identity' value for non-arithmetic types"); for (size_t i = 0; i < N; ++i) { @@ -272,7 +270,7 @@ class TinyMatrix constexpr TinyMatrix() noexcept {} PUGS_INLINE - constexpr TinyMatrix(const ZeroType&) noexcept + constexpr TinyMatrix(ZeroType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot construct from 'zero' value " "for non-arithmetic types"); @@ -282,7 +280,7 @@ class TinyMatrix } PUGS_INLINE - constexpr TinyMatrix(const IdentityType&) noexcept + constexpr TinyMatrix(IdentityType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot construct from 'identity' " "value for non-arithmetic types"); @@ -388,7 +386,7 @@ det(const TinyMatrix<3, T>& A) template <size_t N, typename T> PUGS_INLINE constexpr TinyMatrix<N - 1, T> -getMinor(const TinyMatrix<N, T>& A, const size_t& I, const size_t& J) +getMinor(const TinyMatrix<N, T>& A, size_t I, size_t J) { static_assert(N >= 2, "minor calculation requires at least 2x2 matrices"); Assert((I < N) and (J < N)); @@ -428,7 +426,7 @@ inverse(const TinyMatrix<1, T>& A) template <size_t N, typename T> PUGS_INLINE constexpr T -cofactor(const TinyMatrix<N, T>& A, const size_t& i, const size_t& j) +cofactor(const TinyMatrix<N, T>& A, size_t i, size_t j) { static_assert(std::is_arithmetic<T>::value, "cofactor is not defined for non-arithmetic types"); const T sign = ((i + j) % 2) ? -1 : 1; diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp index a999ec7bcee342dd252d85fd85be8d1364308216..5f5e8a7eb109ba293e13eb9a153918c126816923 100644 --- a/src/algebra/TinyVector.hpp +++ b/src/algebra/TinyVector.hpp @@ -185,22 +185,21 @@ class TinyVector } PUGS_INLINE - constexpr T& operator[](const size_t& i) noexcept(NO_ASSERT) + constexpr T& operator[](size_t i) noexcept(NO_ASSERT) { Assert(i < N); return m_values[i]; } PUGS_INLINE - constexpr const T& operator[](const size_t& i) const noexcept(NO_ASSERT) + constexpr const T& operator[](size_t i) const noexcept(NO_ASSERT) { Assert(i < N); return m_values[i]; } PUGS_INLINE - constexpr TinyVector& - operator=(const ZeroType&) noexcept + constexpr TinyVector& operator=(ZeroType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot assign 'zero' value for non-arithmetic types"); for (size_t i = 0; i < N; ++i) { @@ -222,13 +221,13 @@ class TinyVector this->_unpackVariadicInput(t, std::forward<Args>(args)...); } - // One does not use the '=default' constructor to avoid (unexpected) - // performances issues + // One does not use the '=default' constructor to avoid + // (zero-initialization) performances issues PUGS_INLINE constexpr TinyVector() noexcept {} PUGS_INLINE - constexpr TinyVector(const ZeroType&) noexcept + constexpr TinyVector(ZeroType) noexcept { static_assert(std::is_arithmetic<T>(), "Cannot construct from 'zero' value " "for non-arithmetic types"); diff --git a/src/algebra/Vector.hpp b/src/algebra/Vector.hpp index ac48d969fc55432d3cd8fe180997af09ccee84d0..efe64b41a8940be9fadf7066dd5dc27bff90a633 100644 --- a/src/algebra/Vector.hpp +++ b/src/algebra/Vector.hpp @@ -75,7 +75,7 @@ class Vector // LCOV_EXCL_LINE operator*=(const DataType2& a) { parallel_for( - this->size(), PUGS_LAMBDA(const index_type& i) { m_values[i] *= a; }); + this->size(), PUGS_LAMBDA(index_type i) { m_values[i] *= a; }); return *this; } @@ -86,7 +86,7 @@ class Vector // LCOV_EXCL_LINE Assert(this->size() == y.size()); parallel_for( - this->size(), PUGS_LAMBDA(const index_type& i) { m_values[i] -= y[i]; }); + this->size(), PUGS_LAMBDA(index_type i) { m_values[i] -= y[i]; }); return *this; } @@ -98,7 +98,7 @@ class Vector // LCOV_EXCL_LINE Assert(this->size() == y.size()); parallel_for( - this->size(), PUGS_LAMBDA(const index_type& i) { m_values[i] += y[i]; }); + this->size(), PUGS_LAMBDA(index_type i) { m_values[i] += y[i]; }); return *this; } @@ -111,7 +111,7 @@ class Vector // LCOV_EXCL_LINE Vector<std::remove_const_t<DataType>> sum{y.size()}; parallel_for( - this->size(), PUGS_LAMBDA(const index_type& i) { sum.m_values[i] = m_values[i] + y[i]; }); + this->size(), PUGS_LAMBDA(index_type i) { sum.m_values[i] = m_values[i] + y[i]; }); return sum; } @@ -124,13 +124,13 @@ class Vector // LCOV_EXCL_LINE Vector<std::remove_const_t<DataType>> sum{y.size()}; parallel_for( - this->size(), PUGS_LAMBDA(const index_type& i) { sum.m_values[i] = m_values[i] - y[i]; }); + this->size(), PUGS_LAMBDA(index_type i) { sum.m_values[i] = m_values[i] - y[i]; }); return sum; } PUGS_INLINE - DataType& operator[](const index_type& i) const noexcept(NO_ASSERT) + DataType& operator[](index_type i) const noexcept(NO_ASSERT) { return m_values[i]; } @@ -180,7 +180,7 @@ class Vector // LCOV_EXCL_LINE Vector(Vector&&) = default; - Vector(const size_t& size) : m_values{size} {} + Vector(size_t size) : m_values{size} {} ~Vector() = default; }; diff --git a/src/language/ASTNodeFunctionExpressionBuilder.cpp b/src/language/ASTNodeFunctionExpressionBuilder.cpp index 23c3d9e6a315cc36f45e6860c7fe4625126b4998..769a262061c22f7193a8aa4559cdbfe18c86d7fc 100644 --- a/src/language/ASTNodeFunctionExpressionBuilder.cpp +++ b/src/language/ASTNodeFunctionExpressionBuilder.cpp @@ -199,7 +199,7 @@ ASTNodeFunctionExpressionBuilder::_buildArgumentConverter(FunctionDescriptor& fu } std::unique_ptr<INodeProcessor> -ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType return_value_type, +ASTNodeFunctionExpressionBuilder::_getFunctionProcessor(const ASTNodeDataType& return_value_type, ASTNode& node, ASTNode& function_component_expression) { diff --git a/src/language/ASTNodeFunctionExpressionBuilder.hpp b/src/language/ASTNodeFunctionExpressionBuilder.hpp index 6ccad41d4b33231e67484ba2129254e2a6eb7273..9bb11969605e89c361631905d57ee9ca1c516280 100644 --- a/src/language/ASTNodeFunctionExpressionBuilder.hpp +++ b/src/language/ASTNodeFunctionExpressionBuilder.hpp @@ -24,7 +24,7 @@ class ASTNodeFunctionExpressionBuilder std::unique_ptr<FunctionProcessor> _buildArgumentConverter(FunctionDescriptor& function_descriptor, ASTNode& node); - std::unique_ptr<INodeProcessor> _getFunctionProcessor(const ASTNodeDataType return_value_type, + std::unique_ptr<INodeProcessor> _getFunctionProcessor(const ASTNodeDataType& return_value_type, ASTNode& node, ASTNode& function_component_expression); diff --git a/src/language/ASTNodeSubDataType.hpp b/src/language/ASTNodeSubDataType.hpp index c37ebc266b4cb4da1b5ecf4c7ec7e8b6643826c2..0c0c7459da45bbb3b77cd828a4037e7e32e64cbf 100644 --- a/src/language/ASTNodeSubDataType.hpp +++ b/src/language/ASTNodeSubDataType.hpp @@ -1,6 +1,9 @@ #ifndef AST_NODE_SUB_DATA_TYPE_HPP #define AST_NODE_SUB_DATA_TYPE_HPP +#include <language/ASTNode.hpp> +#include <language/ASTNodeDataType.hpp> + struct ASTNodeSubDataType { ASTNodeDataType m_data_type; diff --git a/src/language/BuiltinFunctionEmbedder.hpp b/src/language/BuiltinFunctionEmbedder.hpp index 8d2bcbf0721b26fee4526e9acb503a5c75615302..31517c95b490e937b5f0b0f7aa9e4994ec204da5 100644 --- a/src/language/BuiltinFunctionEmbedder.hpp +++ b/src/language/BuiltinFunctionEmbedder.hpp @@ -40,6 +40,11 @@ class IBuiltinFunctionEmbedder virtual DataVariant apply(const std::vector<DataVariant>& x) const = 0; + IBuiltinFunctionEmbedder() = default; + + IBuiltinFunctionEmbedder(const IBuiltinFunctionEmbedder&) = delete; + IBuiltinFunctionEmbedder(IBuiltinFunctionEmbedder&&) = delete; + virtual ~IBuiltinFunctionEmbedder() = default; }; @@ -66,8 +71,8 @@ class BuiltinFunctionEmbedder : public IBuiltinFunctionEmbedder std::get<I>(t) = v_i; } else if constexpr (is_shared_ptr_v<Ti_Type>) { if constexpr (std::is_same_v<Vi_Type, EmbeddedData>) { - auto data_handler = static_cast<const DataHandler<typename Ti_Type::element_type>&>(v_i.get()); - std::get<I>(t) = data_handler.data_ptr(); + auto& data_handler = static_cast<const DataHandler<typename Ti_Type::element_type>&>(v_i.get()); + std::get<I>(t) = data_handler.data_ptr(); } else { throw UnexpectedError("unexpected argument types while casting: expecting EmbeddedData"); } @@ -212,7 +217,7 @@ class BuiltinFunctionEmbedder<FX, void> : public IBuiltinFunctionEmbedder } } - BuiltinFunctionEmbedder(std::function<void(void)> f) : m_f(f) {} + BuiltinFunctionEmbedder(const std::function<void(void)>& f) : m_f(f) {} }; #endif // BUILTIN_FUNCTION_EMBEDDER_HPP diff --git a/src/language/CMakeLists.txt b/src/language/CMakeLists.txt index aa545fa6b3ce91aa113d81dffef3dd39e9f2889a..dc667ea9c2282fcd4cf2a3169b1c774218479e87 100644 --- a/src/language/CMakeLists.txt +++ b/src/language/CMakeLists.txt @@ -41,12 +41,6 @@ add_dependencies(PugsLanguage PugsUtils PugsMesh) -include_directories("${PUGS_SOURCE_DIR}/src/mesh" - "${PUGS_SOURCE_DIR}/src/algebra" - "${PUGS_SOURCE_DIR}/src/output" - "${PUGS_BINARY_DIR}/src/utils") - - # ------------------- Installation -------------------- # temporary version workaround if(${CMAKE_VERSION} VERSION_LESS "3.13.0") diff --git a/src/language/DataHandler.hpp b/src/language/DataHandler.hpp index 554b0fe351611f0b561a7bf9a5a37e5dbf52372f..c09256e2a8379cbc934394304fd35d1f98610348 100644 --- a/src/language/DataHandler.hpp +++ b/src/language/DataHandler.hpp @@ -8,6 +8,9 @@ class IDataHandler { public: + IDataHandler(const IDataHandler&) = delete; + IDataHandler(IDataHandler&&) = delete; + IDataHandler() = default; virtual ~IDataHandler() = default; diff --git a/src/language/MeshModule.cpp b/src/language/MeshModule.cpp index c3f5d4916485b3018dc0bc63122f3d3d0477578a..5c1721fa98154f314c73d9adb10f8565dd68ddcd 100644 --- a/src/language/MeshModule.cpp +++ b/src/language/MeshModule.cpp @@ -24,7 +24,7 @@ MeshModule::MeshModule() this->_addBuiltinFunction("readGmsh", std::make_shared<BuiltinFunctionEmbedder<std::shared_ptr<IMesh>, std::string>>( std::function<std::shared_ptr<IMesh>(std::string)>{ - [](std::string file_name) -> std::shared_ptr<IMesh> { + [](const std::string& file_name) -> std::shared_ptr<IMesh> { GmshReader gmsh_reader(file_name); return gmsh_reader.mesh(); }} @@ -57,7 +57,7 @@ MeshModule::MeshModule() NodeValue<TinyVector<3>> xr(given_mesh.connectivity()); parallel_for( - given_mesh.numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { + given_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId r) { const TinyVector<3> shift{0, 0.05, 0.05}; const auto x = given_xr[r] - shift; const double c = std::cos(0.01 * x[0]); diff --git a/src/language/SymbolTable.hpp b/src/language/SymbolTable.hpp index 9930807ba73d4cbc1fc51e7e84d140d3ee556705..3b795f559dc0767cdfd849d771a57240a05899e1 100644 --- a/src/language/SymbolTable.hpp +++ b/src/language/SymbolTable.hpp @@ -107,7 +107,7 @@ class SymbolTable return os; } - Attributes(const TAO_PEGTL_NAMESPACE::position& position, const int32_t& context_id) + Attributes(const TAO_PEGTL_NAMESPACE::position& position, int32_t context_id) : m_position{position}, m_context_id{context_id} {} @@ -184,8 +184,8 @@ class SymbolTable Context() : m_id{next_context_id++} {} + Context& operator=(const Context&) = default; // clazy:exclude=function-args-by-value Context& operator=(Context&&) = default; - Context& operator=(const Context&) = default; Context(const Context&) = default; Context(Context&&) = default; diff --git a/src/language/VTKModule.cpp b/src/language/VTKModule.cpp index b27eb4c86f25ba28ffece5abcfae2291d78cd295..01eb1cabae4501f21067267f52f015ff7ada176b 100644 --- a/src/language/VTKModule.cpp +++ b/src/language/VTKModule.cpp @@ -13,7 +13,7 @@ VTKModule::VTKModule() std::make_shared<BuiltinFunctionEmbedder<void, std::shared_ptr<IMesh>, std::string>>( std::function<void(std::shared_ptr<IMesh>, std::string)>{ - [](std::shared_ptr<IMesh> p_mesh, std::string filename) -> void { + [](std::shared_ptr<IMesh> p_mesh, const std::string& filename) -> void { VTKWriter writer(filename, 0.1); static double time = 0; diff --git a/src/language/node_processor/ASTNodeListProcessor.hpp b/src/language/node_processor/ASTNodeListProcessor.hpp index c86131f6dd75e183d62e1ea23648e5ab63d6fcfe..ec7cc28264ba1d53870b382d78324538e38ae5f0 100644 --- a/src/language/node_processor/ASTNodeListProcessor.hpp +++ b/src/language/node_processor/ASTNodeListProcessor.hpp @@ -1,6 +1,7 @@ #ifndef AST_NODE_LIST_PROCESSOR_HPP #define AST_NODE_LIST_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> class ASTNodeListProcessor final : public INodeProcessor diff --git a/src/language/node_processor/AffectationProcessor.hpp b/src/language/node_processor/AffectationProcessor.hpp index 0baa05cfb292c9d93ff0f301c01abaeb577e8a4b..89cf704125fa88ac345a8246dec4605059e0544a 100644 --- a/src/language/node_processor/AffectationProcessor.hpp +++ b/src/language/node_processor/AffectationProcessor.hpp @@ -56,6 +56,11 @@ struct IAffectationExecutor { virtual void affect(ExecutionPolicy& exec_policy, DataVariant&& rhs) = 0; + IAffectationExecutor(const IAffectationExecutor&) = delete; + IAffectationExecutor(IAffectationExecutor&&) = delete; + + IAffectationExecutor() = default; + virtual ~IAffectationExecutor() = default; }; diff --git a/src/language/node_processor/ArraySubscriptProcessor.hpp b/src/language/node_processor/ArraySubscriptProcessor.hpp index 3870b906193c76719bbaa4ff5ad9b42aac99aac7..76b202c5a57ad686ab44de563fd388eaba82b618 100644 --- a/src/language/node_processor/ArraySubscriptProcessor.hpp +++ b/src/language/node_processor/ArraySubscriptProcessor.hpp @@ -1,6 +1,7 @@ #ifndef ARRAY_SUBSCRIPT_PROCESSOR_HPP #define ARRAY_SUBSCRIPT_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> template <typename ArrayTypeT> diff --git a/src/language/node_processor/BinaryExpressionProcessor.hpp b/src/language/node_processor/BinaryExpressionProcessor.hpp index 71394ec5bd3cbc6696dabec805d07e87f8db93c1..dbbdd56d8ac45de2a8e8492f5b6dd10a2f230efb 100644 --- a/src/language/node_processor/BinaryExpressionProcessor.hpp +++ b/src/language/node_processor/BinaryExpressionProcessor.hpp @@ -1,6 +1,8 @@ #ifndef BINARY_EXPRESSION_PROCESSOR_HPP #define BINARY_EXPRESSION_PROCESSOR_HPP +#include <language/ASTNode.hpp> +#include <language/PEGGrammar.hpp> #include <language/node_processor/INodeProcessor.hpp> template <typename Op> diff --git a/src/language/node_processor/ConcatExpressionProcessor.hpp b/src/language/node_processor/ConcatExpressionProcessor.hpp index adc1c92437bd9687483fce2fc29888520f1e7a7f..9d8e6eeb785b9c734ab68e93d1e41224e74c816e 100644 --- a/src/language/node_processor/ConcatExpressionProcessor.hpp +++ b/src/language/node_processor/ConcatExpressionProcessor.hpp @@ -1,6 +1,7 @@ #ifndef CONCAT_EXPRESSION_PROCESSOR_HPP #define CONCAT_EXPRESSION_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> template <typename B_DataT> diff --git a/src/language/node_processor/DoWhileProcessor.hpp b/src/language/node_processor/DoWhileProcessor.hpp index bec8ab29cc633dbd14cf2e1e1f321c03776e07c3..69a5da7fe26a5ca8a49c813771978482027e5437 100644 --- a/src/language/node_processor/DoWhileProcessor.hpp +++ b/src/language/node_processor/DoWhileProcessor.hpp @@ -1,6 +1,7 @@ #ifndef DO_WHILE_PROCESSOR_HPP #define DO_WHILE_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> class DoWhileProcessor final : public INodeProcessor diff --git a/src/language/node_processor/ExecutionPolicy.hpp b/src/language/node_processor/ExecutionPolicy.hpp index 40a21d48f894f95a66848340f994096f8d09ff60..480906d3658368ba090a65be06bf1ebb382e6fac 100644 --- a/src/language/node_processor/ExecutionPolicy.hpp +++ b/src/language/node_processor/ExecutionPolicy.hpp @@ -83,7 +83,7 @@ class ExecutionPolicy } Context& - contextOfId(const int32_t& context_id) + contextOfId(int32_t context_id) { for (auto i_context = m_context_list.rbegin(); i_context != m_context_list.rend(); ++i_context) { if (i_context->id() == context_id) { @@ -111,7 +111,7 @@ class ExecutionPolicy m_context_list.push_back(context); } - ExecutionPolicy(const ExecutionPolicy& parent_policy, const JumpType& jump_type) + ExecutionPolicy(const ExecutionPolicy& parent_policy, JumpType jump_type) : m_jump_type{jump_type}, m_exec{jump_type == JumpType::no_jump}, m_context_list{parent_policy.m_context_list} { ; diff --git a/src/language/node_processor/ForProcessor.hpp b/src/language/node_processor/ForProcessor.hpp index 5669839e1c54201dd30505729cf4b2e5b19d3d92..568ff7fc5b4cbfa0d98dc332c99bccfe51c56215 100644 --- a/src/language/node_processor/ForProcessor.hpp +++ b/src/language/node_processor/ForProcessor.hpp @@ -1,6 +1,7 @@ #ifndef FOR_PROCESSOR_HPP #define FOR_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> class ForProcessor final : public INodeProcessor diff --git a/src/language/node_processor/FunctionArgumentConverter.hpp b/src/language/node_processor/FunctionArgumentConverter.hpp index 731001823f66f1046ac202c2856cafcdb99a4d22..990fcde2874b75cf2f5d8429d13d1054bf7dcda1 100644 --- a/src/language/node_processor/FunctionArgumentConverter.hpp +++ b/src/language/node_processor/FunctionArgumentConverter.hpp @@ -9,6 +9,11 @@ class IFunctionArgumentConverter public: virtual DataVariant convert(ExecutionPolicy& exec_policy, DataVariant&& value) = 0; + IFunctionArgumentConverter() = default; + + IFunctionArgumentConverter(const IFunctionArgumentConverter&) = delete; + IFunctionArgumentConverter(IFunctionArgumentConverter&&) = delete; + virtual ~IFunctionArgumentConverter() = default; }; diff --git a/src/language/node_processor/FunctionProcessor.hpp b/src/language/node_processor/FunctionProcessor.hpp index f0ac07707627a7617caffb3e4331c404ff9d445a..72161aedafbb64861800e57a06f1d1cf953554b7 100644 --- a/src/language/node_processor/FunctionProcessor.hpp +++ b/src/language/node_processor/FunctionProcessor.hpp @@ -90,7 +90,7 @@ class FunctionProcessor : public INodeProcessor } } - FunctionProcessor(ASTNode& argument_node, const SymbolTable::Context& context) + FunctionProcessor(ASTNode& argument_node, SymbolTable::Context context) : m_argument_node{argument_node}, m_context_size{context.size()}, m_context_id{context.id()} {} }; diff --git a/src/language/node_processor/INodeProcessor.hpp b/src/language/node_processor/INodeProcessor.hpp index c387aa8f83b455d0d996e1d475ea24c8075d3e79..1aa4695204d4d489e294e015cd9affac3bd4164c 100644 --- a/src/language/node_processor/INodeProcessor.hpp +++ b/src/language/node_processor/INodeProcessor.hpp @@ -19,6 +19,7 @@ struct INodeProcessor } INodeProcessor(const INodeProcessor&) = delete; + INodeProcessor(INodeProcessor&&) = delete; INodeProcessor() = default; diff --git a/src/language/node_processor/IfProcessor.hpp b/src/language/node_processor/IfProcessor.hpp index 35799cdee8a01b3bec8e7ea052defe5538ef8410..9c0baf55b0c6b0b8c6143989928e551f8aca3600 100644 --- a/src/language/node_processor/IfProcessor.hpp +++ b/src/language/node_processor/IfProcessor.hpp @@ -1,6 +1,7 @@ #ifndef IF_PROCESSOR_HPP #define IF_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> class IfProcessor final : public INodeProcessor diff --git a/src/language/node_processor/IncDecExpressionProcessor.hpp b/src/language/node_processor/IncDecExpressionProcessor.hpp index 4175790fb9ceed8780ca9d04dc80ff18d042db8d..1f328dd5c4ae5e2c0869aef783e010351f33becc 100644 --- a/src/language/node_processor/IncDecExpressionProcessor.hpp +++ b/src/language/node_processor/IncDecExpressionProcessor.hpp @@ -1,6 +1,8 @@ #ifndef INC_DEC_EXPRESSION_PROCESSOR_HPP #define INC_DEC_EXPRESSION_PROCESSOR_HPP +#include <language/ASTNode.hpp> +#include <language/PEGGrammar.hpp> #include <language/SymbolTable.hpp> #include <language/node_processor/INodeProcessor.hpp> diff --git a/src/language/node_processor/OStreamProcessor.hpp b/src/language/node_processor/OStreamProcessor.hpp index 360221e2b0e267f7d75410d6060981b67904899b..81dc1a91e140d02a989684f39559b9fd16903612 100644 --- a/src/language/node_processor/OStreamProcessor.hpp +++ b/src/language/node_processor/OStreamProcessor.hpp @@ -1,6 +1,7 @@ #ifndef OSTREAM_PROCESSOR_HPP #define OSTREAM_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> class OStreamProcessor final : public INodeProcessor diff --git a/src/language/node_processor/TupleToVectorProcessor.hpp b/src/language/node_processor/TupleToVectorProcessor.hpp index b4e85fa7c82870697c9750de194ba3a2661dde26..3cb70f049572c61323a06897ca75a3ad8f3f56d4 100644 --- a/src/language/node_processor/TupleToVectorProcessor.hpp +++ b/src/language/node_processor/TupleToVectorProcessor.hpp @@ -1,6 +1,7 @@ #ifndef TUPLE_TO_VECTOR_PROCESSOR_HPP #define TUPLE_TO_VECTOR_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> template <typename TupleProcessorT, size_t N> diff --git a/src/language/node_processor/UnaryExpressionProcessor.hpp b/src/language/node_processor/UnaryExpressionProcessor.hpp index 33bb1007c85686633eefe6f0caee2c611481b0c2..e62facdf7c5f50dc4c0b67315bbef3e7ea033d4a 100644 --- a/src/language/node_processor/UnaryExpressionProcessor.hpp +++ b/src/language/node_processor/UnaryExpressionProcessor.hpp @@ -1,6 +1,7 @@ #ifndef UNARY_EXPRESSION_PROCESSOR_HPP #define UNARY_EXPRESSION_PROCESSOR_HPP +#include <language/PEGGrammar.hpp> #include <language/SymbolTable.hpp> #include <language/node_processor/INodeProcessor.hpp> diff --git a/src/language/node_processor/ValueProcessor.hpp b/src/language/node_processor/ValueProcessor.hpp index 29636aabeb9f1447e663795a7446600624b7b037..06052c72f510addda769c3c1c9811edd86f8d6ac 100644 --- a/src/language/node_processor/ValueProcessor.hpp +++ b/src/language/node_processor/ValueProcessor.hpp @@ -1,6 +1,7 @@ #ifndef VALUE_PROCESSOR_HPP #define VALUE_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/PEGGrammar.hpp> #include <language/node_processor/INodeProcessor.hpp> #include <utils/EscapedString.hpp> diff --git a/src/language/node_processor/WhileProcessor.hpp b/src/language/node_processor/WhileProcessor.hpp index cb20012fee281f4c9c073864b8ace51932fd08ac..82d7fa22ab8cee461eaf117fa832b3598091d82c 100644 --- a/src/language/node_processor/WhileProcessor.hpp +++ b/src/language/node_processor/WhileProcessor.hpp @@ -1,6 +1,7 @@ #ifndef WHILE_PROCESSOR_HPP #define WHILE_PROCESSOR_HPP +#include <language/ASTNode.hpp> #include <language/node_processor/INodeProcessor.hpp> class WhileProcessor final : public INodeProcessor diff --git a/src/mesh/CellType.hpp b/src/mesh/CellType.hpp index d0f6986d63a97677662ae91d980e9af02b114347..f0f214a60d9e9fb214e221b7dac1516b9c69b778 100644 --- a/src/mesh/CellType.hpp +++ b/src/mesh/CellType.hpp @@ -20,7 +20,7 @@ enum class CellType : unsigned short PUGS_INLINE std::string_view -name(const CellType& cell_type) +name(CellType cell_type) { switch (cell_type) { case CellType::Line: diff --git a/src/mesh/Connectivity.cpp b/src/mesh/Connectivity.cpp index dc51fe75a6cb773e99d59e235b137c7dd98c1164..a011948482bc8a9b1b562da6625a11a77e6a5b9b 100644 --- a/src/mesh/Connectivity.cpp +++ b/src/mesh/Connectivity.cpp @@ -27,7 +27,7 @@ Connectivity<Dimension>::_buildFrom(const ConnectivityDescriptor& descriptor) { WeakCellValue<CellType> cell_type(*this); parallel_for( - this->numberOfCells(), PUGS_LAMBDA(const CellId& j) { cell_type[j] = descriptor.cell_type_vector[j]; }); + this->numberOfCells(), PUGS_LAMBDA(CellId j) { cell_type[j] = descriptor.cell_type_vector[j]; }); m_cell_type = cell_type; } @@ -47,7 +47,7 @@ Connectivity<Dimension>::_buildFrom(const ConnectivityDescriptor& descriptor) WeakCellValue<int> cell_global_index(*this); int first_index = 0; parallel_for( - this->numberOfCells(), PUGS_LAMBDA(const CellId& j) { cell_global_index[j] = first_index + j; }); + this->numberOfCells(), PUGS_LAMBDA(CellId j) { cell_global_index[j] = first_index + j; }); m_cell_global_index = cell_global_index; } @@ -61,7 +61,7 @@ Connectivity<Dimension>::_buildFrom(const ConnectivityDescriptor& descriptor) const int rank = parallel::rank(); WeakCellValue<bool> cell_is_owned(*this); parallel_for( - this->numberOfCells(), PUGS_LAMBDA(const CellId& j) { cell_is_owned[j] = (m_cell_owner[j] == rank); }); + this->numberOfCells(), PUGS_LAMBDA(CellId j) { cell_is_owned[j] = (m_cell_owner[j] == rank); }); m_cell_is_owned = cell_is_owned; } @@ -75,7 +75,7 @@ Connectivity<Dimension>::_buildFrom(const ConnectivityDescriptor& descriptor) const int rank = parallel::rank(); WeakNodeValue<bool> node_is_owned(*this); parallel_for( - this->numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { node_is_owned[r] = (m_node_owner[r] == rank); }); + this->numberOfNodes(), PUGS_LAMBDA(NodeId r) { node_is_owned[r] = (m_node_owner[r] == rank); }); m_node_is_owned = node_is_owned; } @@ -114,7 +114,7 @@ Connectivity<Dimension>::_buildFrom(const ConnectivityDescriptor& descriptor) const int rank = parallel::rank(); WeakFaceValue<bool> face_is_owned(*this); parallel_for( - this->numberOfFaces(), PUGS_LAMBDA(const FaceId& l) { face_is_owned[l] = (m_face_owner[l] == rank); }); + this->numberOfFaces(), PUGS_LAMBDA(FaceId l) { face_is_owned[l] = (m_face_owner[l] == rank); }); m_face_is_owned = face_is_owned; } @@ -154,7 +154,7 @@ Connectivity<Dimension>::_buildFrom(const ConnectivityDescriptor& descriptor) const int rank = parallel::rank(); WeakEdgeValue<bool> edge_is_owned(*this); parallel_for( - this->numberOfEdges(), PUGS_LAMBDA(const EdgeId& e) { edge_is_owned[e] = (m_edge_owner[e] == rank); }); + this->numberOfEdges(), PUGS_LAMBDA(EdgeId e) { edge_is_owned[e] = (m_edge_owner[e] == rank); }); m_edge_is_owned = edge_is_owned; } diff --git a/src/mesh/Connectivity.hpp b/src/mesh/Connectivity.hpp index 3c319b053eb40a569c660d4c35a0b1235dfa768b..c75fa1f80d50e11e6ddab6dc9b60df2ece62859a 100644 --- a/src/mesh/Connectivity.hpp +++ b/src/mesh/Connectivity.hpp @@ -286,7 +286,7 @@ class Connectivity final : public IConnectivity PUGS_INLINE const bool& - isConnectivityMatrixBuilt(const ItemType& item_type_0, const ItemType& item_type_1) const + isConnectivityMatrixBuilt(ItemType item_type_0, ItemType item_type_1) const { const ConnectivityMatrix& connectivity_matrix = m_item_to_item_matrix[itemTId(item_type_0)][itemTId(item_type_1)]; return connectivity_matrix.isBuilt(); @@ -523,7 +523,7 @@ class Connectivity final : public IConnectivity template <ItemType item_type> const RefItemList<item_type>& - refItemList(const size_t& i) const + refItemList(size_t i) const { if constexpr (item_type == ItemType::cell) { return m_ref_cell_list_vector[i]; @@ -647,7 +647,7 @@ class Connectivity final : public IConnectivity WeakCellValue<double> inv_cell_nb_nodes(*this); parallel_for( - this->numberOfCells(), PUGS_LAMBDA(const CellId& j) { + this->numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix.rowConst(j); inv_cell_nb_nodes[j] = 1. / cell_nodes.length; }); diff --git a/src/mesh/ConnectivityComputer.cpp b/src/mesh/ConnectivityComputer.cpp index a47b491160bb3c27a935925083ba0fb230bfc6c2..f74316c566dc69992eddc7bf5dfabdf537be5195 100644 --- a/src/mesh/ConnectivityComputer.cpp +++ b/src/mesh/ConnectivityComputer.cpp @@ -9,8 +9,8 @@ template <typename ConnectivityType> PUGS_INLINE ConnectivityMatrix ConnectivityComputer::computeConnectivityMatrix(const ConnectivityType& connectivity, - const ItemType& item_type, - const ItemType& child_item_type) const + ItemType item_type, + ItemType child_item_type) const { ConnectivityMatrix item_to_child_item_matrix; if (connectivity.isConnectivityMatrixBuilt(child_item_type, item_type)) { @@ -29,16 +29,16 @@ ConnectivityComputer::computeConnectivityMatrix(const ConnectivityType& connecti } template ConnectivityMatrix ConnectivityComputer::computeConnectivityMatrix(const Connectivity1D&, - const ItemType&, - const ItemType&) const; + ItemType, + ItemType) const; template ConnectivityMatrix ConnectivityComputer::computeConnectivityMatrix(const Connectivity2D&, - const ItemType&, - const ItemType&) const; + ItemType, + ItemType) const; template ConnectivityMatrix ConnectivityComputer::computeConnectivityMatrix(const Connectivity3D&, - const ItemType&, - const ItemType&) const; + ItemType, + ItemType) const; ConnectivityMatrix ConnectivityComputer::_computeInverse(const ConnectivityMatrix& item_to_child_matrix) const diff --git a/src/mesh/ConnectivityComputer.hpp b/src/mesh/ConnectivityComputer.hpp index c6e2a569bc00e0c620224ee9ce9037e4085824e7..a4f843e218107b49a6913e3f9028bf034df7c63f 100644 --- a/src/mesh/ConnectivityComputer.hpp +++ b/src/mesh/ConnectivityComputer.hpp @@ -12,8 +12,8 @@ class ConnectivityComputer public: template <typename ConnectivityType> ConnectivityMatrix computeConnectivityMatrix(const ConnectivityType& connectivity, - const ItemType& item_type, - const ItemType& child_item_type) const; + ItemType item_type, + ItemType child_item_type) const; template <typename ItemOfItem, typename ConnectivityType> WeakSubItemValuePerItem<const unsigned short, typename ItemOfItem::Reversed> computeLocalItemNumberInChildItem( diff --git a/src/mesh/ConnectivityDescriptor.hpp b/src/mesh/ConnectivityDescriptor.hpp index 352a664ea061f38e006332af2abbfa052fad9192..8f26988eadaa01dfec8aa0f14404a82819273475 100644 --- a/src/mesh/ConnectivityDescriptor.hpp +++ b/src/mesh/ConnectivityDescriptor.hpp @@ -1,9 +1,9 @@ #ifndef CONNECTIVITY_DESCRIPTOR_HPP #define CONNECTIVITY_DESCRIPTOR_HPP +#include <mesh/CellType.hpp> #include <mesh/ItemOfItemType.hpp> #include <mesh/RefItemList.hpp> - #include <utils/PugsTraits.hpp> #include <vector> diff --git a/src/mesh/ConnectivityDispatcher.cpp b/src/mesh/ConnectivityDispatcher.cpp index ebba8dbe16312c61695f378291d79bfaf82d06d3..82bf2a2e006a13d0806b2d88b1dc54715a0cc116 100644 --- a/src/mesh/ConnectivityDispatcher.cpp +++ b/src/mesh/ConnectivityDispatcher.cpp @@ -372,7 +372,7 @@ ConnectivityDispatcher<Dimension>::_buildRecvItemIdCorrespondanceByProc() Array<int> send_item_number(item_list_to_send_by_proc[i_rank].size()); const Array<const ItemId> send_item_id = item_list_to_send_by_proc[i_rank]; parallel_for( - send_item_number.size(), PUGS_LAMBDA(const size_t& j) { send_item_number[j] = item_number[send_item_id[j]]; }); + send_item_number.size(), PUGS_LAMBDA(size_t j) { send_item_number[j] = item_number[send_item_id[j]]; }); send_item_number_by_proc[i_rank] = send_item_number; } @@ -514,7 +514,7 @@ ConnectivityDispatcher<Dimension>::_buildItemReferenceList() Array<block_type> send_item_refs(nb_item_to_send_by_proc[i_rank]); const Array<const ItemId> send_item_id = send_item_id_by_proc[i_rank]; parallel_for( - send_item_id.size(), PUGS_LAMBDA(const size_t& l) { + send_item_id.size(), PUGS_LAMBDA(size_t l) { const ItemId& item_id = send_item_id[l]; send_item_refs[l] = item_references[item_id]; }); diff --git a/src/mesh/ConnectivityMatrix.hpp b/src/mesh/ConnectivityMatrix.hpp index bef24bde58b5300d2285a7929bb06e45df00de1b..705dd8a3c6ff035e9c6a0be3cb4eac9cc77a70d2 100644 --- a/src/mesh/ConnectivityMatrix.hpp +++ b/src/mesh/ConnectivityMatrix.hpp @@ -53,14 +53,14 @@ class ConnectivityMatrix PUGS_INLINE auto - rowConst(const size_t& j) const + rowConst(size_t j) const { return m_host_matrix.rowConst(j); } PUGS_INLINE const auto& - rowMap(const size_t& j) const + rowMap(size_t j) const { return m_host_matrix.row_map[j]; } diff --git a/src/mesh/GmshReader.hpp b/src/mesh/GmshReader.hpp index 3501cafdf8c735ab73edf808ca7c886ec572ae34..2b95822863c4ce87395ffc3173ca5934287fd40e 100644 --- a/src/mesh/GmshReader.hpp +++ b/src/mesh/GmshReader.hpp @@ -61,7 +61,7 @@ class GmshReader PhysicalRefId& operator=(const PhysicalRefId&) = default; PhysicalRefId& operator=(PhysicalRefId&&) = default; - PhysicalRefId(const int& dimension, const RefId& ref_id) : m_dimension(dimension), m_ref_id(ref_id) + PhysicalRefId(int dimension, const RefId& ref_id) : m_dimension(dimension), m_ref_id(ref_id) { ; } diff --git a/src/mesh/IConnectivity.hpp b/src/mesh/IConnectivity.hpp index 76a85e0e3d8aae38ba97234395452cbba645db60..27be707cbcc4976b17e9db1e7bf6f37195c9d63a 100644 --- a/src/mesh/IConnectivity.hpp +++ b/src/mesh/IConnectivity.hpp @@ -33,6 +33,7 @@ class IConnectivity : public std::enable_shared_from_this<IConnectivity> size_t numberOf() const = delete; IConnectivity() = default; + IConnectivity(IConnectivity&&) = delete; IConnectivity(const IConnectivity&) = delete; ~IConnectivity() = default; }; diff --git a/src/mesh/ItemId.hpp b/src/mesh/ItemId.hpp index 8863c1a2867773344b8ed6907ebc6786bff0a7f6..c52958f8bd8d48537c8a99666169d0fd1968c003 100644 --- a/src/mesh/ItemId.hpp +++ b/src/mesh/ItemId.hpp @@ -40,7 +40,7 @@ class ItemIdT PUGS_INLINE constexpr ItemIdT& - operator=(const base_type& id) + operator=(base_type id) { m_id = id; return *this; @@ -53,7 +53,7 @@ class ItemIdT constexpr ItemIdT& operator=(ItemIdT&&) = default; PUGS_INLINE - constexpr ItemIdT(const base_type& id) : m_id{id} {} + constexpr ItemIdT(base_type id) : m_id{id} {} PUGS_INLINE constexpr ItemIdT(const ItemIdT&) = default; diff --git a/src/mesh/ItemToItemMatrix.hpp b/src/mesh/ItemToItemMatrix.hpp index a3fc307e03bf928203510514bb2f33cafd3d453c..e8d7071af5ae2c09b60c10478560087f5b2bdc86 100644 --- a/src/mesh/ItemToItemMatrix.hpp +++ b/src/mesh/ItemToItemMatrix.hpp @@ -29,7 +29,7 @@ class ItemToItemMatrix } PUGS_INLINE - TargetItemId operator[](const size_t& j) const + TargetItemId operator[](size_t j) const { return m_row(j); } diff --git a/src/mesh/ItemType.hpp b/src/mesh/ItemType.hpp index 21aebfc5d46b3d9c29712dfb54795826f076c9a3..a63c5e76a31de169f84e2e89eda36aac540b19d3 100644 --- a/src/mesh/ItemType.hpp +++ b/src/mesh/ItemType.hpp @@ -17,7 +17,7 @@ enum class ItemType PUGS_INLINE constexpr std::string_view -itemName(const ItemType& item_type) +itemName(ItemType item_type) { std::string_view name; switch (item_type) { @@ -51,7 +51,7 @@ struct ItemTypeId<1> { PUGS_INLINE static constexpr size_t - itemTId(const ItemType& item_type) + itemTId(ItemType item_type) { size_t i = std::numeric_limits<size_t>::max(); switch (item_type) { @@ -76,7 +76,7 @@ struct ItemTypeId<2> { PUGS_INLINE static constexpr size_t - itemTId(const ItemType& item_type) + itemTId(ItemType item_type) { size_t i = std::numeric_limits<size_t>::max(); switch (item_type) { @@ -104,7 +104,7 @@ struct ItemTypeId<3> { PUGS_INLINE static constexpr size_t - itemTId(const ItemType& item_type) + itemTId(ItemType item_type) { size_t i = std::numeric_limits<size_t>::max(); switch (item_type) { diff --git a/src/mesh/Mesh.hpp b/src/mesh/Mesh.hpp index 232594d2723ebe55a19db320ca06968284571322..935306b525d90d8c61302d6e6219edc1bc690709 100644 --- a/src/mesh/Mesh.hpp +++ b/src/mesh/Mesh.hpp @@ -10,8 +10,14 @@ struct IMesh { + public: virtual size_t dimension() const = 0; - ~IMesh() = default; + + IMesh(const IMesh&) = delete; + IMesh(IMesh&&) = delete; + + IMesh() = default; + ~IMesh() = default; }; template <typename ConnectivityType> diff --git a/src/mesh/MeshData.hpp b/src/mesh/MeshData.hpp index 2a1406c447f4eeb2d8e2b40b0ae3f229650d107e..1647abc0b1fe9f8e29d3a5a6a230548fc8f799b9 100644 --- a/src/mesh/MeshData.hpp +++ b/src/mesh/MeshData.hpp @@ -41,7 +41,7 @@ class MeshData CellValue<Rd> xj(m_mesh.connectivity()); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix[j]; xj[j] = 0.5 * (xr[cell_nodes[0]] + xr[cell_nodes[1]]); }); @@ -54,7 +54,7 @@ class MeshData const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix(); CellValue<Rd> xj(m_mesh.connectivity()); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { Rd X = zero; const auto& cell_nodes = cell_to_node_matrix[j]; for (size_t R = 0; R < cell_nodes.size(); ++R) { @@ -75,7 +75,7 @@ class MeshData CellValue<double> Vj(m_mesh.connectivity()); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { double sum_cjr_xr = 0; const auto& cell_nodes = cell_to_node_matrix[j]; @@ -100,7 +100,7 @@ class MeshData { NodeValuePerCell<Rd> Cjr(m_mesh.connectivity()); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix[j]; for (size_t R = 0; R < cell_nodes.size(); ++R) { int Rp1 = (R + 1) % cell_nodes.size(); @@ -115,14 +115,14 @@ class MeshData { NodeValuePerCell<double> ljr(m_mesh.connectivity()); parallel_for( - m_Cjr.numberOfValues(), PUGS_LAMBDA(const size_t& jr) { ljr[jr] = l2Norm(m_Cjr[jr]); }); + m_Cjr.numberOfValues(), PUGS_LAMBDA(size_t jr) { ljr[jr] = l2Norm(m_Cjr[jr]); }); m_ljr = ljr; } { NodeValuePerCell<Rd> njr(m_mesh.connectivity()); parallel_for( - m_Cjr.numberOfValues(), PUGS_LAMBDA(const size_t& jr) { njr[jr] = (1. / m_ljr[jr]) * m_Cjr[jr]; }); + m_Cjr.numberOfValues(), PUGS_LAMBDA(size_t jr) { njr[jr] = (1. / m_ljr[jr]) * m_Cjr[jr]; }); m_njr = njr; } } else if (Dimension == 3) { @@ -132,7 +132,7 @@ class MeshData const auto& face_to_node_matrix = m_mesh.connectivity().faceToNodeMatrix(); parallel_for( - m_mesh.numberOfFaces(), PUGS_LAMBDA(const FaceId& l) { + m_mesh.numberOfFaces(), PUGS_LAMBDA(FaceId l) { const auto& face_nodes = face_to_node_matrix[l]; const size_t nb_nodes = face_nodes.size(); std::vector<Rd> dxr(nb_nodes); @@ -161,10 +161,10 @@ class MeshData { NodeValuePerCell<Rd> Cjr(m_mesh.connectivity()); parallel_for( - Cjr.numberOfValues(), PUGS_LAMBDA(const size_t& jr) { Cjr[jr] = zero; }); + Cjr.numberOfValues(), PUGS_LAMBDA(size_t jr) { Cjr[jr] = zero; }); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix[j]; const auto& cell_faces = cell_to_face_matrix[j]; @@ -174,7 +174,7 @@ class MeshData const FaceId& l = cell_faces[L]; const auto& face_nodes = face_to_node_matrix[l]; - auto local_node_number_in_cell = [&](const NodeId& node_number) { + auto local_node_number_in_cell = [&](NodeId node_number) { for (size_t i_node = 0; i_node < cell_nodes.size(); ++i_node) { if (node_number == cell_nodes[i_node]) { return i_node; @@ -203,14 +203,14 @@ class MeshData { NodeValuePerCell<double> ljr(m_mesh.connectivity()); parallel_for( - m_Cjr.numberOfValues(), PUGS_LAMBDA(const size_t& jr) { ljr[jr] = l2Norm(m_Cjr[jr]); }); + m_Cjr.numberOfValues(), PUGS_LAMBDA(size_t jr) { ljr[jr] = l2Norm(m_Cjr[jr]); }); m_ljr = ljr; } { NodeValuePerCell<Rd> njr(m_mesh.connectivity()); parallel_for( - m_Cjr.numberOfValues(), PUGS_LAMBDA(const size_t& jr) { njr[jr] = (1. / m_ljr[jr]) * m_Cjr[jr]; }); + m_Cjr.numberOfValues(), PUGS_LAMBDA(size_t jr) { njr[jr] = (1. / m_ljr[jr]) * m_Cjr[jr]; }); m_njr = njr; } } @@ -275,7 +275,7 @@ class MeshData { NodeValuePerCell<Rd> Cjr(m_mesh.connectivity()); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { Cjr(j, 0) = -1; Cjr(j, 1) = 1; }); @@ -286,13 +286,16 @@ class MeshData { NodeValuePerCell<double> ljr(m_mesh.connectivity()); parallel_for( - ljr.numberOfValues(), PUGS_LAMBDA(const size_t& jr) { ljr[jr] = 1; }); + ljr.numberOfValues(), PUGS_LAMBDA(size_t jr) { ljr[jr] = 1; }); m_ljr = ljr; } } this->updateAllData(); } + MeshData(const MeshData&) = delete; + MeshData(MeshData&&) = delete; + ~MeshData() { ; diff --git a/src/mesh/MeshNodeBoundary.hpp b/src/mesh/MeshNodeBoundary.hpp index 8a3d4c913b96c46ca7d7b93573b41eedc0312d24..e02c9b7520db65081977e4bb1774a348c9cd6e25 100644 --- a/src/mesh/MeshNodeBoundary.hpp +++ b/src/mesh/MeshNodeBoundary.hpp @@ -19,7 +19,7 @@ #include <iostream> template <size_t Dimension> -class MeshNodeBoundary +class MeshNodeBoundary // clazy:exclude=copyable-polymorphic { protected: Array<const NodeId> m_node_list; @@ -42,7 +42,7 @@ class MeshNodeBoundary const Array<const FaceId>& face_list = ref_face_list.list(); parallel_for( - face_list.size(), PUGS_LAMBDA(const int& l) { + face_list.size(), PUGS_LAMBDA(int l) { const auto& face_cells = face_to_cell_matrix[face_list[l]]; if (face_cells.size() > 1) { throw NormalError("internal faces cannot be used to define mesh boundaries"); @@ -68,7 +68,7 @@ class MeshNodeBoundary Array<NodeId> node_list(node_ids.size()); parallel_for( - node_ids.size(), PUGS_LAMBDA(const int& r) { node_list[r] = node_ids[r]; }); + node_ids.size(), PUGS_LAMBDA(int r) { node_list[r] = node_ids[r]; }); m_node_list = node_list; } @@ -78,14 +78,16 @@ class MeshNodeBoundary static_assert(Dimension == MeshType::Dimension); } - MeshNodeBoundary() = default; + MeshNodeBoundary() = default; + virtual ~MeshNodeBoundary() = default; + + protected: MeshNodeBoundary(const MeshNodeBoundary&) = default; MeshNodeBoundary(MeshNodeBoundary&&) = default; - virtual ~MeshNodeBoundary() = default; }; template <size_t Dimension> -class MeshFlatNodeBoundary : public MeshNodeBoundary<Dimension> +class MeshFlatNodeBoundary : public MeshNodeBoundary<Dimension> // clazy:exclude=copyable-polymorphic { public: using Rd = TinyVector<Dimension, double>; @@ -97,9 +99,9 @@ class MeshFlatNodeBoundary : public MeshNodeBoundary<Dimension> PUGS_INLINE Rd _getNormal(const MeshType& mesh); template <typename MeshType> - PUGS_INLINE void _checkBoundaryIsFlat(const TinyVector<2, double>& normal, - const TinyVector<2, double>& xmin, - const TinyVector<2, double>& xmax, + PUGS_INLINE void _checkBoundaryIsFlat(TinyVector<2, double> normal, + TinyVector<2, double> xmin, + TinyVector<2, double> xmax, const MeshType& mesh) const; template <typename MeshType> @@ -138,9 +140,9 @@ class MeshFlatNodeBoundary : public MeshNodeBoundary<Dimension> template <> template <typename MeshType> void -MeshFlatNodeBoundary<2>::_checkBoundaryIsFlat(const TinyVector<2, double>& normal, - const TinyVector<2, double>& xmin, - const TinyVector<2, double>& xmax, +MeshFlatNodeBoundary<2>::_checkBoundaryIsFlat(TinyVector<2, double> normal, + TinyVector<2, double> xmin, + TinyVector<2, double> xmax, const MeshType& mesh) const { static_assert(MeshType::Dimension == 2); @@ -152,7 +154,7 @@ MeshFlatNodeBoundary<2>::_checkBoundaryIsFlat(const TinyVector<2, double>& norma const NodeValue<const R2>& xr = mesh.xr(); parallel_for( - m_node_list.size(), PUGS_LAMBDA(const size_t& r) { + m_node_list.size(), PUGS_LAMBDA(size_t r) { const R2& x = xr[m_node_list[r]]; if ((x - origin, normal) > 1E-13 * length) { throw NormalError("this FlatBoundary is not flat!"); diff --git a/src/mesh/RefId.hpp b/src/mesh/RefId.hpp index 35b9c4ef2966d151def68f29736b23a496cd8151..307324ee8bb0515fe79f046cfbf32c1eea89ec44 100644 --- a/src/mesh/RefId.hpp +++ b/src/mesh/RefId.hpp @@ -57,13 +57,12 @@ class RefId RefId(const RefId&) = default; RefId(RefId&&) = default; - explicit RefId(const TagNumberType& tag_number, const TagNameType& tag_name) - : m_tag_number(tag_number), m_tag_name(tag_name) + explicit RefId(TagNumberType tag_number, const TagNameType& tag_name) : m_tag_number(tag_number), m_tag_name(tag_name) { ; } - explicit RefId(const TagNumberType& tag_number) : m_tag_number(tag_number), m_tag_name(std::to_string(tag_number)) + explicit RefId(TagNumberType tag_number) : m_tag_number(tag_number), m_tag_name(std::to_string(tag_number)) { ; } diff --git a/src/mesh/SubItemValuePerItem.hpp b/src/mesh/SubItemValuePerItem.hpp index 37887b1ef2fad8bedd820b3324d2d3ac857ca9a2..9ce6369e07b63537ac698149703547aa107e83cd 100644 --- a/src/mesh/SubItemValuePerItem.hpp +++ b/src/mesh/SubItemValuePerItem.hpp @@ -55,14 +55,14 @@ class SubItemValuePerItem public: PUGS_INLINE - const DataType& operator[](const size_t& i) const noexcept(NO_ASSERT) + const DataType& operator[](size_t i) const noexcept(NO_ASSERT) { Assert(i < m_size); return m_sub_values[i]; } PUGS_FORCEINLINE - DataType& operator[](const size_t& i) noexcept(NO_ASSERT) + DataType& operator[](size_t i) noexcept(NO_ASSERT) { Assert(i < m_size); return m_sub_values[i]; @@ -81,7 +81,7 @@ class SubItemValuePerItem SubView(SubView&&) noexcept = default; PUGS_INLINE - SubView(const Array<DataType>& values, const size_t& begin, const size_t& end) noexcept(NO_ASSERT) + SubView(const Array<DataType>& values, size_t begin, size_t end) noexcept(NO_ASSERT) : m_sub_values(&(values[begin])), m_size(end - begin) { Assert(begin <= end); @@ -100,7 +100,7 @@ class SubItemValuePerItem // changes in data PUGS_FORCEINLINE DataType& - operator()(const ItemId& j, const size_t& r) const noexcept(NO_ASSERT) + operator()(ItemId j, size_t r) const noexcept(NO_ASSERT) { Assert(this->isBuilt()); return m_values[m_host_row_map(size_t{j}) + r]; @@ -108,7 +108,7 @@ class SubItemValuePerItem template <typename IndexType> PUGS_FORCEINLINE DataType& - operator()(const IndexType& j, const size_t& r) const noexcept(NO_ASSERT) + operator()(IndexType j, size_t r) const noexcept(NO_ASSERT) { static_assert(std::is_same_v<IndexType, ItemId>, "SubItemValuePerItem indexed by ItemId"); Assert(this->isBuilt()); @@ -126,7 +126,7 @@ class SubItemValuePerItem // Following Kokkos logic, these classes are view and const view does allow // changes in data PUGS_FORCEINLINE - DataType& operator[](const size_t& i) const noexcept(NO_ASSERT) + DataType& operator[](size_t i) const noexcept(NO_ASSERT) { Assert(this->isBuilt()); return m_values[i]; @@ -152,7 +152,7 @@ class SubItemValuePerItem PUGS_INLINE size_t - numberOfSubValues(const size_t& i_cell) const noexcept(NO_ASSERT) + numberOfSubValues(size_t i_cell) const noexcept(NO_ASSERT) { Assert(this->isBuilt()); return m_host_row_map(i_cell + 1) - m_host_row_map(i_cell); @@ -160,7 +160,7 @@ class SubItemValuePerItem PUGS_INLINE SubView - itemValues(const size_t& i_cell) noexcept(NO_ASSERT) + itemValues(size_t i_cell) noexcept(NO_ASSERT) { Assert(this->isBuilt()); const auto& cell_begin = m_host_row_map(i_cell); @@ -172,7 +172,7 @@ class SubItemValuePerItem // changes in data PUGS_INLINE SubView - itemValues(const size_t& i_cell) const noexcept(NO_ASSERT) + itemValues(size_t i_cell) const noexcept(NO_ASSERT) { Assert(this->isBuilt()); const auto& cell_begin = m_host_row_map(i_cell); diff --git a/src/mesh/SynchronizerManager.hpp b/src/mesh/SynchronizerManager.hpp index e2f89cbdad0a41cc260abcee39e602f11168ba31..e0e4519c1dd339cd7c67a5dbbeac4f49bf120a7c 100644 --- a/src/mesh/SynchronizerManager.hpp +++ b/src/mesh/SynchronizerManager.hpp @@ -16,6 +16,10 @@ class SynchronizerManager std::map<const IConnectivity*, std::shared_ptr<Synchronizer>> m_connectivity_synchronizer_map; static SynchronizerManager* m_instance; + + SynchronizerManager(const SynchronizerManager&) = delete; + SynchronizerManager(SynchronizerManager&) = delete; + SynchronizerManager() = default; ~SynchronizerManager(); diff --git a/src/output/VTKWriter.hpp b/src/output/VTKWriter.hpp index 8a5ad69b4cf4a59d1df1f33a7af4ea3179211dc7..7e818bec46b799ff0acf113230db894890141d78 100644 --- a/src/output/VTKWriter.hpp +++ b/src/output/VTKWriter.hpp @@ -2,6 +2,7 @@ #define VTK_WRITER_HPP #include <algebra/TinyVector.hpp> +#include <mesh/CellType.hpp> #include <mesh/IConnectivity.hpp> #include <mesh/ItemValue.hpp> #include <output/OutputNamedItemValueSet.hpp> @@ -31,7 +32,7 @@ class VTKWriter return sout.str(); } std::string - _getFilenameVTU(const int& rank_number) const + _getFilenameVTU(int rank_number) const { std::ostringstream sout; sout << m_base_filename; @@ -200,8 +201,8 @@ class VTKWriter void write(const MeshType& mesh, const OutputNamedItemValueSet& output_named_item_value_set, - const double& time, - const bool& forced_output = false) + double time, + bool forced_output = false) { if (time == m_last_time) return; // output already performed @@ -316,7 +317,7 @@ class VTKWriter Array<int8_t> types(mesh.numberOfCells()); const auto& cell_type = mesh.connectivity().cellType(); parallel_for( - mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { switch (cell_type[j]) { case CellType::Line: { types[j] = 3; diff --git a/src/scheme/AcousticSolver.hpp b/src/scheme/AcousticSolver.hpp index 1310ddc4c86389d62d17435820528f8ef22a540f..fd10ea3203b02cf624cc0ff0b5a556517ba84512 100644 --- a/src/scheme/AcousticSolver.hpp +++ b/src/scheme/AcousticSolver.hpp @@ -47,7 +47,7 @@ class AcousticSolver computeRhoCj(const CellValue<const double>& rhoj, const CellValue<const double>& cj) { parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { m_rhocj[j] = rhoj[j] * cj[j]; }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { m_rhocj[j] = rhoj[j] * cj[j]; }); return m_rhocj; } @@ -59,7 +59,7 @@ class AcousticSolver const NodeValuePerCell<const Rd>& njr) { parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const size_t& nb_nodes = m_Ajr.numberOfSubValues(j); const double& rho_c = rhocj[j]; for (size_t r = 0; r < nb_nodes; ++r) { @@ -76,7 +76,7 @@ class AcousticSolver const auto& node_local_numbers_in_their_cells = m_connectivity.nodeLocalNumbersInTheirCells(); parallel_for( - m_mesh.numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { + m_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId r) { Rdd sum = zero; const auto& node_to_cell = node_to_cell_matrix[r]; const auto& node_local_number_in_its_cells = node_local_numbers_in_their_cells.itemValues(r); @@ -103,7 +103,7 @@ class AcousticSolver const auto& node_local_numbers_in_their_cells = m_connectivity.nodeLocalNumbersInTheirCells(); parallel_for( - m_mesh.numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { + m_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId r) { Rd& br = m_br[r]; br = zero; const auto& node_to_cell = node_to_cell_matrix[r]; @@ -143,7 +143,7 @@ class AcousticSolver const Array<const NodeId>& node_list = symmetry_bc.nodeList(); parallel_for( - symmetry_bc.numberOfNodes(), PUGS_LAMBDA(const int& r_number) { + symmetry_bc.numberOfNodes(), PUGS_LAMBDA(int r_number) { const NodeId r = node_list[r_number]; m_Ar[r] = P * m_Ar[r] * P + nxn; @@ -161,7 +161,7 @@ class AcousticSolver inverse(Ar, m_inv_Ar); const NodeValue<const Rdd> invAr = m_inv_Ar; parallel_for( - m_mesh.numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { m_ur[r] = invAr[r] * br[r]; }); + m_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId r) { m_ur[r] = invAr[r] * br[r]; }); return m_ur; } @@ -176,7 +176,7 @@ class AcousticSolver const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix[j]; for (size_t r = 0; r < cell_nodes.size(); ++r) { @@ -189,7 +189,7 @@ class AcousticSolver inverse(const NodeValue<const Rdd>& A, NodeValue<Rdd>& inv_A) const { parallel_for( - m_mesh.numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { inv_A[r] = ::inverse(A[r]); }); + m_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId r) { inv_A[r] = ::inverse(A[r]); }); } PUGS_INLINE @@ -254,7 +254,7 @@ class AcousticSolver const auto& cell_to_node_matrix = m_mesh.connectivity().cellToNodeMatrix(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix[j]; double S = 0; @@ -268,7 +268,7 @@ class AcousticSolver } void - computeNextStep(const double&, const double& dt, UnknownsType& unknowns) + computeNextStep(double, double dt, UnknownsType& unknowns) { CellValue<double>& rhoj = unknowns.rhoj(); CellValue<Rd>& uj = unknowns.uj(); @@ -291,7 +291,7 @@ class AcousticSolver const CellValue<const double> inv_mj = unknowns.invMj(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { const auto& cell_nodes = cell_to_node_matrix[j]; Rd momentum_fluxes = zero; @@ -306,16 +306,16 @@ class AcousticSolver }); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { ej[j] = Ej[j] - 0.5 * (uj[j], uj[j]); }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { ej[j] = Ej[j] - 0.5 * (uj[j], uj[j]); }); NodeValue<Rd> mutable_xr = m_mesh.mutableXr(); parallel_for( - m_mesh.numberOfNodes(), PUGS_LAMBDA(const NodeId& r) { mutable_xr[r] += dt * ur[r]; }); + m_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId r) { mutable_xr[r] += dt * ur[r]; }); m_mesh_data.updateAllData(); const CellValue<const double> mj = unknowns.mj(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { rhoj[j] = mj[j] / Vj[j]; }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { rhoj[j] = mj[j] / Vj[j]; }); } }; diff --git a/src/scheme/BlockPerfectGas.hpp b/src/scheme/BlockPerfectGas.hpp index 1a51da28ed344a12c601081ff9bf61721854a631..38aef3262a39101fdc7607143a0bdb0e36d4cfe5 100644 --- a/src/scheme/BlockPerfectGas.hpp +++ b/src/scheme/BlockPerfectGas.hpp @@ -32,7 +32,7 @@ struct BlockPerfectGas const CellValue<const double>& gamma = m_gammaj; parallel_for( - nj, PUGS_LAMBDA(const CellId& j) { + nj, PUGS_LAMBDA(CellId j) { const double gamma_minus_one = gamma[j] - 1; m_pj[j] = gamma_minus_one * rho[j] * e[j]; m_cj[j] = std::sqrt(gamma[j] * gamma_minus_one * e[j]); @@ -48,11 +48,11 @@ struct BlockPerfectGas const CellValue<const double>& gamma = m_gammaj; parallel_for( - nj, PUGS_LAMBDA(const CellId& j) { m_ej[j] = p[j] / (rho[j] * (gamma[j] - 1)); }); + nj, PUGS_LAMBDA(CellId j) { m_ej[j] = p[j] / (rho[j] * (gamma[j] - 1)); }); const CellValue<const double>& e = m_ej; parallel_for( - nj, PUGS_LAMBDA(const CellId& j) { m_cj[j] = std::sqrt(gamma[j] * (gamma[j] - 1) * e[j]); }); + nj, PUGS_LAMBDA(CellId j) { m_cj[j] = std::sqrt(gamma[j] * (gamma[j] - 1) * e[j]); }); } }; diff --git a/src/scheme/BoundaryCondition.hpp b/src/scheme/BoundaryCondition.hpp index 9e1c65cd3b45a71cc996d419acfc17cdc33f82c2..3d3332fc92cfa88792ecf556cb97781de007a104 100644 --- a/src/scheme/BoundaryCondition.hpp +++ b/src/scheme/BoundaryCondition.hpp @@ -9,7 +9,7 @@ #include <memory> #include <vector> -class BoundaryCondition +class BoundaryCondition // clazy:exclude=copyable-polymorphic { public: enum Type @@ -23,7 +23,7 @@ class BoundaryCondition const Type m_type; protected: - BoundaryCondition(const Type& type) : m_type(type) + BoundaryCondition(Type type) : m_type(type) { ; } @@ -38,7 +38,7 @@ class BoundaryCondition virtual ~BoundaryCondition() = default; }; -class PressureBoundaryCondition : public BoundaryCondition +class PressureBoundaryCondition final : public BoundaryCondition // clazy:exclude=copyable-polymorphic { private: const double m_value; @@ -65,12 +65,12 @@ class PressureBoundaryCondition : public BoundaryCondition return m_face_list; } - PressureBoundaryCondition(const double& value, const std::vector<unsigned int>& faces) + PressureBoundaryCondition(double value, const std::vector<unsigned int>& faces) : BoundaryCondition(BoundaryCondition::pressure), m_value(value), m_number_of_faces(faces.size()) { Array<unsigned int> face_list(faces.size()); parallel_for( - m_number_of_faces, PUGS_LAMBDA(const int& f) { face_list[f] = faces[f]; }); + m_number_of_faces, PUGS_LAMBDA(int f) { face_list[f] = faces[f]; }); m_face_list = face_list; } diff --git a/src/scheme/BoundaryConditionDescriptor.hpp b/src/scheme/BoundaryConditionDescriptor.hpp index b73cd6fca1211c2adbb48d7a177e13c28831e0f1..8f4911ad940c56b335fabb1e002582f5d61ddd34 100644 --- a/src/scheme/BoundaryConditionDescriptor.hpp +++ b/src/scheme/BoundaryConditionDescriptor.hpp @@ -30,10 +30,13 @@ class BoundaryDescriptor { return bcd == ref_id; } - virtual Type type() const = 0; - BoundaryDescriptor(const BoundaryDescriptor&) = default; + virtual Type type() const = 0; + + BoundaryDescriptor(const BoundaryDescriptor&) = delete; + BoundaryDescriptor(BoundaryDescriptor&&) = delete; BoundaryDescriptor() = default; - virtual ~BoundaryDescriptor() = default; + + virtual ~BoundaryDescriptor() = default; }; class NamedBoundaryDescriptor : public BoundaryDescriptor @@ -61,7 +64,8 @@ class NamedBoundaryDescriptor : public BoundaryDescriptor return Type::named; } - NamedBoundaryDescriptor(const NamedBoundaryDescriptor&) = default; + NamedBoundaryDescriptor(const NamedBoundaryDescriptor&) = delete; + NamedBoundaryDescriptor(NamedBoundaryDescriptor&&) = delete; NamedBoundaryDescriptor(const std::string& name) : m_name(name) { ; @@ -94,8 +98,9 @@ class NumberedBoundaryDescriptor : public BoundaryDescriptor return Type::numbered; } - NumberedBoundaryDescriptor(const NumberedBoundaryDescriptor&) = default; - NumberedBoundaryDescriptor(const unsigned int& number) : m_number(number) + NumberedBoundaryDescriptor(const NumberedBoundaryDescriptor&) = delete; + NumberedBoundaryDescriptor(NumberedBoundaryDescriptor&&) = delete; + NumberedBoundaryDescriptor(unsigned int number) : m_number(number) { ; } @@ -136,6 +141,9 @@ class BoundaryConditionDescriptor ; } + BoundaryConditionDescriptor(const BoundaryConditionDescriptor&) = delete; + BoundaryConditionDescriptor(BoundaryConditionDescriptor&&) = delete; + virtual ~BoundaryConditionDescriptor() = default; }; @@ -162,8 +170,10 @@ class SymmetryBoundaryConditionDescriptor : public BoundaryConditionDescriptor ; } - SymmetryBoundaryConditionDescriptor(const SymmetryBoundaryConditionDescriptor&) = default; - ~SymmetryBoundaryConditionDescriptor() = default; + SymmetryBoundaryConditionDescriptor(const SymmetryBoundaryConditionDescriptor&) = delete; + SymmetryBoundaryConditionDescriptor(SymmetryBoundaryConditionDescriptor&&) = delete; + + ~SymmetryBoundaryConditionDescriptor() = default; }; #endif // BOUNDARY_CONDITION_DESCRIPTOR_HPP diff --git a/src/scheme/FiniteVolumesEulerUnknowns.hpp b/src/scheme/FiniteVolumesEulerUnknowns.hpp index 6997b63a05e4c0a26002977d944fff21c72d9bf3..a3fd012de3d0ea44fd8b0cfe724238bb115fa05c 100644 --- a/src/scheme/FiniteVolumesEulerUnknowns.hpp +++ b/src/scheme/FiniteVolumesEulerUnknowns.hpp @@ -3,6 +3,7 @@ #include <algebra/TinyVector.hpp> #include <mesh/ItemValue.hpp> +#include <scheme/BlockPerfectGas.hpp> template <typename TMeshData> class FiniteVolumesEulerUnknowns @@ -144,7 +145,7 @@ class FiniteVolumesEulerUnknowns const CellValue<const Rd>& xj = m_mesh_data.xj(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { if (xj[j][0] < 0.5) { m_rhoj[j] = 1; } else { @@ -153,7 +154,7 @@ class FiniteVolumesEulerUnknowns }); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { if (xj[j][0] < 0.5) { m_pj[j] = 1; } else { @@ -162,23 +163,23 @@ class FiniteVolumesEulerUnknowns }); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { m_uj[j] = zero; }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { m_uj[j] = zero; }); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { m_gammaj[j] = 1.4; }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { m_gammaj[j] = 1.4; }); BlockPerfectGas block_eos(m_rhoj, m_ej, m_pj, m_gammaj, m_cj); block_eos.updateEandCFromRhoP(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { m_Ej[j] = m_ej[j] + 0.5 * (m_uj[j], m_uj[j]); }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { m_Ej[j] = m_ej[j] + 0.5 * (m_uj[j], m_uj[j]); }); const CellValue<const double>& Vj = m_mesh_data.Vj(); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { m_mj[j] = m_rhoj[j] * Vj[j]; }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { m_mj[j] = m_rhoj[j] * Vj[j]; }); parallel_for( - m_mesh.numberOfCells(), PUGS_LAMBDA(const CellId& j) { m_inv_mj[j] = 1. / m_mj[j]; }); + m_mesh.numberOfCells(), PUGS_LAMBDA(CellId j) { m_inv_mj[j] = 1. / m_mj[j]; }); } FiniteVolumesEulerUnknowns(const MeshDataType& mesh_data) diff --git a/src/utils/Array.hpp b/src/utils/Array.hpp index 2d6668c68db33aa0816f9f83ef0c95d95ede0e64..42ae7f61c375a9cb544020063f827c43dcf5e143 100644 --- a/src/utils/Array.hpp +++ b/src/utils/Array.hpp @@ -43,7 +43,7 @@ class Array friend PUGS_INLINE Array<DataType2> encapsulate(const Kokkos::View<DataType2*, RT...>& values); PUGS_INLINE - DataType& operator[](const index_type& i) const noexcept(NO_ASSERT) + DataType& operator[](index_type i) const noexcept(NO_ASSERT) { Assert(i < m_values.extent(0)); return m_values[i]; @@ -57,7 +57,7 @@ class Array // could consider to use std::fill parallel_for( - this->size(), PUGS_LAMBDA(const index_type& i) { m_values[i] = data; }); + this->size(), PUGS_LAMBDA(index_type i) { m_values[i] = data; }); } template <typename DataType2> @@ -81,7 +81,7 @@ class Array Array& operator=(Array&&) = default; PUGS_INLINE - Array(const size_t& size) : m_values("anonymous", size) + Array(size_t size) : m_values("anonymous", size) { static_assert(not std::is_const<DataType>(), "Cannot allocate Array of const data: only view is " "supported"); diff --git a/src/utils/ArrayUtils.hpp b/src/utils/ArrayUtils.hpp index 6b5b09685ce6266cce13fdce10930750111909da..d85fb162756deb20d19971470ea1f40421dfdfa1 100644 --- a/src/utils/ArrayUtils.hpp +++ b/src/utils/ArrayUtils.hpp @@ -203,7 +203,7 @@ value_copy(const SourceArray<SourceT...>& source_array, ImageArray<ImageT...>& i Assert(source_array.size() == image_array.size()); parallel_for( - source_array.size(), PUGS_LAMBDA(const size_t& i) { image_array[i] = source_array[i]; }); + source_array.size(), PUGS_LAMBDA(size_t i) { image_array[i] = source_array[i]; }); } #endif // ARRAY_UTILS_HPP diff --git a/src/utils/CSRGraph.hpp b/src/utils/CSRGraph.hpp index f2e8ea2865e5ea69a1deda594caee2f57e207dfe..a3ae85dcced1897fc54901903c919f0009761d74 100644 --- a/src/utils/CSRGraph.hpp +++ b/src/utils/CSRGraph.hpp @@ -32,7 +32,7 @@ class CSRGraph CSRGraph& operator=(CSRGraph&&) = default; CSRGraph& operator=(const CSRGraph&) = default; - CSRGraph(Array<int> entries, Array<int> neighbors) : m_entries(entries), m_neighbors(neighbors) + CSRGraph(const Array<int>& entries, const Array<int>& neighbors) : m_entries(entries), m_neighbors(neighbors) { Assert(m_entries.size() > 0); } diff --git a/src/utils/CastArray.hpp b/src/utils/CastArray.hpp index 26397a1605f2384efab5f4ff7fcf9bd1c78241e8..120bcc25c1f5dd9da75a387016bad8d2b5175688 100644 --- a/src/utils/CastArray.hpp +++ b/src/utils/CastArray.hpp @@ -27,7 +27,7 @@ class CastArray } PUGS_INLINE - CastDataType& operator[](const size_t& i) const + CastDataType& operator[](size_t i) const { Assert(i < m_size); return m_values[i]; diff --git a/src/utils/ConsoleManager.cpp b/src/utils/ConsoleManager.cpp index aa6d23b042a9f7aa7365d6d38668183a154de800..666caa1b17c5bb397e592132febeabab4846732f 100644 --- a/src/utils/ConsoleManager.cpp +++ b/src/utils/ConsoleManager.cpp @@ -9,7 +9,7 @@ ConsoleManager::isTerminal(std::ostream& os) } void -ConsoleManager::init(const bool& colorize) +ConsoleManager::init(bool colorize) { std::cout << "Console management: color "; if (colorize) { diff --git a/src/utils/ConsoleManager.hpp b/src/utils/ConsoleManager.hpp index 8befab9f6d78aa72c25f4c768ebda530e4545096..b9ee7cbfbf123af63f131d07df8655c6f6ba4f85 100644 --- a/src/utils/ConsoleManager.hpp +++ b/src/utils/ConsoleManager.hpp @@ -6,7 +6,7 @@ struct ConsoleManager { static bool isTerminal(std::ostream& os); - static void init(const bool& colorize); + static void init(bool colorize); }; #endif // CONSOLE_MANAGER_HPP diff --git a/src/utils/EscapedString.hpp b/src/utils/EscapedString.hpp index b43a4521326436a84a19ea0c8e994222ecb2a860..ed525abd0368614fb756fd8c7795bb1c7ea178c6 100644 --- a/src/utils/EscapedString.hpp +++ b/src/utils/EscapedString.hpp @@ -8,7 +8,7 @@ #include <string_view> PUGS_INLINE std::string -unescapeString(const std::string_view& input_string) +unescapeString(std::string_view input_string) { std::stringstream ss; for (size_t i = 1; i < input_string.size() - 1; ++i) { @@ -71,7 +71,7 @@ unescapeString(const std::string_view& input_string) } PUGS_INLINE std::string -escapeString(const std::string_view& input_string) +escapeString(std::string_view input_string) { std::stringstream ss; for (size_t i = 0; i < input_string.size(); ++i) { diff --git a/src/utils/Exceptions.hpp b/src/utils/Exceptions.hpp index 1c0a56b4b7c4572faa13ae1fb9b82644d262418a..2b7906dfee7de16e848633597a7645c146084103 100644 --- a/src/utils/Exceptions.hpp +++ b/src/utils/Exceptions.hpp @@ -6,32 +6,51 @@ struct IExitError : public std::runtime_error { IExitError(std::string_view error_msg) : std::runtime_error(std::string{error_msg}){}; + + IExitError(const IExitError&) = delete; + IExitError(IExitError&&) = delete; + virtual ~IExitError() = default; }; struct RawError : public IExitError { + RawError(const RawError&) = delete; + RawError(RawError&&) = delete; + RawError(std::string_view error_msg); }; struct NormalError : public IExitError { + NormalError(const NormalError&) = delete; + NormalError(NormalError&&) = delete; + NormalError(std::string_view error_msg); }; struct IBacktraceError : public std::runtime_error { + IBacktraceError(const IBacktraceError&) = delete; + IBacktraceError(IBacktraceError&&) = delete; + IBacktraceError(const std::string& error_msg) : std::runtime_error(std::string{error_msg}){}; virtual ~IBacktraceError() = default; }; struct UnexpectedError : IBacktraceError { + UnexpectedError(const UnexpectedError&) = delete; + UnexpectedError(UnexpectedError&&) = delete; + UnexpectedError(std::string_view error_msg); }; struct NotImplementedError : IBacktraceError { + NotImplementedError(const NotImplementedError&) = delete; + NotImplementedError(NotImplementedError&&) = delete; + NotImplementedError(std::string_view error_msg); }; diff --git a/src/utils/FPEManager.cpp b/src/utils/FPEManager.cpp index 2bf268392c5a37dbf4bf058cf3f137ff6c7e13d5..7430b5bbcc8c17d31b3a9508a170bfb3ed525632 100644 --- a/src/utils/FPEManager.cpp +++ b/src/utils/FPEManager.cpp @@ -92,7 +92,7 @@ FPEManager::disable() #endif // PUGS_HAS_FENV_H void -FPEManager::init(const bool& enable) +FPEManager::init(bool enable) { if (enable) { FPEManager::enable(); diff --git a/src/utils/FPEManager.hpp b/src/utils/FPEManager.hpp index f90a477ed6def18fe07d48f1d95b7d028791d86c..57ffe2bccc5ea01bfcd1de1f093180aa43941de9 100644 --- a/src/utils/FPEManager.hpp +++ b/src/utils/FPEManager.hpp @@ -5,7 +5,7 @@ struct FPEManager { static void enable(); static void disable(); - static void init(const bool& enable); + static void init(bool enable); }; #endif // FPEMANAGER_HPP diff --git a/src/utils/Messenger.hpp b/src/utils/Messenger.hpp index b1acd5e0f11c5c6e6640a1e049a51087231be7d1..1f8903eccf8465e5d06ebc2164ec8f3768672289 100644 --- a/src/utils/Messenger.hpp +++ b/src/utils/Messenger.hpp @@ -137,7 +137,7 @@ class Messenger template <typename DataType> void - _broadcast_value([[maybe_unused]] DataType& data, [[maybe_unused]] const size_t& root_rank) const + _broadcast_value([[maybe_unused]] DataType& data, [[maybe_unused]] size_t root_rank) const { static_assert(not std::is_const_v<DataType>); static_assert(std::is_arithmetic_v<DataType>); @@ -151,7 +151,7 @@ class Messenger template <typename ArrayType> void - _broadcast_array([[maybe_unused]] ArrayType& array, [[maybe_unused]] const size_t& root_rank) const + _broadcast_array([[maybe_unused]] ArrayType& array, [[maybe_unused]] size_t root_rank) const { using DataType = typename ArrayType::data_type; static_assert(not std::is_const_v<DataType>); @@ -436,7 +436,7 @@ class Messenger template <typename DataType> PUGS_INLINE void - broadcast(DataType& data, const size_t& root_rank) const + broadcast(DataType& data, size_t root_rank) const { static_assert(not std::is_const_v<DataType>, "cannot broadcast const data"); if constexpr (std::is_arithmetic_v<DataType>) { @@ -457,7 +457,7 @@ class Messenger template <typename DataType> PUGS_INLINE void - broadcast(Array<DataType>& array, const size_t& root_rank) const + broadcast(Array<DataType>& array, size_t root_rank) const { static_assert(not std::is_const_v<DataType>, "cannot broadcast array of const"); if constexpr (std::is_arithmetic_v<DataType>) { @@ -546,7 +546,7 @@ PUGS_INLINE void barrier() { - return messenger().barrier(); + messenger().barrier(); } template <typename DataType> @@ -593,14 +593,14 @@ allToAll(const Array<DataType>& array) template <typename DataType> PUGS_INLINE void -broadcast(DataType& data, const size_t& root_rank) +broadcast(DataType& data, size_t root_rank) { messenger().broadcast(data, root_rank); } template <typename DataType> PUGS_INLINE void -broadcast(Array<DataType>& array, const size_t& root_rank) +broadcast(Array<DataType>& array, size_t root_rank) { messenger().broadcast(array, root_rank); } diff --git a/src/utils/PugsAssert.hpp b/src/utils/PugsAssert.hpp index c34d62b43bedcd7a3759260934f54e27bbd6006e..810cc26db9ff035d5e994dceaf1c355632d403c9 100644 --- a/src/utils/PugsAssert.hpp +++ b/src/utils/PugsAssert.hpp @@ -35,7 +35,11 @@ class AssertError } AssertError(const AssertError&) = default; - AssertError(std::string file, int line, std::string function, std::string test, std::string message = "") + AssertError(const std::string& file, + int line, + const std::string& function, + const std::string& test, + const std::string& message = "") : m_file(file), m_line(line), m_function(function), m_test(test), m_message(message) { ; diff --git a/src/utils/PugsTraits.hpp b/src/utils/PugsTraits.hpp index 30283afa80efdde9110ce9cf8bbba548934224a6..60316bfe4239a8427840da5853db8bf3bab78cb4 100644 --- a/src/utils/PugsTraits.hpp +++ b/src/utils/PugsTraits.hpp @@ -1,6 +1,7 @@ #ifndef PUGS_TRAITS_HPP #define PUGS_TRAITS_HPP +#include <cstddef> #include <memory> #include <type_traits> diff --git a/src/utils/PugsUtils.hpp b/src/utils/PugsUtils.hpp index 6a64867dbc3dc7c5fe21a9cf254efb704cb1655a..ef4eeb72c340b8a6ca654d001c32390973b63c55 100644 --- a/src/utils/PugsUtils.hpp +++ b/src/utils/PugsUtils.hpp @@ -9,14 +9,14 @@ template <typename FunctionType> PUGS_FORCEINLINE void -parallel_for(const size_t& size, const FunctionType& lambda, const std::string& label = "") +parallel_for(size_t size, const FunctionType& lambda, const std::string& label = "") { Kokkos::parallel_for(size, lambda, label); } template <typename ArrayType, typename ReturnType> PUGS_FORCEINLINE void -parallel_reduce(const size_t& size, const ArrayType& array, ReturnType& value, const std::string& label = "") +parallel_reduce(size_t size, const ArrayType& array, ReturnType& value, const std::string& label = "") { Kokkos::parallel_reduce(label, size, array, value); } diff --git a/src/utils/SignalManager.cpp b/src/utils/SignalManager.cpp index 45a6dd49d68d94206312203d509fba673b15ebd2..ab08424fa2731bc62d84b461cea850878da9514b 100644 --- a/src/utils/SignalManager.cpp +++ b/src/utils/SignalManager.cpp @@ -22,13 +22,13 @@ SignalManager::pauseOnError() } void -SignalManager::setPauseForDebug(const bool& pause_on_error) +SignalManager::setPauseForDebug(bool pause_on_error) { s_pause_on_error = pause_on_error; } std::string -SignalManager::signalName(const int& signal) +SignalManager::signalName(int signal) { switch (signal) { case SIGILL: @@ -48,7 +48,7 @@ SignalManager::signalName(const int& signal) } void -SignalManager::pauseForDebug(const int& signal) +SignalManager::pauseForDebug(int signal) { if (std::string(PUGS_BUILD_TYPE) != "Release") { if (s_pause_on_error) { @@ -105,7 +105,7 @@ SignalManager::handler(int signal) } void -SignalManager::init(const bool& enable) +SignalManager::init(bool enable) { if (enable) { std::signal(SIGFPE, SignalManager::handler); diff --git a/src/utils/SignalManager.hpp b/src/utils/SignalManager.hpp index b64195e7ee0e0800a3dd764aa1bce60b370e5f9b..6f24613f4d074ac7377002bf83cb76f3e22dc8b1 100644 --- a/src/utils/SignalManager.hpp +++ b/src/utils/SignalManager.hpp @@ -7,14 +7,14 @@ struct SignalManager { private: static bool s_pause_on_error; - static std::string signalName(const int& signal); - static void pauseForDebug(const int& signal); + static std::string signalName(int signal); + static void pauseForDebug(int signal); static void handler(int signal); public: static bool pauseOnError(); - static void setPauseForDebug(const bool& pause_on_error); - static void init(const bool& enable); + static void setPauseForDebug(bool pause_on_error); + static void init(bool enable); }; #endif // SIGNAL_MANAGER_HPP diff --git a/tests/mpi_test_Messenger.cpp b/tests/mpi_test_Messenger.cpp index 3ab24267795b84fe328fb6b8f05b262b99edd935..beea7430bc83b17b11dc6ab2375f70d5a13e785a 100644 --- a/tests/mpi_test_Messenger.cpp +++ b/tests/mpi_test_Messenger.cpp @@ -19,16 +19,19 @@ namespace mpi_check struct integer { int m_int; + operator int&() { return m_int; } + operator const int&() const { return m_int; } + integer& - operator=(const int& i) + operator=(int i) { m_int = i; return *this; @@ -47,8 +50,9 @@ struct tri_int int m_int_0; int m_int_1; int m_int_2; + bool - operator==(const tri_int& t) const + operator==(tri_int t) const { return ((m_int_0 == t.m_int_0) and (m_int_1 == t.m_int_1) and (m_int_2 == t.m_int_2)); } @@ -104,6 +108,8 @@ test_allToAll<tri_int>() } // namespace mpi_check +// clazy:excludeall=non-pod-global-static + TEST_CASE("Messenger", "[mpi]") { SECTION("communication info") diff --git a/tests/test_ASTBuilder.cpp b/tests/test_ASTBuilder.cpp index ef8c0c67090417261f396495297438d1404ebc0b..418fb979c464d4f57c61e0200f1121d4e633ecf3 100644 --- a/tests/test_ASTBuilder.cpp +++ b/tests/test_ASTBuilder.cpp @@ -21,6 +21,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTBuilder", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_ASTDotPrinter.cpp b/tests/test_ASTDotPrinter.cpp index 64046f33eef743ace05ea2d3d3a1c86bf9acb1d0..55917fdd25bcf47792fd02d15ca449c6bca439bb 100644 --- a/tests/test_ASTDotPrinter.cpp +++ b/tests/test_ASTDotPrinter.cpp @@ -21,6 +21,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTDotPrinter", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_ASTModulesImporter.cpp b/tests/test_ASTModulesImporter.cpp index 522a5d76ded203f7d17d7724e7950710cb4cca3f..92412553a5b2c52371c64ec885dada35aed22b37 100644 --- a/tests/test_ASTModulesImporter.cpp +++ b/tests/test_ASTModulesImporter.cpp @@ -30,6 +30,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTModulesImporter", "[language]") { SECTION("no module") diff --git a/tests/test_ASTNode.cpp b/tests/test_ASTNode.cpp index 5f55c8632bec5742afce6b42e871fc4f44e59823..1c51d7b5859051304b89d2ef0ca33dc41c285bd2 100644 --- a/tests/test_ASTNode.cpp +++ b/tests/test_ASTNode.cpp @@ -5,6 +5,8 @@ #include <language/node_processor/FakeProcessor.hpp> #include <utils/Demangle.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNode", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_ASTNodeAffectationExpressionBuilder.cpp b/tests/test_ASTNodeAffectationExpressionBuilder.cpp index 916c2355759e27b858fe2ceb1579302d358eb14d..dce1fac55f51ea51d21aa5705f2f1b3509c647ee 100644 --- a/tests/test_ASTNodeAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeAffectationExpressionBuilder.cpp @@ -54,6 +54,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeAffectationExpressionBuilder", "[language]") { const std::string demangled_stdstring = demangle(typeid(std::string{}).name()); diff --git a/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp b/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp index 286c147b256e1ce30a0e1574e507504ced662737..30b3abb50928b0fb1b244e6edf9edb5a3a398527 100644 --- a/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp +++ b/tests/test_ASTNodeArraySubscriptExpressionBuilder.cpp @@ -6,6 +6,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeArraySubscriptExpressionBuilder", "[language]") { SECTION("R^d component access") diff --git a/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp b/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp index 2ae97cf6e05043b6ae78df893b78d8cc3fa568be..91ba822fa55368dfc42af5bc77d1339d7d000c01 100644 --- a/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp +++ b/tests/test_ASTNodeBinaryOperatorExpressionBuilder.cpp @@ -51,6 +51,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeBinaryOperatorExpressionBuilder", "[language]") { SECTION("multiply") diff --git a/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp b/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp index 8dcf49014a2671609285903c483d3f0c163cd481..614ef6a68c38c67d904ebcd7813213918a404c28 100644 --- a/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeBuiltinFunctionExpressionBuilder.cpp @@ -48,8 +48,9 @@ class BuiltinFunctionRegister std::function<bool(double, double)>{[](double x, double y) -> bool { return x > y; }}))); m_name_builtin_function_map.insert( - std::make_pair("StoB", std::make_shared<BuiltinFunctionEmbedder<bool, std::string>>( - std::function<bool(std::string)>{[](std::string s) -> bool { return s.size() > 0; }}))); + std::make_pair("StoB", + std::make_shared<BuiltinFunctionEmbedder<bool, std::string>>( + std::function<bool(std::string)>{[](const std::string& s) -> bool { return s.size() > 0; }}))); } public: @@ -61,7 +62,7 @@ class BuiltinFunctionRegister this->_populateNameBuiltinFunctionMap(); - for (auto [symbol_name, builtin_function] : m_name_builtin_function_map) { + for (const auto& [symbol_name, builtin_function] : m_name_builtin_function_map) { auto [i_symbol, success] = symbol_table.add(symbol_name, root_node.begin()); if (not success) { @@ -121,6 +122,8 @@ class BuiltinFunctionRegister REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, Catch::Matchers::Contains(expected_error)); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeBuiltinFunctionExpressionBuilder", "[language]") { SECTION("R -> R") diff --git a/tests/test_ASTNodeDataType.cpp b/tests/test_ASTNodeDataType.cpp index f885bcf586852c530fdca04a5841aebf89d3c1bc..761a0a965796529f18eb8b0d3bb66c012794deb0 100644 --- a/tests/test_ASTNodeDataType.cpp +++ b/tests/test_ASTNodeDataType.cpp @@ -10,6 +10,8 @@ struct real; struct vector_type; } // namespace language +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeDataType", "[language]") { SECTION("dataTypeName") diff --git a/tests/test_ASTNodeDataTypeBuilder.cpp b/tests/test_ASTNodeDataTypeBuilder.cpp index 5e27362e8a80aa3dc567c843e558be32c6935ef7..0d5a3306001e584190dc84101cf324f0f448b802 100644 --- a/tests/test_ASTNodeDataTypeBuilder.cpp +++ b/tests/test_ASTNodeDataTypeBuilder.cpp @@ -24,6 +24,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeDataTypeBuilder", "[language]") { SECTION("module") diff --git a/tests/test_ASTNodeDataTypeChecker.cpp b/tests/test_ASTNodeDataTypeChecker.cpp index e641592f466b187237ee26f2526ad0551212f0d5..61784aea28cf4abdc3fa8df6cbb68cf243a54159 100644 --- a/tests/test_ASTNodeDataTypeChecker.cpp +++ b/tests/test_ASTNodeDataTypeChecker.cpp @@ -7,6 +7,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeDataTypeChecker", "[language]") { SECTION("everything ok: nothrow") diff --git a/tests/test_ASTNodeDataTypeFlattener.cpp b/tests/test_ASTNodeDataTypeFlattener.cpp index 7cdb4c3dfc68c7eb51a8908bc7abaadc9e8f1acf..b6de87c63546c0ca5274fbdcdd18da9a26a237cc 100644 --- a/tests/test_ASTNodeDataTypeFlattener.cpp +++ b/tests/test_ASTNodeDataTypeFlattener.cpp @@ -9,6 +9,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeDataTypeFlattener", "[language]") { SECTION("simple types") diff --git a/tests/test_ASTNodeDeclarationToAffectationConverter.cpp b/tests/test_ASTNodeDeclarationToAffectationConverter.cpp index ddad4f876cd6fb7651c4086ad268609021f66b91..538d7cf8f190e1cf77df792534e1bd1044ba4dd9 100644 --- a/tests/test_ASTNodeDeclarationToAffectationConverter.cpp +++ b/tests/test_ASTNodeDeclarationToAffectationConverter.cpp @@ -27,6 +27,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeDeclarationToAffectationConverter", "[language]") { SECTION("nothing to convert") diff --git a/tests/test_ASTNodeEmptyBlockCleaner.cpp b/tests/test_ASTNodeEmptyBlockCleaner.cpp index 088f16d734e2c0320edf2c0bcdb11c91d4727ab1..5c8f34d849c0c8486f035d8a9d5d4e9a01dfe295 100644 --- a/tests/test_ASTNodeEmptyBlockCleaner.cpp +++ b/tests/test_ASTNodeEmptyBlockCleaner.cpp @@ -36,6 +36,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeEmptyBlockCleaner", "[language]") { SECTION("empty file") diff --git a/tests/test_ASTNodeExpressionBuilder.cpp b/tests/test_ASTNodeExpressionBuilder.cpp index 039c1b442f03ba0bd9b75ce100be02436d39eed0..63a285e0ffdfa83d4518a8ebbc524b4020324b91 100644 --- a/tests/test_ASTNodeExpressionBuilder.cpp +++ b/tests/test_ASTNodeExpressionBuilder.cpp @@ -43,6 +43,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeExpressionBuilder", "[language]") { SECTION("empty file") diff --git a/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp b/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp index 15ac9b35a920989c0d31a9e72b51f5e7aed25251..b0dc7609bac06a46d687f0409f7b18500994e829 100644 --- a/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionEvaluationExpressionBuilder.cpp @@ -36,6 +36,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeFunctionEvaluationExpressionBuilder", "[language]") { SECTION("C function evaluation") diff --git a/tests/test_ASTNodeFunctionExpressionBuilder.cpp b/tests/test_ASTNodeFunctionExpressionBuilder.cpp index e3de7085ef85284d03bd118c61cfcb0c1b93e939..1bf624e6a8bc110fabe80fa8a660d8c3b1fc0d2a 100644 --- a/tests/test_ASTNodeFunctionExpressionBuilder.cpp +++ b/tests/test_ASTNodeFunctionExpressionBuilder.cpp @@ -75,6 +75,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeFunctionExpressionBuilder", "[language]") { SECTION("return a B") diff --git a/tests/test_ASTNodeIncDecExpressionBuilder.cpp b/tests/test_ASTNodeIncDecExpressionBuilder.cpp index 4b5db89a3ccb18c15b1d43dae08c55d4b8a58af4..beb59ce2a1c70dd185998052809379606fc8dc8c 100644 --- a/tests/test_ASTNodeIncDecExpressionBuilder.cpp +++ b/tests/test_ASTNodeIncDecExpressionBuilder.cpp @@ -53,6 +53,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, expected_error); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeIncDecExpressionBuilder", "[language]") { SECTION("Pre-increment") diff --git a/tests/test_ASTNodeJumpPlacementChecker.cpp b/tests/test_ASTNodeJumpPlacementChecker.cpp index e81dab7b1fbb0fb53679e1e1d89028cd4ceca645..1d8b8937179535e8cdcad814bfaa2ba34e134214 100644 --- a/tests/test_ASTNodeJumpPlacementChecker.cpp +++ b/tests/test_ASTNodeJumpPlacementChecker.cpp @@ -7,6 +7,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeJumpPlacementChecker", "[language]") { SECTION("break") diff --git a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp index 73c3a6b62c17ce0c0c41aeb8c6cea496daceb081..bcb91c9340ffe163d872ac184bb1160aee3ead4d 100644 --- a/tests/test_ASTNodeListAffectationExpressionBuilder.cpp +++ b/tests/test_ASTNodeListAffectationExpressionBuilder.cpp @@ -54,6 +54,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeListAffectationExpressionBuilder", "[language]") { const std::string demangled_stdstring = demangle(typeid(std::string{}).name()); diff --git a/tests/test_ASTNodeListProcessor.cpp b/tests/test_ASTNodeListProcessor.cpp index 59787c7d98dc664f1d4f861484ebe7f6394508f8..7b1105a347a9e722a4d04d887891d7637d6435bf 100644 --- a/tests/test_ASTNodeListProcessor.cpp +++ b/tests/test_ASTNodeListProcessor.cpp @@ -11,6 +11,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeListProcessor", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_ASTNodeNaturalConversionChecker.cpp b/tests/test_ASTNodeNaturalConversionChecker.cpp index 75ef12957ef6489977f0505b7117a247f40aefeb..5202b437f1c6cd240ed6945edd2048986395f039 100644 --- a/tests/test_ASTNodeNaturalConversionChecker.cpp +++ b/tests/test_ASTNodeNaturalConversionChecker.cpp @@ -8,6 +8,8 @@ namespace language struct integer; } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeNaturalConversionChecker", "[language]") { SECTION("Valid conversions") diff --git a/tests/test_ASTNodeTypeCleaner.cpp b/tests/test_ASTNodeTypeCleaner.cpp index a48d0c01d4f3f79986575fb1ed868673d807139a..d899878769ab04002153e6ab4b31618f74d0b935 100644 --- a/tests/test_ASTNodeTypeCleaner.cpp +++ b/tests/test_ASTNodeTypeCleaner.cpp @@ -25,6 +25,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeTypeCleaner", "[language]") { SECTION("no declaration") diff --git a/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp b/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp index 3f86ac93a735c012027409e2cb9aed04f6a6fb75..e215f77da85626000285fe4a3adf31068f7b5331 100644 --- a/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp +++ b/tests/test_ASTNodeUnaryOperatorExpressionBuilder.cpp @@ -45,6 +45,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTNodeUnaryOperatorExpressionBuilder", "[language]") { SECTION("unary minus") diff --git a/tests/test_ASTPrinter.cpp b/tests/test_ASTPrinter.cpp index 1a6a97bf8960e1f2c3880d5b3453c6d2ac7af6d0..34203e49a404b9c739021e128fdeecf872f9a22b 100644 --- a/tests/test_ASTPrinter.cpp +++ b/tests/test_ASTPrinter.cpp @@ -22,6 +22,8 @@ REQUIRE(ast_output.str() == expected_output); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTPrinter", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_ASTSymbolInitializationChecker.cpp b/tests/test_ASTSymbolInitializationChecker.cpp index 4fc2699882a39f1afe09ff87d548938dd9b17ccb..7950a463c0916dca5af29599d30589b4dfba38d5 100644 --- a/tests/test_ASTSymbolInitializationChecker.cpp +++ b/tests/test_ASTSymbolInitializationChecker.cpp @@ -6,6 +6,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTSymbolInitializationChecker", "[language]") { SECTION("Declarative initialization") diff --git a/tests/test_ASTSymbolTableBuilder.cpp b/tests/test_ASTSymbolTableBuilder.cpp index 291b8213310d64dadadb95fc7aef4cb177c41928..0cbeb8b27a1dfbfb1944ff44a42f7372193196d7 100644 --- a/tests/test_ASTSymbolTableBuilder.cpp +++ b/tests/test_ASTSymbolTableBuilder.cpp @@ -5,6 +5,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTSymbolTableBuilder", "[language]") { SECTION("Build symbols") diff --git a/tests/test_AffectationProcessor.cpp b/tests/test_AffectationProcessor.cpp index 3a207f58d7b043d19b0042890a9ea991426aea6e..9da8e5b11e4da14cd5fa5b8d33032913b7d9b100 100644 --- a/tests/test_AffectationProcessor.cpp +++ b/tests/test_AffectationProcessor.cpp @@ -56,6 +56,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("AffectationProcessor", "[language]") { SECTION("Affectations") diff --git a/tests/test_AffectationToStringProcessor.cpp b/tests/test_AffectationToStringProcessor.cpp index 97722de320cacb3ddb1d11a4b77860ef4baac294..33a1866c4ff3bda2a387b5df359dd2f541269425 100644 --- a/tests/test_AffectationToStringProcessor.cpp +++ b/tests/test_AffectationToStringProcessor.cpp @@ -42,6 +42,8 @@ REQUIRE(value == expected_value); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ASTAffectationToStringProcessor", "[language]") { SECTION("Affectations") diff --git a/tests/test_Array.cpp b/tests/test_Array.cpp index 948cfb554216c41ea62a84c3b7632d986d167602..3b8dd45878d07747cae3b4e761266c8d9bf14293 100644 --- a/tests/test_Array.cpp +++ b/tests/test_Array.cpp @@ -14,6 +14,8 @@ // Instantiate to ensure full coverage is performed template class Array<int>; +// clazy:excludeall=non-pod-global-static + TEST_CASE("Array", "[utils]") { Array<int> a(10); diff --git a/tests/test_ArraySubscriptProcessor.cpp b/tests/test_ArraySubscriptProcessor.cpp index 0bd859c79a1eedbd51efc4335c06c535f7d8364c..539308e9ae3302ac3fffa730a0b4ebd4e3e33627 100644 --- a/tests/test_ArraySubscriptProcessor.cpp +++ b/tests/test_ArraySubscriptProcessor.cpp @@ -71,6 +71,8 @@ REQUIRE_THROWS_WITH(eval(), error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ArraySubscriptProcessor", "[language]") { SECTION("R^1 component access") diff --git a/tests/test_ArrayUtils.cpp b/tests/test_ArrayUtils.cpp index 6a7774e1de458a535db66af5000150fad820609e..fd34c4e00d34d0e83e60633effc7fe86bb78c048 100644 --- a/tests/test_ArrayUtils.cpp +++ b/tests/test_ArrayUtils.cpp @@ -7,6 +7,8 @@ #include <algebra/TinyMatrix.hpp> #include <algebra/TinyVector.hpp> +// clazy:excludeall=non-pod-global-static + // Instantiate to ensure full coverage is performed template class Array<int>; diff --git a/tests/test_BiCGStab.cpp b/tests/test_BiCGStab.cpp index a40fa8a4f9f9607ce7eea53b2c4a1c5685a4281d..b7cb2d3bd8afe280a7d8c416a662016851e0d820 100644 --- a/tests/test_BiCGStab.cpp +++ b/tests/test_BiCGStab.cpp @@ -3,6 +3,8 @@ #include <algebra/BiCGStab.hpp> #include <algebra/CRSMatrix.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BiCGStab", "[algebra]") { SECTION("no preconditionner") diff --git a/tests/test_BinaryExpressionProcessor_arithmetic.cpp b/tests/test_BinaryExpressionProcessor_arithmetic.cpp index e527d86e9b0f1236163b95429265bfb76d52fe2b..6b3f3bb07597b9d2f6704c117cc02ff6d02743a6 100644 --- a/tests/test_BinaryExpressionProcessor_arithmetic.cpp +++ b/tests/test_BinaryExpressionProcessor_arithmetic.cpp @@ -2,6 +2,8 @@ #include <test_BinaryExpressionProcessor_utils.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BinaryExpressionProcessor arithmetic", "[language]") { SECTION("+") diff --git a/tests/test_BinaryExpressionProcessor_comparison.cpp b/tests/test_BinaryExpressionProcessor_comparison.cpp index 4516a7505ac540062b7230108cd828cd318e4911..c74d73f919f557fc992812848e9eb7a9afa1fd31 100644 --- a/tests/test_BinaryExpressionProcessor_comparison.cpp +++ b/tests/test_BinaryExpressionProcessor_comparison.cpp @@ -2,6 +2,8 @@ #include <test_BinaryExpressionProcessor_utils.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BinaryExpressionProcessor comparison", "[language]") { SECTION("<") diff --git a/tests/test_BinaryExpressionProcessor_equality.cpp b/tests/test_BinaryExpressionProcessor_equality.cpp index ea6aa94d7905ea724966a8fa804f96afbb69ebf1..c7d526b97939bb64998bc6d8b961a2a042999de4 100644 --- a/tests/test_BinaryExpressionProcessor_equality.cpp +++ b/tests/test_BinaryExpressionProcessor_equality.cpp @@ -2,6 +2,8 @@ #include <test_BinaryExpressionProcessor_utils.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BinaryExpressionProcessor equality", "[language]") { SECTION("==") diff --git a/tests/test_BinaryExpressionProcessor_logic.cpp b/tests/test_BinaryExpressionProcessor_logic.cpp index 4548f38f9daf8392ff36819e4af3940674bcd343..f53d8557cc48551a9abe630c3bbda43aed9ae366 100644 --- a/tests/test_BinaryExpressionProcessor_logic.cpp +++ b/tests/test_BinaryExpressionProcessor_logic.cpp @@ -2,6 +2,8 @@ #include <test_BinaryExpressionProcessor_utils.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BinaryExpressionProcessor logic", "[language]") { SECTION("and") diff --git a/tests/test_BreakProcessor.cpp b/tests/test_BreakProcessor.cpp index c246ee8b8415984386fc5cb6c4aa8b226dfbe0d9..6cefebec47eb216847f1115406a3456d3ea2d421 100644 --- a/tests/test_BreakProcessor.cpp +++ b/tests/test_BreakProcessor.cpp @@ -4,6 +4,8 @@ #include <rang.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BreakProcessor", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_BuiltinFunctionEmbedder.cpp b/tests/test_BuiltinFunctionEmbedder.cpp index ae470052610ec28718d940596f293bb733c4ae55..dc8ff9081a42831d86c96ddebc264453b4c730a8 100644 --- a/tests/test_BuiltinFunctionEmbedder.cpp +++ b/tests/test_BuiltinFunctionEmbedder.cpp @@ -2,6 +2,8 @@ #include <language/BuiltinFunctionEmbedder.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BuiltinFunctionEmbedder", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_BuiltinFunctionEmbedderTable.cpp b/tests/test_BuiltinFunctionEmbedderTable.cpp index 78241990160c7477435d8b0dca25321772721945..2b14e92434a7a7497e5bf18ab81f2e5df63a049b 100644 --- a/tests/test_BuiltinFunctionEmbedderTable.cpp +++ b/tests/test_BuiltinFunctionEmbedderTable.cpp @@ -3,6 +3,8 @@ #include <language/BuiltinFunctionEmbedder.hpp> #include <language/EmbedderTable.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("BuiltinFunctionEmbedderTable", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_BuiltinFunctionProcessor.cpp b/tests/test_BuiltinFunctionProcessor.cpp index 587fa6ceb610ba44429a0a254c5d317715f3291b..c3870ba94446ae312af3708c63fc38e1afa194f9 100644 --- a/tests/test_BuiltinFunctionProcessor.cpp +++ b/tests/test_BuiltinFunctionProcessor.cpp @@ -37,7 +37,7 @@ \ using namespace Catch::Matchers; \ \ - REQUIRE_THAT(found, Predicate<bool>([](const bool& found) -> bool { return found; }, \ + REQUIRE_THAT(found, Predicate<bool>([](bool found) -> bool { return found; }, \ std::string{"Cannot find symbol '"} + variable_name + "'")); \ \ auto attributes = symbol->attributes(); \ @@ -46,6 +46,8 @@ REQUIRE(value == expected_value); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("BuiltinFunctionProcessor", "[language]") { SECTION("math module functions") @@ -255,7 +257,7 @@ let z:Z, z = round(-1.2); MathModule math_module; bool missing_test = false; - for (auto [function_name, builtin_function] : math_module.getNameBuiltinFunctionMap()) { + for (const auto& [function_name, builtin_function] : math_module.getNameBuiltinFunctionMap()) { if (tested_function_set.find(function_name) == tested_function_set.end()) { UNSCOPED_INFO("function '" << function_name << "' is NOT tested"); missing_test = true; diff --git a/tests/test_CRSMatrix.cpp b/tests/test_CRSMatrix.cpp index 651eb2350aa0fe95a4895a7ee257cd303486325e..7a7a943d14c943f5a315544fc6eab947ffc28463 100644 --- a/tests/test_CRSMatrix.cpp +++ b/tests/test_CRSMatrix.cpp @@ -5,6 +5,8 @@ // Instantiate to ensure full coverage is performed template class SparseMatrixDescriptor<int, uint8_t>; +// clazy:excludeall=non-pod-global-static + TEST_CASE("CRSMatrix", "[algebra]") { SECTION("matrix size") diff --git a/tests/test_ConcatExpressionProcessor.cpp b/tests/test_ConcatExpressionProcessor.cpp index 93b0df134e48d84053d5b96e3c259c8122ab67eb..ac8a2f94406b670631ab548d0305c91563a7a4ae 100644 --- a/tests/test_ConcatExpressionProcessor.cpp +++ b/tests/test_ConcatExpressionProcessor.cpp @@ -42,6 +42,8 @@ REQUIRE(value == expected_value); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ConcatExpressionProcessor", "[language]") { SECTION("string + string") diff --git a/tests/test_ContinueProcessor.cpp b/tests/test_ContinueProcessor.cpp index 0eaf7e1d1cad2129c7efe8e4369ff4470862d92f..0d4348b4558eaba1e7503601c4ee67bcbfa9ab00 100644 --- a/tests/test_ContinueProcessor.cpp +++ b/tests/test_ContinueProcessor.cpp @@ -4,6 +4,8 @@ #include <rang.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ContinueProcessor", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_DataVariant.cpp b/tests/test_DataVariant.cpp index a5f8ed5a07c95d5532d1d64993674420a632b571..590d394fb2b977d9fc53751923b73ffa9865736b 100644 --- a/tests/test_DataVariant.cpp +++ b/tests/test_DataVariant.cpp @@ -4,6 +4,8 @@ #include <sstream> +// clazy:excludeall=non-pod-global-static + TEST_CASE("DataVariant", "[language]") { SECTION("AggregateDataVariant") diff --git a/tests/test_DoWhileProcessor.cpp b/tests/test_DoWhileProcessor.cpp index 6fc7ec24f977d383331141874de48123bfbf29f6..228b38a6e92517ada281aab4093e89d90a09c150 100644 --- a/tests/test_DoWhileProcessor.cpp +++ b/tests/test_DoWhileProcessor.cpp @@ -52,6 +52,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("DoWhileProcessor", "[language]") { SECTION("simple loop") diff --git a/tests/test_ExecutionPolicy.cpp b/tests/test_ExecutionPolicy.cpp index 919f034f060024f03f79d1d068f6a2bea4984f4a..b293a64689492f7a85df579d0ac2af5df65a83f1 100644 --- a/tests/test_ExecutionPolicy.cpp +++ b/tests/test_ExecutionPolicy.cpp @@ -4,6 +4,8 @@ #include <rang.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ExecutionPolicy", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_FakeProcessor.cpp b/tests/test_FakeProcessor.cpp index 2043b18cf4dc2fe3a3e34674b0a59b56449807c4..cd5031db5049eac005ee921a45253ca833935b1a 100644 --- a/tests/test_FakeProcessor.cpp +++ b/tests/test_FakeProcessor.cpp @@ -5,6 +5,8 @@ #include <rang.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("FakeProcessor", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_ForProcessor.cpp b/tests/test_ForProcessor.cpp index e139981c258838875e8ea68c8533a73fd9a496b3..115d22c033467299808119190244f29216130309 100644 --- a/tests/test_ForProcessor.cpp +++ b/tests/test_ForProcessor.cpp @@ -52,6 +52,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ForProcessor", "[language]") { SECTION("simple for") diff --git a/tests/test_FunctionProcessor.cpp b/tests/test_FunctionProcessor.cpp index efa44cbc96d01304ae8d5dcf03ad799064ee5f4e..cca3bc054e6a33b074608c19c9fe1a8d5f7cd79c 100644 --- a/tests/test_FunctionProcessor.cpp +++ b/tests/test_FunctionProcessor.cpp @@ -45,6 +45,8 @@ REQUIRE(value == expected_value); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("FunctionProcessor", "[language]") { SECTION("Scalar functions") diff --git a/tests/test_FunctionTable.cpp b/tests/test_FunctionTable.cpp index 9309e2867949f3893927021bd3f15febf455d439..d056f072796e30f06135105e41a9ad93e2d66cdf 100644 --- a/tests/test_FunctionTable.cpp +++ b/tests/test_FunctionTable.cpp @@ -2,6 +2,8 @@ #include <language/FunctionTable.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("FunctionTable", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_INodeProcessor.cpp b/tests/test_INodeProcessor.cpp index 6e34caa106ae7c1d19d3446fb2beb2262afe5cb1..d1bbe63635edb9e1764656b2d7f55e76ffd0070f 100644 --- a/tests/test_INodeProcessor.cpp +++ b/tests/test_INodeProcessor.cpp @@ -5,6 +5,8 @@ #include <rang.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("INodeProcessor", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_IfProcessor.cpp b/tests/test_IfProcessor.cpp index f3d303ac98709d00fae171d77eff536d13436378..99eaa6342f5ad17730f77be8238e90a7ec30b61b 100644 --- a/tests/test_IfProcessor.cpp +++ b/tests/test_IfProcessor.cpp @@ -50,6 +50,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("IfProcessor", "[language]") { SECTION("simple if(true)") diff --git a/tests/test_IncDecExpressionProcessor.cpp b/tests/test_IncDecExpressionProcessor.cpp index 3cc699c75df004cfa8b02674e8370de96e063215..910e6cc56ca39da43373178069d4e04949bd6b50 100644 --- a/tests/test_IncDecExpressionProcessor.cpp +++ b/tests/test_IncDecExpressionProcessor.cpp @@ -40,6 +40,8 @@ REQUIRE(value == expected_value); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("IncDecExpressionProcessor", "[language]") { SECTION("pre ++") diff --git a/tests/test_ItemType.cpp b/tests/test_ItemType.cpp index 88e3ad877024f9c4ea4bd3304d8d3414f438abe0..98e5d5d114dc336fae48da0552b45b7661f5de89 100644 --- a/tests/test_ItemType.cpp +++ b/tests/test_ItemType.cpp @@ -3,6 +3,8 @@ #include <mesh/ItemType.hpp> #include <utils/PugsMacros.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("ItemType", "[connectivity]") { ItemType node_type = ItemType::node; diff --git a/tests/test_ListAffectationProcessor.cpp b/tests/test_ListAffectationProcessor.cpp index 59f848469946baca4e40af6066e890fb77ac3c34..bb5fd303a279f3617e1f444e2e95023955322fdb 100644 --- a/tests/test_ListAffectationProcessor.cpp +++ b/tests/test_ListAffectationProcessor.cpp @@ -69,6 +69,8 @@ REQUIRE_THROWS_WITH(ASTNodeExpressionBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("ListAffectationProcessor", "[language]") { SECTION("ListAffectations") diff --git a/tests/test_MathModule.cpp b/tests/test_MathModule.cpp index 64d885c3073d6cf647d21514a8e3850f40972ace..1adf3b825fd48a32a59b63402399a273b74f52aa 100644 --- a/tests/test_MathModule.cpp +++ b/tests/test_MathModule.cpp @@ -3,6 +3,8 @@ #include <language/BuiltinFunctionEmbedder.hpp> #include <language/MathModule.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("MathModule", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_NameProcessor.cpp b/tests/test_NameProcessor.cpp index 2c000c32b17cb760db1c35367b650000a8068e07..011e528d4e06950dd9344e14c65ee586913f2d8b 100644 --- a/tests/test_NameProcessor.cpp +++ b/tests/test_NameProcessor.cpp @@ -11,6 +11,8 @@ #include <pegtl/string_input.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("NameProcessor", "[language]") { rang::setControlMode(rang::control::Off); diff --git a/tests/test_OStreamProcessor.cpp b/tests/test_OStreamProcessor.cpp index 49c624106106ce8212b496b3b3960823440d53b1..017f1218af3f4d293d4da557d1714a5394da8daa 100644 --- a/tests/test_OStreamProcessor.cpp +++ b/tests/test_OStreamProcessor.cpp @@ -47,6 +47,8 @@ _replaceOStream(ASTNode& node, std::ostringstream& sout) REQUIRE(sout.str() == expected_value); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("OStreamProcessor", "[language]") { SECTION("cout") diff --git a/tests/test_PCG.cpp b/tests/test_PCG.cpp index d0939d327602f440af82d449c64fb329afa8a662..4b2f2df9bed4bec0ea31502be3c5480e1eec6989 100644 --- a/tests/test_PCG.cpp +++ b/tests/test_PCG.cpp @@ -3,6 +3,8 @@ #include <algebra/CRSMatrix.hpp> #include <algebra/PCG.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("PCG", "[algebra]") { SECTION("no preconditionner") diff --git a/tests/test_PugsAssert.cpp b/tests/test_PugsAssert.cpp index 9f155fc631173a0a4c6b2ca5cfffb2f55df3d52b..b28ee88148cb0a3c39eb897a86918b17dad2199b 100644 --- a/tests/test_PugsAssert.cpp +++ b/tests/test_PugsAssert.cpp @@ -4,6 +4,8 @@ #include <string> +// clazy:excludeall=non-pod-global-static + TEST_CASE("PugsAssert", "[utils]") { SECTION("checking for assert error") diff --git a/tests/test_RevisionInfo.cpp b/tests/test_RevisionInfo.cpp index e3becb6cbd3c7b60b2c92ccc7e24ae82573d217e..64c324c4d1eab11c763cd0cbd775370f7966bf9f 100644 --- a/tests/test_RevisionInfo.cpp +++ b/tests/test_RevisionInfo.cpp @@ -5,6 +5,8 @@ #include <utils/pugs_git_revision.hpp> #include <utils/pugs_version.hpp> +// clazy:excludeall=non-pod-global-static + TEST_CASE("RevisionInfo", "[utils]") { SECTION("checking pugs version") diff --git a/tests/test_SparseMatrixDescriptor.cpp b/tests/test_SparseMatrixDescriptor.cpp index 039ba08242013e339afb1a1ba37725a319603cb0..4e8b90134060c786cc7f97bc8fc8cd00bfba3257 100644 --- a/tests/test_SparseMatrixDescriptor.cpp +++ b/tests/test_SparseMatrixDescriptor.cpp @@ -7,6 +7,8 @@ // Instantiate to ensure full coverage is performed template class SparseMatrixDescriptor<int, uint8_t>; +// clazy:excludeall=non-pod-global-static + TEST_CASE("SparseMatrixDescriptor", "[algebra]") { SECTION("SparseRowDescriptor subclass") diff --git a/tests/test_SymbolTable.cpp b/tests/test_SymbolTable.cpp index 93623384fd7ed929df0cfc86aff3d5ce19888c4a..91154367855f678d82a20ddb57787cd73007f62b 100644 --- a/tests/test_SymbolTable.cpp +++ b/tests/test_SymbolTable.cpp @@ -7,6 +7,8 @@ #include <sstream> +// clazy:excludeall=non-pod-global-static + TEST_CASE("SymbolTable", "[language]") { SECTION("Simple Symbol Table") diff --git a/tests/test_TinyMatrix.cpp b/tests/test_TinyMatrix.cpp index d764a88fc83ccbfb683a7037cece1042eea0f265..e0d7ef39da53ae03358b307e448136d69216d1cf 100644 --- a/tests/test_TinyMatrix.cpp +++ b/tests/test_TinyMatrix.cpp @@ -13,6 +13,8 @@ template class TinyMatrix<2, int>; template class TinyMatrix<3, int>; template class TinyMatrix<4, double>; +// clazy:excludeall=non-pod-global-static + TEST_CASE("TinyMatrix", "[algebra]") { TinyMatrix<3, int> A(1, 2, 3, 4, 5, 6, 7, 8, 9); diff --git a/tests/test_TinyVector.cpp b/tests/test_TinyVector.cpp index f64e2da09b410a53c1549efd09602b959beef2ce..20f1f68be22f35b67a38d13d70b95e3fad188e08 100644 --- a/tests/test_TinyVector.cpp +++ b/tests/test_TinyVector.cpp @@ -8,6 +8,8 @@ template class TinyVector<1, int>; template class TinyVector<3, int>; +// clazy:excludeall=non-pod-global-static + TEST_CASE("TinyVector", "[algebra]") { TinyVector<3, int> v(1, 2, 3); diff --git a/tests/test_TupleToVectorProcessor.cpp b/tests/test_TupleToVectorProcessor.cpp index 68ab0de93ad27ff339e2ca1d4aa48f1e0150df16..20e7081ecea66ca45b0af8c78d166a5b81e46c12 100644 --- a/tests/test_TupleToVectorProcessor.cpp +++ b/tests/test_TupleToVectorProcessor.cpp @@ -69,6 +69,8 @@ REQUIRE_THROWS_WITH(eval(), error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("TupleToVectorProcessor", "[language]") { SECTION("Return tuple -> R^3") diff --git a/tests/test_UnaryExpressionProcessor.cpp b/tests/test_UnaryExpressionProcessor.cpp index 21152ee8ac4e944fe050da7c02e9a7ee61ab545e..728eed9ff1144c3b10e515f313d018fb2e43aca1 100644 --- a/tests/test_UnaryExpressionProcessor.cpp +++ b/tests/test_UnaryExpressionProcessor.cpp @@ -50,6 +50,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("UnaryExpressionProcessor", "[language]") { SECTION("unary minus") diff --git a/tests/test_Vector.cpp b/tests/test_Vector.cpp index 9b6730f0576233cd8c155a7328fbe6172a049e51..b52ac45232af6750d99cd3770e16c7da50679231 100644 --- a/tests/test_Vector.cpp +++ b/tests/test_Vector.cpp @@ -7,6 +7,8 @@ // Instantiate to ensure full coverage is performed template class Vector<int>; +// clazy:excludeall=non-pod-global-static + TEST_CASE("Vector", "[algebra]") { SECTION("size") diff --git a/tests/test_WhileProcessor.cpp b/tests/test_WhileProcessor.cpp index 6f0a5f3b1056da8e3d14261a4fa46aae88544366..325efedd0671f8953c11bb7d387940e854cbbac7 100644 --- a/tests/test_WhileProcessor.cpp +++ b/tests/test_WhileProcessor.cpp @@ -51,6 +51,8 @@ REQUIRE_THROWS_WITH(ASTNodeDataTypeBuilder{*ast}, error_message); \ } +// clazy:excludeall=non-pod-global-static + TEST_CASE("WhileProcessor", "[language]") { SECTION("simple loop")