https://mooseframework.inl.gov
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 
18 {
19  return emptyInputParameters();
20 }
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 
29 template <>
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 
44 template <>
47 {
48  return getSurrogateModelByName<SurrogateModel>(_smi_params.get<UserObjectName>(name));
49 }
50 
51 template <>
54 {
56 }
57 
58 template <>
61 {
62  return getSurrogateTrainerByName<SurrogateTrainerBase>(_smi_params.get<UserObjectName>(name));
63 }
const InputParameters & _smi_params
Parameters of the object with this interface.
T & getUserObject(const std::string &name, unsigned int tid=0) const
void mooseError(Args &&... args)
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
T & getSurrogateModelByName(const UserObjectName &name) const
Get a sampler with a given name.
FEProblemBase & _smi_feproblem
Reference to FEProblemBase instance.
T & getSurrogateModel(const std::string &name) const
Get a SurrogateModel/Trainer with a given name.
InputParameters emptyInputParameters()
TheWarehouse & theWarehouse() const
const std::string name
Definition: Setup.h:20
T & getSurrogateTrainer(const std::string &name) const
Query query()
T & getSurrogateTrainerByName(const UserObjectName &name) const
This is the base trainer class whose main functionality is the API for declaring model data...
static InputParameters validParams()
SurrogateModelInterface(const MooseObject *moose_object)
const Elem & get(const ElemType type_in)
unsigned int THREAD_ID