LCOV - code coverage report
Current view: top level - variable - bin_array_variable.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 18 18 100.0 %
Date: 2024-04-28 01:25:40 Functions: 4 4 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             : #include "scipp/variable/bin_array_variable.tcc"
       6             : 
       7             : namespace scipp::variable::bin_array_variable_detail {
       8             : 
       9       15428 : std::tuple<Variable, scipp::index> contiguous_indices(const Variable &parent,
      10             :                                                       const Dimensions &dims) {
      11       15428 :   auto indices = Variable(parent, dims);
      12       15428 :   copy(parent, indices);
      13       15428 :   scipp::index size = 0;
      14      165857 :   for (auto &range : indices.values<scipp::index_pair>().as_span()) {
      15      150429 :     range.second += size - range.first;
      16      150429 :     range.first = size;
      17      150429 :     size = range.second;
      18             :   }
      19       30856 :   return std::tuple{indices, size};
      20       15428 : }
      21             : 
      22      182511 : const scipp::index_pair *index_pair_data(const Variable &indices) {
      23      182511 :   return indices.template values<scipp::index_pair>().data();
      24             : }
      25             : 
      26        4476 : scipp::index size_from_end_index(const Variable &end) {
      27        8952 :   return end.dims().volume() > 0 ? end.values<scipp::index>().as_span().back()
      28        8952 :                                  : 0;
      29             : }
      30             : 
      31           4 : VariableConceptHandle zero_indices(const scipp::index size) {
      32           8 :   return makeVariable<scipp::index_pair>(Dims{Dim::X}, Shape{size})
      33           8 :       .data_handle();
      34             : }
      35             : 
      36             : } // namespace scipp::variable::bin_array_variable_detail

Generated by: LCOV version 1.14