https://mooseframework.inl.gov
GaussianProcessData.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 
10 // Stocastic Tools Includes
11 #include "GaussianProcessData.h"
12 
13 registerMooseObject("StochasticToolsApp", GaussianProcessData);
14 
17 {
20  params.addClassDescription(
21  "Tool for extracting hyperparameter data from gaussian process user object and "
22  "storing in VectorPostprocessor vectors.");
23  params.addRequiredParam<UserObjectName>("gp_name", "Name of GaussianProcess.");
24  return params;
25 }
26 
28  : GeneralVectorPostprocessor(parameters),
30  _gp_surrogate(getSurrogateModel<GaussianProcessSurrogate>("gp_name"))
31 {
32 }
33 
34 void
36 {
37  const std::unordered_map<std::string, Real> & _hyperparam_map =
39  const std::unordered_map<std::string, std::vector<Real>> & _hyperparam_vec_map =
41 
42  for (auto iter = _hyperparam_map.begin(); iter != _hyperparam_map.end(); ++iter)
43  {
44  _hp_vector.push_back(&declareVector(iter->first));
45  _hp_vector.back()->push_back(iter->second);
46  }
47  for (auto iter = _hyperparam_vec_map.begin(); iter != _hyperparam_vec_map.end(); ++iter)
48  {
49  std::vector<Real> vec = iter->second;
50  for (unsigned int ii = 0; ii < vec.size(); ++ii)
51  {
52  _hp_vector.push_back(&declareVector(iter->first + std::to_string(ii)));
53  _hp_vector.back()->push_back(vec[ii]);
54  }
55  }
56 }
const StochasticTools::GaussianProcess & getGP() const
virtual void initialize() override
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
static InputParameters validParams()
const GaussianProcessSurrogate & _gp_surrogate
Reference to GaussianProcess.
VectorPostprocessorValue & declareVector(const std::string &vector_name)
std::vector< VectorPostprocessorValue * > _hp_vector
Vector of hyperparamater values.
const std::unordered_map< std::string, std::vector< Real > > & getHyperParamVectorMap() const
GaussianProcessData(const InputParameters &parameters)
Interface for objects that need to use samplers.
void addClassDescription(const std::string &doc_string)
registerMooseObject("StochasticToolsApp", GaussianProcessData)
static InputParameters validParams()
const std::unordered_map< std::string, Real > & getHyperParamMap() const