LCOV - code coverage report
Current view: top level - src/mfem/auxkernels - MFEMSumAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #31405 (292dce) with base fef103 Lines: 21 22 95.5 %
Date: 2025-09-04 07:52:05 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 "MFEMSumAux.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMSumAux);
      16             : 
      17             : InputParameters
      18        8676 : MFEMSumAux::validParams()
      19             : {
      20        8676 :   InputParameters params = MFEMAuxKernel::validParams();
      21       17352 :   params.addClassDescription(
      22             :       "Calculates the sum of two variables sharing an FE space, each optionally scaled by a real "
      23             :       "constant, and stores the result in a third.");
      24       34704 :   params.addRequiredParam<VariableName>("first_source_variable", "First variable to sum.");
      25       34704 :   params.addRequiredParam<VariableName>("second_source_variable", "Second variable to sum.");
      26       26028 :   params.addParam<mfem::real_t>(
      27       17352 :       "first_scale_factor", 1.0, "Factor to scale the first variable by prior to sum.");
      28       17352 :   params.addParam<mfem::real_t>(
      29       17352 :       "second_scale_factor", 1.0, "Factor to scale the second variable by prior to sum.");
      30        8676 :   return params;
      31           0 : }
      32             : 
      33          23 : MFEMSumAux::MFEMSumAux(const InputParameters & parameters)
      34             :   : MFEMAuxKernel(parameters),
      35          23 :     _v1_var_name(getParam<VariableName>("first_source_variable")),
      36          46 :     _v2_var_name(getParam<VariableName>("second_source_variable")),
      37          23 :     _v1_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_v1_var_name)),
      38          23 :     _v2_var(*getMFEMProblem().getProblemData().gridfunctions.Get(_v2_var_name)),
      39          46 :     _lambda1(getParam<mfem::real_t>("first_scale_factor")),
      40          69 :     _lambda2(getParam<mfem::real_t>("second_scale_factor"))
      41             : {
      42          23 : }
      43             : 
      44             : void
      45          23 : MFEMSumAux::execute()
      46             : {
      47             :   // result = lambda1 * v1 + lambda2 * v2
      48          23 :   add(_lambda1, _v1_var, _lambda2, _v2_var, _result_var);
      49          23 : }
      50             : 
      51             : #endif

Generated by: LCOV version 1.14