LCOV - code coverage report
Current view: top level - python - dim.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 11 90.9 %
Date: 2024-11-17 01:47:58 Functions: 3 3 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 Jan-Lukas Wynen
       5             : 
       6             : #include <algorithm>
       7             : #include <iterator>
       8             : #include <vector>
       9             : 
      10             : #include "scipp/core/dimensions.h"
      11             : #include "scipp/units/dim.h"
      12             : 
      13       13159 : inline auto to_dim_type(const scipp::span<const std::string> dim_strings) {
      14       13159 :   std::vector<scipp::Dim> dims;
      15       13159 :   dims.reserve(dim_strings.size());
      16       13159 :   std::transform(begin(dim_strings), end(dim_strings), std::back_inserter(dims),
      17       16058 :                  [](const std::string &d) { return scipp::Dim{d}; });
      18       13159 :   return dims;
      19           0 : }
      20             : 
      21             : inline scipp::core::Dimensions
      22        3801 : make_dims(const scipp::span<const std::string> dim_strings,
      23             :           scipp::span<const scipp::index> shape) {
      24        3801 :   const auto dims = to_dim_type(dim_strings);
      25        7602 :   return scipp::core::Dimensions{dims, shape};
      26        3801 : }

Generated by: LCOV version 1.14