view src/include/utils.hpp @ 61:b3bf4ac981ec default tip

Update the doxygen documentation
author Jordi Gutiérrez Hermoso <jordigh@gmail.com>
date Sat, 29 May 2010 20:01:40 -0500
parents 11395e64852f
children
line wrap: on
line source

/*! \file utils.hpp
 * \brief Defines some miscellaneous functions.
 *
 *  \file utils.cpp
 *  \brief Implementations and instantiations of the functions and
 *  classes declared in utils.hpp
 */

#pragma once

#include <string>
#include <map>
#include <set>
#include "linalg.hpp"

namespace kwantix{
/*! \defgroup utils */
/// \{

///Clears whitespace from front and back of string s.
std::string trim(const std::string& s);

///Does map m contain thing?
template<typename K, typename V> 
bool contains(const std::map<K,V>& m, K thing);
///Does set s contain thing?
template<typename E>
bool contains(const std::set<E>& s, E thing);

///Does set s1 include set s2?
template<typename E>
bool includes(const std::set<E>& s1, const std::set<E>& s2);

///Reads matrices from filenames.
kwantix::matrix read_matrix(std::string filename);
///Reads vectors from filenames.
kwantix::vector read_vector(std::string filename);

/*! \brief Reads map<point,double> from a matrix.  
 *
 *Last column is the value at each point which is represented in
 *turn by the rest of the row.
 */
std::map<kwantix::point, double> read_pd_map(std::string filename);

///Outputs some information about generic exceptions.
void show_exception(kwantix::error exc);

/// \}

}//namespace kwantix