|
2 Dimensional Ising Model
Simulate the change in energy and magnetization in a ferro magnet
|
Implementation of the utils. More...
#include "utils.hpp"Go to the source code of this file.
Functions | |
| std::string | utils::scientific_format (double d, int width=20, int prec=10) |
| Turns a double into a string written in scientific format. | |
| std::string | utils::scientific_format (const std::vector< double > &v, int width=20, int prec=10) |
| Turns a vector of doubles into a string written in scientific format. | |
| bool | utils::mkpath (std::string path, int mode=0777) |
| Make path given. | |
| std::string | utils::dirname (const std::string &path) |
| Get the directory name of the path. | |
| std::string | utils::concatpath (const std::string &left, const std::string &right) |
| Take 2 strings and concatenate them and make sure there is a directory separator (/) between them. | |
| std::string utils::concatpath | ( | const std::string & | left, |
| const std::string & | right | ||
| ) |
Take 2 strings and concatenate them and make sure there is a directory separator (/) between them.
This function doesn't care whether or not the values given as parameters are valid path strings. It is the responsibility of the user to make sure that the values given are valid path strings. The function only guarantees that the output string is a valid path string.
| left | The left hand side of the result string |
| right | The right hand side of the result string |
| std::string utils::dirname | ( | const std::string & | path | ) |
| bool utils::mkpath | ( | std::string | path, |
| int | mode = 0777 |
||
| ) |
| std::string utils::scientific_format | ( | const std::vector< double > & | v, |
| int | width = 20, |
||
| int | prec = 10 |
||
| ) |
Turns a vector of doubles into a string written in scientific format.
The code is stolen from https://github.com/anderkve/FYS3150.
| v | The vector to stringify |
| width | The reserved width of the string |
| prec | The precision of the stringified number |
| std::string utils::scientific_format | ( | double | d, |
| int | width = 20, |
||
| int | prec = 10 |
||
| ) |
Turns a double into a string written in scientific format.
The code is stolen from https://github.com/anderkve/FYS3150.
| d | The number to stringify |
| width | The reserved width of the string |
| prec | The precision of the stringified number |