LCOV - code coverage report
Current view: top level - src/loops - GatherRCDataElementThread.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 28 28 100.0 %
Date: 2025-08-14 10:14:56 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://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             : #include "GatherRCDataElementThread.h"
      11             : #include "INSFVAttributes.h"
      12             : #include "INSFVMomentumResidualObject.h"
      13             : #include "FVElementalKernel.h"
      14             : #include "FVTimeKernel.h"
      15             : 
      16       92458 : GatherRCDataElementThread::GatherRCDataElementThread(FEProblemBase & fe_problem,
      17             :                                                      const unsigned int nl_sys_number,
      18       92458 :                                                      const std::vector<unsigned int> & vars)
      19       92458 :   : ThreadedElementLoop<ConstElemRange>(fe_problem), _nl_system_num(nl_sys_number), _vars(vars)
      20             : {
      21       92458 : }
      22             : 
      23             : // Splitting Constructor
      24       16270 : GatherRCDataElementThread::GatherRCDataElementThread(GatherRCDataElementThread & x,
      25       16270 :                                                      Threads::split split)
      26       16270 :   : ThreadedElementLoop<ConstElemRange>(x, split), _nl_system_num(x._nl_system_num), _vars(x._vars)
      27             : {
      28       16270 : }
      29             : 
      30             : void
      31      204752 : GatherRCDataElementThread::subdomainChanged()
      32             : {
      33             :   ThreadedElementLoop<ConstElemRange>::subdomainChanged();
      34             : 
      35      204752 :   _insfv_elemental_kernels.clear();
      36             : 
      37      204752 :   auto queries = _fe_problem.theWarehouse()
      38      204752 :                      .query()
      39      204752 :                      .template condition<AttribSystem>("FVElementalKernel")
      40      204752 :                      .template condition<AttribSysNum>(this->_nl_system_num)
      41      204752 :                      .template condition<AttribThread>(_tid)
      42      204752 :                      .template condition<AttribSubdomains>(_subdomain);
      43             : 
      44      609012 :   for (const auto var_num : _vars)
      45             :   {
      46             :     // We don't want to do cascading var num attributes or else the second time around we won't get
      47             :     // any results out of the query (e.g. an object cannot have a variable that simultaneously has
      48             :     // both var number 0 and 1)
      49      404260 :     auto copied_queries = queries;
      50             :     std::vector<FVElementalKernel *> var_eks;
      51      808520 :     copied_queries.template condition<AttribVar>(static_cast<int>(var_num)).queryInto(var_eks);
      52     1233308 :     for (auto var_ek : var_eks)
      53      829048 :       if (auto insfv_ek = dynamic_cast<INSFVMomentumResidualObject *>(var_ek))
      54      829048 :         _insfv_elemental_kernels.push_back(insfv_ek);
      55      404260 :   }
      56      204752 : }
      57             : 
      58             : void
      59    23203262 : GatherRCDataElementThread::onElement(const Elem * const elem)
      60             : {
      61             :   mooseAssert(elem && elem->subdomain_id() == _subdomain, "sub ids don't match");
      62             : 
      63   111139519 :   for (auto * const insfv_ek : _insfv_elemental_kernels)
      64    87936257 :     insfv_ek->gatherRCData(*elem);
      65    23203262 : }

Generated by: LCOV version 1.14