Project-4/docs/utils_8hpp_source.html
2023-12-04 22:23:30 +01:00

283 lines
38 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>2 Dimensional Ising Model: include/utils.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">2 Dimensional Ising Model
</div>
<div id="projectbrief">Simulate the change in energy and magnetization in a ferro magnet</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('utils_8hpp_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">utils.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="utils_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="comment">/** @file utils.hpp</span></div>
<div class="line"><span class="lineno"> 2</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 3</span><span class="comment"> * @author Cory Alexander Balaton (coryab)</span></div>
<div class="line"><span class="lineno"> 4</span><span class="comment"> * @author Janita Ovidie Sandtrøen Willumsen (janitaws)</span></div>
<div class="line"><span class="lineno"> 5</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 6</span><span class="comment"> * @version 1.0</span></div>
<div class="line"><span class="lineno"> 7</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 8</span><span class="comment"> * @brief Function prototypes and macros that are useful.</span></div>
<div class="line"><span class="lineno"> 9</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 10</span><span class="comment"> * These utility function are mainly for convenience and aren&#39;t directly</span></div>
<div class="line"><span class="lineno"> 11</span><span class="comment"> * related to the project. Anything that is in the details namespace should</span></div>
<div class="line"><span class="lineno"> 12</span><span class="comment"> * not be used directly, or else it might cause undefined behavior if not used</span></div>
<div class="line"><span class="lineno"> 13</span><span class="comment"> * correctly.</span></div>
<div class="line"><span class="lineno"> 14</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 15</span><span class="comment"> * @bug No known bugs</span></div>
<div class="line"><span class="lineno"> 16</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#</span><span class="preprocessor">ifndef</span> <span class="preprocessor">__UTILS__</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#</span><span class="preprocessor">define</span> <span class="preprocessor">__UTILS__</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> </div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor">&lt;</span><span class="preprocessor">armadillo</span><span class="preprocessor">&gt;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor">&lt;</span><span class="preprocessor">iomanip</span><span class="preprocessor">&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor">&lt;</span><span class="preprocessor">sstream</span><span class="preprocessor">&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor">&lt;</span><span class="preprocessor">string</span><span class="preprocessor">&gt;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor">&lt;</span><span class="preprocessor">sys</span><span class="preprocessor">/</span><span class="preprocessor">stat</span><span class="preprocessor">.</span><span class="preprocessor">h</span><span class="preprocessor">&gt;</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#</span><span class="preprocessor">include</span> <span class="preprocessor">&lt;</span><span class="preprocessor">vector</span><span class="preprocessor">&gt;</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> </div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span><span class="comment">/** @def DEBUG(msg)</span></div>
<div class="line"><span class="lineno"> 28</span><span class="comment"> * @brief Writes a debug message</span></div>
<div class="line"><span class="lineno"> 29</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 30</span><span class="comment"> * This macro writes a debug message that includes the filename,</span></div>
<div class="line"><span class="lineno"> 31</span><span class="comment"> * line number, and a custom message. The function is wrapped in an ifdef</span></div>
<div class="line"><span class="lineno"> 32</span><span class="comment"> * that checks if DBG is defined, so one can choose to display the debug</span></div>
<div class="line"><span class="lineno"> 33</span><span class="comment"> * messages by adding the -DDBG flag when compiling.</span></div>
<div class="line"><span class="lineno"> 34</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="preprocessor">#</span><span class="preprocessor">ifdef</span> <span class="preprocessor">DBG</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="preprocessor">#</span><span class="preprocessor">define</span> <span class="preprocessor">DEBUG</span><span class="preprocessor">(</span><span class="preprocessor">msg</span><span class="preprocessor">)</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <span class="preprocessor">std</span><span class="preprocessor">::</span><span class="preprocessor">cout</span> <span class="preprocessor">&lt;&lt;</span> <span class="preprocessor">__FILE__</span> <span class="preprocessor">&lt;&lt;</span> <span class="stringliteral">&quot; &quot;</span> <span class="preprocessor">&lt;&lt;</span> <span class="preprocessor">__LINE__</span> <span class="preprocessor">&lt;&lt;</span> <span class="stringliteral">&quot;: &quot;</span> <span class="preprocessor">&lt;&lt;</span> <span class="preprocessor">msg</span> <span class="preprocessor">&lt;&lt;</span> <span class="preprocessor">std</span><span class="preprocessor">::</span><span class="preprocessor">endl</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="preprocessor">#</span><span class="preprocessor">else</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b"> 39</a></span><span class="preprocessor">#</span><span class="preprocessor">define</span> <span class="preprocessor">DEBUG</span><span class="preprocessor">(</span><span class="preprocessor">msg</span><span class="preprocessor">)</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span><span class="preprocessor">#</span><span class="preprocessor">endif</span></div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span><span class="comment">/** @def __METHOD_NAME__</span></div>
<div class="line"><span class="lineno"> 43</span><span class="comment"> * @brief Get the name of the current method/function without the return type.</span></div>
<div class="line"><span class="lineno"> 44</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168"> 45</a></span><span class="preprocessor">#</span><span class="preprocessor">define</span> <span class="preprocessor">__METHOD_NAME__</span> <span class="preprocessor">details</span><span class="preprocessor">::</span><span class="preprocessor">methodName</span><span class="preprocessor">(</span><span class="keyword">__PRETTY_FUNCTION__</span><span class="preprocessor">)</span></div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="keyword">namespace</span> details {</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span><span class="comment">/** @brief Takes in the __PRETTY_FUNCTION__ string and removes the return type.</span></div>
<div class="line"><span class="lineno"> 49</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 50</span><span class="comment"> * @details This function should only be used for the __METHOD_NAME__ macro,</span></div>
<div class="line"><span class="lineno"> 51</span><span class="comment"> * since it takes the output from __PRETTY_FUNCTION__ and strips the return</span></div>
<div class="line"><span class="lineno"> 52</span><span class="comment"> * type.</span></div>
<div class="line"><span class="lineno"> 53</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 54</span><span class="comment"> * @param pretty_function The string from __PRETTY_FUNCTION__</span></div>
<div class="line"><span class="lineno"> 55</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 56</span><span class="comment"> * @return std::string</span></div>
<div class="line"><span class="lineno"> 57</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a178c4922157666a6e9c127c2ffd96346"> 58</a></span><span class="keyword">inline</span> std::string <a class="code hl_function" href="utils_8hpp.html#a178c4922157666a6e9c127c2ffd96346">methodName</a>(<span class="keyword">const</span> std::string &amp;pretty_function)</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span>{</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> size_t colons = pretty_function.find(<span class="stringliteral">&quot;::&quot;</span>);</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> size_t begin = pretty_function.substr(0, colons).rfind(<span class="stringliteral">&quot; &quot;</span>) + 1;</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> size_t end = pretty_function.rfind(<span class="stringliteral">&quot;(&quot;</span>) - begin;</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">return</span> pretty_function.substr(begin, end) + <span class="stringliteral">&quot;()&quot;</span>;</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span>}</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span>} <span class="comment">// namespace details</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> </div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span><span class="keyword">namespace</span> utils {</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span><span class="comment">/** @brief Turns a double into a string written in scientific format.</span></div>
<div class="line"><span class="lineno"> 72</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 73</span><span class="comment"> * @details The code is stolen from https://github.com/anderkve/FYS3150.</span></div>
<div class="line"><span class="lineno"> 74</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 75</span><span class="comment"> * @param d The number to stringify</span></div>
<div class="line"><span class="lineno"> 76</span><span class="comment"> * @param width The reserved width of the string</span></div>
<div class="line"><span class="lineno"> 77</span><span class="comment"> * @param prec The precision of the stringified number</span></div>
<div class="line"><span class="lineno"> 78</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 79</span><span class="comment"> * @return std::string</span></div>
<div class="line"><span class="lineno"> 80</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span>std::string <a class="code hl_function" href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">scientific_format</a>(<span class="keywordtype">double</span> d, <span class="keywordtype">int</span> width = 20, <span class="keywordtype">int</span> prec = 10);</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span><span class="comment">/** @brief Turns a vector of doubles into a string written in scientific</span></div>
<div class="line"><span class="lineno"> 84</span><span class="comment"> * format.</span></div>
<div class="line"><span class="lineno"> 85</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 86</span><span class="comment"> * @details The code is stolen from https://github.com/anderkve/FYS3150.</span></div>
<div class="line"><span class="lineno"> 87</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 88</span><span class="comment"> * @param v The vector to stringify</span></div>
<div class="line"><span class="lineno"> 89</span><span class="comment"> * @param width The reserved width of the string</span></div>
<div class="line"><span class="lineno"> 90</span><span class="comment"> * @param prec The precision of the stringified number</span></div>
<div class="line"><span class="lineno"> 91</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 92</span><span class="comment"> * @return std::string</span></div>
<div class="line"><span class="lineno"> 93</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span>std::string <a class="code hl_function" href="utils_8hpp.html#ab3e89176433ddc9ba721b2eba3d08357">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;<span class="keywordtype">double</span>&gt; &amp;v, <span class="keywordtype">int</span> width = 20,</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordtype">int</span> prec = 10);</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span><span class="comment">/** @brief Make path given.</span></div>
<div class="line"><span class="lineno"> 98</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 99</span><span class="comment"> * @details This tries to be the equivalent to &quot;mkdir -p&quot; and creates a new</span></div>
<div class="line"><span class="lineno"> 100</span><span class="comment"> * directory whenever it needs to.</span></div>
<div class="line"><span class="lineno"> 101</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 102</span><span class="comment"> * @param path The path to be created</span></div>
<div class="line"><span class="lineno"> 103</span><span class="comment"> * @param mode The mode/permissions for all the new directories</span></div>
<div class="line"><span class="lineno"> 104</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 105</span><span class="comment"> * @return bool Success/Fail</span></div>
<div class="line"><span class="lineno"> 106</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">mkpath</a>(std::string path, <span class="keywordtype">int</span> mode = 0777);</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> </div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span><span class="comment">/** @brief Get the directory name of the path</span></div>
<div class="line"><span class="lineno"> 110</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 111</span><span class="comment"> * @param path The path to use.</span></div>
<div class="line"><span class="lineno"> 112</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 113</span><span class="comment"> * @return string</span></div>
<div class="line"><span class="lineno"> 114</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span>std::string <a class="code hl_function" href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">dirname</a>(<span class="keyword">const</span> std::string &amp;path);</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span><span class="comment">/** @brief Take 2 strings and concatenate them and make sure there is a</span></div>
<div class="line"><span class="lineno"> 118</span><span class="comment"> * directory separator (/) between them.</span></div>
<div class="line"><span class="lineno"> 119</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 120</span><span class="comment"> * @details This function doesn&#39;t care whether or not the values given as </span></div>
<div class="line"><span class="lineno"> 121</span><span class="comment"> * parameters are valid path strings. It is the responsibility of the user to make</span></div>
<div class="line"><span class="lineno"> 122</span><span class="comment"> * sure that the values given are valid path strings. </span></div>
<div class="line"><span class="lineno"> 123</span><span class="comment"> * The function only guarantees that the output string is a valid path string.</span></div>
<div class="line"><span class="lineno"> 124</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 125</span><span class="comment"> * @param left The left hand side of the result string</span></div>
<div class="line"><span class="lineno"> 126</span><span class="comment"> * @param right The right hand side of the result string</span></div>
<div class="line"><span class="lineno"> 127</span><span class="comment"> *</span></div>
<div class="line"><span class="lineno"> 128</span><span class="comment"> * @return string</span></div>
<div class="line"><span class="lineno"> 129</span><span class="comment"> * */</span></div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span>std::string <a class="code hl_function" href="utils_8hpp.html#ae91fad89394d745d544737e43524bde6">concatpath</a>(<span class="keyword">const</span> std::string &amp;left, <span class="keyword">const</span> std::string &amp;right);</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> </div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span>} <span class="comment">// namespace utils</span></div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> </div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span><span class="preprocessor">#</span><span class="preprocessor">endif</span></div>
<div class="ttc" id="aIsingModel_8hpp_html_a1965eaca47dbf3f87acdafc2208f04eb"><div class="ttname"><a href="IsingModel_8hpp.html#a1965eaca47dbf3f87acdafc2208f04eb">UP</a></div><div class="ttdeci">#define UP</div><div class="ttdoc">Used for the neighbor matrix in the class.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00026">IsingModel.hpp:26</a></div></div>
<div class="ttc" id="aIsingModel_8hpp_html_a3039ac753f46401767c38f867787fae6"><div class="ttname"><a href="IsingModel_8hpp.html#a3039ac753f46401767c38f867787fae6">INDEX</a></div><div class="ttdeci">#define INDEX(I, N)</div><div class="ttdoc">I modulo N.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00023">IsingModel.hpp:23</a></div></div>
<div class="ttc" id="aIsingModel_8hpp_html_a4193cd1c8c2e6ebd0e056fa2364a663f"><div class="ttname"><a href="IsingModel_8hpp.html#a4193cd1c8c2e6ebd0e056fa2364a663f">DOWN</a></div><div class="ttdeci">#define DOWN</div><div class="ttdoc">Used for the neighbor matrix in the class.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00028">IsingModel.hpp:28</a></div></div>
<div class="ttc" id="aIsingModel_8hpp_html_a437ef08681e7210d6678427030446a54"><div class="ttname"><a href="IsingModel_8hpp.html#a437ef08681e7210d6678427030446a54">LEFT</a></div><div class="ttdeci">#define LEFT</div><div class="ttdoc">Used for the neighbor matrix in the class.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00027">IsingModel.hpp:27</a></div></div>
<div class="ttc" id="aIsingModel_8hpp_html_a80fb826a684cf3f0d306b22aa100ddac"><div class="ttname"><a href="IsingModel_8hpp.html#a80fb826a684cf3f0d306b22aa100ddac">RIGHT</a></div><div class="ttdeci">#define RIGHT</div><div class="ttdoc">Used for the neighbor matrix in the class.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00029">IsingModel.hpp:29</a></div></div>
<div class="ttc" id="aclassIsingModelTest_html"><div class="ttname"><a href="classIsingModelTest.html">IsingModelTest</a></div><div class="ttdoc">Test class for the Ising model.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00036">test_suite.cpp:36</a></div></div>
<div class="ttc" id="aclassIsingModel_html"><div class="ttname"><a href="classIsingModel.html">IsingModel</a></div><div class="ttdoc">The Ising model in 2 dimensions.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00036">IsingModel.hpp:36</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a1bbe0cb10abee98058e7b45b22b9cd0a"><div class="ttname"><a href="classIsingModel.html#a1bbe0cb10abee98058e7b45b22b9cd0a">IsingModel::engine</a></div><div class="ttdeci">std::mt19937 engine</div><div class="ttdoc">The RNG that is used for the Metropolis algorithm.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00078">IsingModel.hpp:78</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a1c8a2a4331c7e60c3e1350c0cf8300b9"><div class="ttname"><a href="classIsingModel.html#a1c8a2a4331c7e60c3e1350c0cf8300b9">IsingModel::E</a></div><div class="ttdeci">int64_t E</div><div class="ttdoc">The current energy state. unit: .</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00070">IsingModel.hpp:70</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a20fc4c0c99d8a119f70a1614784d4e5c"><div class="ttname"><a href="classIsingModel.html#a20fc4c0c99d8a119f70a1614784d4e5c">IsingModel::T</a></div><div class="ttdeci">double T</div><div class="ttdoc">The temperature of the model.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00062">IsingModel.hpp:62</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a2b8ac43baefeb386186266d5aa4de348"><div class="ttname"><a href="classIsingModel.html#a2b8ac43baefeb386186266d5aa4de348">IsingModel::L</a></div><div class="ttdeci">int L</div><div class="ttdoc">Size of the lattice.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00066">IsingModel.hpp:66</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a2c3c76c79717c968d7c227c58b46df41"><div class="ttname"><a href="classIsingModel.html#a2c3c76c79717c968d7c227c58b46df41">IsingModel::lattice</a></div><div class="ttdeci">arma::Mat&lt; int &gt; lattice</div><div class="ttdoc">matrix where element .</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00044">IsingModel.hpp:44</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a34a4710949b4a70f3e37ca223aefcf8a"><div class="ttname"><a href="classIsingModel.html#a34a4710949b4a70f3e37ca223aefcf8a">IsingModel::initialize_lattice</a></div><div class="ttdeci">void initialize_lattice()</div><div class="ttdoc">Initialize the lattice with a random distribution of 1s and -1s.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00049">IsingModel.cpp:49</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a46c9446e94854452f715d307c77c1c15"><div class="ttname"><a href="classIsingModel.html#a46c9446e94854452f715d307c77c1c15">IsingModel::IsingModel</a></div><div class="ttdeci">IsingModel(int L, double T, int val)</div><div class="ttdoc">Constructor for the Ising model.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00031">IsingModel.cpp:31</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a4a39ee7fbfbbf566f75bc28900ca9ea5"><div class="ttname"><a href="classIsingModel.html#a4a39ee7fbfbbf566f75bc28900ca9ea5">IsingModel::IsingModel</a></div><div class="ttdeci">IsingModel(int L, double T)</div><div class="ttdoc">Constructor for the Ising model.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00019">IsingModel.cpp:19</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a56559d68dc9aaff1976d84b157f43488"><div class="ttname"><a href="classIsingModel.html#a56559d68dc9aaff1976d84b157f43488">IsingModel::Metropolis</a></div><div class="ttdeci">data_t Metropolis()</div><div class="ttdoc">The Metropolis algorithm.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00110">IsingModel.cpp:110</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a59fced38c695e2fa647f53be81b9d2a1"><div class="ttname"><a href="classIsingModel.html#a59fced38c695e2fa647f53be81b9d2a1">IsingModel::initialize_energy</a></div><div class="ttdeci">void initialize_energy()</div><div class="ttdoc">Initialize the energy of the system.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00096">IsingModel.cpp:96</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a6776109105051597c275670dabd0054a"><div class="ttname"><a href="classIsingModel.html#a6776109105051597c275670dabd0054a">IsingModel::initialize_neighbors</a></div><div class="ttdeci">void initialize_neighbors()</div><div class="ttdoc">initialize the neighbors matrix.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00070">IsingModel.cpp:70</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a7112dd6433b1bb9512150cbdc1a0b77e"><div class="ttname"><a href="classIsingModel.html#a7112dd6433b1bb9512150cbdc1a0b77e">IsingModel::energy_diff</a></div><div class="ttdeci">double energy_diff[17]</div><div class="ttdoc">An array containing all possible energy differences.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00058">IsingModel.hpp:58</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a926cf4964d190d2ce23e5a17201787a4"><div class="ttname"><a href="classIsingModel.html#a926cf4964d190d2ce23e5a17201787a4">IsingModel::initialize_magnetization</a></div><div class="ttdeci">void initialize_magnetization()</div><div class="ttdoc">Initialize the magnetization of the system.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00088">IsingModel.cpp:88</a></div></div>
<div class="ttc" id="aclassIsingModel_html_a94093aaf30facca62737f2ac381fdbcd"><div class="ttname"><a href="classIsingModel.html#a94093aaf30facca62737f2ac381fdbcd">IsingModel::neighbors</a></div><div class="ttdeci">arma::Mat&lt; int &gt; neighbors</div><div class="ttdoc">matrix with the neighbors of each element .</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00054">IsingModel.hpp:54</a></div></div>
<div class="ttc" id="aclassIsingModel_html_aaedc25b7284e04849269f31291590bf5"><div class="ttname"><a href="classIsingModel.html#aaedc25b7284e04849269f31291590bf5">IsingModel::initialize_engine</a></div><div class="ttdeci">void initialize_engine()</div><div class="ttdoc">Initialize the RNG.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00043">IsingModel.cpp:43</a></div></div>
<div class="ttc" id="aclassIsingModel_html_acc86effd6889bea199a3d70a9f38dc78"><div class="ttname"><a href="classIsingModel.html#acc86effd6889bea199a3d70a9f38dc78">IsingModel::initialize_lattice</a></div><div class="ttdeci">void initialize_lattice(int val)</div><div class="ttdoc">Initialize the lattice with a specific value.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00059">IsingModel.cpp:59</a></div></div>
<div class="ttc" id="aclassIsingModel_html_acf281f6f5ed02911ca6ab07004449864"><div class="ttname"><a href="classIsingModel.html#acf281f6f5ed02911ca6ab07004449864">IsingModel::IsingModel</a></div><div class="ttdeci">IsingModel()</div><div class="ttdoc">Constructor used for testing.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00014">IsingModel.cpp:14</a></div></div>
<div class="ttc" id="aclassIsingModel_html_aef7232b28df08e064ef58eb5ef32f738"><div class="ttname"><a href="classIsingModel.html#aef7232b28df08e064ef58eb5ef32f738">IsingModel::M</a></div><div class="ttdeci">int64_t M</div><div class="ttdoc">The current magnetic strength. unit: Unitless.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8hpp_source.html#l00074">IsingModel.hpp:74</a></div></div>
<div class="ttc" id="aclassIsingModel_html_aff9a1201933fd5408845a1447e4895b4"><div class="ttname"><a href="classIsingModel.html#aff9a1201933fd5408845a1447e4895b4">IsingModel::initialize_energy_diff</a></div><div class="ttdeci">void initialize_energy_diff()</div><div class="ttdoc">Initialize the energy_diff array with the correct values.</div><div class="ttdef"><b>Definition:</b> <a href="IsingModel_8cpp_source.html#l00081">IsingModel.cpp:81</a></div></div>
<div class="ttc" id="aclassdata__t_html"><div class="ttname"><a href="classdata__t.html">data_t</a></div><div class="ttdoc">Type to use with the IsingModel class and montecarlo module.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00019">data_type.hpp:19</a></div></div>
<div class="ttc" id="aclassdata__t_html_a3f2d19ab309e696ba91a2000479bcb83"><div class="ttname"><a href="classdata__t.html#a3f2d19ab309e696ba91a2000479bcb83">data_t::data_t</a></div><div class="ttdeci">data_t(double E, double E2, double M, double M2, double M_abs)</div><div class="ttdoc">Constructor with parameters.</div><div class="ttdef"><b>Definition:</b> <a href="data__type_8hpp_source.html#l00045">data_type.hpp:45</a></div></div>
<div class="ttc" id="autils_8hpp_html_a178c4922157666a6e9c127c2ffd96346"><div class="ttname"><a href="utils_8hpp.html#a178c4922157666a6e9c127c2ffd96346">details::methodName</a></div><div class="ttdeci">std::string methodName(const std::string &amp;pretty_function)</div><div class="ttdoc">Takes in the PRETTY_FUNCTION string and removes the return type.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00058">utils.hpp:58</a></div></div>
<div class="ttc" id="autils_8hpp_html_a2b45adc86b70f42021582994e83fa00d"><div class="ttname"><a href="utils_8hpp.html#a2b45adc86b70f42021582994e83fa00d">utils::mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode=0777)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00032">utils.cpp:32</a></div></div>
<div class="ttc" id="autils_8hpp_html_a3529a74fd2a25d24de73d9d4e1c90835"><div class="ttname"><a href="utils_8hpp.html#a3529a74fd2a25d24de73d9d4e1c90835">utils::scientific_format</a></div><div class="ttdeci">std::string scientific_format(double d, int width=20, int prec=10)</div><div class="ttdoc">Turns a double into a string written in scientific format.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00016">utils.cpp:16</a></div></div>
<div class="ttc" id="autils_8hpp_html_ab3e89176433ddc9ba721b2eba3d08357"><div class="ttname"><a href="utils_8hpp.html#ab3e89176433ddc9ba721b2eba3d08357">utils::scientific_format</a></div><div class="ttdeci">std::string scientific_format(const std::vector&lt; double &gt; &amp;v, int width=20, int prec=10)</div><div class="ttdoc">Turns a vector of doubles into a string written in scientific format.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00023">utils.cpp:23</a></div></div>
<div class="ttc" id="autils_8hpp_html_ae91fad89394d745d544737e43524bde6"><div class="ttname"><a href="utils_8hpp.html#ae91fad89394d745d544737e43524bde6">utils::concatpath</a></div><div class="ttdeci">std::string concatpath(const std::string &amp;left, const std::string &amp;right)</div><div class="ttdoc">Take 2 strings and concatenate them and make sure there is a directory separator (/) between them.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00063">utils.cpp:63</a></div></div>
<div class="ttc" id="autils_8hpp_html_aed026119193a9bbe076671809ff0f430"><div class="ttname"><a href="utils_8hpp.html#aed026119193a9bbe076671809ff0f430">utils::dirname</a></div><div class="ttdeci">std::string dirname(const std::string &amp;path)</div><div class="ttdoc">Get the directory name of the path.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00058">utils.cpp:58</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="utils_8hpp.html">utils.hpp</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.6 </li>
</ul>
</div>
</body>
</html>