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 : #pragma once 11 : 12 : #include "Sampler.h" 13 : 14 : /** 15 : * A class used to generate samples for a direct perturbation analysis. 16 : */ 17 : class DirectPerturbationSampler : public Sampler 18 : { 19 : public: 20 : static InputParameters validParams(); 21 : 22 : DirectPerturbationSampler(const InputParameters & parameters); 23 : 24 : /// Return the requested perturbation method 25 960 : const MooseEnum & perturbationMethod() const { return _perturbation_method; } 26 : 27 : /// Return the absolute perturbation interval for a given index 28 : Real getAbsoluteInterval(const Real param_index) const; 29 : 30 : /// Return the relative perturbation interval for a given index 31 : Real getRelativeInterval(const Real param_index) const; 32 : 33 : /// Return the nominal value of the parameter 34 : Real getNominalValue(const Real param_index) const; 35 : 36 : protected: 37 : /// Return the sample for the given row and column 38 : virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override; 39 : 40 : private: 41 : /// The nominal values of the parameters 42 : const std::vector<Real> _nominal_values; 43 : 44 : /// The relative intervals that should be used for the perturbation of each parameter 45 : const std::vector<Real> _relative_intervals; 46 : 47 : /// The method which is used for the perturbation (one-sided/two-sided) 48 : const MooseEnum _perturbation_method; 49 : 50 : /// The data matrix created using the parameters 51 : std::vector<std::vector<Real>> _parameter_vectors; 52 : 53 : /// The intervals for the perturbations 54 : std::vector<Real> _absolute_intervals; 55 : };