21 "evaluated, otherwise data is set to a default value.");
26 "function expression that should evaluate to 0 if sample should NOT be evaluated.");
28 "Value to replace in data when sample is not evaluated.");
29 params.
addParam<std::vector<std::string>>(
30 "sampler_vars", std::vector<std::string>(),
"Vector of variables defined by sampler values.");
31 params.
addParam<std::vector<unsigned int>>(
"sampler_var_indices",
32 std::vector<unsigned int>(),
33 "Vector of indices defining the sampler column index "
34 "associated with the variables in 'sampler_vars'.");
36 "use_time",
true,
"Make time (t) variable available in the function expression.");
45 _function(this->template getParam<
std::string>(
"function")),
46 _default_value(this->template getParam<
T>(
"default_value")),
48 this->template getParam<
std::string, unsigned
int>(
"sampler_vars",
"sampler_var_indices")),
49 _use_time(this->template getParam<bool>(
"use_time"))
52 std::stringstream
vars;
56 vars << sep << it.first;
57 if (it.second >= this->sampler().getNumberOfCols())
61 " must be smaller than the sampler number of columns (",
62 this->sampler().getNumberOfCols(),
70 _func_F = std::make_shared<SymFunction>();
101 for (
const auto &
p : index_range(_sampler_vars))
102 _func_params[
p] = row[_sampler_vars[
p].second];
105 _func_params[_sampler_vars.size()] = this->_t;
113 val = _default_value;
registerMooseObject("StochasticToolsApp", ConditionalSampleReporter)
T evaluate(Real, const Point &)
void ErrorVector unsigned int
This is a base class for performing active learning routines, meant to be used in conjunction with Sa...
static InputParameters validParams()
This object is mainly meant for demonstration for eventual active learning algorithms,...
static InputParameters validParams()
SymFunctionPtr _func_F
Parsed function pointer.
virtual bool needSample(const std::vector< Real > &row, dof_id_type local_ind, dof_id_type global_ind, T &val) override
This evaluates the inputted function to determine whether a multiapp solve is necessary/allowed,...
const std::string & _function
User-inputted function string.
const std::vector< std::pair< std::string, unsigned int > > _sampler_vars
Pairs between the variables in the function string and their associated sampler column index.
const bool _use_time
Whether or not the function string includes a time variable.
ConditionalSampleReporterTempl(const InputParameters ¶meters)
std::vector< GenericReal< is_ad > > _func_params
void setParserFeatureFlags(SymFunctionPtr &) const
bool _disable_fpoptimizer
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const
processor_id_type rank() const
const Parallel::Communicator & _communicator