23 params.
addClassDescription(
"Provides complete Cartesian product for the supplied variables.");
26 "A list of triplets, each item should include the min, step size, and number of steps.");
34 const std::vector<Real> & items = getParam<std::vector<Real>>(
"linear_space_items");
35 if (items.size() % 3 != 0)
37 "The number of numeric items must be divisible by 3; min, max, divisions for each " 38 "item are required.");
40 std::vector<std::vector<Real>> grid_items;
41 for (std::size_t i = 0; i < items.size(); i += 3)
43 if (items[i + 2] != std::floor(items[i + 2]))
45 "The third entry for each item must be an integer; it provides the number of " 46 "entries in the resulting item vector.");
50 "The third entry for each item must be positive; it provides the number of " 51 "entries in the resulting item vector.");
53 unsigned int div =
static_cast<unsigned int>(items[i + 2]);
54 grid_items.emplace_back(std::vector<Real>(div));
55 for (std::size_t
j = 0;
j < grid_items.back().size(); ++
j)
56 grid_items.back()[
j] = items[i] +
j * items[i + 1];
59 _cp_ptr = std::make_unique<const StochasticTools::CartesianProduct<Real>>(grid_items);
67 return _cp_ptr->computeValue(row_index, col_index);
void setNumberOfRows(dof_id_type n_rows)
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
Return the sample for the given row and column.
static InputParameters validParams()
Creates samples based on the Cartesian product, see CartesianProduct in utils.
registerMooseObjectReplaced("StochasticToolsApp", CartesianProductSampler, "07/01/2020 00:00", CartesianProduct)
registerMooseObjectAliased("StochasticToolsApp", CartesianProductSampler, "CartesianProduct")
static InputParameters validParams()
void paramError(const std::string ¶m, Args... args) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setNumberOfCols(dof_id_type n_cols)
CartesianProductSampler(const InputParameters ¶meters)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
std::unique_ptr< const StochasticTools::CartesianProduct< Real > > _cp_ptr
Helper object for computing the CartesianProcduct values.
const ExecFlagType EXEC_INITIAL