LCOV - code coverage report
Current view: top level - src/base - ResidualObject.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31706 (f8ed4a) with base bb0a08 Lines: 34 37 91.9 %
Date: 2025-11-03 17:23:24 Functions: 4 5 80.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 "ResidualObject.h"
      11             : #include "FEProblemBase.h"
      12             : #include "InputParameters.h"
      13             : 
      14             : InputParameters
      15     6185009 : ResidualObject::validParams()
      16             : {
      17     6185009 :   auto params = MooseObject::validParams();
      18     6185009 :   params += TransientInterface::validParams();
      19     6185009 :   params += RandomInterface::validParams();
      20     6185009 :   params += MeshChangedInterface::validParams();
      21     6185009 :   params += TaggingInterface::validParams();
      22             : 
      23    18555027 :   params.addRequiredParam<NonlinearVariableName>(
      24             :       "variable", "The name of the variable that this residual object operates on");
      25             : 
      26    18555027 :   params.declareControllable("enable");
      27     6185009 :   params.set<bool>("_residual_object") = true;
      28     6185009 :   return params;
      29           0 : }
      30             : 
      31      196193 : ResidualObject::ResidualObject(const InputParameters & parameters, bool is_nodal)
      32             :   : MooseObject(parameters),
      33             :     SetupInterface(this),
      34             :     FunctionInterface(this),
      35             :     UserObjectInterface(this),
      36             :     TransientInterface(this),
      37             :     PostprocessorInterface(this),
      38             :     // VPPs used by ScalarKernels must be broadcast because we don't know where the
      39             :     // ScalarKernel will end up being evaluated
      40             :     // Note: residual objects should have a valid _moose_base.
      41      196185 :     VectorPostprocessorInterface(this, getBase() == "ScalarKernel"),
      42             :     RandomInterface(parameters,
      43      784740 :                     *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"),
      44      196185 :                     parameters.get<THREAD_ID>("_tid"),
      45             :                     is_nodal),
      46      392370 :     Restartable(this, getBase() + "s"),
      47             :     MeshChangedInterface(parameters),
      48             :     TaggingInterface(this),
      49      588459 :     _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
      50      196153 :     _fe_problem(*parameters.get<FEProblemBase *>("_fe_problem_base")),
      51      784612 :     _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
      52      196153 :     _tid(parameters.get<THREAD_ID>("_tid")),
      53      196153 :     _assembly(_subproblem.assembly(_tid, _sys.number())),
      54     1569456 :     _mesh(_subproblem.mesh())
      55             : {
      56      196153 : }
      57             : 
      58             : #ifdef MOOSE_KOKKOS_ENABLED
      59      160587 : ResidualObject::ResidualObject(const ResidualObject & object,
      60      160587 :                                const Moose::Kokkos::FunctorCopy & key)
      61             :   : MooseObject(object, key),
      62             :     SetupInterface(object, key),
      63             :     FunctionInterface(object, key),
      64             :     UserObjectInterface(object, key),
      65             :     TransientInterface(object, key),
      66             :     PostprocessorInterface(object, key),
      67             :     VectorPostprocessorInterface(object, key),
      68             :     RandomInterface(object, key),
      69             :     Restartable(object, key),
      70             :     MeshChangedInterface(object, key),
      71             :     TaggingInterface(object, key),
      72      160587 :     _subproblem(object._subproblem),
      73      160587 :     _fe_problem(object._fe_problem),
      74      160587 :     _sys(object._sys),
      75      160587 :     _tid(object._tid),
      76      160587 :     _assembly(object._assembly),
      77      160587 :     _mesh(object._mesh)
      78             : {
      79      160587 : }
      80             : #endif
      81             : 
      82             : void
      83   146915476 : ResidualObject::prepareShapes(const unsigned int var_num)
      84             : {
      85   146915476 :   _subproblem.prepareShapes(var_num, _tid);
      86   146915476 : }
      87             : 
      88             : void
      89           0 : ResidualObject::computeResidualAndJacobian()
      90             : {
      91           0 :   mooseError(
      92             :       "This object has not yet implemented 'computeResidualAndJacobian'. If you would like that "
      93             :       "feature for this object, please contact a MOOSE developer.");
      94             : }

Generated by: LCOV version 1.14