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-04-28 01:25:40 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       12319 : inline auto to_dim_type(const scipp::span<const std::string> dim_strings) {
      14       12319 :   std::vector<scipp::Dim> dims;
      15       12319 :   dims.reserve(dim_strings.size());
      16       12319 :   std::transform(begin(dim_strings), end(dim_strings), std::back_inserter(dims),
      17       12047 :                  [](const std::string &d) { return scipp::Dim{d}; });
      18       12319 :   return dims;
      19           0 : }
      20             : 
      21             : inline scipp::core::Dimensions
      22        3701 : make_dims(const scipp::span<const std::string> dim_strings,
      23             :           scipp::span<const scipp::index> shape) {
      24        3701 :   const auto dims = to_dim_type(dim_strings);
      25        7402 :   return scipp::core::Dimensions{dims, shape};
      26        3701 : }

Generated by: LCOV version 1.14