LCOV - code coverage report
Current view: top level - include/samplers - SobolSampler.h (source / functions) Hit Total Coverage
Test: idaholab/moose stochastic_tools: f45d79 Lines: 1 1 100.0 %
Date: 2025-07-25 05:00:46 Functions: 0 0 -
Legend: Lines: hit not hit

          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 perform Monte Carlo sampling for performing Sobol sensitivity analysis.
      16             :  *
      17             :  * The created matrices are stacked in the following order, following the nomenclature from
      18             :  * Saltelli (2002), "Making best use of model evaluations to compute sensitivity indices"
      19             :  *
      20             :  * with re-sampling: [M2, N_1, ..., N_n, N_-1, ..., N-n, M1]
      21             :  * without re-sampling: [M2, N_1, ..., N_n, M1]
      22             :  */
      23             : class SobolSampler : public Sampler
      24             : {
      25             : public:
      26             :   static InputParameters validParams();
      27             : 
      28             :   SobolSampler(const InputParameters & parameters);
      29             : 
      30             :   /// Resampling flag, see SobolStatistics
      31         328 :   bool resample() const { return _resample; }
      32             : 
      33             : protected:
      34             :   virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override;
      35             : 
      36             :   /**
      37             :    * Sobol sampling should have a slightly different partitioning in order to keep
      38             :    * the sample and resample samplers distributed and make computing indices more
      39             :    * efficient.
      40             :    */
      41             :   virtual LocalRankConfig constructRankConfig(bool batch_mode) const override;
      42             : 
      43             :   ///@{
      44             :   /// Sobol Monte Carlo rows
      45             :   std::vector<Real> _row_a;
      46             :   std::vector<Real> _row_b;
      47             :   ///@}
      48             : 
      49             :   /// Sampler matrix
      50             :   Sampler & _sampler_a;
      51             : 
      52             :   /// Re-sample matrix
      53             :   Sampler & _sampler_b;
      54             : 
      55             :   /// Flag for building the re-sampling matrix for computing second order sensitivity indices
      56             :   const bool & _resample;
      57             : 
      58             : private:
      59             :   /// Number of matrices
      60             :   const dof_id_type _num_matrices;
      61             : };

Generated by: LCOV version 1.14