https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SurrogateModelInterface.C
Go to the documentation of this file.
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
11#include "SurrogateTrainer.h"
12#include "SurrogateModel.h"
13#include "SubProblem.h"
14#include "MooseTypes.h"
15
21
23 : _smi_params(moose_object->parameters()),
24 _smi_feproblem(*_smi_params.get<FEProblemBase *>("_fe_problem_base")),
25 _smi_tid(_smi_params.have_parameter<THREAD_ID>("_tid") ? _smi_params.get<THREAD_ID>("_tid") : 0)
26{
27}
28
29template <>
32{
33 std::vector<SurrogateModel *> models;
35 .query()
36 .condition<AttribName>(name)
37 .condition<AttribSystem>("SurrogateModel")
38 .queryInto(models);
39 if (models.empty())
40 mooseError("Unable to find a SurrogateModel object with the name '" + name + "'");
41 return *(models[0]);
42}
43
44template <>
47{
48 return getSurrogateModelByName<SurrogateModel>(_smi_params.get<UserObjectName>(name));
49}
50
51template <>
57
58template <>
61{
62 return getSurrogateTrainerByName<SurrogateTrainerBase>(_smi_params.get<UserObjectName>(name));
63}
InputParameters emptyInputParameters()
void mooseError(Args &&... args)
unsigned int THREAD_ID
const std::string name
Definition Setup.h:21
T & getUserObject(const std::string &name, unsigned int tid=0) const
TheWarehouse & theWarehouse() const
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
const InputParameters & _smi_params
Parameters of the object with this interface.
T & getSurrogateTrainer(const std::string &name) const
T & getSurrogateTrainerByName(const UserObjectName &name) const
FEProblemBase & _smi_feproblem
Reference to FEProblemBase instance.
SurrogateModelInterface(const MooseObject *moose_object)
static InputParameters validParams()
T & getSurrogateModel(const std::string &name) const
Get a SurrogateModel/Trainer with a given name.
T & getSurrogateModelByName(const UserObjectName &name) const
Get a sampler with a given name.
This is the base trainer class whose main functionality is the API for declaring model data.
Query query()