Skip to content

Commit

Permalink
Apply pre-commit hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
fbriol committed Oct 23, 2024
1 parent 233e427 commit e850034
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 46 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-case-conflict
- id: check-docstring-first
Expand All @@ -14,13 +14,13 @@ repos:
exclude: docs/make.bat
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: "v3.16.0"
rev: "v3.19.0"
hooks:
- id: pyupgrade
args: [--py310-plus]
exclude: setup.py
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8
exclude: tests
Expand Down Expand Up @@ -58,12 +58,12 @@ repos:
exclude: "leap-seconds.txt"
args: [-L inout]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.8
rev: v19.1.2
hooks:
- id: clang-format
exclude: "(dataset.*json)$"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.13.0
hooks:
- id: mypy
exclude: docs
Expand Down
24 changes: 14 additions & 10 deletions include/fes/angle/astronomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,18 @@ class Astronomic {
/// @param[in] epoch Desired UTC time in seconds since 1970-01-01T00:00:00Z.
/// @param[in] leap_seconds The number of leap seconds since
/// 1970-01-01T00:00:00Z.
FES_MATH_CONSTEXPR auto schureman_order1(
const double epoch, const uint16_t leap_seconds) noexcept -> void;
FES_MATH_CONSTEXPR auto schureman_order1(const double epoch,
const uint16_t leap_seconds) noexcept
-> void;

/// Calculates the astronomic angles using the Schureman formulae.
///
/// @param[in] epoch Desired UTC time in seconds since 1970-01-01T00:00:00Z.
/// @param[in] leap_seconds The number of leap seconds since
/// 1970-01-01T00:00:00Z.
FES_MATH_CONSTEXPR auto schureman_order3(
const double epoch, const uint16_t leap_seconds) noexcept -> void;
FES_MATH_CONSTEXPR auto schureman_order3(const double epoch,
const uint16_t leap_seconds) noexcept
-> void;

/// Calculates the astronomic angles using the Meeus formulae.
///
Expand All @@ -396,8 +398,8 @@ class Astronomic {
/// @param[in] epoch UTC epoch
/// @param[in] leap_seconds The number of leap seconds since
/// 1970-01-01T00:00:00Z.
constexpr auto utc_2_tdt(const double epoch,
const uint16_t leap_seconds) -> double {
constexpr auto utc_2_tdt(const double epoch, const uint16_t leap_seconds)
-> double {
// Number of seconds to add to TAI to get Terrestrial Dynamical Time (TDT)
constexpr auto dynamic_time = 32.184;
return epoch + static_cast<double>(leap_seconds) + dynamic_time;
Expand Down Expand Up @@ -474,8 +476,9 @@ auto FES_MATH_CONSTEXPR Astronomic::schureman_order3(
}

// /////////////////////////////////////////////////////////////////////////////
FES_MATH_CONSTEXPR auto Astronomic::meeus(
const double epoch, const uint16_t leap_seconds) noexcept -> void {
FES_MATH_CONSTEXPR auto Astronomic::meeus(const double epoch,
const uint16_t leap_seconds) noexcept
-> void {
// Number of seconds elapsed since 2000-01-01T12:00:00Z (J2000) to epoch
constexpr auto j2000 = 946728000.0;
// Julian Ephemeris Millennium
Expand Down Expand Up @@ -518,8 +521,9 @@ FES_MATH_CONSTEXPR auto Astronomic::meeus(
-1.0 / 80053.0, 1.0 / 18999000.0);
}

auto FES_MATH_CONSTEXPR Astronomic::update(
const double epoch, const uint16_t leap_seconds) noexcept -> void {
auto FES_MATH_CONSTEXPR Astronomic::update(const double epoch,
const uint16_t leap_seconds) noexcept
-> void {
((*this).*update_)(epoch, leap_seconds);

// T mean solar angle relative to Greenwich
Expand Down
4 changes: 2 additions & 2 deletions include/fes/detail/geometry/algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace geometry {
/// @param[in] geometry2 The second geometry.
/// @return The distance between the two geometries.
template <typename Geometry1, typename Geometry2>
inline auto distance(const Geometry1& geometry1,
const Geometry2& geometry2) -> double {
inline auto distance(const Geometry1& geometry1, const Geometry2& geometry2)
-> double {
return boost::geometry::distance(geometry1, geometry2);
}

Expand Down
8 changes: 4 additions & 4 deletions include/fes/detail/grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ class Grid {

/// The index of the element at the given row and column if the grid is
/// stored in row-major order.
constexpr auto index_xy(const Eigen::Index x,
const Eigen::Index y) const -> Eigen::Index {
constexpr auto index_xy(const Eigen::Index x, const Eigen::Index y) const
-> Eigen::Index {
return x * ny_ + y;
}

/// The index of the element at the given row and column if the grid is
/// stored in column-major order.
constexpr auto index_yx(const Eigen::Index x,
const Eigen::Index y) const -> Eigen::Index {
constexpr auto index_yx(const Eigen::Index x, const Eigen::Index y) const
-> Eigen::Index {
return y * nx_ + x;
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/fes/detail/isviewstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class sviewbuf : public std::streambuf {
/// @param[in] sp The position to seek to.
/// @param[in] which The open mode.
/// @return The position in the buffer.
auto seekpos(pos_type sp,
std::ios_base::openmode which) -> pos_type override {
auto seekpos(pos_type sp, std::ios_base::openmode which)
-> pos_type override {
return seekoff(sp - pos_type(static_cast<off_type>(0)), std::ios_base::beg,
which);
}
Expand Down
4 changes: 2 additions & 2 deletions include/fes/detail/math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ constexpr auto sincosd(const T& x) noexcept -> std::tuple<T, T> {
template <typename T, typename std::enable_if<std::is_floating_point<T>::value,
T>::type* = nullptr>
constexpr auto is_almost_zero(
const T& a,
const T& epsilon = std::numeric_limits<T>::epsilon()) noexcept -> bool {
const T& a, const T& epsilon = std::numeric_limits<T>::epsilon()) noexcept
-> bool {
return std::fabs(a) < epsilon;
}

Expand Down
4 changes: 2 additions & 2 deletions include/fes/detail/serialize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ auto read_data(detail::isviewstream& ss) -> T {
/// @brief Write a string to a stringstream
/// @param[in] ss The stringstream to write to
/// @param[in] data The string to write
inline auto write_string(std::stringstream& ss,
const std::string& data) -> void {
inline auto write_string(std::stringstream& ss, const std::string& data)
-> void {
auto size = data.size();
write_data(ss, size);
ss.write(data.data(), data.size());
Expand Down
8 changes: 4 additions & 4 deletions include/fes/geometry/ecef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class EarthCenteredEarthFixed : public ecef_t {
inline auto z(const double z) { set<2>(z); }

/// Write the ECEF point to a stream.
friend auto operator<<(std::ostream& os,
const EarthCenteredEarthFixed& ecef) -> std::ostream&;
friend auto operator<<(std::ostream& os, const EarthCenteredEarthFixed& ecef)
-> std::ostream&;

/// Convert the point to a string representation.
explicit inline operator std::string() const {
Expand Down Expand Up @@ -143,8 +143,8 @@ namespace geometry {
/// @param[in,out] os The stream.
/// @param[in] ecef The ECEF point.
/// @return The stream.
inline auto operator<<(std::ostream& os,
const EarthCenteredEarthFixed& ecef) -> std::ostream& {
inline auto operator<<(std::ostream& os, const EarthCenteredEarthFixed& ecef)
-> std::ostream& {
os << "ECEF(" << ecef.x() << " " << ecef.y() << " " << ecef.z() << ")";
return os;
}
Expand Down
8 changes: 4 additions & 4 deletions include/fes/geometry/triangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ class Triangle : public triangle_t {
inline auto area() const -> double { return detail::geometry::area(*this); }

/// Write the triangle to a stream.
friend auto operator<<(std::ostream &os,
const Triangle &triangle) -> std::ostream &;
friend auto operator<<(std::ostream &os, const Triangle &triangle)
-> std::ostream &;

/// Convert the triangle to a string representation.
explicit operator std::string() const;
Expand Down Expand Up @@ -236,8 +236,8 @@ namespace geometry {
/// @param[in,out] os The stream.
/// @param[in] triangle The triangle.
/// @return The stream.
inline auto operator<<(std::ostream &os,
const Triangle &triangle) -> std::ostream & {
inline auto operator<<(std::ostream &os, const Triangle &triangle)
-> std::ostream & {
os << boost::geometry::wkt(triangle);
return os;
}
Expand Down
4 changes: 2 additions & 2 deletions include/fes/mesh/index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class Index : public std::enable_shared_from_this<Index> {
/// @param[in] point The point.
/// @param[in] max_distance The maximum distance to the nearest triangle.
/// @return The selected triangle.
auto search(const geometry::Point& point,
const double max_distance) const -> SelectedTriangle;
auto search(const geometry::Point& point, const double max_distance) const
-> SelectedTriangle;

/// Get the number of positions in the index
inline auto n_positions() const noexcept -> size_t { return lon_.size(); }
Expand Down
12 changes: 7 additions & 5 deletions include/fes/tide.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ static auto build_wave_table(const AbstractTidalModel<T>* const tidal_model,
/// spectrum (same units as the constituents).
/// - The quality of the interpolation (see Quality)
template <typename T>
inline auto evaluate_tide(
const AbstractTidalModel<T>* const tidal_model, const double epoch,
const uint16_t leap_seconds, const double longitude, const double latitude,
wave::Table& wave_table, wave::LongPeriodEquilibrium& long_period,
Accelerator* acc) -> std::tuple<double, double, Quality> {
inline auto evaluate_tide(const AbstractTidalModel<T>* const tidal_model,
const double epoch, const uint16_t leap_seconds,
const double longitude, const double latitude,
wave::Table& wave_table,
wave::LongPeriodEquilibrium& long_period,
Accelerator* acc)
-> std::tuple<double, double, Quality> {
// Update the astronomic angle used to evaluate the tidal constituents.
const auto& angles = acc->calculate_angle(epoch, leap_seconds);
// Adjusts nodal corrections to the tidal estimate date.
Expand Down
10 changes: 6 additions & 4 deletions include/fes/wave/table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,19 @@ class TableIterator : public std::iterator_traits<RangeType> {
/// @param[in] rhs iterator to compare
/// @returns true if the two iterators are equal
template <typename OtherRange, typename OtherRangeType>
constexpr auto operator==(const TableIterator<OtherRange, OtherRangeType>&
rhs) const noexcept -> bool {
constexpr auto operator==(
const TableIterator<OtherRange, OtherRangeType>& rhs) const noexcept
-> bool {
return it_ == rhs.base();
}

/// Tests if the iterator are different
/// @param[in] rhs iterator to compare
/// @returns true if the two iterators are different
template <typename OtherRange, typename OtherRangeType>
constexpr auto operator!=(const TableIterator<OtherRange, OtherRangeType>&
rhs) const noexcept -> bool {
constexpr auto operator!=(
const TableIterator<OtherRange, OtherRangeType>& rhs) const noexcept
-> bool {
return !(*this == rhs);
}

Expand Down

0 comments on commit e850034

Please sign in to comment.