LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - SideOptimizationFunctionInnerProduct.C (source / functions) Hit Total Coverage
Test: idaholab/moose optimization: #31405 (292dce) with base fef103 Lines: 21 25 84.0 %
Date: 2025-09-04 07:54:57 Functions: 5 6 83.3 %
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 "SideOptimizationFunctionInnerProduct.h"
      11             : 
      12             : InputParameters
      13          90 : SideOptimizationFunctionInnerProduct::validParams()
      14             : {
      15          90 :   InputParameters params = SideVectorPostprocessor::validParams();
      16          90 :   params += OptimizationFunctionInnerProductHelper::validParams();
      17         180 :   params.addRequiredCoupledVar(
      18             :       "variable", "Variable used for inner product calculation, usually the adjoint variable.");
      19          90 :   return params;
      20           0 : }
      21             : 
      22          45 : SideOptimizationFunctionInnerProduct::SideOptimizationFunctionInnerProduct(
      23          45 :     const InputParameters & parameters)
      24             :   : SideVectorPostprocessor(parameters),
      25             :     OptimizationFunctionInnerProductHelper(parameters),
      26          45 :     _var(coupledValue("variable")),
      27          90 :     _vec(declareVector("inner_product"))
      28             : {
      29          45 : }
      30             : 
      31             : void
      32         972 : SideOptimizationFunctionInnerProduct::initialize()
      33             : {
      34         972 :   setCurrentTime(_t, _dt);
      35         972 : }
      36             : 
      37             : void
      38       12960 : SideOptimizationFunctionInnerProduct::execute()
      39             : {
      40       38880 :   for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
      41             :   {
      42       25920 :     const Real q_inner_product = _JxW[_qp] * _coord[_qp] * computeQpInnerProduct();
      43       25920 :     update(_q_point[_qp], q_inner_product);
      44             :   }
      45       12960 : }
      46             : 
      47             : void
      48           0 : SideOptimizationFunctionInnerProduct::threadJoin(const UserObject & y)
      49             : {
      50             :   const auto & vpp = static_cast<const SideOptimizationFunctionInnerProduct &>(y);
      51           0 :   add(vpp);
      52           0 : }
      53             : 
      54             : void
      55         972 : SideOptimizationFunctionInnerProduct::finalize()
      56             : {
      57         972 :   getVector(_vec);
      58         972 : }

Generated by: LCOV version 1.14