22 "The number of rows for each loop of parameters. The first number represents the outermost " 26 "Sets of distribution names to be sampled. Each set defines the parameters for the nested " 27 "loop, with the first set being the outermost loop.");
35 const auto & dnames = getParam<std::vector<std::vector<DistributionName>>>(
"distributions");
36 const auto & nrows = getParam<std::vector<dof_id_type>>(
"num_rows");
37 if (dnames.size() != nrows.size())
39 "There must be a set of distributions for each loop defined by 'num_rows'.");
42 const std::size_t nloop = dnames.size();
44 for (
const auto &
name : dnames[n])
53 nrows.rbegin(), nrows.rend(),
_loop_mod.rbegin(), std::multiplies<dof_id_type>());
60 setNumberOfRows(std::accumulate(nrows.begin(), nrows.end(), 1, std::multiplies<dof_id_type>()));
80 curr_row = target_row + 1;
void setNumberOfRows(dof_id_type n_rows)
static InputParameters validParams()
static InputParameters validParams()
virtual void advanceGenerators(const dof_id_type count)
NestedMonteCarloSampler(const InputParameters ¶meters)
std::vector< const Distribution * > _distributions
Storage for distribution objects to be utilized.
std::vector< std::size_t > _loop_index
The loop index for distribution.
dof_id_type getLocalRowBegin() const
registerMooseObjectAliased("StochasticToolsApp", NestedMonteCarloSampler, "NestedMonteCarlo")
void restoreGeneratorState()
Real getRand(unsigned int index=0)
virtual const std::string & name() const
void paramError(const std::string ¶m, Args... args) const
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
Return the sample for the given row and column.
dof_id_type getNumberOfRows() const
const Distribution & getDistributionByName(const DistributionName &name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setNumberOfCols(dof_id_type n_cols)
std::vector< dof_id_type > _loop_mod
Helper for determining if a set of columns need to be recomputed: if (row_index % _loop_mod[_loop_ind...
IntRange< T > make_range(T beg, T end)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
std::vector< Real > _row_data
Storage for row data (to be used when not recomputing a column)
virtual void sampleSetUp(const SampleMode mode) override
Here we need to precompute rows that might not be assigned to this processor.
dof_id_type getNumberOfCols() const
A class used to perform nested Monte Carlo Sampling.