LCOV - code coverage report
Current view: top level - variable - operations.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 14 100.0 %
Date: 2024-11-24 01:48:31 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/core/element/geometric_operations.h"
       6             : #include "scipp/core/element/special_values.h"
       7             : #include "scipp/core/element/util.h"
       8             : #include "scipp/variable/creation.h"
       9             : #include "scipp/variable/misc_operations.h"
      10             : #include "scipp/variable/transform.h"
      11             : #include "scipp/variable/variable_concept.h"
      12             : 
      13             : #include "operations_common.h"
      14             : 
      15             : using namespace scipp::core;
      16             : 
      17             : namespace scipp::variable {
      18             : 
      19             : /// Return a deep copy of a Variable.
      20      284047 : Variable copy(const Variable &var) {
      21      568094 :   Variable out(empty_like(var));
      22      284047 :   out.set_aligned(var.is_aligned());
      23      284047 :   out.data().copy(var, out);
      24      284046 :   return out;
      25           1 : }
      26             : 
      27             : /// Copy variable to output variable.
      28      121812 : Variable &copy(const Variable &var, Variable &out) {
      29      121812 :   var.data().copy(var, out);
      30      121786 :   return out;
      31             : }
      32             : 
      33             : /// Copy variable to output variable.
      34       76230 : Variable copy(const Variable &var, Variable &&out) {
      35       76230 :   copy(var, out);
      36       76208 :   return std::move(out);
      37             : }
      38             : 
      39             : namespace geometry {
      40          11 : Variable position(const Variable &x, const Variable &y, const Variable &z) {
      41          11 :   return transform(x, y, z, element::geometry::position, "position");
      42             : }
      43             : } // namespace geometry
      44             : 
      45             : } // namespace scipp::variable

Generated by: LCOV version 1.14