Skip to content

Draft: Migrate Nektar++ to use C++17 language features

Dave Moxey requested to merge dmoxey/nektar:feature/c++17 into master

Issue/feature addressed

Transitioning to a more modern C++ standard is important to improve interoperability with other libraries and application development. Furthermore, there are a number of boost libraries / capabilities which are now part of the standard and can reduce our dependence on Boost.

Proposed solution

This MR updates the source to use a number of C++17 features, including std::filesystem, std::thread, nested namespaces and aligned allocation.

Implementation

The following has been implemented:

  • Use clang-tidy to refactor nested namespaces and also fix places in the code where we have if statements without braces merged in !1556 (merged)
  • In the process of the above, a number of non-compiled files were detected and removed. PanditGilesDemir03.cpp cell model in CardiacEPSolver was re-added to compilation list. moved to !1672 (merged)
  • Replace boost::random with <random> merged in !1673 (merged)
  • Replace boost::filesystem with <filesystem>, or <experimental/filesystem> on older versions of gcc (minimum supported is now gcc 6). Added Filesystem.hpp to LibUtilities to give consistent definition of fs namespace. merged in !1674 (merged)
  • Use std::aligned_alloc and std::aligned_free instead of boost::alignment moved to !1675
  • A few places have replaced boost::ignore_unused with [[maybe_unused]] attribute. moved to !1684 (merged) and !1683 (merged) (and done throughout the library)
  • Replace boost::thread with <thread> moved to !1687 (merged)
  • Replace boost::system::errc with std::errc merged in !1674 (merged)

Tests

No new tests have been added, but existing ones are running through the pipeline.

Notes

Although the diff here is very large, most changes are very minor and related to the nested namespaces. Most changes in this branch focus on the LibUtilities library.

Checklist

  • Functions and classes, or changes to them, are documented.
    - [ ] User guide/documentation is updated.
  • Changelog is updated.
    - [ ] Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
    - [ ] License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).

Warning

On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master branch. To resolve these conflicts , see #295 (closed)

Edited by Dave Moxey

Merge request reports