LCOV - code coverage report
Current view: top level - dataset - bin_detail.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 4 100.0 %
Date: 2024-04-28 01:25:40 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: BSD-3-Clause
       2             : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
       3             : /// @file
       4             : /// @author Simon Heybrock
       5             : #pragma once
       6             : 
       7             : #include "scipp-dataset_export.h"
       8             : #include "scipp/variable/subspan_view.h"
       9             : #include "scipp/variable/variable.h"
      10             : 
      11             : namespace scipp::dataset::bin_detail {
      12             : 
      13       69390 : template <class T> Variable as_subspan_view(T &&binned) {
      14       69390 :   auto &&[indices, dim, buffer] = binned.template constituents<Variable>();
      15             :   if constexpr (std::is_const_v<std::remove_reference_t<T>>)
      16      138780 :     return subspan_view(std::as_const(buffer), dim, indices);
      17             :   else
      18             :     return subspan_view(buffer, dim, indices);
      19       69390 : }
      20             : 
      21             : void map_to_bins(Variable &out, const Variable &var, const Variable &offsets,
      22             :                  const Variable &indices);
      23             : 
      24             : Variable make_range(const scipp::index begin, const scipp::index end,
      25             :                     const scipp::index stride, const Dim dim);
      26             : 
      27             : void update_indices_by_binning(Variable &indices, const Variable &key,
      28             :                                const Variable &edges, const bool linspace);
      29             : void update_indices_by_grouping(Variable &indices, const Variable &key,
      30             :                                 const Variable &groups);
      31             : void update_indices_from_existing(Variable &indices, const Dim dim);
      32             : Variable bin_sizes(const Variable &sub_bin, const Variable &offset,
      33             :                    const Variable &nbin);
      34             : 
      35             : } // namespace scipp::dataset::bin_detail

Generated by: LCOV version 1.14