17#include "libmesh/parallel.h"
52 const std::size_t
INVALID_SIZE = std::numeric_limits<std::size_t>::max();
107 const std::vector<std::string> &
getNames()
const;
114 const std::vector<std::vector<T>> &
getData()
const;
126 const std::vector<T> &
getData(
const std::string & name)
const;
127 const std::vector<T> &
getData(std::size_t index)
const;
166 void readColumnData(std::ifstream & stream_data, std::vector<T> & output);
167 void readRowData(std::ifstream & stream_data, std::vector<T> & output);
176 void processLine(
const std::string & line, std::vector<T> & row,
const unsigned int & num);
184 bool preprocessLine(std::string & line,
const unsigned int & num);
192 const std::string &
delimiter(
const std::string & line);
197 bool header(
const std::string & line);
Utility class for reading delimited data (e.g., CSV data).
const std::string & getComment() const
const std::vector< std::string > & getNames() const
Return the column/row names.
std::size_t numEntries() const
Get the total number of entries in the file.
void readRowData(std::ifstream &stream_data, std::vector< T > &output)
void processLine(const std::string &line, std::vector< T > &row, const unsigned int &num)
Populate supplied vector with content from line.
HeaderFlag _header_flag
Flag indicating if the file contains a header.
const std::vector< std::vector< T > > & getData() const
Return the rows/columns of data.
const libMesh::Parallel::Communicator *const _communicator
Communicator.
void setHeaderFlag(HeaderFlag value)
void setIgnoreEmptyLines(bool value)
Set/Get methods for file format controls.
const std::string & delimiter(const std::string &line)
Determine the delimiter.
std::string _delimiter
The delimiter separating the supplied data entires.
void setComment(const std::string &value)
FormatFlag _format_flag
Format "rows" vs "columns".
bool getIgnoreEmptyLines() const
std::string _filename
The supplied filename.
void setDelimiter(const std::string &value)
const std::string & setDelimiter() const
const std::vector< Point > getDataAsPoints() const
Get the data in Point format.
std::vector< std::string > _names
Storage for the read or generated column names.
std::vector< std::size_t > _row_offsets
Row offsets (only used with _format == "rows")
bool preprocessLine(std::string &line, const unsigned int &num)
Check the content of the line and if it should be skipped.
std::vector< std::vector< T > > _data
Storage for the read data columns.
void setFormatFlag(FormatFlag value)
std::string _row_comment
Hide row comments.
const std::size_t INVALID_SIZE
FormatFlag getFormatFlag() const
void setFileName(const std::string &new_file)
Set the file name, used to change the file to read from We also reset the column/row names as a secon...
bool header(const std::string &line)
Return the header flag, if it is set to AUTO attempt to determine if a header exists in line.
void readColumnData(std::ifstream &stream_data, std::vector< T > &output)
Read the numeric data as rows or columns into a single vector.
HeaderFlag getHeaderFlag() const
void read()
Perform the actual data reading.
bool _ignore_empty_lines
Flag for ignoring empty lines.
DelimitedFileReaderTempl< std::string > DelimitedFileOfStringReader
DelimitedFileReaderTempl< double > DelimitedFileReader