n2p2 - A neural network potential package
utility.cpp File Reference
#include "utility.h"
#include <algorithm>
#include <cstdio>
#include <cstdarg>
#include <iomanip>
#include <limits>
#include <sstream>
#include <stdexcept>
Include dependency graph for utility.cpp:

Go to the source code of this file.

Namespaces

namespace  nnp
 

Macros

#define STRPR_MAXBUF   1024
 

Functions

vector< string > nnp::split (std::string const &input, char delimiter=' ')
 Split string at each delimiter. More...
 
string nnp::trim (std::string const &line, std::string const &whitespace=" \t")
 Remove leading and trailing whitespaces from string. More...
 
string nnp::reduce (std::string const &line, std::string const &whitespace=" \t", std::string const &fill=" ")
 Replace multiple whitespaces with fill. More...
 
string nnp::pad (string const &input, size_t num, char fill, bool right)
 
string nnp::strpr (const char *format,...)
 String version of printf function. More...
 
string nnp::cap (std::string word)
 Capitalize first letter of word. More...
 
vector< string > nnp::createFileHeader (vector< string > const &title, vector< size_t > const &colSize, vector< string > const &colName, vector< string > const &colInfo, char const &commentChar)
 
void nnp::appendLinesToFile (std::ofstream &file, std::vector< std::string > const lines)
 Append multiple lines of strings to open file stream. More...
 
void nnp::appendLinesToFile (FILE *const &file, std::vector< std::string > const lines)
 Append multiple lines of strings to open file pointer. More...
 
map< size_t, vector< double > > nnp::readColumnsFromFile (string fileName, vector< size_t > columns, char comment)
 
double nnp::pow_int (double x, int n)
 Integer version of power function, "fast exponentiation algorithm". More...
 

Macro Definition Documentation

◆ STRPR_MAXBUF

#define STRPR_MAXBUF   1024

Definition at line 26 of file utility.cpp.