Skip to content

Commit

Permalink
fix: Add lbt folder to includes and adapt files to not use relative i…
Browse files Browse the repository at this point in the history
…ncludes, fix bug with initialization of testing fixtures
  • Loading branch information
2b-t committed Feb 25, 2024
1 parent 6995102 commit c953d43
Show file tree
Hide file tree
Showing 161 changed files with 409 additions and 415 deletions.
23 changes: 13 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
endif()

# Set compilation flags
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17) # The vast majority of code is written for C++17 but certain tests require C++20
set(CMAKE_CXX_STANDARD_REQUIRED True)
Expand Down Expand Up @@ -46,24 +45,26 @@ else()
message(WARNING "OpenMP not found: Multi-threading disabled!")
endif()

include_directories(
include
)

# Add executable
add_library(lbt_obj OBJECT
src/general/disclaimer.cpp
src/general/openmp_manager.cpp
src/general/timer.cpp
src/general/vtk_utilities.cpp
src/geometry/vtk_import.cpp
)
target_include_directories(lbt_obj PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

add_executable(lbt
$<TARGET_OBJECTS:lbt_obj>
src/main.cpp
)

# Link executable to libraries
target_include_directories(lbt PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set(LBT_LIBRARIES ${VTK_LIBRARIES} nlohmann_json::nlohmann_json)
if(OpenMP_CXX_FOUND)
set(LBT_LIBRARIES ${LBT_LIBRARIES} OpenMP::OpenMP_CXX)
Expand All @@ -79,7 +80,6 @@ include(GoogleTest)
if (NOT GTest_FOUND)
set(LBT_TEST_LIBRARIES ${LBT_LIBRARIES} gtest pthread)

# Add executable
add_library(lbt_test_obj OBJECT
test/constexpr_math/constexpr_math_test.cpp
test/continuum/simple_continuum_test.cpp
Expand Down Expand Up @@ -109,6 +109,10 @@ if (NOT GTest_FOUND)
test/converter_test.cpp
test/simulation_test.cpp
)
target_include_directories(lbt_test_obj PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
add_executable(run_lbt_tests
$<TARGET_OBJECTS:lbt_obj>
$<TARGET_OBJECTS:lbt_test_obj>
Expand All @@ -123,7 +127,6 @@ if (NOT GTest_FOUND)
)
set_tests_properties(${noArgsTests} PROPERTIES TIMEOUT 10)

# Link executable to libraries
target_link_libraries(lbt_test_obj ${LBT_TEST_LIBRARIES})
target_link_libraries(run_lbt_tests ${LBT_TEST_LIBRARIES})
else()
Expand Down
23 changes: 0 additions & 23 deletions include/constexpr_math/constexpr_math.hpp

This file was deleted.

16 changes: 0 additions & 16 deletions include/lattice/lattices.hpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define LBT_BASE_SIMULATION
#pragma once

#include "nlohmann/json.hpp"
#include <nlohmann/json.hpp>


namespace lbt {
Expand Down
23 changes: 23 additions & 0 deletions include/lbt/constexpr_math/constexpr_math.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* \file constexpr_math.hpp
* \mainpage A series of functions that can evaluate to a constant expression and thus
* can make use of evaluation and optimisation at compile time.
* \author Tobit Flatscher (github.com/2b-t)
*/

#ifndef LBT_CONSTEXPR_MATH
#define LBT_CONSTEXPR_MATH
#pragma once

#include "lbt/constexpr_math/detail/abs.hpp"
#include "lbt/constexpr_math/detail/ceil.hpp"
#include "lbt/constexpr_math/detail/exp.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal.hpp"
#include "lbt/constexpr_math/detail/log.hpp"
#include "lbt/constexpr_math/detail/mathematical_constants.hpp"
#include "lbt/constexpr_math/detail/pow.hpp"
#include "lbt/constexpr_math/detail/sqrt.hpp"

#endif // LBT_CONSTEXPR_MATH
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include <type_traits>

#include "is_inf.hpp"
#include "is_nan.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <limits>
#include <type_traits>

#include "is_inf.hpp"
#include "is_nan.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#include <limits>
#include <type_traits>

#include "abs.hpp"
#include "ceil.hpp"
#include "ipow.hpp"
#include "is_inf.hpp"
#include "is_nan.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "mathematical_constants.hpp"
#include "lbt/constexpr_math/detail/abs.hpp"
#include "lbt/constexpr_math/detail/ceil.hpp"
#include "lbt/constexpr_math/detail/ipow.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/mathematical_constants.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <limits>
#include <type_traits>

#include "is_inf.hpp"
#include "is_nan.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#define LBT_CEM_IS_ALMOST_EQUAL
#pragma once

#include "is_almost_equal_eps_abs.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_abs.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"

#if __cplusplus >= 202002L
/// Constexpr ULPS comparison only possible from C++20 onwards
#include "is_almost_equal_ulps.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_ulps.hpp"
#endif

#endif // LBT_CEM_IS_ALMOST_EQUAL
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <limits>
#include <type_traits>

#include "abs.hpp"
#include "lbt/constexpr_math/detail/abs.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <limits>
#include <type_traits>

#include "abs.hpp"
#include "lbt/constexpr_math/detail/abs.hpp"


namespace lbt {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#include <limits>
#include <type_traits>

#include "definitions.hpp"
#include "exp.hpp"
#include "is_inf.hpp"
#include "is_nan.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "mathematical_constants.hpp"
#include "lbt/constexpr_math/detail/definitions.hpp"
#include "lbt/constexpr_math/detail/exp.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/mathematical_constants.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
#include <limits>
#include <type_traits>

#include "exp.hpp"
#include "ipow.hpp"
#include "is_inf.hpp"
#include "is_nan.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "log.hpp"
#include "lbt/constexpr_math/detail/exp.hpp"
#include "lbt/constexpr_math/detail/ipow.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/log.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#include <limits>
#include <type_traits>

#include "definitions.hpp"
#include "is_inf.hpp"
#include "is_nan.hpp"
#include "is_almost_equal_eps_rel.hpp"
#include "lbt/constexpr_math/detail/definitions.hpp"
#include "lbt/constexpr_math/detail/is_inf.hpp"
#include "lbt/constexpr_math/detail/is_nan.hpp"
#include "lbt/constexpr_math/detail/is_almost_equal_eps_rel.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
#define LBT_CONTINUUM
#pragma once

#include "../general/use_vtk.hpp"
#include "lbt/general/use_vtk.hpp"

#ifdef LBT_USE_VTK
#include "vtk_continuum.hpp"
#include "lbt/continuum/vtk_continuum.hpp"

namespace lbt {
template <typename T>
using Continuum = VtkContinuum<T>;
}
#else
#include "simple_continuum.hpp"
#include "lbt/continuum/simple_continuum.hpp"

namespace lbt {
template <typename T>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <tuple>
#include <type_traits>

#include "../general/output_utilities.hpp"
#include "../general/type_definitions.hpp"
#include "continuum_base.hpp"
#include "lbt/continuum/continuum_base.hpp"
#include "lbt/general/output_utilities.hpp"
#include "lbt/general/type_definitions.hpp"


namespace lbt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define LBT_VTK_CONTINUUM
#pragma once

#include "../general/use_vtk.hpp"
#include "lbt/general/use_vtk.hpp"

#ifdef LBT_USE_VTK
#include <cassert>
Expand All @@ -22,9 +22,9 @@
#include <vtkPointData.h>
#include <vtkSmartPointer.h>

#include "../general/output_utilities.hpp"
#include "../general/vtk_utilities.hpp"
#include "continuum_base.hpp"
#include "lbt/general/output_utilities.hpp"
#include "lbt/general/vtk_utilities.hpp"
#include "lbt/continuum/continuum_base.hpp"


namespace lbt {
Expand Down
2 changes: 1 addition & 1 deletion include/converter.hpp → include/lbt/converter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define LBT_CONVERTER
#pragma once

#include "unit/units.hpp"
#include "lbt/unit/units.hpp"


namespace lbt {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define LBT_VTK_UTILITITES
#pragma once

#include "use_vtk.hpp"
#include "lbt/general/use_vtk.hpp"

#ifdef LBT_USE_VTK
#include <filesystem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define LBT_VTK_IMPORT
#pragma once

#include "../general/use_vtk.hpp"
#include "lbt/general/use_vtk.hpp"

#ifdef LBT_USE_VTK
#include <array>
Expand All @@ -23,7 +23,7 @@
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>

#include "../general/vtk_utilities.hpp"
#include "lbt/general/vtk_utilities.hpp"


namespace lbt {
Expand Down
4 changes: 2 additions & 2 deletions include/lattice/D2Q9.hpp → include/lbt/lattice/D2Q9.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <cstdint>
#include <type_traits>

#include "../constexpr_math/constexpr_math.hpp"
#include "../general/type_definitions.hpp"
#include "lbt/constexpr_math/constexpr_math.hpp"
#include "lbt/general/type_definitions.hpp"


namespace lbt {
Expand Down
Loading

0 comments on commit c953d43

Please sign in to comment.