LCOV - code coverage report
Current view: top level - include/vectorpostprocessors - OptimizationFunctionInnerProductHelper.h (source / functions) Hit Total Coverage
Test: idaholab/moose optimization: #31405 (292dce) with base fef103 Lines: 0 1 0.0 %
Date: 2025-09-04 07:54:57 Functions: 0 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             : #pragma once
      11             : 
      12             : // Standard library
      13             : #include <vector>
      14             : #include <memory>
      15             : 
      16             : // MOOSE includes
      17             : #include "MooseTypes.h"
      18             : 
      19             : // Forward Declarations
      20             : class FEProblemBase;
      21             : class OptimizationFunction;
      22             : class InputParameters;
      23             : 
      24           0 : class OptimizationFunctionInnerProductHelper
      25             : {
      26             : public:
      27             :   static InputParameters validParams();
      28             :   OptimizationFunctionInnerProductHelper(const InputParameters & parameters);
      29             : 
      30             : protected:
      31             :   /**
      32             :    * This function sets up member variables for the inner product accumulation at certain time.
      33             :    * The time step size is needed in order to calculate the actual simulation time (for adjoint
      34             :    * calculations)
      35             :    *
      36             :    * @param time Current simulation time, the actual time is computed via _reverse_time_end
      37             :    * @param dt The current time step size
      38             :    */
      39             :   void setCurrentTime(Real time, Real dt);
      40             : 
      41             :   /**
      42             :    * Accumulates integration for inner product by multiplying the given value
      43             :    * by the function's parameterGradient
      44             :    *
      45             :    * @param q_point The quadrature point location
      46             :    * @param q_inner_product The inner product value for the current quadrature point,
      47             :    *                        which is multiplied by the function parameter gradient.
      48             :    */
      49             :   void update(const Point & q_point, Real q_inner_product);
      50             : 
      51             :   /**
      52             :    * Accumulates inner product integration in _curr_time_ip vector from another object.
      53             :    * This is used for thread joining.
      54             :    */
      55             :   void add(const OptimizationFunctionInnerProductHelper & other);
      56             : 
      57             :   /**
      58             :    * Gathers _curr_time_ip from other processors and performs time integration
      59             :    * @param result Return vector of inner products
      60             :    */
      61             :   void getVector(std::vector<Real> & result);
      62             : 
      63             : private:
      64             :   /// FEProblem used for getting system quantities
      65             :   FEProblemBase & _ip_problem;
      66             : 
      67             :   /// Function used in optimization
      68             :   const OptimizationFunction * const _function;
      69             : 
      70             :   /// The final time when we want to reverse the time index in function evaluation
      71             :   const Real & _reverse_time_end;
      72             :   /// Time the simulation is at
      73             :   Real _simulation_time;
      74             :   /// Time the actual problem is at, defined by _reverse_time_end
      75             :   Real _actual_time;
      76             : 
      77             :   /// Vector holding data for each time
      78             :   std::vector<std::pair<Real, std::vector<Real>>> _time_ip;
      79             :   /// Vector for current time
      80             :   std::vector<Real> * _curr_time_ip = nullptr;
      81             : };

Generated by: LCOV version 1.14