132 mooseError(
"This method should be overridden in adaptive sampling classes.");
170 Real getRand(std::size_t n,
unsigned int index = 0)
const;
183 getRandl(std::size_t n,
unsigned int lower,
unsigned int upper,
unsigned int index = 0)
const;
267 const std::string &
name,
274 friend void FEProblemBase::objectExecuteHelper<Sampler>(
const std::vector<Sampler *> & objects);
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...
void init()
Functions called by MOOSE to setup the Sampler for use.
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.
void advanceGeneratorsInternal(const dof_id_type count)
Advance method for internal use that considers the auto advance flag.
DenseMatrix< Real > getLocalSamples()
dof_id_type _local_row_begin
Global row index for start of data for this processor.
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index)=0
Base class must override this method to supply the sample distribution data.
static InputParameters validParams()
virtual void advanceGenerators(const dof_id_type count)
Method for advancing the random number generator(s) by the supplied number or calls to rand()...
This is the base class for Samplers as used within the Stochastic Tools module.
dof_id_type _n_local_rows
Number of rows for this processor.
virtual void executeSetUp()
Callbacks for before and after execute.
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) ...
const InputParameters & parameters() const
Get the parameters of the object.
DenseMatrix< Real > getGlobalSamples()
Return the sampled complete or distributed sample data.
Interface for objects that need to use samplers.
virtual void advanceGenerator(const unsigned int seed_index, const dof_id_type count)
std::vector< Real > getNextLocalRow()
Return the "next" local row.
dof_id_type getLocalRowBegin() const
Return the beginning/end local row index for this processor.
void checkReinitStatus() const
Helper function for reinit() errors.
virtual void computeLocalSampleMatrix(DenseMatrix< Real > &matrix)
const dof_id_type _max_procs_per_row
The maximum number of processors that are associated with a set of rows.
virtual void computeSampleMatrix(DenseMatrix< Real > &matrix)
Methods to populate the global or local sample matrix.
const dof_id_type _limit_get_next_local_row
Max number of entries for matrix returned by getNextLocalRow.
dof_id_type getNumberOfLocalRows() const
Sampler(const InputParameters ¶meters)
virtual void computeSampleRow(dof_id_type i, std::vector< Real > &data)
Method to populate a complete row of sample data.
virtual bool isAdaptiveSamplingCompleted() const
Returns true if the adaptive sampling is completed.
const std::string & name() const
Get the name of the class.
Real getRand(std::size_t n, unsigned int index=0) const
Get nth random number from the generator.
bool _needs_reinit
Flag to indicate if the reinit method should be called during execute.
libMesh::Parallel::Communicator & getLocalComm()
Return the parallel communicator.
const dof_id_type _limit_get_global_samples
Max number of entries for matrix returned by getGlobalSamples.
Every object that can be built by the factory should be derived from this class.
const dof_id_type _limit_get_local_samples
Max number of entries for matrix returned by getLocalSamples.
Interface for objects that need to use distributions.
Interface to allow object to consume Reporter values.
const std::string & type() const
Get the type of this class.
std::pair< LocalRankConfig, LocalRankConfig > _rank_config
The partitioning of the sampler matrix, built in reinit() first is for normal mode and send is for ba...
std::size_t _n_seeds
Number of seeds.
const LocalRankConfig & getRankConfig(bool batch_mode) const
Reference to rank configuration defining the partitioning of the sampler matrix This is primarily use...
bool _has_executed
Flag for initial execute to allow the first set of random numbers to be always be the same...
Interface for objects interacting with the PerfGraph.
virtual LocalRankConfig constructRankConfig(bool batch_mode) const
This is where the sampler partitioning is defined.
dof_id_type getLocalRowEnd() const
const dof_id_type _min_procs_per_row
The minimum number of processors that are associated with a set of rows.
libMesh::Parallel::Communicator _local_comm
Communicator that was split based on samples that have rows.
dof_id_type _local_row_end
Global row index for end of data for this processor.
dof_id_type getNumberOfRows() const
Return the number of samples.
void setAutoAdvanceGenerators(const bool state)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setNumberOfCols(dof_id_type n_cols)
virtual void executeTearDown()
bool _initialized
Flag to indicate if the init method for this class was called.
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...
bool _auto_advance_generators
Flag for disabling automatic generator advancing.
bool _next_local_row_requires_state_restore
Flag for restoring state during getNextLocalRow iteration.
Holds app partitioning information relevant to the a particular rank for a multiapp scenario...
dof_id_type _n_rows
Total number of rows in the sample matrix.
std::vector< std::unique_ptr< MooseRandomStateless > > _generators
Random number generators, don't give users access. Control it via the interface from this class...
void execute()
Advance MooseRandomStateless generators so that new calls to sample methods will create new numbers...
dof_id_type _n_cols
Total number of columns in the sample matrix.
dof_id_type getNumberOfCols() const
void setNumberOfRandomSeeds(std::size_t number)
Set the number of seeds required by the sampler.
dof_id_type _next_local_row
Iterator index for getNextLocalRow method.