LCOV - code coverage report
Current view: top level - src/bcs - DirichletBCBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 15 16 93.8 %
Date: 2025-08-08 20:01:16 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 "DirichletBCBase.h"
      11             : 
      12             : InputParameters
      13      191712 : DirichletBCBase::validParams()
      14             : {
      15      191712 :   InputParameters params = NodalBC::validParams();
      16      575136 :   params.addParam<bool>(
      17      383424 :       "preset", true, "Whether or not to preset the BC (apply the value before the solve begins).");
      18      191712 :   return params;
      19           0 : }
      20             : 
      21       66354 : DirichletBCBase::DirichletBCBase(const InputParameters & parameters)
      22       66354 :   : NodalBC(parameters), _preset(getParam<bool>("preset"))
      23             : {
      24       66346 : }
      25             : 
      26             : void
      27     4270397 : DirichletBCBase::computeValue(NumericVector<Number> & current_solution)
      28             : {
      29             :   mooseAssert(_preset, "BC is not preset");
      30             : 
      31     4270397 :   if (_var.isNodalDefined())
      32             :   {
      33     4202612 :     const dof_id_type & dof_idx = _var.nodalDofIndex();
      34     4202612 :     current_solution.set(dof_idx, computeQpValue());
      35             :   }
      36     4270397 : }
      37             : 
      38             : Real
      39    54529170 : DirichletBCBase::computeQpResidual()
      40             : {
      41    54529170 :   return _u[_qp] - computeQpValue();
      42             : }

Generated by: LCOV version 1.14