LCOV - code coverage report
Current view: top level - src/kokkos/base - KokkosVariable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 6f668f Lines: 32 32 100.0 %
Date: 2025-09-22 20:01:15 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "KokkosVariable.h"
      11             : 
      12             : #include "SystemBase.h"
      13             : #include "FEProblemBase.h"
      14             : 
      15             : namespace Moose
      16             : {
      17             : namespace Kokkos
      18             : {
      19             : 
      20             : void
      21        7754 : Variable::init(const MooseVariableBase & variable, const TagName & tag_name)
      22             : {
      23        7754 :   init(variable, variable.sys().feProblem().getVectorTagID(tag_name));
      24        7754 : }
      25             : 
      26             : void
      27        7754 : Variable::init(const MooseVariableBase & variable, const TagID tag)
      28             : {
      29        7754 :   _coupled = true;
      30        7754 :   _components = variable.count();
      31        7754 :   _tag = tag;
      32             : 
      33        7754 :   _var.create(_components);
      34        7754 :   _sys.create(_components);
      35             : 
      36       15508 :   for (unsigned int comp = 0; comp < _components; ++comp)
      37             :   {
      38        7754 :     _var[comp] = variable.number() + comp;
      39        7754 :     _sys[comp] = variable.sys().number();
      40             :   }
      41             : 
      42        7754 :   _var.copyToDevice();
      43        7754 :   _sys.copyToDevice();
      44        7754 : }
      45             : 
      46             : void
      47         459 : Variable::init(const std::vector<const MooseVariableBase *> & variables,
      48             :                const TagID tag,
      49             :                CoupleableKey)
      50             : {
      51         459 :   _coupled = true;
      52         459 :   _components = variables.size();
      53         459 :   _tag = tag;
      54             : 
      55         459 :   _var.create(_components);
      56         459 :   _sys.create(_components);
      57             : 
      58         930 :   for (unsigned int comp = 0; comp < _components; ++comp)
      59             :   {
      60         471 :     _var[comp] = variables[comp]->number();
      61         471 :     _sys[comp] = variables[comp]->sys().number();
      62             :   }
      63             : 
      64         459 :   _var.copyToDevice();
      65         459 :   _sys.copyToDevice();
      66         459 : }
      67             : 
      68             : void
      69         226 : Variable::init(const std::vector<Real> & values, CoupleableKey)
      70             : {
      71         226 :   _coupled = false;
      72         226 :   _components = values.size();
      73             : 
      74         226 :   _default_value = values;
      75         226 : }
      76             : 
      77             : } // namespace Kokkos
      78             : } // namespace Moose

Generated by: LCOV version 1.14