https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MorrisReporter.h
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#pragma once
11
12#include "GeneralReporter.h"
13#include "VectorCalculators.h"
14
15#include "nlohmann/json.h"
16
18{
19public:
22
23 virtual void initialize() override final;
24
25 virtual void execute() override final {}
26 virtual void finalize() override final {}
27 virtual void store(nlohmann::json & json) const override;
28
29private:
33 template <typename DataType>
34 void declareValueHelper(const ReporterName & r_name);
35
38
40 const std::vector<Real> & _ci_levels;
41
43 const unsigned int & _ci_replicates;
44
46 const unsigned int & _ci_seed;
47
50};
51
52template <typename DataType>
54 std::map<std::string, std::pair<std::vector<DataType>, std::vector<std::vector<DataType>>>>;
55
56template <typename DataType>
57class MorrisReporterContext : public ReporterGeneralContext<MorrisState<DataType>>
58{
59public:
61 const MooseObject & producer,
63 Sampler & sampler,
64 const std::vector<DataType> & data);
65
67 const MooseObject & producer,
69 Sampler & sampler,
70 const std::vector<DataType> & data,
71 const MooseEnum & ci_method,
72 const std::vector<Real> & ci_levels,
73 unsigned int ci_replicates,
74 unsigned int ci_seed);
75
76 virtual void finalize() override;
77 virtual std::string type() const override
78 {
79 return "MorrisSensitivity<" + MooseUtils::prettyCppType<DataType>() + ">";
80 }
81
82private:
87 std::vector<DataType> computeElementaryEffects(const RealEigenMatrix & x,
88 const std::vector<DataType> & y) const;
89
92
94 const std::vector<DataType> & _data;
95
97 std::unique_ptr<StochasticTools::Calculator<std::vector<DataType>, DataType>> _mu_calc;
98 std::unique_ptr<StochasticTools::Calculator<std::vector<DataType>, DataType>> _mustar_calc;
99 std::unique_ptr<StochasticTools::Calculator<std::vector<DataType>, DataType>> _sig_calc;
100
102 std::unique_ptr<StochasticTools::BootstrapCalculator<std::vector<DataType>, DataType>>
104 std::unique_ptr<StochasticTools::BootstrapCalculator<std::vector<DataType>, DataType>>
106 std::unique_ptr<StochasticTools::BootstrapCalculator<std::vector<DataType>, DataType>>
108};
const std::vector< double > y
const std::vector< double > x
std::map< std::string, std::pair< std::vector< DataType >, std::vector< std::vector< DataType > > > > MorrisState
const InputParameters & parameters() const
std::unique_ptr< StochasticTools::BootstrapCalculator< std::vector< DataType >, DataType > > _ci_mustar_calc
std::unique_ptr< StochasticTools::Calculator< std::vector< DataType >, DataType > > _mu_calc
Storage for the Calculator object for the desired stat, this is created in constructor.
std::unique_ptr< StochasticTools::Calculator< std::vector< DataType >, DataType > > _mustar_calc
std::vector< DataType > computeElementaryEffects(const RealEigenMatrix &x, const std::vector< DataType > &y) const
Function for computing elementary effects for a single set of trajectories This is meant to be specia...
std::unique_ptr< StochasticTools::BootstrapCalculator< std::vector< DataType >, DataType > > _ci_sig_calc
std::unique_ptr< StochasticTools::BootstrapCalculator< std::vector< DataType >, DataType > > _ci_mu_calc
Storage for the BootstrapCalculator for the desired confidence interval calculations (optional)
virtual void finalize() override
std::unique_ptr< StochasticTools::Calculator< std::vector< DataType >, DataType > > _sig_calc
Sampler & _sampler
Morris sampler (don't need any specific functions, but should be this type)
const std::vector< DataType > & _data
Data used for the statistic calculation.
virtual std::string type() const override
virtual void store(nlohmann::json &json) const override
Sampler & _sampler
Morris sampler (don't need any specific functions, but should be this type)
bool _initialized
Whether or not initialize() has been called for reporter value declaration.
const unsigned int & _ci_seed
Random seed for producing CI replicates.
const unsigned int & _ci_replicates
Number of CI replicates to use in Bootstrap methods.
virtual void finalize() override final
virtual void initialize() override final
virtual void execute() override final
const std::vector< Real > & _ci_levels
CI levels to be computed.
static InputParameters validParams()
void declareValueHelper(const ReporterName &r_name)
Helper for adding Morris reporter values.
const ReporterState< T > & state() const