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 "GeneralVectorPostprocessor.h" 13 : #include "BootstrapCalculators.h" 14 : 15 : /** 16 : * Compute several metrics for supplied VPP vectors. 17 : * 18 : * This class uses calculator objects defined in Statistics.h and is setup such that if a new 19 : * calculation is needed it can be added in Statistics.h without modification of this object. 20 : */ 21 : class Statistics : public GeneralVectorPostprocessor 22 : { 23 : public: 24 : static InputParameters validParams(); 25 : Statistics(const InputParameters & parameters); 26 : 27 : virtual void initialSetup() override; 28 : virtual void execute() override; 29 : 30 : /// Not used; all parallel computation is wrapped in the Statistics objects 31 : void initialize() override final; 32 168 : void finalize() override final {} 33 : 34 : protected: 35 : /// The selected statistics to compute 36 : const MultiMooseEnum & _compute_stats; 37 : 38 : /// Bootstrap Confidence Level method 39 : const MooseEnum & _ci_method; 40 : 41 : /// Confidence levels to compute (see computeLevels) 42 : const std::vector<Real> _ci_levels; 43 : 44 : /// Confidence level replicates 45 : const unsigned int _replicates; 46 : 47 : /// Confidence level seed 48 : const unsigned int _seed; 49 : 50 : /// The VPP vector that will hold the statistics identifiers 51 : VectorPostprocessorValue & _stat_type_vector; 52 : 53 : // The following vectors are sized to the number of statistics to be computed 54 : 55 : /// The VPP vectors being computed 56 : std::vector<VectorPostprocessorValue *> _stat_vectors; 57 : 58 : /// VPPs names to be computed from (Vectorpostprocessor name, vector name, is_distribute) 59 : std::vector<std::tuple<std::string, std::string, bool>> _compute_from_names; 60 : 61 : private: 62 : /** 63 : * Helper function for converting confidence levels given in (0, 0.5] into levels in (0, 1). 64 : * For example, levels_in = {0.05, 0.1, 0.5} converts to {0.05 0.1, 0.5, 0.9, 0.95}. 65 : * 66 : * This also performs error checking on the supplied "ci_levels". 67 : */ 68 : std::vector<Real> computeLevels(const std::vector<Real> & levels_in) const; 69 : };