Skip to content

Atomic lint numerical quadrature

hgratten requested to merge atomic_lint_num_quad into master

this merge request introduces the clang-tidied numerical quadrature chapter:

LectureCodes/NumQuad/*:

  • reordered includes as good practice (user header first, then system headers, ordered alphabetically
  • put functions in header files in a separate namespace if there are using directives, to avoid clutter in the global namespace and clarify dependencies in main files
  • introduced const wherever possible
  • avoided multiple declarations in a single line for readability
  • wrapped body statement of if-else, for, do while, and while in braces. increases readability and forgetting braces is a common source of bugs for students
  • explicitly casted integer types to double as a good practice to avoid e.g. unwanted integer divisions
  • avoided pointer arithmetic, instead used begin and end iterator for e.g. modern std::sort and std::find
  • removed cmake_minimum_required(VERSION 2.8), since the cmake version is better handled by the global CMakeLists.txt file
  • inlined functions in header file to avoid potential ODR (one-definition-rule) violations: since functions are defined directly in the header, including it from multiple translation units would cause multiple definitions, which inlining avoids by duplicating the definition per translation unit
  • avoided passing by value when passing by const reference is possible

LectureCodes/NumQuad/gaussquad/Eigen/gaussquad.hpp and LectureCodes/NumQuad/numquad/Eigen/gaussquad.hpp:

  • aligned struct QuadRule which is inefficient to access if not properly aligned (as good practice). the alignment is determined by the static checker

LectureCodes/NumQuad/numquad/Eigen/main.cpp:

  • added print error statements for chebychev and equidistant quadrature (next to gauss)

Merge request reports

Loading