3D Beam Finite Element Code  1.0
Public Member Functions | List of all members
fea::CSVParser Class Reference

Reads data from a csv file into an std::vector and writes the contents of an std::vector to a file. More...

#include <csv_parser.h>

Public Member Functions

template<typename T >
void parseToVector (std::string filename, std::vector< T > &data)
 parses the contents of file_name into data. More...
 
template<typename T >
void write (const std::string &filename, const std::vector< std::vector< T > > &data, unsigned int precision, const std::string &delimiter)
 

Detailed Description

Reads data from a csv file into an std::vector and writes the contents of an std::vector to a file.

Note
The parser assumes the data is comma delimited when reading data from a file.

Member Function Documentation

template<typename T >
void fea::CSVParser::parseToVector ( std::string  filename,
std::vector< T > &  data 
)
inline

parses the contents of file_name into data.

Parameters
[in]file_namestd::string. The file specified is opened and the contained information is parsed into data.
datastd::vector<T>. Variable updated in place that will fold the data of the specified file.
template<typename T >
void fea::CSVParser::write ( const std::string &  filename,
const std::vector< std::vector< T > > &  data,
unsigned int  precision,
const std::string &  delimiter 
)
inline

Writes the 2D vector data to the file specified by filename.

Parameters
[in]filenamestd::string. The file to write data to.
[in]datastd::vector< std::vector< T > >. Data to write to file.
[in]precisionunsigned int. The number of decimal places to use when writing the data to file.
[in]demlimiterstd::string. The delimiter to use between data entries.

Here is the caller graph for this function:


The documentation for this class was generated from the following file: