LCOV - code coverage report
Current view: top level - src/loops - ComputeNodalAuxBcsThread.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 27 33 81.8 %
Date: 2025-07-17 01:28:37 Functions: 5 15 33.3 %
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 "libmesh/threads.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "ComputeNodalAuxBcsThread.h"
      14             : #include "AuxiliarySystem.h"
      15             : #include "FEProblem.h"
      16             : #include "AuxKernel.h"
      17             : 
      18             : template <typename AuxKernelType>
      19       84051 : ComputeNodalAuxBcsThread<AuxKernelType>::ComputeNodalAuxBcsThread(
      20             :     FEProblemBase & fe_problem, const MooseObjectWarehouse<AuxKernelType> & storage)
      21             :   : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(fe_problem),
      22      168102 :     _aux_sys(fe_problem.getAuxiliarySystem()),
      23       84051 :     _storage(storage)
      24             : {
      25       84051 : }
      26             : 
      27             : // Splitting Constructor
      28             : template <typename AuxKernelType>
      29        7749 : ComputeNodalAuxBcsThread<AuxKernelType>::ComputeNodalAuxBcsThread(ComputeNodalAuxBcsThread & x,
      30             :                                                                   Threads::split split)
      31             :   : ThreadedNodeLoop<ConstBndNodeRange, ConstBndNodeRange::const_iterator>(x, split),
      32        7749 :     _aux_sys(x._aux_sys),
      33        7749 :     _storage(x._storage)
      34             : {
      35        7749 : }
      36             : 
      37             : template <typename AuxKernelType>
      38             : void
      39     6242401 : ComputeNodalAuxBcsThread<AuxKernelType>::onNode(ConstBndNodeRange::const_iterator & node_it)
      40             : {
      41     6242401 :   const BndNode * bnode = *node_it;
      42             : 
      43     6242401 :   BoundaryID boundary_id = bnode->_bnd_id;
      44             : 
      45     6242401 :   Node * node = bnode->_node;
      46             : 
      47     6242401 :   if (node->processor_id() == _fe_problem.processor_id())
      48             :   {
      49             :     // Get a map of all active block restricted AuxKernel objects
      50     4565130 :     const auto & kernels = _storage.getActiveBoundaryObjects(_tid);
      51             : 
      52             :     // Operate on the node BoundaryID only
      53     4565130 :     const auto iter = kernels.find(boundary_id);
      54     4565130 :     if (iter != kernels.end())
      55             :     {
      56     1411134 :       _fe_problem.reinitNodeFace(node, boundary_id, _tid);
      57             : 
      58    10049080 :       for (const auto & aux : iter->second)
      59             :       {
      60     8637946 :         aux->compute();
      61             :         // This is the same conditional check that the aux kernel performs internally before calling
      62             :         // computeValue and _var.setNodalValue. We don't want to attempt to insert into the solution
      63             :         // if we don't actually have any dofs on this node
      64     8637946 :         if (aux->variable().isNodalDefined())
      65     8637946 :           aux->variable().insert(_aux_sys.solution());
      66             :       }
      67             :     }
      68             :   }
      69     6242401 : }
      70             : 
      71             : template <typename AuxKernelType>
      72             : void
      73        7749 : ComputeNodalAuxBcsThread<AuxKernelType>::join(const ComputeNodalAuxBcsThread & /*y*/)
      74             : {
      75        7749 : }
      76             : 
      77             : template <typename AuxKernelType>
      78             : void
      79       91800 : ComputeNodalAuxBcsThread<AuxKernelType>::printGeneralExecutionInformation() const
      80             : {
      81       91800 :   if (!_fe_problem.shouldPrintExecution(_tid) || !_storage.hasActiveObjects())
      82       91800 :     return;
      83             : 
      84           0 :   const auto & console = _fe_problem.console();
      85           0 :   const auto & execute_on = _fe_problem.getCurrentExecuteOnFlag();
      86           0 :   console << "[DBG] Executing nodal auxiliary kernels on boundary nodes on " << execute_on
      87           0 :           << std::endl;
      88           0 :   console << "[DBG] Ordering of the kernels on each boundary they are defined on:" << std::endl;
      89             :   // TODO Check that all objects are active at this point
      90           0 :   console << _storage.activeObjectsToFormattedString() << std::endl;
      91             : }
      92             : 
      93             : template class ComputeNodalAuxBcsThread<AuxKernel>;
      94             : template class ComputeNodalAuxBcsThread<VectorAuxKernel>;
      95             : template class ComputeNodalAuxBcsThread<ArrayAuxKernel>;

Generated by: LCOV version 1.14