88 std::vector<Real>
getSampleRow(dof_id_type row_index)
const;
97 Real
getSample(dof_id_type row_index, dof_id_type col_index)
const;
130 mooseError(
"This method should be overridden in adaptive sampling classes.");
163 Real
getRand(std::size_t n,
unsigned int index = 0)
const;
176 getRandl(std::size_t n,
unsigned int lower,
unsigned int upper,
unsigned int index = 0)
const;
184 virtual Real
computeSample(dof_id_type row_index, dof_id_type col_index)
const = 0;
209 virtual void computeSampleRow(dof_id_type i, std::vector<Real> & data)
const;
256 const std::string &
name,
263 friend void FEProblemBase::objectExecuteHelper<Sampler>(
const std::vector<Sampler *> & objects);
Interface for objects that need to use distributions.
virtual void addSampler(const std::string &type, const std::string &name, InputParameters ¶meters)
The following functions will enable MOOSE to have the capability to import Samplers.
const InputParameters & parameters() const
Get the parameters of the object.
const std::string & type() const
Get the type of this class.
const std::string & name() const
Get the name of the class.
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Every object that can be built by the factory should be derived from this class.
Interface for objects interacting with the PerfGraph.
Interface to allow object to consume Reporter values.
A class for creating restricted objects.
Interface for objects that need to use samplers.
This is the base class for Samplers as used within the Stochastic Tools module.
virtual void advanceGenerator(const unsigned int seed_index, const dof_id_type count)
void checkReinitStatus() const
Helper function for reinit() errors.
void setNumberOfCols(dof_id_type n_cols)
const dof_id_type _limit_get_local_samples
Max number of entries for matrix returned by getLocalSamples.
Real getSample(dof_id_type row_index, dof_id_type col_index) const
Return a single sample value by global row and column index.
Real getRand(std::size_t n, unsigned int index=0) const
Get nth random number from the generator.
const dof_id_type _limit_get_global_samples
Max number of entries for matrix returned by getGlobalSamples.
void advanceGeneratorsInternal(const dof_id_type count)
Advance method for internal use that considers the auto advance flag.
bool & _has_executed
Flag for initial execute to allow the first set of random numbers to be always be the same.
bool _initialized
Flag to indicate if the init method for this class was called.
DenseMatrix< Real > getLocalSamples()
dof_id_type getNumberOfLocalRows() const
const dof_id_type _max_procs_per_row
The maximum number of processors that are associated with a set of rows.
void execute()
Advance MooseRandomStateless generators so that new calls to sample methods will create new numbers.
std::vector< std::unique_ptr< MooseRandomStateless > > & _generators
Random number generators, don't give users access. Control it via the interface from this class.
unsigned int getRandl(std::size_t n, unsigned int lower, unsigned int upper, unsigned int index=0) const
Get nth random integer from the generator within the specified range [lower, upper)
dof_id_type & _local_row_end
Global row index for end of data for this processor.
dof_id_type & _local_row_begin
Global row index for start of data for this processor.
dof_id_type getLocalRowEnd() const
void init()
Functions called by MOOSE to setup the Sampler for use.
dof_id_type getLocalRowBegin() const
Return the beginning/end local row index for this processor.
bool _auto_advance_generators
Flag for disabling automatic generator advancing.
virtual void executeSetUp()
Callbacks for before and after execute.
std::vector< Real > getSampleRow(dof_id_type row_index) const
Return a single sample row by global row.
virtual LocalRankConfig constructRankConfig(bool batch_mode) const
This is where the sampler partitioning is defined.
dof_id_type getNumberOfRows() const
Return the number of samples.
const dof_id_type _limit_get_row
Max number of entries for matrix returned by getSampleRow.
const LocalRankConfig & getRankConfig(bool batch_mode) const
Reference to rank configuration defining the partitioning of the sampler matrix This is primarily use...
virtual void advanceGenerators(const dof_id_type count)
Method for advancing the random number generator(s) by the supplied number or calls to rand().
virtual void executeTearDown()
dof_id_type & _n_cols
Total number of columns in the sample matrix.
virtual void computeSampleMatrix(DenseMatrix< Real > &matrix)
Methods to populate the global or local sample matrix.
virtual void computeSampleRow(dof_id_type i, std::vector< Real > &data) const
Method to populate a complete row of sample data.
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) const =0
Base class must override this method to supply the sample distribution data.
void setAutoAdvanceGenerators(const bool state)
bool _needs_reinit
Flag to indicate if the reinit method should be called during execute.
static InputParameters validParams()
virtual void computeLocalSampleMatrix(DenseMatrix< Real > &matrix)
std::size_t _n_seeds
Number of seeds.
dof_id_type getNumberOfCols() const
void setNumberOfRows(dof_id_type n_rows)
These methods must be called within the constructor of child classes to define the size of the matrix...
dof_id_type & _n_rows
Total number of rows in the sample matrix.
dof_id_type & _n_local_rows
Number of rows for this processor.
const dof_id_type _min_procs_per_row
The minimum number of processors that are associated with a set of rows.
std::pair< LocalRankConfig, LocalRankConfig > & _rank_config
The partitioning of the sampler matrix, built in reinit() first is for normal mode and second is for ...
void setNumberOfRandomSeeds(std::size_t number)
Set the number of seeds required by the sampler.
DenseMatrix< Real > getGlobalSamples()
Return the sampled complete or distributed sample data.
virtual bool isAdaptiveSamplingCompleted() const
Returns true if the adaptive sampling is completed.
Holds app partitioning information relevant to the a particular rank for a multiapp scenario.