Skip to content

Commit

Permalink
#718: implement pressio-log as logger
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Jan 31, 2025
1 parent 49094d5 commit a21091d
Show file tree
Hide file tree
Showing 187 changed files with 168 additions and 33,877 deletions.
26 changes: 25 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ else()
set(PRESSIO_OPS_INCLUDE_DIR ${pressio-ops_SOURCE_DIR}/include)
endif()

# pull in pressio-log and read macros
#=====================================================================
if(PRESSIO_LOG_INCLUDE_DIR)
message("${Green}-- Using ${PRESSIO_LOG_INCLUDE_DIR}")
include_directories(SYSTEM ${PRESSIO_LOG_INCLUDE_DIR})

else()

include(FetchContent)
message("${Green}-- PRESSIO_LOG_INCLUDE_DIR is not defined, so fetching pressio-log...")

FetchContent_Declare(
pressio-log
GIT_REPOSITORY https://github.com/Pressio/pressio-log.git
GIT_TAG main
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
)

FetchContent_MakeAvailable(pressio-log)
set(PRESSIO_LOG_INCLUDE_DIR ${pressio-log_SOURCE_DIR}/include)

endif()

# versioning
#=====================================================================
# adapted from Eigen
Expand Down Expand Up @@ -74,7 +98,7 @@ if(PRESSIO_ENABLE_TESTS)

target_include_directories(
pressio INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${PRESSIO_OPS_INCLUDE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include;${PRESSIO_OPS_INCLUDE_DIR};${PRESSIO_LOG_INCLUDE_DIR}>"
)

enable_testing()
Expand Down
166 changes: 0 additions & 166 deletions docs/source/components/utils.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ open an issue on `github <https://github.com/Pressio/pressio>`_.
./components/ode
./components/nonlinsolvers
./components/linsolvers
./components/utils

.. toctree::
:caption: Miscellanea
Expand Down
2 changes: 1 addition & 1 deletion helper_scripts/fix_headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
PCK_REL_DIR=${PWD}/../include/pressio

# array of names
declare -a pcks=("utils" "solvers_linear" "solvers_nonlinear" "ode" "rom")
declare -a pcks=("solvers_linear" "solvers_nonlinear" "ode" "rom")

# loop over and fix he
for packName in ${pcks[@]}; do
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/ode/impl/ode_advance_to_target_time.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void to_target_time_with_step_size_policy(StepperType & stepper,
throw std::runtime_error("Violation of minimum time step while trying to recover time step");
}

PRESSIOLOG_CRITICAL("time step={} failed, retrying with dt={}", step, dt.get());
PRESSIOLOG_ERROR("time step={} failed, retrying with dt={}", step, dt.get());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/ode_advancers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include "pressio/mpl.hpp"
#include "pressio/type_traits.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"

#include "./ode_concepts.hpp"
#include "./ode/exceptions.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/ode_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./ode/ode_strong_types.hpp"
#include "./ode/ode_enum_and_tags.hpp"
#include "./ode/ode_stencil_containers.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/ode_steppers_explicit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers.hpp"
#include "./ode_concepts.hpp"
#include "./ode/exceptions.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/ode_steppers_implicit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers.hpp"
#include "./ode_concepts.hpp"
#include "./ode/exceptions.hpp"
Expand Down
27 changes: 1 addition & 26 deletions include/pressio/pressio_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,7 @@
#ifndef PRESSIO_MACROS_HPP_
#define PRESSIO_MACROS_HPP_

#include "pressio-log/core.hpp"
#include "pressio/ops_macros.hpp"

// ----------------------------------------
// logging macros
// ----------------------------------------
#define PRESSIO_LOG_LEVEL_TRACE 0
#define PRESSIO_LOG_LEVEL_DEBUG 1
#define PRESSIO_LOG_LEVEL_INFO 2
#define PRESSIO_LOG_LEVEL_WARN 3
#define PRESSIO_LOG_LEVEL_ERROR 4
#define PRESSIO_LOG_LEVEL_CRITICAL 5
#define PRESSIO_LOG_LEVEL_OFF 6

// if we are in debug mode, enable debug prints by default
#if !defined NDEBUG && !defined PRESSIO_ENABLE_DEBUG_PRINT
#define PRESSIO_ENABLE_DEBUG_PRINT
#endif

#if defined(PRESSIO_ENABLE_DEBUG_PRINT) && !defined(PRESSIO_LOG_ACTIVE_MIN_LEVEL)
// if DEBUG_PRINT is on but MIN_LEVEL off, then set min level to trace
#define PRESSIO_LOG_ACTIVE_MIN_LEVEL PRESSIO_LOG_LEVEL_TRACE
#elif !defined(PRESSIO_ENABLE_DEBUG_PRINT) && !defined(PRESSIO_LOG_ACTIVE_MIN_LEVEL)
// if DEBUG_PRINT=off and MIN_LEVEL=off, then set logging off
#define PRESSIO_LOG_ACTIVE_MIN_LEVEL PRESSIO_LOG_LEVEL_OFF
#else
//DEBUG_PRINT is off and LOG_ACTIVE_MIN_LEVEL=on, nothing to do
#endif

#endif
2 changes: 1 addition & 1 deletion include/pressio/rom_concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/rom_galerkin_steady.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/rom_galerkin_unsteady.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/rom_linear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/rom_lspg_steady.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/rom_lspg_unsteady.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/rom_subspaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "pressio/type_traits.hpp"
#include "pressio/ops.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "./solvers_linear.hpp"
#include "./solvers_nonlinear.hpp"
#include "./ode.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/pressio/solvers_linear.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include "pressio/mpl.hpp"
#include "pressio/type_traits.hpp"

#include "./utils.hpp"
#include "pressio-log/core.hpp"
#include "solvers_linear/solvers_linear_tags.hpp"
#include "solvers_linear/solvers_linear_solver.hpp"

Expand Down
Loading

0 comments on commit a21091d

Please sign in to comment.