AlmaBTE  1.3
A solver of the space- and time-dependent Boltzmann transport equation for phonons
io_utils.hpp File Reference

Helper code to write calculation results into external files. More...

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <vector>
#include <ctime>
#include <Eigen/Dense>
#include <boost/filesystem.hpp>
#include <boost/property_tree/ptree.hpp>
Include dependency graph for io_utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void alma::write_to_csv (const std::string filename, const Eigen::Ref< const Eigen::MatrixXd > &data, char colsep, bool append=false, std::string headermessage="")
 Save a Matrix of double precision numbers as a csv file. More...
 
Eigen::MatrixXd alma::read_from_csv (const std::string filename, char colsep, std::size_t skipheaderlines=0)
 Read a csv file into a Matrix. More...
 
template<class C >
alma::parseXMLfield (boost::property_tree::ptree::value_type const &v, std::string field)
 Extract a value from an XML tree.
 
template<class C >
bool alma::probeXMLfield (boost::property_tree::ptree::value_type const &v, std::string field)
 Check if an XML field is present.
 

Detailed Description

Helper code to write calculation results into external files.

Function Documentation

◆ read_from_csv()

Eigen::MatrixXd alma::read_from_csv ( const std::string  filename,
char  colsep,
std::size_t  skipheaderlines = 0 
)
inline

Read a csv file into a Matrix.

Parameters
[in]filename- sourcefile location
[in]colsep- column separation character
[out]datamatrix

◆ write_to_csv()

void alma::write_to_csv ( const std::string  filename,
const Eigen::Ref< const Eigen::MatrixXd > &  data,
char  colsep,
bool  append = false,
std::string  headermessage = "" 
)
inline

Save a Matrix of double precision numbers as a csv file.

Parameters
[in]filename- target file location
[in]data- matrix with data to save
[in]colsep- column separation character