LCOV - code coverage report
Current view: top level - src/mfem/postprocessors - MFEMVectorFEInnerProductIntegralPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 329044 Lines: 25 28 89.3 %
Date: 2026-08-03 21:12:22 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             : #ifdef MOOSE_MFEM_ENABLED
      11             : 
      12             : #include "MFEMVectorFEInnerProductIntegralPostprocessor.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMVectorFEInnerProductIntegralPostprocessor);
      16             : 
      17             : InputParameters
      18        2270 : MFEMVectorFEInnerProductIntegralPostprocessor::validParams()
      19             : {
      20        2270 :   InputParameters params = MFEMPostprocessor::validParams();
      21        2270 :   params += MFEMBlockRestrictable::validParams();
      22        4540 :   params.addClassDescription(
      23             :       "Calculates the integral of the inner product of two vector variables within a subdomain.");
      24        9080 :   params.addParam<MFEMScalarCoefficientName>(
      25             :       "coefficient", "1.", "Name of optional scalar coefficient to scale integrand by.");
      26        9080 :   MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
      27             :       params, "primal_variable", "Name of the first vector variable in the inner product.");
      28        6810 :   MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
      29             :       params, "dual_variable", "Name of the second vector variable in the inner product.");
      30        2270 :   return params;
      31           0 : }
      32             : 
      33          70 : MFEMVectorFEInnerProductIntegralPostprocessor::MFEMVectorFEInnerProductIntegralPostprocessor(
      34          70 :     const InputParameters & parameters)
      35             :   : MFEMPostprocessor(parameters),
      36             :     MFEMBlockRestrictable(
      37             :         parameters,
      38         210 :         getMFEMProblem().getMFEMVariableMesh(getParam<VariableName>("primal_variable"))),
      39         140 :     _primal_var(*getMFEMProblem().getGridFunction(getParam<VariableName>("primal_variable"))),
      40         210 :     _scaled_dual_var_coef(getScalarCoefficient("coefficient"),
      41         210 :                           getVectorCoefficientByName(getParam<VariableName>("dual_variable"))),
      42         280 :     _subdomain_integrator(_primal_var.ParFESpace())
      43             : {
      44          70 :   if (isSubdomainRestricted())
      45         140 :     _subdomain_integrator.AddDomainIntegrator(
      46          70 :         new mfem::VectorFEDomainLFIntegrator(_scaled_dual_var_coef), getSubdomainMarkers());
      47             :   else
      48           0 :     _subdomain_integrator.AddDomainIntegrator(
      49           0 :         new mfem::VectorFEDomainLFIntegrator(_scaled_dual_var_coef));
      50          70 : }
      51             : 
      52             : void
      53         126 : MFEMVectorFEInnerProductIntegralPostprocessor::execute()
      54             : {
      55         126 :   _subdomain_integrator.Assemble();
      56         126 :   _integral = _subdomain_integrator(_primal_var);
      57         126 : }
      58             : 
      59             : PostprocessorValue
      60         126 : MFEMVectorFEInnerProductIntegralPostprocessor::getValue() const
      61             : {
      62         126 :   return _integral;
      63             : }
      64             : 
      65             : #endif

Generated by: LCOV version 1.14