LCOV - code coverage report
Current view: top level - src/mfem/auxkernels - MFEMDivAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 18 19 94.7 %
Date: 2025-08-08 20:01:16 Functions: 3 3 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             : #ifdef MOOSE_MFEM_ENABLED
      11             : 
      12             : #include "MFEMDivAux.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMDivAux);
      16             : 
      17             : InputParameters
      18        8662 : MFEMDivAux::validParams()
      19             : {
      20        8662 :   InputParameters params = MFEMAuxKernel::validParams();
      21        8662 :   params.addClassDescription(
      22             :       "Calculates the divergence of an H(div) conforming RT source variable and stores the result"
      23             :       " on an L2 conforming result auxvariable");
      24        8662 :   params.addRequiredParam<VariableName>("source",
      25             :                                         "Vector H(div) MFEMVariable to take the divergence of.");
      26        8662 :   params.addParam<mfem::real_t>("scale_factor", 1.0, "Factor to scale result auxvariable by.");
      27        8662 :   return params;
      28           0 : }
      29             : 
      30          16 : MFEMDivAux::MFEMDivAux(const InputParameters & parameters)
      31             :   : MFEMAuxKernel(parameters),
      32          16 :     _source_var_name(getParam<VariableName>("source")),
      33          16 :     _source_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_source_var_name)),
      34          16 :     _scale_factor(getParam<mfem::real_t>("scale_factor")),
      35          32 :     _div(_source_var.ParFESpace(), _result_var.ParFESpace())
      36             : {
      37          16 :   _div.Assemble();
      38          16 :   _div.Finalize();
      39          16 : }
      40             : 
      41             : // Computes the auxvariable.
      42             : void
      43          16 : MFEMDivAux::execute()
      44             : {
      45          16 :   _result_var = 0.0;
      46          16 :   _div.AddMult(_source_var, _result_var, _scale_factor);
      47          16 : }
      48             : 
      49             : #endif

Generated by: LCOV version 1.14