LCOV - code coverage report
Current view: top level - src/loops - ComputeJacobianBlocksThread.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 38 38 100.0 %
Date: 2025-07-17 01:28:37 Functions: 6 6 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 "ComputeJacobianBlocksThread.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "DGKernel.h"
      14             : #include "FEProblem.h"
      15             : #include "KernelBase.h"
      16             : #include "IntegratedBC.h"
      17             : 
      18             : #include "libmesh/threads.h"
      19             : #include "libmesh/dof_map.h"
      20             : 
      21         569 : ComputeJacobianBlocksThread::ComputeJacobianBlocksThread(FEProblemBase & fe_problem,
      22             :                                                          std::vector<JacobianBlock *> & blocks,
      23         569 :                                                          const std::set<TagID> & tags)
      24         569 :   : ComputeFullJacobianThread(fe_problem, tags), _blocks(blocks)
      25             : {
      26         569 : }
      27             : 
      28             : // Splitting Constructor
      29          57 : ComputeJacobianBlocksThread::ComputeJacobianBlocksThread(ComputeJacobianBlocksThread & x,
      30          57 :                                                          Threads::split split)
      31          57 :   : ComputeFullJacobianThread(x, split), _blocks(x._blocks)
      32             : {
      33          57 : }
      34             : 
      35         683 : ComputeJacobianBlocksThread::~ComputeJacobianBlocksThread() {}
      36             : 
      37             : void
      38       25016 : ComputeJacobianBlocksThread::postElement(const Elem * elem)
      39             : {
      40       25016 :   _dof_indices.clear();
      41             : 
      42       25016 :   Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
      43             : 
      44       90560 :   for (const auto & block : _blocks)
      45             :   {
      46       65544 :     const auto & dof_map = block->_precond_system.get_dof_map();
      47       65544 :     dof_map.dof_indices(elem, _dof_indices);
      48             : 
      49       65544 :     _fe_problem.addJacobianBlockTags(
      50       65544 :         block->_jacobian, block->_ivar, block->_jvar, dof_map, _dof_indices, _tags, _tid);
      51             :   }
      52       25016 : }
      53             : 
      54             : void
      55       87760 : ComputeJacobianBlocksThread::postInternalSide(const Elem * elem, unsigned int side)
      56             : {
      57       87760 :   if (_dg_warehouse->hasActiveBlockObjects(_subdomain, _tid))
      58             :   {
      59         672 :     _dof_indices.clear();
      60         672 :     _dof_neighbor_indices.clear();
      61             : 
      62             :     // Pointer to the neighbor we are currently working on.
      63         672 :     const Elem * neighbor = elem->neighbor_ptr(side);
      64             : 
      65         672 :     Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
      66             :     // Get the global id of the element and the neighbor
      67         672 :     const auto elem_id = elem->id(), neighbor_id = neighbor->id();
      68             : 
      69        1008 :     if ((neighbor->active() && (neighbor->level() == elem->level()) && (elem_id < neighbor_id)) ||
      70         336 :         (neighbor->level() < elem->level()))
      71        1680 :       for (const auto & block : _blocks)
      72             :       {
      73        1344 :         const auto & dof_map = block->_precond_system.get_dof_map();
      74        1344 :         dof_map.dof_indices(elem, _dof_indices);
      75        1344 :         dof_map.dof_indices(neighbor, _dof_neighbor_indices);
      76             : 
      77        1344 :         _fe_problem.addJacobianNeighbor(block->_jacobian,
      78        1344 :                                         block->_ivar,
      79        1344 :                                         block->_jvar,
      80             :                                         dof_map,
      81        1344 :                                         _dof_indices,
      82        1344 :                                         _dof_neighbor_indices,
      83             :                                         _tags,
      84             :                                         _tid);
      85             :       }
      86         672 :   }
      87       87760 : }

Generated by: LCOV version 1.14