LCOV - code coverage report
Current view: top level - src/vectorpostprocessors - GaussianProcessData.C (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: #32971 (54bef8) with base c6cf66 Lines: 21 22 95.5 %
Date: 2026-05-29 20:40:35 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             : // Stocastic Tools Includes
      11             : #include "GaussianProcessData.h"
      12             : 
      13             : registerMooseObject("StochasticToolsApp", GaussianProcessData);
      14             : 
      15             : InputParameters
      16         184 : GaussianProcessData::validParams()
      17             : {
      18         184 :   InputParameters params = GeneralVectorPostprocessor::validParams();
      19         184 :   params += SurrogateModelInterface::validParams();
      20         184 :   params.addClassDescription(
      21             :       "Tool for extracting hyperparameter data from gaussian process user object and "
      22             :       "storing in VectorPostprocessor vectors.");
      23         368 :   params.addRequiredParam<UserObjectName>("gp_name", "Name of GaussianProcess.");
      24         184 :   return params;
      25           0 : }
      26             : 
      27          91 : GaussianProcessData::GaussianProcessData(const InputParameters & parameters)
      28             :   : GeneralVectorPostprocessor(parameters),
      29             :     SurrogateModelInterface(this),
      30          91 :     _gp_surrogate(getSurrogateModel<GaussianProcessSurrogate>("gp_name"))
      31             : {
      32          91 : }
      33             : 
      34             : void
      35          91 : GaussianProcessData::initialize()
      36             : {
      37             :   const std::unordered_map<std::string, Real> & _hyperparam_map =
      38         182 :       _gp_surrogate.getGP().getHyperParamMap();
      39             :   const std::unordered_map<std::string, std::vector<Real>> & _hyperparam_vec_map =
      40             :       _gp_surrogate.getGP().getHyperParamVectorMap();
      41             : 
      42         308 :   for (auto iter = _hyperparam_map.begin(); iter != _hyperparam_map.end(); ++iter)
      43             :   {
      44         217 :     _hp_vector.push_back(&declareVector(iter->first));
      45         217 :     _hp_vector.back()->push_back(iter->second);
      46             :   }
      47         224 :   for (auto iter = _hyperparam_vec_map.begin(); iter != _hyperparam_vec_map.end(); ++iter)
      48             :   {
      49         133 :     std::vector<Real> vec = iter->second;
      50         392 :     for (unsigned int ii = 0; ii < vec.size(); ++ii)
      51             :     {
      52         777 :       _hp_vector.push_back(&declareVector(iter->first + std::to_string(ii)));
      53         259 :       _hp_vector.back()->push_back(vec[ii]);
      54             :     }
      55         133 :   }
      56          91 : }

Generated by: LCOV version 1.14