LCOV - code coverage report
Current view: top level - src/interfaces - SurrogateModelInterface.C (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: #32971 (54bef8) with base c6cf66 Lines: 19 22 86.4 %
Date: 2026-05-29 20:40:35 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 "SurrogateModelInterface.h"
      11             : #include "SurrogateTrainer.h"
      12             : #include "SurrogateModel.h"
      13             : #include "SubProblem.h"
      14             : #include "MooseTypes.h"
      15             : 
      16             : InputParameters
      17        5769 : SurrogateModelInterface::validParams()
      18             : {
      19        5769 :   return emptyInputParameters();
      20             : }
      21             : 
      22        2602 : SurrogateModelInterface::SurrogateModelInterface(const MooseObject * moose_object)
      23        2602 :   : _smi_params(moose_object->parameters()),
      24        2602 :     _smi_feproblem(*_smi_params.get<FEProblemBase *>("_fe_problem_base")),
      25        2602 :     _smi_tid(_smi_params.have_parameter<THREAD_ID>("_tid") ? _smi_params.get<THREAD_ID>("_tid") : 0)
      26             : {
      27        2602 : }
      28             : 
      29             : template <>
      30             : SurrogateModel &
      31         624 : SurrogateModelInterface::getSurrogateModelByName(const UserObjectName & name) const
      32             : {
      33             :   std::vector<SurrogateModel *> models;
      34         624 :   _smi_feproblem.theWarehouse()
      35         624 :       .query()
      36         624 :       .condition<AttribName>(name)
      37         624 :       .condition<AttribSystem>("SurrogateModel")
      38             :       .queryInto(models);
      39         624 :   if (models.empty())
      40           0 :     mooseError("Unable to find a SurrogateModel object with the name '" + name + "'");
      41         624 :   return *(models[0]);
      42         624 : }
      43             : 
      44             : template <>
      45             : SurrogateModel &
      46          22 : SurrogateModelInterface::getSurrogateModel(const std::string & name) const
      47             : {
      48          22 :   return getSurrogateModelByName<SurrogateModel>(_smi_params.get<UserObjectName>(name));
      49             : }
      50             : 
      51             : template <>
      52             : SurrogateTrainerBase &
      53         646 : SurrogateModelInterface::getSurrogateTrainerByName(const UserObjectName & name) const
      54             : {
      55         646 :   return _smi_feproblem.getUserObject<SurrogateTrainerBase>(name);
      56             : }
      57             : 
      58             : template <>
      59             : SurrogateTrainerBase &
      60           0 : SurrogateModelInterface::getSurrogateTrainer(const std::string & name) const
      61             : {
      62           0 :   return getSurrogateTrainerByName<SurrogateTrainerBase>(_smi_params.get<UserObjectName>(name));
      63             : }

Generated by: LCOV version 1.14