21 "Name of the CSV file that contains the samples matrix.");
22 params.
addParam<std::vector<dof_id_type>>(
24 "Column indices in the CSV file to be sampled from. Number of indices here " 25 "will be the same as the number of columns per matrix.");
26 params.
addParam<std::vector<std::string>>(
28 "Column names in the CSV file to be sampled from. Number of columns names " 29 "here will be the same as the number of columns per matrix.");
48 ": Please provide either column_indices or column_names but not both.");
53 std::vector<dof_id_type> indices = getParam<std::vector<dof_id_type>>(
"column_indices");
54 for (
unsigned int i = 0; i < indices.size(); i++)
66 std::vector<std::string> names = getParam<std::vector<std::string>>(
"column_names");
67 for (
unsigned int i = 0; i < names.size(); i++)
84 mooseAssert(row_index <
_data[0].size(),
"row_index cannot be out of bounds of the data.");
85 mooseAssert(col_index <
_data.size(),
"col_index cannot be out of bounds of the data.");
87 return _data[col_index][row_index];
void setNumberOfRows(dof_id_type n_rows)
static InputParameters validParams()
A class used to generate samples from a CSV file.
const Parallel::Communicator & _communicator
std::vector< std::vector< Real > > _data
Data read in from the CSV file.
bool isParamValid(const std::string &name) const
CSVSampler(const InputParameters ¶meters)
static InputParameters validParams()
registerMooseObject("StochasticToolsApp", CSVSampler)
const std::vector< std::vector< T > > & getData() const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void setNumberOfCols(dof_id_type n_cols)
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
Return the sample for the given row and column.
void mooseError(Args &&... args) const