LCOV - code coverage report
Current view: top level - src/loops - ComputeJacobianForScalingThread.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31761 (28487c) with base 701993 Lines: 33 46 71.7 %
Date: 2025-11-11 13:51:07 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 "ComputeJacobianForScalingThread.h"
      11             : #include "MooseError.h"
      12             : #include "NonlinearSystemBase.h"
      13             : 
      14             : #include "libmesh/elem.h"
      15             : 
      16             : // C++
      17             : #include <cstring> // for "Jacobian" exception test
      18             : 
      19             : using namespace libMesh;
      20             : 
      21         602 : ComputeJacobianForScalingThread::ComputeJacobianForScalingThread(FEProblemBase & fe_problem,
      22         602 :                                                                  const std::set<TagID> & tags)
      23         602 :   : ComputeFullJacobianThread(fe_problem, tags)
      24             : {
      25         602 : }
      26             : 
      27             : // Splitting Constructor
      28          59 : ComputeJacobianForScalingThread::ComputeJacobianForScalingThread(
      29          59 :     ComputeJacobianForScalingThread & x, Threads::split split)
      30          59 :   : ComputeFullJacobianThread(x, split)
      31             : {
      32          59 : }
      33             : 
      34             : void
      35         661 : ComputeJacobianForScalingThread::operator()(const ConstElemRange & range,
      36             :                                             bool bypass_threading /*= false*/)
      37             : {
      38             :   try
      39             :   {
      40             :     try
      41             :     {
      42         661 :       ParallelUniqueId puid;
      43         661 :       _tid = bypass_threading ? 0 : puid.id;
      44             : 
      45         661 :       pre();
      46             : 
      47         661 :       _subdomain = Moose::INVALID_BLOCK_ID;
      48         661 :       _neighbor_subdomain = Moose::INVALID_BLOCK_ID;
      49         661 :       typename ConstElemRange::const_iterator el = range.begin();
      50       81554 :       for (el = range.begin(); el != range.end(); ++el)
      51             :       {
      52       80893 :         if (!keepGoing())
      53           0 :           break;
      54             : 
      55       80893 :         const Elem * elem = *el;
      56             : 
      57       80893 :         preElement(elem);
      58             : 
      59       80893 :         _old_subdomain = _subdomain;
      60       80893 :         _subdomain = elem->subdomain_id();
      61       80893 :         if (_subdomain != _old_subdomain)
      62         673 :           subdomainChanged();
      63             : 
      64       80893 :         onElement(elem);
      65             : 
      66       80893 :         postElement(elem);
      67             :       } // range
      68             : 
      69         661 :       post();
      70         661 :     }
      71           0 :     catch (MetaPhysicL::LogicError & e)
      72             :     {
      73           0 :       moose::translateMetaPhysicLError(e);
      74           0 :     }
      75           0 :     catch (std::exception & e)
      76             :     {
      77             :       // Continue if we find a libMesh degenerate map exception, but
      78             :       // just re-throw for any real error
      79           0 :       if (!strstr(e.what(), "Jacobian") && !strstr(e.what(), "singular") &&
      80           0 :           !strstr(e.what(), "det != 0"))
      81           0 :         throw;
      82             : 
      83           0 :       mooseException(
      84             :           "We caught a libMesh degeneracy exception in ComputeJacobianForScalingThread:\n",
      85             :           e.what());
      86           0 :     }
      87             :   }
      88           0 :   catch (MooseException & e)
      89             :   {
      90           0 :     caughtMooseException(e);
      91           0 :   }
      92         661 : }
      93             : 
      94             : void
      95       80893 : ComputeJacobianForScalingThread::computeOnElement()
      96             : {
      97       80893 :   if (_nl.offDiagonalsInAutoScaling())
      98         964 :     ComputeFullJacobianThread::computeOnElement();
      99             :   else
     100       79929 :     ComputeJacobianThread::computeOnElement();
     101       80893 : }

Generated by: LCOV version 1.14