LCOV - code coverage report
Current view: top level - src/base - ResidualObject.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 99787a Lines: 34 37 91.9 %
Date: 2025-10-14 20:01: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     6106394 : ResidualObject::validParams()
      16             : {
      17     6106394 :   auto params = MooseObject::validParams();
      18     6106394 :   params += TransientInterface::validParams();
      19     6106394 :   params += RandomInterface::validParams();
      20     6106394 :   params += MeshChangedInterface::validParams();
      21     6106394 :   params += TaggingInterface::validParams();
      22             : 
      23    18319182 :   params.addRequiredParam<NonlinearVariableName>(
      24             :       "variable", "The name of the variable that this residual object operates on");
      25             : 
      26    18319182 :   params.declareControllable("enable");
      27     6106394 :   params.set<bool>("_residual_object") = true;
      28     6106394 :   return params;
      29           0 : }
      30             : 
      31      195681 : 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      195673 :     VectorPostprocessorInterface(this, getBase() == "ScalarKernel"),
      42             :     RandomInterface(parameters,
      43      782692 :                     *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"),
      44      195673 :                     parameters.get<THREAD_ID>("_tid"),
      45             :                     is_nodal),
      46      391346 :     Restartable(this, getBase() + "s"),
      47             :     MeshChangedInterface(parameters),
      48             :     TaggingInterface(this),
      49      586923 :     _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
      50      195641 :     _fe_problem(*parameters.get<FEProblemBase *>("_fe_problem_base")),
      51      782564 :     _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
      52      195641 :     _tid(parameters.get<THREAD_ID>("_tid")),
      53      195641 :     _assembly(_subproblem.assembly(_tid, _sys.number())),
      54     1565360 :     _mesh(_subproblem.mesh())
      55             : {
      56      195641 : }
      57             : 
      58             : #ifdef MOOSE_KOKKOS_ENABLED
      59      162146 : ResidualObject::ResidualObject(const ResidualObject & object,
      60      162146 :                                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      162146 :     _subproblem(object._subproblem),
      73      162146 :     _fe_problem(object._fe_problem),
      74      162146 :     _sys(object._sys),
      75      162146 :     _tid(object._tid),
      76      162146 :     _assembly(object._assembly),
      77      162146 :     _mesh(object._mesh)
      78             : {
      79      162146 : }
      80             : #endif
      81             : 
      82             : void
      83   146865754 : ResidualObject::prepareShapes(const unsigned int var_num)
      84             : {
      85   146865754 :   _subproblem.prepareShapes(var_num, _tid);
      86   146865754 : }
      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