LCOV - code coverage report
Current view: top level - src/materials - MaterialWarehouse.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 76 85 89.4 %
Date: 2026-07-23 16:15:30 Functions: 11 13 84.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       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             : // MOOSE includes
      11             : #include "MaterialWarehouse.h"
      12             : #include "MaterialBase.h"
      13             : 
      14             : void
      15       23266 : MaterialWarehouse::addObjects(std::shared_ptr<MaterialBase> block,
      16             :                               std::shared_ptr<MaterialBase> neighbor,
      17             :                               std::shared_ptr<MaterialBase> face,
      18             :                               THREAD_ID tid /*=0*/)
      19             : {
      20       23266 :   MooseObjectWarehouse<MaterialBase>::addObject(block, tid);
      21       23266 :   _neighbor_materials.addObject(neighbor, tid);
      22       23266 :   _face_materials.addObject(face, tid);
      23       23266 : }
      24             : 
      25             : const MooseObjectWarehouse<MaterialBase> &
      26    22792867 : MaterialWarehouse::operator[](Moose::MaterialDataType data_type) const
      27             : {
      28    22792867 :   switch (data_type)
      29             :   {
      30    10547145 :     case Moose::NEIGHBOR_MATERIAL_DATA:
      31    10547145 :       return _neighbor_materials;
      32             : 
      33    12243025 :     case Moose::FACE_MATERIAL_DATA:
      34    12243025 :       return _face_materials;
      35             : 
      36        2697 :     default:
      37        2697 :       return *this;
      38             :   }
      39             : }
      40             : 
      41             : void
      42        9262 : MaterialWarehouse::initialSetup(THREAD_ID tid /*=0*/) const
      43             : {
      44        9262 :   MooseObjectWarehouse<MaterialBase>::initialSetup(tid);
      45        9247 :   _neighbor_materials.initialSetup(tid);
      46        9247 :   _face_materials.initialSetup(tid);
      47        9247 : }
      48             : 
      49             : void
      50      296962 : MaterialWarehouse::timestepSetup(THREAD_ID tid /*=0*/) const
      51             : {
      52      296962 :   MooseObjectWarehouse<MaterialBase>::timestepSetup(tid);
      53      296962 :   _neighbor_materials.timestepSetup(tid);
      54      296962 :   _face_materials.timestepSetup(tid);
      55      296962 : }
      56             : 
      57             : void
      58           0 : MaterialWarehouse::subdomainSetup(THREAD_ID tid /*=0*/) const
      59             : {
      60           0 :   MooseObjectWarehouse<MaterialBase>::subdomainSetup(tid);
      61           0 :   _face_materials.subdomainSetup(tid);
      62           0 : }
      63             : 
      64             : void
      65           0 : MaterialWarehouse::neighborSubdomainSetup(THREAD_ID tid /*=0*/) const
      66             : {
      67           0 :   _neighbor_materials.subdomainSetup(tid);
      68           0 : }
      69             : 
      70             : void
      71     5097407 : MaterialWarehouse::subdomainSetup(SubdomainID id, THREAD_ID tid /*=0*/) const
      72             : {
      73     5097407 :   MooseObjectWarehouse<MaterialBase>::subdomainSetup(id, tid);
      74     5097407 :   _face_materials.subdomainSetup(id, tid);
      75     5097407 : }
      76             : 
      77             : void
      78    16557839 : MaterialWarehouse::neighborSubdomainSetup(SubdomainID id, THREAD_ID tid /*=0*/) const
      79             : {
      80    16557839 :   _neighbor_materials.subdomainSetup(id, tid);
      81    16557839 : }
      82             : 
      83             : void
      84     3367099 : MaterialWarehouse::residualSetup(THREAD_ID tid /*=0*/) const
      85             : {
      86     3367099 :   MooseObjectWarehouse<MaterialBase>::residualSetup(tid);
      87     3367099 :   _neighbor_materials.residualSetup(tid);
      88     3367099 :   _face_materials.residualSetup(tid);
      89     3367099 : }
      90             : 
      91             : void
      92      525483 : MaterialWarehouse::jacobianSetup(THREAD_ID tid /*=0*/) const
      93             : {
      94      525483 :   MooseObjectWarehouse<MaterialBase>::jacobianSetup(tid);
      95      525483 :   _neighbor_materials.jacobianSetup(tid);
      96      525483 :   _face_materials.jacobianSetup(tid);
      97      525483 : }
      98             : 
      99             : void
     100     1284514 : MaterialWarehouse::updateActive(THREAD_ID tid /*=0*/)
     101             : {
     102     1284514 :   MooseObjectWarehouse<MaterialBase>::updateActive(tid);
     103     1284514 :   _neighbor_materials.updateActive(tid);
     104     1284514 :   _face_materials.updateActive(tid);
     105     1284514 : }
     106             : 
     107             : void
     108       25022 : MaterialWarehouse::sort(THREAD_ID tid /*=0*/, bool sort_all_objects /*=false*/)
     109             : {
     110       25022 :   checkThreadID(tid);
     111             : 
     112       38643 :   for (auto & object_pair : _all_block_objects[tid])
     113       13626 :     sortHelper(object_pair.second);
     114       25778 :   for (auto & object_pair : _all_boundary_objects[tid])
     115         761 :     sortHelper(object_pair.second);
     116             : 
     117       34794 :   for (auto & object_pair : _neighbor_materials._all_block_objects[tid])
     118        9777 :     sortHelper(object_pair.second);
     119       25017 :   for (auto & object_pair : _neighbor_materials._all_boundary_objects[tid])
     120           0 :     sortHelper(object_pair.second);
     121             : 
     122       34794 :   for (auto & object_pair : _face_materials._all_block_objects[tid])
     123        9777 :     sortHelper(object_pair.second);
     124       25017 :   for (auto & object_pair : _face_materials._all_boundary_objects[tid])
     125           0 :     sortHelper(object_pair.second);
     126             : 
     127       25017 :   if (sort_all_objects)
     128             :   {
     129        6381 :     sortHelper(_all_objects[tid]);
     130        6381 :     sortHelper(_neighbor_materials._all_objects[tid]);
     131        6381 :     sortHelper(_face_materials._all_objects[tid]);
     132             :   }
     133             : 
     134       25017 :   updateActive(tid);
     135       25017 : }
     136             : 
     137             : void
     138      629210 : MaterialWarehouse::updateMatPropDependencyHelper(
     139             :     std::unordered_set<unsigned int> & needed_mat_props,
     140             :     const std::vector<std::shared_ptr<MaterialBase>> & materials,
     141             :     const bool producer_only) const
     142             : {
     143      629210 :   if (producer_only)
     144             :   {
     145       23139 :     std::unordered_set<unsigned int> consumer_needed_mat_props;
     146             : 
     147             :     do
     148             :     {
     149       26568 :       consumer_needed_mat_props = needed_mat_props;
     150             : 
     151       62547 :       for (auto & material : materials)
     152       79921 :         for (const auto prop : consumer_needed_mat_props)
     153       43942 :           if (material->getSuppliedPropIDs().count(prop))
     154             :           {
     155       32378 :             auto & mp_deps = material->getMatPropDependencies();
     156       32378 :             needed_mat_props.insert(mp_deps.begin(), mp_deps.end());
     157             :           }
     158             : 
     159       26568 :     } while (consumer_needed_mat_props.size() != needed_mat_props.size());
     160       23139 :   }
     161             :   else
     162      606071 :     MooseObjectWarehouseBase<MaterialBase>::updateMatPropDependencyHelper(
     163             :         needed_mat_props, materials, producer_only);
     164      629210 : }

Generated by: LCOV version 1.14