Skip to content

Commit

Permalink
More refactoring fixes
Browse files Browse the repository at this point in the history
 - CI: updated Qt build to Ubuntu 20, as 18 is deprecated by GH Actions
 - Separated logging and Eigen formatters, placed them into utility
   folder. This allows the UIs to include formatting of log messages
   without including Eigen
  • Loading branch information
GPMueller committed May 31, 2023
1 parent 1a04b92 commit b4ba087
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -300,7 +300,7 @@ jobs:
run: cmake --build . --config $BUILD_TYPE -j 2

build-ui-qt:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DSPIRIT_UI_USE_IMGUI=OFF -DSPIRIT_UI_CXX_USE_QT=ON
Expand Down
2 changes: 1 addition & 1 deletion core/include/io/Filter_File_Handle.hpp
Expand Up @@ -4,8 +4,8 @@

#include <engine/Vectormath_Defines.hpp>
#include <io/Fileformat.hpp>
#include <io/Formatters.hpp>
#include <utility/Exception.hpp>
#include <utility/Formatters_Eigen.hpp>
#include <utility/Logging.hpp>

#include <fmt/format.h>
Expand Down
14 changes: 14 additions & 0 deletions core/include/utility/Formatters_Eigen.hpp
@@ -0,0 +1,14 @@
#pragma once
#ifndef SPIRIT_CORE_FORMATTERS_EIGEN_HPP
#define SPIRIT_CORE_FORMATTERS_EIGEN_HPP

#include <Eigen/Core>

#include <fmt/ostream.h>

template<typename T>
struct fmt::formatter<T, std::enable_if_t<std::is_base_of_v<Eigen::DenseBase<T>, T>, char>> : ostream_formatter
{
};

#endif
@@ -1,22 +1,16 @@
#pragma once
#include <type_traits>
#ifndef SPIRIT_CORE_IO_TYPE_FORMATTERS_HPP
#define SPIRIT_CORE_IO_TYPE_FORMATTERS_HPP
#ifndef SPIRIT_CORE_FORMATTERS_LOGGING_HPP
#define SPIRIT_CORE_FORMATTERS_LOGGING_HPP

#include <utility/Exception.hpp>
#include <utility/Logging.hpp>

#include <Eigen/Core>

#include <fmt/chrono.h>
#include <fmt/color.h>
#include <fmt/ostream.h>

#include <iostream>

template<typename T>
struct fmt::formatter<T, std::enable_if_t<std::is_base_of_v<Eigen::DenseBase<T>, T>, char>> : ostream_formatter
{
};
#include <type_traits>

template<>
struct fmt::formatter<Utility::Log_Sender> : formatter<string_view>
Expand Down
2 changes: 1 addition & 1 deletion core/src/Spirit/Geometry.cpp
Expand Up @@ -4,8 +4,8 @@
#include <data/State.hpp>
#include <engine/Hamiltonian_Heisenberg.hpp>
#include <engine/Indexing.hpp>
#include <io/Formatters.hpp>
#include <utility/Exception.hpp>
#include <utility/Formatters_Eigen.hpp>
#include <utility/Logging.hpp>

#include <fmt/format.h>
Expand Down
2 changes: 1 addition & 1 deletion core/src/Spirit/Parameters_LLG.cpp
Expand Up @@ -2,9 +2,9 @@

#include <data/State.hpp>
#include <engine/Vectormath.hpp>
#include <io/Formatters.hpp>
#include <utility/Constants.hpp>
#include <utility/Exception.hpp>
#include <utility/Formatters_Eigen.hpp>
#include <utility/Logging.hpp>

#include <fmt/format.h>
Expand Down
2 changes: 1 addition & 1 deletion core/src/Spirit/Quantities.cpp
Expand Up @@ -5,9 +5,9 @@
#include <engine/Eigenmodes.hpp>
#include <engine/Manifoldmath.hpp>
#include <engine/Vectormath.hpp>
#include <io/Formatters.hpp>
#include <utility/Constants.hpp>
#include <utility/Exception.hpp>
#include <utility/Formatters_Eigen.hpp>
#include <utility/Logging.hpp>

#include <fmt/format.h>
Expand Down
2 changes: 1 addition & 1 deletion core/src/data/Geometry.cpp
Expand Up @@ -2,8 +2,8 @@
#include <engine/Indexing.hpp>
#include <engine/Neighbours.hpp>
#include <engine/Vectormath.hpp>
#include <io/Formatters.hpp>
#include <utility/Exception.hpp>
#include <utility/Formatters_Eigen.hpp>

#include <Eigen/Core>
#include <Eigen/Geometry>
Expand Down
2 changes: 1 addition & 1 deletion core/src/engine/Eigenmodes.cpp
@@ -1,7 +1,7 @@
#include <engine/Eigenmodes.hpp>
#include <engine/Manifoldmath.hpp>
#include <engine/Vectormath.hpp>
#include <io/Formatters.hpp>
#include <utility/Formatters_Eigen.hpp>
// #include <engine/Backend_par.hpp>

#include <Spectra/MatOp/SparseSymMatProd.h> // Also includes <Spectra/MatOp/DenseSymMatProd.h>
Expand Down
2 changes: 1 addition & 1 deletion core/src/engine/HTST.cpp
Expand Up @@ -4,8 +4,8 @@
#include <engine/Hamiltonian_Heisenberg.hpp>
#include <engine/Manifoldmath.hpp>
#include <engine/Vectormath.hpp>
#include <io/Formatters.hpp>
#include <utility/Constants.hpp>
#include <utility/Formatters_Eigen.hpp>
#include <utility/Logging.hpp>

#include <Eigen/Core>
Expand Down
2 changes: 1 addition & 1 deletion core/src/utility/Logging.cpp
@@ -1,6 +1,6 @@
#include <io/Formatters.hpp>
#include <io/IO.hpp>
#include <utility/Exception.hpp>
#include <utility/Formatters_Logging.hpp>
#include <utility/Logging.hpp>
#include <utility/Timing.hpp>

Expand Down
1 change: 1 addition & 0 deletions ui-cpp/ui-qt/src/DebugWidget.cpp
@@ -1,6 +1,7 @@
#include "DebugWidget.hpp"

///// TODO: Find a way around this...
#include <utility/Formatters_Logging.hpp>
#include <utility/Logging.hpp>
using Utility::Log_Level;
using Utility::Log_Sender;
Expand Down

0 comments on commit b4ba087

Please sign in to comment.