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

Open 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.


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
  • 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.
  • Replace boost::random with <random>
  • 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.
  • Use std::aligned_alloc and std::aligned_free instead of boost::alignment
  • A few places have replaced boost::ignore_unused with [[maybe_unused]] attribute.
  • Replace boost::thread with <thread>
  • Replace boost::system::errc with std::errc


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


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.


  • 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).


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

Edited by Chris Cantwell

Merge request reports