LCOV - code coverage report
Current view: top level - src/kokkos/materials - KokkosMaterial.K (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 863ef6 Lines: 62 63 98.4 %
Date: 2025-10-15 18:16:15 Functions: 5 5 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 "KokkosMaterial.h"
      11             : 
      12             : namespace Moose
      13             : {
      14             : namespace Kokkos
      15             : {
      16             : 
      17             : InputParameters
      18      128756 : Material::validParams()
      19             : {
      20      128756 :   InputParameters params = MaterialBase::validParams();
      21      128756 :   params += MaterialPropertyInterface::validParams();
      22      386268 :   params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
      23      128756 :   return params;
      24           0 : }
      25             : 
      26         952 : Material::Material(const InputParameters & parameters)
      27             :   : MaterialBase(parameters),
      28             :     Coupleable(this, false),
      29             :     MaterialPropertyInterface(this, blockIDs(), boundaryIDs()),
      30         766 :     _bnd(_material_data_type != Moose::BLOCK_MATERIAL_DATA),
      31         766 :     _neighbor(_material_data_type == Moose::NEIGHBOR_MATERIAL_DATA),
      32         770 :     _qrule(_bnd ? (_neighbor ? _subproblem.assembly(_tid, 0).qRuleNeighbor()
      33         260 :                              : _subproblem.assembly(_tid, 0).qRuleFace())
      34         766 :                 : _subproblem.assembly(_tid, 0).qRule())
      35             : {
      36        1108 :   for (auto coupled_var : getCoupledMooseVars())
      37         156 :     addMooseVariableDependency(coupled_var);
      38         952 : }
      39             : 
      40       37959 : Material::Material(const Material & object)
      41             :   : MaterialBase(object),
      42             :     Coupleable(object, {}),
      43             :     MaterialPropertyInterface(object, {}),
      44       30689 :     _bnd(object._bnd),
      45       30689 :     _neighbor(object._neighbor),
      46       30689 :     _qrule(object._qrule)
      47             : {
      48       37959 : }
      49             : 
      50             : void
      51         656 : Material::initStatefulProperties(unsigned int)
      52             : {
      53         656 :   if (!_bnd && !_neighbor)
      54             :   {
      55         216 :     if (!DispatcherRegistry::hasUserMethod<ElementInit>(type()))
      56          48 :       return;
      57             : 
      58         168 :     Policy policy(0, numKokkosElements());
      59             : 
      60         168 :     if (!_init_dispatcher)
      61         168 :       _init_dispatcher = DispatcherRegistry::build<ElementInit>(this, type());
      62             : 
      63         168 :     _init_dispatcher->parallelFor(policy);
      64         168 :   }
      65         440 :   else if (_bnd && !_neighbor)
      66             :   {
      67         224 :     if (!DispatcherRegistry::hasUserMethod<SideInit>(type()))
      68          46 :       return;
      69             : 
      70         178 :     Policy policy(0, numKokkosElementSides());
      71             : 
      72         178 :     if (!_init_dispatcher)
      73         178 :       _init_dispatcher = DispatcherRegistry::build<SideInit>(this, type());
      74             : 
      75         178 :     _init_dispatcher->parallelFor(policy);
      76         178 :   }
      77             :   else
      78             :   {
      79         216 :     if (!DispatcherRegistry::hasUserMethod<NeighborInit>(type()))
      80          48 :       return;
      81             : 
      82         168 :     Policy policy(0, numKokkosElementSides());
      83             : 
      84         168 :     if (!_init_dispatcher)
      85         168 :       _init_dispatcher = DispatcherRegistry::build<NeighborInit>(this, type());
      86             : 
      87         168 :     _init_dispatcher->parallelFor(policy);
      88         168 :   }
      89             : }
      90             : 
      91             : void
      92       36289 : Material::computeProperties()
      93             : {
      94       36289 :   if (!_bnd && !_neighbor)
      95             :   {
      96       11806 :     Policy policy(0, numKokkosElements());
      97             : 
      98       11806 :     if (!_compute_dispatcher)
      99         210 :       _compute_dispatcher = DispatcherRegistry::build<ElementCompute>(this, type());
     100             : 
     101       11806 :     _compute_dispatcher->parallelFor(policy);
     102       11806 :   }
     103       24483 :   else if (_bnd && !_neighbor)
     104             :   {
     105       12677 :     Policy policy(0, numKokkosElementSides());
     106             : 
     107       12677 :     if (!_compute_dispatcher)
     108         222 :       _compute_dispatcher = DispatcherRegistry::build<SideCompute>(this, type());
     109             : 
     110       12677 :     _compute_dispatcher->parallelFor(policy);
     111       12677 :   }
     112             :   else
     113             :   {
     114       11806 :     Policy policy(0, numKokkosElementSides());
     115             : 
     116       11806 :     if (!_compute_dispatcher)
     117         210 :       _compute_dispatcher = DispatcherRegistry::build<NeighborCompute>(this, type());
     118             : 
     119       11806 :     _compute_dispatcher->parallelFor(policy);
     120       11806 :   }
     121       36289 : }
     122             : 
     123             : } // namespace Kokkos
     124             : } // namespace Moose

Generated by: LCOV version 1.14