Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 5, 2024
1 parent 459c03d commit 8a7bd64
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 35 deletions.
4 changes: 2 additions & 2 deletions include/fastscapelib/eroders/diffusion_adi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ namespace fastscapelib


template <class G, class S>
auto diffusion_adi_eroder<G, S>::erode(const data_array_type& elevation, double dt)
-> const data_array_type&
auto diffusion_adi_eroder<G, S>::erode(const data_array_type& elevation,
double dt) -> const data_array_type&
{
// solve for rows
resize_tridiagonal(m_ncols);
Expand Down
6 changes: 3 additions & 3 deletions include/fastscapelib/flow/flow_router.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace fastscapelib
public:
single_flow_router() = default;
single_flow_router(int n_threads)
: m_threads_count(n_threads){};
: m_threads_count(n_threads) {};

inline std::string name() const noexcept override
{
Expand Down Expand Up @@ -70,7 +70,7 @@ namespace fastscapelib

public:
flow_operator_impl(std::shared_ptr<single_flow_router> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};

void apply(graph_impl_type& graph_impl,
data_array_type& elevation,
Expand Down Expand Up @@ -268,7 +268,7 @@ namespace fastscapelib
using thread_pool_type = thread_pool<size_type>;

flow_operator_impl(std::shared_ptr<multi_flow_router> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};

void apply(graph_impl_type& graph_impl,
data_array_type& elevation,
Expand Down
2 changes: 1 addition & 1 deletion include/fastscapelib/flow/flow_snapshot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace fastscapelib
using elevation_map = std::map<std::string, std::unique_ptr<data_array_type>>;

flow_operator_impl(std::shared_ptr<flow_snapshot> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};

void save(const FG& graph_impl,
graph_impl_map& graph_impl_snapshots,
Expand Down
4 changes: 2 additions & 2 deletions include/fastscapelib/flow/sink_resolver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace fastscapelib
using thread_pool_type = thread_pool<size_type>;

flow_operator_impl(std::shared_ptr<pflood_sink_resolver> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};

void apply(graph_impl_type& graph_impl,
data_array_type& elevation,
Expand Down Expand Up @@ -182,7 +182,7 @@ namespace fastscapelib
using thread_pool_type = thread_pool<size_type>;

flow_operator_impl(std::shared_ptr<mst_sink_resolver> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};

void apply(graph_impl_type& graph_impl,
data_array_type& elevation,
Expand Down
11 changes: 5 additions & 6 deletions include/fastscapelib/grid/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ namespace fastscapelib
typename neighbors_cache_type::template storage_type<grid_data_type>;

grid(std::size_t size)
: m_neighbors_indices_cache(neighbors_cache_type(size)){};
: m_neighbors_indices_cache(neighbors_cache_type(size)) {};
~grid() = default;

const derived_grid_type& derived_grid() const noexcept;
Expand Down Expand Up @@ -585,9 +585,8 @@ namespace fastscapelib
* @param neighbors_indices Reference to the container to be updated with the neighbors indices.
*/
template <class G>
inline auto grid<G>::neighbors_indices(const size_type& idx,
neighbors_indices_type& neighbors_indices)
-> neighbors_indices_type&
inline auto grid<G>::neighbors_indices(
const size_type& idx, neighbors_indices_type& neighbors_indices) -> neighbors_indices_type&
{
const auto& n_count = neighbors_count(idx);
const auto& n_indices = get_nb_indices_from_cache(idx);
Expand Down Expand Up @@ -647,8 +646,8 @@ namespace fastscapelib
* @param neighbors Reference to the vector to be updated with the neighbor objects.
*/
template <class G>
inline auto grid<G>::neighbors(const size_type& idx, neighbors_type& neighbors)
-> neighbors_type&
inline auto grid<G>::neighbors(const size_type& idx,
neighbors_type& neighbors) -> neighbors_type&
{
size_type n_idx;
const auto& n_count = neighbors_count(idx);
Expand Down
22 changes: 14 additions & 8 deletions include/fastscapelib/grid/raster_grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ namespace fastscapelib
* 5 6 7 3 4 2 3 4
*/
inline auto raster_neighbors<raster_connect::queen>::node_neighbors_offsets(
std::ptrdiff_t up, std::ptrdiff_t down, std::ptrdiff_t left, std::ptrdiff_t right) const
-> neighbors_offsets_type
std::ptrdiff_t up,
std::ptrdiff_t down,
std::ptrdiff_t left,
std::ptrdiff_t right) const -> neighbors_offsets_type
{
std::array<bool, 8> mask{
(up != 0 && left != 0), up != 0, (up != 0 && right != 0), left != 0, right != 0,
Expand Down Expand Up @@ -282,8 +284,10 @@ namespace fastscapelib
* 3 2 2
*/
inline auto raster_neighbors<raster_connect::rook>::node_neighbors_offsets(
std::ptrdiff_t up, std::ptrdiff_t down, std::ptrdiff_t left, std::ptrdiff_t right) const
-> neighbors_offsets_type
std::ptrdiff_t up,
std::ptrdiff_t down,
std::ptrdiff_t left,
std::ptrdiff_t right) const -> neighbors_offsets_type
{
std::array<bool, 4> mask{ up != 0, left != 0, right != 0, down != 0 };

Expand Down Expand Up @@ -359,8 +363,10 @@ namespace fastscapelib
* 2 3 1 0 1
*/
inline auto raster_neighbors<raster_connect::bishop>::node_neighbors_offsets(
std::ptrdiff_t up, std::ptrdiff_t down, std::ptrdiff_t left, std::ptrdiff_t right) const
-> neighbors_offsets_type
std::ptrdiff_t up,
std::ptrdiff_t down,
std::ptrdiff_t left,
std::ptrdiff_t right) const -> neighbors_offsets_type
{
std::array<bool, 4> mask{ (up != 0 && left != 0),
(up != 0 && right != 0),
Expand Down Expand Up @@ -932,8 +938,8 @@ namespace fastscapelib
* @return A vector of neighbor node objects.
*/
template <class S, raster_connect RC, class C>
inline auto raster_grid<S, RC, C>::neighbors(const size_type& row, const size_type& col)
-> neighbors_raster_type
inline auto raster_grid<S, RC, C>::neighbors(const size_type& row,
const size_type& col) -> neighbors_raster_type
{
neighbors_raster_type nb;
neighbors(row, col, nb);
Expand Down
6 changes: 2 additions & 4 deletions python/fastscapelib/flow/numba_flow_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ def visit_AugAssign(self, node: ast.AugAssign):


class NumbaJittedFunc(Protocol[P, R]):
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R:
...
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R: ...

def get_compile_result(self, sig: Any) -> Any:
...
def get_compile_result(self, sig: Any) -> Any: ...


# simplified type annotation for numba.experimental.jitclass decorated class
Expand Down
10 changes: 5 additions & 5 deletions python/src/flow_graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace fastscapelib

using basins_type = fixed_shape_container_t<xt_python_selector, size_type, 1>;

virtual ~flow_graph_impl_wrapper_base(){};
virtual ~flow_graph_impl_wrapper_base() {};

virtual bool single_flow() const = 0;

Expand Down Expand Up @@ -96,7 +96,7 @@ namespace fastscapelib
class flow_graph_impl_wrapper : public flow_graph_impl_wrapper_base
{
public:
virtual ~flow_graph_impl_wrapper(){};
virtual ~flow_graph_impl_wrapper() {};

flow_graph_impl_wrapper(const std::shared_ptr<FG>& graph_impl_ptr)
: m_graph_impl_ptr(graph_impl_ptr)
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace fastscapelib
template <class FG>
py_flow_graph_impl(const std::shared_ptr<FG>& graph_impl_ptr)
: m_wrapper_ptr(
std::make_unique<detail::flow_graph_impl_wrapper<FG>>(graph_impl_ptr)){};
std::make_unique<detail::flow_graph_impl_wrapper<FG>>(graph_impl_ptr)){};

bool single_flow() const
{
Expand Down Expand Up @@ -388,7 +388,7 @@ namespace fastscapelib
using shape_type = data_array_type::shape_type;
using data_array_size_type = dynamic_shape_container_t<xt_python_selector, size_type>;

virtual ~flow_graph_wrapper_base(){};
virtual ~flow_graph_wrapper_base() {};

virtual bool single_flow() const = 0;
virtual size_type size() const = 0;
Expand Down Expand Up @@ -442,7 +442,7 @@ namespace fastscapelib
= std::make_unique<py_flow_graph_impl>(m_snapshot_graph_ptr->impl_ptr());
}

virtual ~flow_graph_wrapper(){};
virtual ~flow_graph_wrapper() {};

bool single_flow() const
{
Expand Down
4 changes: 2 additions & 2 deletions test/test_flow_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace fastscapelib
using base_type = flow_operator_impl_base<FG, fake_operator>;

flow_operator_impl(std::shared_ptr<fake_operator> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};
};
}

Expand Down Expand Up @@ -91,7 +91,7 @@ namespace fastscapelib
using thread_pool_type = thread_pool<size_type>;

flow_operator_impl(std::shared_ptr<test_operator> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};

void apply(graph_impl_type& /*graph_impl*/,
data_array_type& elevation,
Expand Down
4 changes: 2 additions & 2 deletions test/test_flow_router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace fastscapelib
using base_type = flow_operator_impl<FG, multi_flow_router, flow_graph_fixed_array_tag>;

flow_operator_impl(std::shared_ptr<multi_flow_router_0> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};
};

template <class FG>
Expand All @@ -56,7 +56,7 @@ namespace fastscapelib
using base_type = flow_operator_impl<FG, multi_flow_router, flow_graph_fixed_array_tag>;

flow_operator_impl(std::shared_ptr<multi_flow_router_2> ptr)
: base_type(std::move(ptr)){};
: base_type(std::move(ptr)) {};
};
}

Expand Down

0 comments on commit 8a7bd64

Please sign in to comment.