LCOV - code coverage report
Current view: top level - src/kokkos/base - KokkosVariable.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31653 (1b668c) with base bb0a08 Lines: 39 39 100.0 %
Date: 2025-11-03 17:02:13 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        9082 : Variable::init(const MooseVariableBase & variable, const TagName & tag_name)
      22             : {
      23        9082 :   init(variable, variable.sys().feProblem().getVectorTagID(tag_name));
      24        9082 : }
      25             : 
      26             : void
      27        9398 : Variable::init(const MooseVariableBase & variable, const TagID tag)
      28             : {
      29        9398 :   _initialized = true;
      30        9398 :   _coupled = true;
      31        9398 :   _nodal = variable.isNodal();
      32        9398 :   _components = variable.count();
      33        9398 :   _tag = tag;
      34             : 
      35        9398 :   _var.create(_components);
      36        9398 :   _sys.create(_components);
      37             : 
      38       18796 :   for (unsigned int comp = 0; comp < _components; ++comp)
      39             :   {
      40        9398 :     _var[comp] = variable.number() + comp;
      41        9398 :     _sys[comp] = variable.sys().number();
      42             :   }
      43             : 
      44        9398 :   _var.copyToDevice();
      45        9398 :   _sys.copyToDevice();
      46        9398 : }
      47             : 
      48             : void
      49         639 : Variable::init(const std::vector<const MooseVariableBase *> & variables,
      50             :                const TagID tag,
      51             :                CoupleableKey)
      52             : {
      53         639 :   _initialized = true;
      54         639 :   _coupled = true;
      55         639 :   _nodal = true;
      56         639 :   _components = variables.size();
      57         639 :   _tag = tag;
      58             : 
      59         639 :   _var.create(_components);
      60         639 :   _sys.create(_components);
      61             : 
      62        1290 :   for (unsigned int comp = 0; comp < _components; ++comp)
      63             :   {
      64         651 :     _nodal = _nodal && variables[comp]->isNodal();
      65             : 
      66         651 :     _var[comp] = variables[comp]->number();
      67         651 :     _sys[comp] = variables[comp]->sys().number();
      68             :   }
      69             : 
      70         639 :   _var.copyToDevice();
      71         639 :   _sys.copyToDevice();
      72         639 : }
      73             : 
      74             : void
      75         262 : Variable::init(const std::vector<Real> & values, CoupleableKey)
      76             : {
      77         262 :   _initialized = true;
      78         262 :   _coupled = false;
      79         262 :   _nodal = true;
      80         262 :   _components = values.size();
      81             : 
      82         262 :   _default_value = values;
      83         262 : }
      84             : 
      85             : } // namespace Kokkos
      86             : } // namespace Moose

Generated by: LCOV version 1.14