LCOV - code coverage report
Current view: top level - src/userobjects - NodalAuxVariableUserObjectBasePD.C (source / functions) Hit Total Coverage
Test: idaholab/moose peridynamics: #31405 (292dce) with base fef103 Lines: 22 23 95.7 %
Date: 2025-09-04 07:55:08 Functions: 5 5 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 "NodalAuxVariableUserObjectBasePD.h"
      11             : #include "AuxiliarySystem.h"
      12             : #include "PeridynamicsMesh.h"
      13             : #include "MooseVariable.h"
      14             : 
      15             : InputParameters
      16          44 : NodalAuxVariableUserObjectBasePD::validParams()
      17             : {
      18          44 :   InputParameters params = ElementUserObjectBasePD::validParams();
      19          44 :   params.addClassDescription("Base class for computing value for nodal AuxVariable from elemental "
      20             :                              "information in a peridynamic model");
      21             : 
      22          88 :   params.addRequiredCoupledVar("variable", "Name of AuxVariable this userobject is acting on");
      23             : 
      24          44 :   return params;
      25           0 : }
      26             : 
      27          24 : NodalAuxVariableUserObjectBasePD::NodalAuxVariableUserObjectBasePD(
      28          24 :     const InputParameters & parameters)
      29          24 :   : ElementUserObjectBasePD(parameters), _var(getVar("variable", 0))
      30             : {
      31          24 : }
      32             : 
      33             : void
      34          76 : NodalAuxVariableUserObjectBasePD::initialize()
      35             : {
      36             :   std::vector<std::string> zero_vars;
      37          76 :   zero_vars.push_back(_var->name());
      38          76 :   _aux.zeroVariables(zero_vars);
      39             : 
      40          76 :   _aux.solution().close();
      41          76 : }
      42             : 
      43             : void
      44       28496 : NodalAuxVariableUserObjectBasePD::execute()
      45             : {
      46       85488 :   for (unsigned int i = 0; i < _nnodes; ++i)
      47             :   {
      48       56992 :     dof_id_type dof = _current_elem->node_ptr(i)->dof_number(_aux.number(), _var->number(), 0);
      49             : 
      50       56992 :     computeValue(i, dof);
      51             :   }
      52       28496 : }
      53             : 
      54             : void
      55          64 : NodalAuxVariableUserObjectBasePD::finalize()
      56             : {
      57          64 :   _aux.solution().close();
      58          64 : }

Generated by: LCOV version 1.14