25 "Converts columns of a CSV file into vectors of a VectorPostprocessor.");
27 "The name of the CSV file to read. Currently, with " 28 "the exception of the header row, only numeric " 29 "values are supported.");
31 "When true it is assumed that the first row contains column headers, these " 32 "headers are used as the VectorPostprocessor vector names. If false the " 33 "file is assumed to contain only numbers and the vectors are named " 34 "automatically based on the column number (e.g., 'column_0000', " 35 "'column_0001'). If not supplied the reader attempts to auto detect the " 37 params.
addParam<std::string>(
"delimiter",
38 "The column delimiter. Despite the name this can read files " 39 "separated by delimiter other than a comma. If this options is " 40 "omitted it will read comma or space separated files.");
42 "ignore_empty_lines",
true,
"When true new empty lines in the file are ignored.");
43 params.
set<
bool>(
"contains_complete_history") =
true;
50 params.
set<
bool>(
"_auto_broadcast") =
false;
66 csv_reader.
setDelimiter(getParam<std::string>(
"delimiter"));
69 const std::vector<std::string> & names = csv_reader.
getNames();
70 const std::vector<std::vector<double>> & data = csv_reader.
getData();
71 for (std::size_t i = 0; i < data.size(); ++i)
74 _column_data[names[i]]->assign(data[i].begin(), data[i].end());
A MultiMooseEnum object to hold "execute_on" flags.
void setIgnoreEmptyLines(bool value)
Set/Get methods for file format controls.
const ExecFlagType EXEC_NONE
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
registerMooseObject("MooseApp", CSVReaderVectorPostprocessor)
static InputParameters validParams()
const Parallel::Communicator & _communicator
std::map< std::string, VectorPostprocessorValue * > _column_data
The vector variables storing the data read from the csv.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
static InputParameters validParams()
registerMooseObjectRenamed("MooseApp", CSVReader, "06/30/2024 24:00", CSVReaderVectorPostprocessor)
void read()
Perform the actual data reading.
VectorPostprocessorValue & declareVector(const std::string &vector_name)
Register a new vector to fill up.
const std::vector< std::vector< T > > & getData() const
Return the rows/columns of data.
Utility class for reading delimited data (e.g., CSV data).
void setDelimiter(const std::string &value)
void setHeaderFlag(HeaderFlag value)
const std::vector< std::string > & getNames() const
Return the column/row names.
CSVReaderVectorPostprocessor(const InputParameters ¶meters)