Coryab/code #9

Merged
coryab merged 23 commits from coryab/code into develop 2023-10-22 15:46:55 +00:00
88 changed files with 3403 additions and 1273 deletions

View File

@ -8,3 +8,5 @@ BreakBeforeBraces: Custom
BraceWrapping:
AfterFunction: true
BeforeElse: true
BreakBeforeBinaryOperators: All
ColumnLimit: 79

View File

@ -917,7 +917,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = include src README.md
INPUT = include src src/scripts README.md
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

View File

@ -2,6 +2,78 @@
![](./images/100_particles.gif)
[Repo](https://github.uio.no/FYS3150-G2-2023/Project-3)
[Documentation](https://pages.github.uio.no/FYS3150-G2-2023/Project-3/)
## Requirements
### Operating systems
- Linux
- Has been tested on [Fedora 38](https://fedoraproject.org/)
- Will most likely work on other Linux distributions
- MacOS
- Might work, but hasn't been tested
- Windows
- Will most likely not work
### Libraries
- Python
- [matplotlib](https://matplotlib.org/)
- [numpy](https://numpy.org/)
- C++
- [openmp](https://www.openmp.org/)
- [armadillo](https://arma.sourceforge.net/)
## Compiling
Compiling is as easy as running this command while being inside the src directory:
```shell
make
```
## Running programs
### C++ binaries
To run **main** or **test_suite**, just run this command while being inside src:
```shell
./<program-name>
```
### Python scripts
#### Install libraries
Before running the scripts, make sure that all libraries are installed.
Using pip, you can install all requirements like this:
```shell
pip install -r requirements.txt
```
This recursively install all the packages that are listed in **requirements.txt**.
#### Running scripts
For the Python scripts, run them from the src directory like this:
```shell
python scripts/<script-name>
```
If you have any problems running the scripts, you might have to run this instead:
```shell
python3 scripts/<script-name>
```
## Credits

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View File

@ -105,8 +105,8 @@ $(document).ready(function(){initNavTree('Particle_8cpp_source.html',''); initRe
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &quot;<a class="code" href="Particle_8hpp.html">Particle.hpp</a>&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4"> 15</a></span><a class="code hl_function" href="classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4">Particle::Particle</a>(<span class="keywordtype">double</span> q, <span class="keywordtype">double</span> m,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> arma::vec::fixed&lt;3&gt; r_vec,</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> arma::vec::fixed&lt;3&gt; v_vec)</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r_vec,</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> v_vec)</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span>{</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="comment">// Giving the particle its properties</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> this-&gt;q = <a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a>;</div>
@ -120,6 +120,7 @@ $(document).ready(function(){initNavTree('Particle_8cpp_source.html',''); initRe
<div class="ttc" id="aclassParticle_html_a879692772803d6ab65fa4993b54aea6e"><div class="ttname"><a href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">Particle::v_vec</a></div><div class="ttdeci">vec_3d v_vec</div><div class="ttdoc">velocity</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00026">Particle.hpp:26</a></div></div>
<div class="ttc" id="aclassParticle_html_aedcc7e1bc53b0e2b1a4a07c9a1b47563"><div class="ttname"><a href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">Particle::m</a></div><div class="ttdeci">double m</div><div class="ttdoc">Mass.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00024">Particle.hpp:24</a></div></div>
<div class="ttc" id="aclassParticle_html_af9497cd8f2dcad0fad54f571ddb383e6"><div class="ttname"><a href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">Particle::r_vec</a></div><div class="ttdeci">vec_3d r_vec</div><div class="ttdoc">position</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00025">Particle.hpp:25</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -128,7 +128,7 @@ $(document).ready(function(){initNavTree('Particle_8hpp_source.html',''); initRe
<div class="ttc" id="aclassParticle_html_a879692772803d6ab65fa4993b54aea6e"><div class="ttname"><a href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">Particle::v_vec</a></div><div class="ttdeci">vec_3d v_vec</div><div class="ttdoc">velocity</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00026">Particle.hpp:26</a></div></div>
<div class="ttc" id="aclassParticle_html_aedcc7e1bc53b0e2b1a4a07c9a1b47563"><div class="ttname"><a href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">Particle::m</a></div><div class="ttdeci">double m</div><div class="ttdoc">Mass.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00024">Particle.hpp:24</a></div></div>
<div class="ttc" id="aclassParticle_html_af9497cd8f2dcad0fad54f571ddb383e6"><div class="ttname"><a href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">Particle::r_vec</a></div><div class="ttdeci">vec_3d r_vec</div><div class="ttdoc">position</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00025">Particle.hpp:25</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00030">PenningTrap.hpp:30</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:31</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html"><div class="ttname"><a href="typedefs_8hpp.html">typedefs.hpp</a></div><div class="ttdoc">Useful typedefs for cleaner code.</div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>
</div><!-- fragment --></div><!-- contents -->

View File

@ -105,9 +105,6 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp.html',''); initResiza
<p>The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="constants_8hpp_source.html">constants.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
</div>
<p><a href="PenningTrap_8cpp_source.html">Go to the source code of this file.</a></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>

View File

@ -103,310 +103,336 @@ $(document).ready(function(){initNavTree('PenningTrap_8cpp_source.html',''); ini
<div class="contents">
<a href="PenningTrap_8cpp.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> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &quot;<a class="code" href="constants_8hpp.html">constants.hpp</a>&quot;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &quot;<a class="code" href="typedefs_8hpp.html">typedefs.hpp</a>&quot;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63"> 18</a></span><a class="code hl_function" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a>(<span class="keywordtype">double</span> B_0, std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; V_0,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span>{</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> this-&gt;B_0 = <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>;</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> = <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a>;</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> this-&gt;d = <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> this-&gt;t = <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</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"><a class="line" href="classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1"> 27</a></span><a class="code hl_function" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">double</span> B_0,</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span>{</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r, v;</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; i; j++) {</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> r = <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> v = <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., r, v));</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> }</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span>}</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73"> 39</a></span><a class="code hl_function" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a>(std::vector&lt;Particle&gt; particles, <span class="keywordtype">double</span> B_0,</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span>{</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> this-&gt;particles = <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span>}</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e"> 46</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap::v_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span>{</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[0][j];</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_v[1][j];</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> <span class="keywordflow">return</span> dt * this-&gt;k_v[2][j];</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> <span class="keywordflow">return</span> (dt / 6.) * (this-&gt;k_v[0][j].eval() + this-&gt;k_v[1][j].eval() +</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> this-&gt;k_v[2][j].eval() + this-&gt;k_v[3][j].eval());</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> abort();</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> }</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span>}</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"><a class="line" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648"> 64</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap::r_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt)</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> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[0][j];</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_r[1][j];</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="keywordflow">return</span> dt * this-&gt;k_r[2][j];</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordflow">return</span> (dt / 6.) * (this-&gt;k_r[0][j].eval() + this-&gt;k_r[1][j].eval() +</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> this-&gt;k_r[2][j].eval() + this-&gt;k_r[3][j].eval());</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> abort();</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> }</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>}</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8"> 82</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle)</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span>{</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> this-&gt;particles.push_back(particle);</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span>}</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9"> 87</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r)</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span>{</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> r(2) *= -2.;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordtype">double</span> f = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a>(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) / (this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>);</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63"> 15</a></span><a class="code hl_function" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a>(<span class="keywordtype">double</span> B_0, std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; V_0,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span>{</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> this-&gt;B_0 = <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>;</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> = <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a>;</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> this-&gt;d = <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> this-&gt;t = <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span>}</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1"> 24</a></span><a class="code hl_function" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">double</span> B_0,</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span>{</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r, v;</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; i; j++) {</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> r = <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> v = <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>().randn() * .1 * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>;</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., r, v));</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> }</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>}</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73"> 36</a></span><a class="code hl_function" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a>(std::vector&lt;Particle&gt; particles, <span class="keywordtype">double</span> B_0,</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; V_0, <span class="keywordtype">double</span> d, <span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> : <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(B_0, V_0, d)</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span>{</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> this-&gt;particles = <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</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> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e"> 43</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap::v_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span>{</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[0][j];</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_v[1][j];</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">return</span> dt * this-&gt;k_v[2][j];</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">return</span> (dt / 6.) * (this-&gt;k_v[0][j] + 2. * this-&gt;k_v[1][j] +</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> 2. * this-&gt;k_v[2][j] + this-&gt;k_v[3][j]);</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> abort();</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> }</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> </div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648"> 61</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap::r_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt)</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span>{</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">switch</span> (i) {</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="keywordflow">case</span> 0:</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[0][j];</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <span class="keywordflow">case</span> 1:</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">return</span> .5 * dt * this-&gt;k_r[1][j];</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">case</span> 2:</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordflow">return</span> dt * this-&gt;k_r[2][j];</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">case</span> 3:</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordflow">return</span> (dt / 6.) * (this-&gt;k_r[0][j] + 2. * this-&gt;k_r[1][j] +</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> 2. * this-&gt;k_r[2][j] + this-&gt;k_r[3][j]);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">default</span>:</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not valid!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> abort();</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> }</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span>}</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8"> 79</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle)</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span>{</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> this-&gt;particles.push_back(particle);</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> </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9"> 84</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r)</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span>{</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> r(2) *= -2.;</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordtype">double</span> f = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a>(this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) / (this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> * this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> </div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordflow">return</span> f * r;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span>}</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">return</span> f * r;</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>}</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"><a class="line" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c"> 95</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r)</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="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., this-&gt;B_0};</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span>}</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> </div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce"> 100</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j)</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span>{</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <a class="code hl_class" href="classParticle.html">Particle</a> p_j = this-&gt;particles[j];</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="comment">// Calculate the difference between the particles&#39; position</span></div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> res = this-&gt;particles[i].<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a> - p_j.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> </div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="comment">// Get the distance between the particles</span></div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">double</span> norm = arma::norm(res, 2);</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">// Multiply res with p_j&#39;s charge divided by the norm cubed</span></div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>(res * p_j.<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a> / (norm * norm * norm));</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span>}</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56"> 114</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span>{</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_class" href="classParticle.html">Particle</a> p = this-&gt;particles[i];</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="keywordflow">if</span> (arma::norm(p.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>) &gt; this-&gt;d) {</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.};</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> }</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> </div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> force =</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> p.<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a> * (this-&gt;<a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(p.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>) +</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> arma::cross(p.<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a>, this-&gt;external_B_field(p.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>)));</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> </div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> <span class="keywordflow">return</span> force;</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span>}</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"><a class="line" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c"> 92</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r)</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>{</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., this-&gt;B_0};</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span>}</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"><a class="line" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce"> 97</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j)</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span>{</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// Calculate the difference between the particles&#39; position</span></div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> res = this-&gt;particles[i].r_vec - this-&gt;particles[j].r_vec;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="comment">// Get the distance between the particles</span></div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordtype">double</span> norm = arma::norm(res, 2);</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> </div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>(res * this-&gt;particles[j].q / (norm * norm * norm));</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span>}</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56"> 108</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span>{</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <a class="code hl_class" href="classParticle.html">Particle</a> p = this-&gt;particles[i];</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> </div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">if</span> (arma::norm(p.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>) &gt; this-&gt;d) {</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.};</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> }</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> </div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> force =</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> p.<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a> * (this-&gt;<a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(p.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>) +</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> arma::cross(p.<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a>, this-&gt;external_B_field(p.<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a>)));</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordflow">return</span> force;</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span>}</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> </div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b"> 123</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span>{</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_class" href="classParticle.html">Particle</a> p = this-&gt;particles[i];</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> res;</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b"> 129</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span>{</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <a class="code hl_class" href="classParticle.html">Particle</a> p = this-&gt;particles[i];</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> res;</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> </div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; this-&gt;particles.size(); j++) {</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="keywordflow">if</span> (i == j) {</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="keywordflow">continue</span>;</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> }</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; this-&gt;particles.size(); j++) {</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="keywordflow">if</span> (i == j) {</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordflow">continue</span>;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</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> res += this-&gt;<a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(i, j);</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> }</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> </div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>(res * <a class="code hl_define" href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">K_E</a> * (p.<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a> / p.<a class="code hl_variable" href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">m</a>));</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span>}</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> res += this-&gt;<a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(i, j);</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> }</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> </div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>(res * <a class="code hl_define" href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">K_E</a> * (p.<a class="code hl_variable" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">q</a> / p.<a class="code hl_variable" href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">m</a>));</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span>}</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8"> 146</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span>{</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keywordflow">return</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(i) - this-&gt;<a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(i);</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span>}</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8"> 140</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span>{</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="keywordflow">if</span> (arma::norm(this-&gt;particles[i].r_vec) &gt; this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>) {</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="keywordflow">return</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.};</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> }</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <span class="keywordflow">return</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(i) - this-&gt;<a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(i);</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span>}</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e"> 148</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span>{</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e"> 151</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span>{</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> std::vector&lt;Particle&gt; original_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> std::vector&lt;Particle&gt; tmp_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> </div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> std::vector&lt;Particle&gt; original_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> std::vector&lt;Particle&gt; tmp_particles = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> </div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(<span class="keywordtype">unsigned</span> int);</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="keywordflow">if</span> (particle_interaction) {</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a>;</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(<span class="keywordtype">unsigned</span> int);</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keywordflow">if</span> (particle_interaction) {</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a>;</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> }</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a>;</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> }</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a>;</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> }</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> </div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> <span class="keywordtype">size_t</span> size = this-&gt;particles.size();</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> </div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> <span class="keywordtype">size_t</span> size = this-&gt;particles.size();</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> </div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(size));</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(size));</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> </div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(size));</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a> = <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(4, <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(size));</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> </div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; this-&gt;particles.size(); j++) {</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[i][j] = (this-&gt;*force)(j) / this-&gt;particles[j].m;</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[i][j] = this-&gt;particles[j].v_vec;</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> </div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p = &amp;tmp_particles[j];</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> </div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a> = original_particles[j].v_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">v_func</a>(i, j, dt);</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> p-&gt;<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a> = original_particles[j].r_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">r_func</a>(i, j, dt);</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> }</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> this-&gt;particles = tmp_particles;</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> }</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span>}</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> </div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e"> 186</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span>{</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> std::vector&lt;Particle&gt; new_state = this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>;</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> </div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p;</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> </div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(<span class="keywordtype">unsigned</span> int);</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordflow">if</span> (particle_interaction) {</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a>;</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; this-&gt;particles.size(); j++) {</div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>[i][j] = (this-&gt;*force)(j) / this-&gt;particles[j].m;</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>[i][j] = this-&gt;particles[j].v_vec;</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> </div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p = &amp;tmp_particles[j];</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> </div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a> = original_particles[j].v_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">v_func</a>(i, j, dt);</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> p-&gt;<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a> = original_particles[j].r_vec + this-&gt;<a class="code hl_function" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">r_func</a>(i, j, dt);</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> }</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> this-&gt;particles.swap(tmp_particles);</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> }</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span>}</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> </div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e"> 183</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span>{</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="keywordtype">size_t</span> size = this-&gt;particles.size();</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> force_res[size];</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <a class="code hl_class" href="classParticle.html">Particle</a> *p;</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> </div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*force)(<span class="keywordtype">unsigned</span> int);</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <span class="keywordflow">if</span> (particle_interaction) {</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a>;</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> }</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a>;</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> }</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> force = &amp;<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a>;</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> }</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> </div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span><span class="preprocessor">#pragma omp parallel for private(p)</span></div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;particles.size(); i++) {</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> p = &amp;new_state[i];</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a> += dt * (this-&gt;*force)(i) / p-&gt;<a class="code hl_variable" href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">m</a>;</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> p-&gt;<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a> += dt * this-&gt;particles[i].v_vec;</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> }</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> </div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> this-&gt;particles = new_state;</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span>}</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> </div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854"> 211</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> <a class="code hl_function" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">PenningTrap::simulate</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> std::string method, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span>{</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span> </div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> res(this-&gt;particles.size(), <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(steps));</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> </div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span><span class="preprocessor">#pragma omp parallel for</span></div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> force_res[i] = (this-&gt;*force)(i);</div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> }</div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> </div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span><span class="preprocessor">#pragma omp parallel for private(p)</span></div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> p = &amp;this-&gt;particles[i];</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> p-&gt;<a class="code hl_variable" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">r_vec</a> += dt * p-&gt;<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a>;</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> p-&gt;<a class="code hl_variable" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">v_vec</a> += dt * force_res[i] / p-&gt;<a class="code hl_variable" href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">m</a>;</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> }</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> </div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> += dt;</div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span>}</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> </div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599"> 212</a></span><a class="code hl_struct" href="structsimulation.html">simulation_t</a> <a class="code hl_function" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">PenningTrap::simulate</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> std::string method,</div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span>{</div>
<div class="line"><a id="l00216" name="l00216"></a><span class="lineno"> 216</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> </div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> void (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*func)(double, bool);</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;rk4&quot;</span>) {</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>;</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> }</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;euler&quot;</span>) {</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>;</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> }</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not a valid method!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> abort();</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> }</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> </div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; steps; j++) {</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;particles.size(); i++) {</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> res[i][j] = this-&gt;particles[i].r_vec;</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> size = this-&gt;particles.size();</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> </div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res{<a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(size, <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(steps)),</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>(size, <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>(steps))};</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> </div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> void (<a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>::*func)(double, bool);</div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;rk4&quot;</span>) {</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a>;</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span> }</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (method == <span class="stringliteral">&quot;euler&quot;</span>) {</div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span> func = &amp;<a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a>;</div>
<div class="line"><a id="l00229" name="l00229"></a><span class="lineno"> 229</span> }</div>
<div class="line"><a id="l00230" name="l00230"></a><span class="lineno"> 230</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00231" name="l00231"></a><span class="lineno"> 231</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Not a valid method!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00232" name="l00232"></a><span class="lineno"> 232</span> abort();</div>
<div class="line"><a id="l00233" name="l00233"></a><span class="lineno"> 233</span> }</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> (this-&gt;*func)(dt, particle_interaction);</div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> }</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> </div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span>}</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> </div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"><a class="line" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57"> 240</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time,</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> <span class="keywordtype">int</span> steps, std::string method,</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span>{</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span> <span class="keywordflow">if</span> (path.back() != <span class="charliteral">&#39;/&#39;</span>) {</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> path += <span class="charliteral">&#39;/&#39;</span>;</div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"> 246</span> }</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path, 0777) != 0) {</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hello&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span> }</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> </div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> res = this-&gt;<a class="code hl_function" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">simulate</a>(time, steps, method, particle_interaction);</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> </div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> std::ofstream ofile;</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> </div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span><span class="preprocessor">#pragma omp parallel for private(ofile)</span></div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;particles.size(); i++) {</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;.txt&quot;</span>);</div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> &amp;vec : res[i]) {</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> ofile &lt;&lt; vec(0) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; vec(1) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; vec(2) &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> }</div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> ofile.close();</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> }</div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span>}</div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> </div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b"> 266</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps, std::string method, <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span>{</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> res = this-&gt;<a class="code hl_function" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">simulate</a>(time, steps, method, particle_interaction);</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> </div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> <span class="keywordtype">int</span> particles_left = 0;</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> </div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> <span class="keywordflow">for</span> (<a class="code hl_class" href="classParticle.html">Particle</a> p : this-&gt;particles) {</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> <span class="keywordflow">if</span> (arma::norm(p.r_vec) &lt; this-&gt;d) {</div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> particles_left++;</div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> }</div>
<div class="line"><a id="l00234" name="l00234"></a><span class="lineno"> 234</span> </div>
<div class="line"><a id="l00235" name="l00235"></a><span class="lineno"> 235</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; steps; j++) {</div>
<div class="line"><a id="l00236" name="l00236"></a><span class="lineno"> 236</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; size; i++) {</div>
<div class="line"><a id="l00237" name="l00237"></a><span class="lineno"> 237</span> res.r_vecs[i][j] = this-&gt;particles[i].r_vec;</div>
<div class="line"><a id="l00238" name="l00238"></a><span class="lineno"> 238</span> res.v_vecs[i][j] = this-&gt;particles[i].v_vec;</div>
<div class="line"><a id="l00239" name="l00239"></a><span class="lineno"> 239</span> }</div>
<div class="line"><a id="l00240" name="l00240"></a><span class="lineno"> 240</span> (this-&gt;*func)(dt, particle_interaction);</div>
<div class="line"><a id="l00241" name="l00241"></a><span class="lineno"> 241</span> }</div>
<div class="line"><a id="l00242" name="l00242"></a><span class="lineno"> 242</span> </div>
<div class="line"><a id="l00243" name="l00243"></a><span class="lineno"> 243</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00244" name="l00244"></a><span class="lineno"> 244</span>}</div>
<div class="line"><a id="l00245" name="l00245"></a><span class="lineno"> 245</span> </div>
<div class="line"><a id="l00246" name="l00246"></a><span class="lineno"><a class="line" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57"> 246</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time,</div>
<div class="line"><a id="l00247" name="l00247"></a><span class="lineno"> 247</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00248" name="l00248"></a><span class="lineno"> 248</span> std::string method,</div>
<div class="line"><a id="l00249" name="l00249"></a><span class="lineno"> 249</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00250" name="l00250"></a><span class="lineno"> 250</span>{</div>
<div class="line"><a id="l00251" name="l00251"></a><span class="lineno"> 251</span> <span class="keywordflow">if</span> (path.back() != <span class="charliteral">&#39;/&#39;</span>) {</div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno"> 252</span> path += <span class="charliteral">&#39;/&#39;</span>;</div>
<div class="line"><a id="l00253" name="l00253"></a><span class="lineno"> 253</span> }</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno"> 254</span> <span class="keywordflow">if</span> (<a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path, 0777) != 0) {</div>
<div class="line"><a id="l00255" name="l00255"></a><span class="lineno"> 255</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Hello&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00256" name="l00256"></a><span class="lineno"> 256</span> <span class="keywordflow">return</span>;</div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno"> 257</span> }</div>
<div class="line"><a id="l00258" name="l00258"></a><span class="lineno"> 258</span> </div>
<div class="line"><a id="l00259" name="l00259"></a><span class="lineno"> 259</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res =</div>
<div class="line"><a id="l00260" name="l00260"></a><span class="lineno"> 260</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">simulate</a>(time, steps, method, particle_interaction);</div>
<div class="line"><a id="l00261" name="l00261"></a><span class="lineno"> 261</span> </div>
<div class="line"><a id="l00262" name="l00262"></a><span class="lineno"> 262</span> std::ofstream ofile;</div>
<div class="line"><a id="l00263" name="l00263"></a><span class="lineno"> 263</span> </div>
<div class="line"><a id="l00264" name="l00264"></a><span class="lineno"> 264</span><span class="preprocessor">#pragma omp parallel for private(ofile)</span></div>
<div class="line"><a id="l00265" name="l00265"></a><span class="lineno"> 265</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; this-&gt;particles.size(); i++) {</div>
<div class="line"><a id="l00266" name="l00266"></a><span class="lineno"> 266</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;_r.txt&quot;</span>);</div>
<div class="line"><a id="l00267" name="l00267"></a><span class="lineno"> 267</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> &amp;vec : res.r_vecs[i]) {</div>
<div class="line"><a id="l00268" name="l00268"></a><span class="lineno"> 268</span> ofile &lt;&lt; vec(0) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; vec(1) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; vec(2) &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00269" name="l00269"></a><span class="lineno"> 269</span> }</div>
<div class="line"><a id="l00270" name="l00270"></a><span class="lineno"> 270</span> ofile.close();</div>
<div class="line"><a id="l00271" name="l00271"></a><span class="lineno"> 271</span> ofile.open(path + <span class="stringliteral">&quot;particle_&quot;</span> + std::to_string(i) + <span class="stringliteral">&quot;_v.txt&quot;</span>);</div>
<div class="line"><a id="l00272" name="l00272"></a><span class="lineno"> 272</span> <span class="keywordflow">for</span> (<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> &amp;vec : res.v_vecs[i]) {</div>
<div class="line"><a id="l00273" name="l00273"></a><span class="lineno"> 273</span> ofile &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(0), 10, 8) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span></div>
<div class="line"><a id="l00274" name="l00274"></a><span class="lineno"> 274</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(1), 8, 10) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span></div>
<div class="line"><a id="l00275" name="l00275"></a><span class="lineno"> 275</span> &lt;&lt; <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(vec(2), 8, 10) &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00276" name="l00276"></a><span class="lineno"> 276</span> }</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> </div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> <span class="keywordflow">return</span> (<span class="keywordtype">double</span>) particles_left / (double) this-&gt;particles.size();</div>
<div class="line"><a id="l00277" name="l00277"></a><span class="lineno"> 277</span> ofile.close();</div>
<div class="line"><a id="l00278" name="l00278"></a><span class="lineno"> 278</span> }</div>
<div class="line"><a id="l00279" name="l00279"></a><span class="lineno"> 279</span>}</div>
<div class="line"><a id="l00280" name="l00280"></a><span class="lineno"> 280</span> </div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b"> 281</a></span><span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno"> 282</span> std::string method,</div>
<div class="line"><a id="l00283" name="l00283"></a><span class="lineno"> 283</span> <span class="keywordtype">bool</span> particle_interaction)</div>
<div class="line"><a id="l00284" name="l00284"></a><span class="lineno"> 284</span>{</div>
<div class="line"><a id="l00285" name="l00285"></a><span class="lineno"> 285</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res =</div>
<div class="line"><a id="l00286" name="l00286"></a><span class="lineno"> 286</span> this-&gt;<a class="code hl_function" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">simulate</a>(time, steps, method, particle_interaction);</div>
<div class="line"><a id="l00287" name="l00287"></a><span class="lineno"> 287</span> </div>
<div class="line"><a id="l00288" name="l00288"></a><span class="lineno"> 288</span> <span class="keywordtype">int</span> particles_left = 0;</div>
<div class="line"><a id="l00289" name="l00289"></a><span class="lineno"> 289</span> </div>
<div class="line"><a id="l00290" name="l00290"></a><span class="lineno"> 290</span> <span class="keywordflow">for</span> (<a class="code hl_class" href="classParticle.html">Particle</a> p : this-&gt;particles) {</div>
<div class="line"><a id="l00291" name="l00291"></a><span class="lineno"> 291</span> <span class="keywordflow">if</span> (arma::norm(p.r_vec) &lt; this-&gt;d) {</div>
<div class="line"><a id="l00292" name="l00292"></a><span class="lineno"> 292</span> particles_left++;</div>
<div class="line"><a id="l00293" name="l00293"></a><span class="lineno"> 293</span> }</div>
<div class="line"><a id="l00294" name="l00294"></a><span class="lineno"> 294</span> }</div>
<div class="line"><a id="l00295" name="l00295"></a><span class="lineno"> 295</span> </div>
<div class="line"><a id="l00296" name="l00296"></a><span class="lineno"> 296</span> <span class="keywordflow">return</span> (<span class="keywordtype">double</span>)particles_left / (double)this-&gt;particles.size();</div>
<div class="line"><a id="l00297" name="l00297"></a><span class="lineno"> 297</span>}</div>
<div class="line"><a id="l00298" name="l00298"></a><span class="lineno"> 298</span> </div>
<div class="line"><a id="l00299" name="l00299"></a><span class="lineno"> 299</span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> PenningTrap::get_r(<span class="keywordtype">int</span> i)</div>
<div class="line"><a id="l00300" name="l00300"></a><span class="lineno"> 300</span>{</div>
<div class="line"><a id="l00301" name="l00301"></a><span class="lineno"> 301</span> <span class="keywordflow">return</span> this-&gt;particles[i].r_vec;</div>
<div class="line"><a id="l00302" name="l00302"></a><span class="lineno"> 302</span>}</div>
<div class="line"><a id="l00303" name="l00303"></a><span class="lineno"> 303</span> </div>
<div class="line"><a id="l00304" name="l00304"></a><span class="lineno"> 304</span><span class="keywordtype">double</span> PenningTrap::get_t()</div>
<div class="line"><a id="l00305" name="l00305"></a><span class="lineno"> 305</span>{</div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno"> 306</span> <span class="keywordflow">return</span> this-&gt;<a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>;</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno"> 307</span>}</div>
<div class="ttc" id="aPenningTrap_8hpp_html"><div class="ttname"><a href="PenningTrap_8hpp.html">PenningTrap.hpp</a></div><div class="ttdoc">A class for simulating a Penning trap.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00021">Particle.hpp:21</a></div></div>
<div class="ttc" id="aclassParticle_html_a566dcc1de4bdc01251776948798ea8e1"><div class="ttname"><a href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">Particle::q</a></div><div class="ttdeci">double q</div><div class="ttdoc">Charge.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00023">Particle.hpp:23</a></div></div>
<div class="ttc" id="aclassParticle_html_a879692772803d6ab65fa4993b54aea6e"><div class="ttname"><a href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">Particle::v_vec</a></div><div class="ttdeci">vec_3d v_vec</div><div class="ttdoc">velocity</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00026">Particle.hpp:26</a></div></div>
<div class="ttc" id="aclassParticle_html_aedcc7e1bc53b0e2b1a4a07c9a1b47563"><div class="ttname"><a href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">Particle::m</a></div><div class="ttdeci">double m</div><div class="ttdoc">Mass.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00024">Particle.hpp:24</a></div></div>
<div class="ttc" id="aclassParticle_html_af9497cd8f2dcad0fad54f571ddb383e6"><div class="ttname"><a href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">Particle::r_vec</a></div><div class="ttdeci">vec_3d r_vec</div><div class="ttdoc">position</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00025">Particle.hpp:25</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00030">PenningTrap.hpp:30</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0112525d9e79a472e761f8ef402a339f"><div class="ttname"><a href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap::particles</a></div><div class="ttdeci">std::vector&lt; Particle &gt; particles</div><div class="ttdoc">The particles in the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00036">PenningTrap.hpp:36</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0194be61c956a9259c747c23e4163c5b"><div class="ttname"><a href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00266">PenningTrap.cpp:266</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0cac3509aa96e71a26d3b2c902e27716"><div class="ttname"><a href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap::B_0</a></div><div class="ttdeci">double B_0</div><div class="ttdoc">Magnetic field strength.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00032">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1d58feaa2c9e34cbf26b1c5ed75ca9d9"><div class="ttname"><a href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a></div><div class="ttdeci">vec_3d external_E_field(vec_3d r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00087">PenningTrap.cpp:87</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1f668c4433421136ad51741741aa1bc8"><div class="ttname"><a href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a></div><div class="ttdeci">vec_3d total_force(unsigned int i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00146">PenningTrap.cpp:146</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2f168622587709b9e3c49077f0b9a640"><div class="ttname"><a href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap::k_r</a></div><div class="ttdeci">sim_arr k_r</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00039">PenningTrap.hpp:39</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00151">PenningTrap.cpp:151</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a43e74792ab4b3f9299f35cb64bdb2648"><div class="ttname"><a href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap::r_func</a></div><div class="ttdeci">vec_3d r_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00064">PenningTrap.cpp:64</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a46a954a0946def199e30fb300ba1c47b"><div class="ttname"><a href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec_3d total_force_particles(unsigned int i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00129">PenningTrap.cpp:129</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5331837e6dd7bce807a99edd2ba7e854"><div class="ttname"><a href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">PenningTrap::simulate</a></div><div class="ttdeci">sim_arr simulate(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00211">PenningTrap.cpp:211</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a66dfe89c68716b9502927b97f59c27d2"><div class="ttname"><a href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap::d</a></div><div class="ttdeci">double d</div><div class="ttdoc">Characteristic dimension.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00034">PenningTrap.hpp:34</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00082">PenningTrap.cpp:82</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a8ca4e21291f60fde619c14099d8c4e8e"><div class="ttname"><a href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap::t</a></div><div class="ttdeci">double t</div><div class="ttdoc">Current time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00035">PenningTrap.hpp:35</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9ae34ad740a230e667e96bc6ee8730ce"><div class="ttname"><a href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec_3d force_on_particle(unsigned int i, unsigned int j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00100">PenningTrap.cpp:100</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaf105828121c4a33cc2b217453c20317"><div class="ttname"><a href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">PenningTrap::V_0</a></div><div class="ttdeci">std::function&lt; double(double)&gt; V_0</div><div class="ttdoc">Applied potential.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00033">PenningTrap.hpp:33</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00186">PenningTrap.cpp:186</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_abbb832a85139b1a56ebde57d7b8f9a57"><div class="ttname"><a href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00240">PenningTrap.cpp:240</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_acbf065c9c125682329ad82a8d166554c"><div class="ttname"><a href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a></div><div class="ttdeci">vec_3d external_B_field(vec_3d r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00095">PenningTrap.cpp:95</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae670d7de621acdb343b01af098086f63"><div class="ttname"><a href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a></div><div class="ttdeci">PenningTrap(double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)</div><div class="ttdoc">Constructor for the PenningTrap class.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00018">PenningTrap.cpp:18</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae72d203b0bfa1b9e72bea28cb2863c56"><div class="ttname"><a href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a></div><div class="ttdeci">vec_3d total_force_external(unsigned int i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00114">PenningTrap.cpp:114</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae9b5afdaa5cd366e94bd294452a1eed4"><div class="ttname"><a href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap::k_v</a></div><div class="ttdeci">sim_arr k_v</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00037">PenningTrap.hpp:37</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_af98a720da60b0e1a62aefa5f5cb37c1e"><div class="ttname"><a href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap::v_func</a></div><div class="ttdeci">vec_3d v_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00046">PenningTrap.cpp:46</a></div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div><div class="ttdoc">Library of constants.</div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:31</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0112525d9e79a472e761f8ef402a339f"><div class="ttname"><a href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap::particles</a></div><div class="ttdeci">std::vector&lt; Particle &gt; particles</div><div class="ttdoc">The particles in the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00037">PenningTrap.hpp:37</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0194be61c956a9259c747c23e4163c5b"><div class="ttname"><a href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00281">PenningTrap.cpp:281</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0cac3509aa96e71a26d3b2c902e27716"><div class="ttname"><a href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap::B_0</a></div><div class="ttdeci">double B_0</div><div class="ttdoc">Magnetic field strength.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00033">PenningTrap.hpp:33</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1d58feaa2c9e34cbf26b1c5ed75ca9d9"><div class="ttname"><a href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a></div><div class="ttdeci">vec_3d external_E_field(vec_3d r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00084">PenningTrap.cpp:84</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1f668c4433421136ad51741741aa1bc8"><div class="ttname"><a href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a></div><div class="ttdeci">vec_3d total_force(unsigned int i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00140">PenningTrap.cpp:140</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2f168622587709b9e3c49077f0b9a640"><div class="ttname"><a href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap::k_r</a></div><div class="ttdeci">sim_arr k_r</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00040">PenningTrap.hpp:40</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00148">PenningTrap.cpp:148</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a43e74792ab4b3f9299f35cb64bdb2648"><div class="ttname"><a href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap::r_func</a></div><div class="ttdeci">vec_3d r_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00061">PenningTrap.cpp:61</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a46a954a0946def199e30fb300ba1c47b"><div class="ttname"><a href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec_3d total_force_particles(unsigned int i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00123">PenningTrap.cpp:123</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a66dfe89c68716b9502927b97f59c27d2"><div class="ttname"><a href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap::d</a></div><div class="ttdeci">double d</div><div class="ttdoc">Characteristic dimension.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00035">PenningTrap.hpp:35</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00079">PenningTrap.cpp:79</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a8ca4e21291f60fde619c14099d8c4e8e"><div class="ttname"><a href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap::t</a></div><div class="ttdeci">double t</div><div class="ttdoc">Current time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00036">PenningTrap.hpp:36</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9ae34ad740a230e667e96bc6ee8730ce"><div class="ttname"><a href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec_3d force_on_particle(unsigned int i, unsigned int j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00097">PenningTrap.cpp:97</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaf105828121c4a33cc2b217453c20317"><div class="ttname"><a href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">PenningTrap::V_0</a></div><div class="ttdeci">std::function&lt; double(double)&gt; V_0</div><div class="ttdoc">Applied potential.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00034">PenningTrap.hpp:34</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00183">PenningTrap.cpp:183</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_abbb832a85139b1a56ebde57d7b8f9a57"><div class="ttname"><a href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00246">PenningTrap.cpp:246</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_acbf065c9c125682329ad82a8d166554c"><div class="ttname"><a href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a></div><div class="ttdeci">vec_3d external_B_field(vec_3d r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00092">PenningTrap.cpp:92</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae09ef9cfa7e4ed1c108c8576405b3599"><div class="ttname"><a href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00212">PenningTrap.cpp:212</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae670d7de621acdb343b01af098086f63"><div class="ttname"><a href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap::PenningTrap</a></div><div class="ttdeci">PenningTrap(double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)</div><div class="ttdoc">Constructor for the PenningTrap class.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00015">PenningTrap.cpp:15</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae72d203b0bfa1b9e72bea28cb2863c56"><div class="ttname"><a href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a></div><div class="ttdeci">vec_3d total_force_external(unsigned int i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00108">PenningTrap.cpp:108</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae9b5afdaa5cd366e94bd294452a1eed4"><div class="ttname"><a href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap::k_v</a></div><div class="ttdeci">sim_arr k_v</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00038">PenningTrap.hpp:38</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_af98a720da60b0e1a62aefa5f5cb37c1e"><div class="ttname"><a href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap::v_func</a></div><div class="ttdeci">vec_3d v_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00043">PenningTrap.cpp:43</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_a4e451456ad7e9276ed0afa42826e7ccb"><div class="ttname"><a href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">K_E</a></div><div class="ttdeci">#define K_E</div><div class="ttdoc">Coulomb constant. unit: .</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00015">constants.hpp:15</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html"><div class="ttname"><a href="typedefs_8hpp.html">typedefs.hpp</a></div><div class="ttdoc">Useful typedefs for cleaner code.</div></div>
<div class="ttc" id="astructsimulation_html"><div class="ttname"><a href="structsimulation.html">simulation</a></div><div class="ttdoc">Typedef for PenningTrap::simulation return value.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00040">typedefs.hpp:40</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a7c2dfa854274262c4e00e4ef0ab2ce23"><div class="ttname"><a href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a></div><div class="ttdeci">std::vector&lt; arma::vec::fixed&lt; 3 &gt; &gt; sim_cols</div><div class="ttdoc">Typedef for the column of the result vector from simulating particles.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00024">typedefs.hpp:24</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_aec69d34220fff45de238b9e01f2686af"><div class="ttname"><a href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a></div><div class="ttdeci">std::vector&lt; sim_cols &gt; sim_arr</div><div class="ttdoc">Typedef for the result of the simulate method.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00032">typedefs.hpp:32</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">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#l00076">utils.cpp:76</a></div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">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#l00074">utils.cpp:74</a></div></div>
<div class="ttc" id="autils_8hpp_html_adfb618b2fdff47ef30a4a2b62c04f384"><div class="ttname"><a href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">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#l00015">utils.cpp:15</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -111,6 +111,7 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp.html',''); initResiza
<code>#include &quot;<a class="el" href="Particle_8hpp_source.html">Particle.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="constants_8hpp_source.html">constants.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
</div>
<p><a href="PenningTrap_8hpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">

View File

@ -111,105 +111,111 @@ $(document).ready(function(){initNavTree('PenningTrap_8hpp_source.html',''); ini
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &quot;<a class="code" href="Particle_8hpp.html">Particle.hpp</a>&quot;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &quot;<a class="code" href="constants_8hpp.html">constants.hpp</a>&quot;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include &quot;<a class="code" href="typedefs_8hpp.html">typedefs.hpp</a>&quot;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor"> initializer(omp_priv = omp_orig)</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="classPenningTrap.html"> 30</a></span><span class="keyword">class </span><a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> {</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716"> 32</a></span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>; </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317"> 33</a></span> std::function&lt;double(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a>; </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2"> 34</a></span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>; </div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e"> 35</a></span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>; </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f"> 36</a></span> std::vector&lt;Particle&gt; <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>; </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4"> 37</a></span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> <a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>; </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640"> 39</a></span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> <a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>; </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">v_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt);</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">r_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt);</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><span class="keyword">public</span>:</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> =</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.; },</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> =</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.; },</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> std::vector&lt;Particle&gt; <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> =</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.; },</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle);</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r);</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> </div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j);</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> </div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> </div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">total_force</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> </div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> </div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> </div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> <a class="code hl_function" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">simulate</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> </div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time,</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps, std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> </div>
<div class="line"><a id="l00217" name="l00217"></a><span class="lineno"> 217</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00218" name="l00218"></a><span class="lineno"> 218</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00219" name="l00219"></a><span class="lineno"> 219</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span>};</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> </div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor"> initializer(omp_priv = omp_orig)</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"><a class="line" href="classPenningTrap.html"> 31</a></span><span class="keyword">class </span><a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> {</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716"> 33</a></span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a>; </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317"> 34</a></span> std::function&lt;double(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a>; </div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2"> 35</a></span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a>; </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e"> 36</a></span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>; </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f"> 37</a></span> std::vector&lt;Particle&gt; <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>; </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4"> 38</a></span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> <a class="code hl_variable" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a>; </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640"> 40</a></span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> <a class="code hl_variable" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a>; </div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> </div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">v_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt);</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">r_func</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j, <span class="keywordtype">double</span> dt);</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="keyword">public</span>:</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> =</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.; },</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> =</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.; },</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a>(</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> std::vector&lt;Particle&gt; <a class="code hl_variable" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a>, <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">B_0</a> = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> std::function&lt;<span class="keywordtype">double</span>(<span class="keywordtype">double</span>)&gt; <a class="code hl_variable" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">V_0</a> =</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> [](<span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a>) { <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.; },</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">d</a> = 500., <span class="keywordtype">double</span> <a class="code hl_variable" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a> = 0.);</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> </div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a> particle);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r);</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> r);</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> </div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j);</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> </div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> </div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">total_force</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> </div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">evolve_RK4</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">evolve_forward_euler</a>(<span class="keywordtype">double</span> dt, <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> </div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> <a class="code hl_function" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">simulate</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> </div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(std::string path, <span class="keywordtype">double</span> time,</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps, std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
<div class="line"><a id="l00220" name="l00220"></a><span class="lineno"> 220</span> <span class="keywordtype">double</span> <a class="code hl_function" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">fraction_of_particles_left</a>(<span class="keywordtype">double</span> time, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> steps,</div>
<div class="line"><a id="l00221" name="l00221"></a><span class="lineno"> 221</span> std::string method = <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00222" name="l00222"></a><span class="lineno"> 222</span> <span class="keywordtype">bool</span> particle_interaction = <span class="keyword">true</span>);</div>
<div class="line"><a id="l00223" name="l00223"></a><span class="lineno"> 223</span> </div>
<div class="line"><a id="l00224" name="l00224"></a><span class="lineno"> 224</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> get_r(<span class="keywordtype">int</span> i);</div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno"> 225</span> <span class="keywordtype">double</span> get_t();</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno"> 226</span>};</div>
<div class="line"><a id="l00227" name="l00227"></a><span class="lineno"> 227</span> </div>
<div class="line"><a id="l00228" name="l00228"></a><span class="lineno"> 228</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="aParticle_8hpp_html"><div class="ttname"><a href="Particle_8hpp.html">Particle.hpp</a></div><div class="ttdoc">A class that holds the properties of a particle.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00021">Particle.hpp:21</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00030">PenningTrap.hpp:30</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0112525d9e79a472e761f8ef402a339f"><div class="ttname"><a href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap::particles</a></div><div class="ttdeci">std::vector&lt; Particle &gt; particles</div><div class="ttdoc">The particles in the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00036">PenningTrap.hpp:36</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0194be61c956a9259c747c23e4163c5b"><div class="ttname"><a href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00266">PenningTrap.cpp:266</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0cac3509aa96e71a26d3b2c902e27716"><div class="ttname"><a href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap::B_0</a></div><div class="ttdeci">double B_0</div><div class="ttdoc">Magnetic field strength.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00032">PenningTrap.hpp:32</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1d58feaa2c9e34cbf26b1c5ed75ca9d9"><div class="ttname"><a href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a></div><div class="ttdeci">vec_3d external_E_field(vec_3d r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00087">PenningTrap.cpp:87</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1f668c4433421136ad51741741aa1bc8"><div class="ttname"><a href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a></div><div class="ttdeci">vec_3d total_force(unsigned int i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00146">PenningTrap.cpp:146</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2f168622587709b9e3c49077f0b9a640"><div class="ttname"><a href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap::k_r</a></div><div class="ttdeci">sim_arr k_r</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00039">PenningTrap.hpp:39</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00151">PenningTrap.cpp:151</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a43e74792ab4b3f9299f35cb64bdb2648"><div class="ttname"><a href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap::r_func</a></div><div class="ttdeci">vec_3d r_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00064">PenningTrap.cpp:64</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a46a954a0946def199e30fb300ba1c47b"><div class="ttname"><a href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec_3d total_force_particles(unsigned int i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00129">PenningTrap.cpp:129</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a5331837e6dd7bce807a99edd2ba7e854"><div class="ttname"><a href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">PenningTrap::simulate</a></div><div class="ttdeci">sim_arr simulate(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00211">PenningTrap.cpp:211</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a66dfe89c68716b9502927b97f59c27d2"><div class="ttname"><a href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap::d</a></div><div class="ttdeci">double d</div><div class="ttdoc">Characteristic dimension.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00034">PenningTrap.hpp:34</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00082">PenningTrap.cpp:82</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a8ca4e21291f60fde619c14099d8c4e8e"><div class="ttname"><a href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap::t</a></div><div class="ttdeci">double t</div><div class="ttdoc">Current time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00035">PenningTrap.hpp:35</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9ae34ad740a230e667e96bc6ee8730ce"><div class="ttname"><a href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec_3d force_on_particle(unsigned int i, unsigned int j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00100">PenningTrap.cpp:100</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaf105828121c4a33cc2b217453c20317"><div class="ttname"><a href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">PenningTrap::V_0</a></div><div class="ttdeci">std::function&lt; double(double)&gt; V_0</div><div class="ttdoc">Applied potential.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00033">PenningTrap.hpp:33</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00186">PenningTrap.cpp:186</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_abbb832a85139b1a56ebde57d7b8f9a57"><div class="ttname"><a href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00240">PenningTrap.cpp:240</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_acbf065c9c125682329ad82a8d166554c"><div class="ttname"><a href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a></div><div class="ttdeci">vec_3d external_B_field(vec_3d r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00095">PenningTrap.cpp:95</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae72d203b0bfa1b9e72bea28cb2863c56"><div class="ttname"><a href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a></div><div class="ttdeci">vec_3d total_force_external(unsigned int i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00114">PenningTrap.cpp:114</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae9b5afdaa5cd366e94bd294452a1eed4"><div class="ttname"><a href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap::k_v</a></div><div class="ttdeci">sim_arr k_v</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00037">PenningTrap.hpp:37</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_af98a720da60b0e1a62aefa5f5cb37c1e"><div class="ttname"><a href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap::v_func</a></div><div class="ttdeci">vec_3d v_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00046">PenningTrap.cpp:46</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:31</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0112525d9e79a472e761f8ef402a339f"><div class="ttname"><a href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap::particles</a></div><div class="ttdeci">std::vector&lt; Particle &gt; particles</div><div class="ttdoc">The particles in the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00037">PenningTrap.hpp:37</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0194be61c956a9259c747c23e4163c5b"><div class="ttname"><a href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00281">PenningTrap.cpp:281</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0cac3509aa96e71a26d3b2c902e27716"><div class="ttname"><a href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap::B_0</a></div><div class="ttdeci">double B_0</div><div class="ttdoc">Magnetic field strength.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00033">PenningTrap.hpp:33</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1d58feaa2c9e34cbf26b1c5ed75ca9d9"><div class="ttname"><a href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a></div><div class="ttdeci">vec_3d external_E_field(vec_3d r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00084">PenningTrap.cpp:84</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1f668c4433421136ad51741741aa1bc8"><div class="ttname"><a href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap::total_force</a></div><div class="ttdeci">vec_3d total_force(unsigned int i)</div><div class="ttdoc">calculate the total force on a particle p_i.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00140">PenningTrap.cpp:140</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a2f168622587709b9e3c49077f0b9a640"><div class="ttname"><a href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap::k_r</a></div><div class="ttdeci">sim_arr k_r</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00040">PenningTrap.hpp:40</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a36946152fd951b1f7c346c51ff900d8e"><div class="ttname"><a href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap::evolve_RK4</a></div><div class="ttdeci">void evolve_RK4(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the RK4 method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00148">PenningTrap.cpp:148</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a43e74792ab4b3f9299f35cb64bdb2648"><div class="ttname"><a href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap::r_func</a></div><div class="ttdeci">vec_3d r_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00061">PenningTrap.cpp:61</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a46a954a0946def199e30fb300ba1c47b"><div class="ttname"><a href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec_3d total_force_particles(unsigned int i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00123">PenningTrap.cpp:123</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a66dfe89c68716b9502927b97f59c27d2"><div class="ttname"><a href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap::d</a></div><div class="ttdeci">double d</div><div class="ttdoc">Characteristic dimension.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00035">PenningTrap.hpp:35</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00079">PenningTrap.cpp:79</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a8ca4e21291f60fde619c14099d8c4e8e"><div class="ttname"><a href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap::t</a></div><div class="ttdeci">double t</div><div class="ttdoc">Current time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00036">PenningTrap.hpp:36</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9ae34ad740a230e667e96bc6ee8730ce"><div class="ttname"><a href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec_3d force_on_particle(unsigned int i, unsigned int j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00097">PenningTrap.cpp:97</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_aaf105828121c4a33cc2b217453c20317"><div class="ttname"><a href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">PenningTrap::V_0</a></div><div class="ttdeci">std::function&lt; double(double)&gt; V_0</div><div class="ttdoc">Applied potential.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00034">PenningTrap.hpp:34</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ab9ea97a406534bbe621a95215144875e"><div class="ttname"><a href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap::evolve_forward_euler</a></div><div class="ttdeci">void evolve_forward_euler(double dt, bool particle_interaction=true)</div><div class="ttdoc">Go forward one timestep using the forward Euler method.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00183">PenningTrap.cpp:183</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_abbb832a85139b1a56ebde57d7b8f9a57"><div class="ttname"><a href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00246">PenningTrap.cpp:246</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_acbf065c9c125682329ad82a8d166554c"><div class="ttname"><a href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a></div><div class="ttdeci">vec_3d external_B_field(vec_3d r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00092">PenningTrap.cpp:92</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae09ef9cfa7e4ed1c108c8576405b3599"><div class="ttname"><a href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">PenningTrap::simulate</a></div><div class="ttdeci">simulation_t simulate(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate the particle system inside the Penning trap over a certain amount of time.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00212">PenningTrap.cpp:212</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae72d203b0bfa1b9e72bea28cb2863c56"><div class="ttname"><a href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a></div><div class="ttdeci">vec_3d total_force_external(unsigned int i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00108">PenningTrap.cpp:108</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae9b5afdaa5cd366e94bd294452a1eed4"><div class="ttname"><a href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap::k_v</a></div><div class="ttdeci">sim_arr k_v</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00038">PenningTrap.hpp:38</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_af98a720da60b0e1a62aefa5f5cb37c1e"><div class="ttname"><a href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap::v_func</a></div><div class="ttdeci">vec_3d v_func(unsigned int i, unsigned int j, double dt)</div><div class="ttdoc">Helper for evolve_RK4 when calculating values.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00043">PenningTrap.cpp:43</a></div></div>
<div class="ttc" id="aconstants_8hpp_html"><div class="ttname"><a href="constants_8hpp.html">constants.hpp</a></div><div class="ttdoc">Library of constants.</div></div>
<div class="ttc" id="aconstants_8hpp_html_a0acb682b8260ab1c60b918599864e2e5"><div class="ttname"><a href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a></div><div class="ttdeci">#define T</div><div class="ttdoc">1 Tesla. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00017">constants.hpp:17</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_af40a326b23c68a27cebe60f16634a2cb"><div class="ttname"><a href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a></div><div class="ttdeci">#define V</div><div class="ttdoc">1 Volt. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00019">constants.hpp:19</a></div></div>
<div class="ttc" id="astructsimulation_html"><div class="ttname"><a href="structsimulation.html">simulation</a></div><div class="ttdoc">Typedef for PenningTrap::simulation return value.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00040">typedefs.hpp:40</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html"><div class="ttname"><a href="typedefs_8hpp.html">typedefs.hpp</a></div><div class="ttdoc">Useful typedefs for cleaner code.</div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_aec69d34220fff45de238b9e01f2686af"><div class="ttname"><a href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a></div><div class="ttdeci">std::vector&lt; sim_cols &gt; sim_arr</div><div class="ttdoc">Typedef for the result of the simulate method.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00032">typedefs.hpp:32</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -5,7 +5,7 @@
<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>Penning Trap Simulation: src/animate_100_particles.py Source File</title>
<title>Penning Trap Simulation: src/scripts/animate_100_particles.py 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>
@ -177,7 +177,7 @@ $(document).ready(function(){initNavTree('animate__100__particles_8py_source.htm
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><b>animate_100_particles.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>animate_100_particles.py</b></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>

View File

@ -105,7 +105,8 @@ $(document).ready(function(){initNavTree('annotated.html',''); initResizable();
<table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classParticle.html" target="_self">Particle</a></td><td class="desc">A class that holds attributes of a particle </td></tr>
<tr id="row_1_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classPenningTrap.html" target="_self">PenningTrap</a></td><td class="desc">A class that simulates a Penning trap </td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classPenningTrapTest.html" target="_self">PenningTrapTest</a></td><td class="desc"></td></tr>
<tr id="row_2_" class="even"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="classPenningTrapTest.html" target="_self">PenningTrapTest</a></td><td class="desc">Test class for the Penning trap </td></tr>
<tr id="row_3_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span class="icona"><span class="icon">C</span></span><a class="el" href="structsimulation.html" target="_self">simulation</a></td><td class="desc">Typedef for PenningTrap::simulation return value </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->

View File

@ -2,5 +2,6 @@ var annotated_dup =
[
[ "Particle", "classParticle.html", "classParticle" ],
[ "PenningTrap", "classPenningTrap.html", "classPenningTrap" ],
[ "PenningTrapTest", "classPenningTrapTest.html", null ]
[ "PenningTrapTest", "classPenningTrapTest.html", null ],
[ "simulation", "structsimulation.html", null ]
];

View File

@ -113,6 +113,8 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(vec_3d r)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(unsigned int i, unsigned int j)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">fraction_of_particles_left</a>(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>get_r</b>(int i) (defined in <a class="el" href="classPenningTrap.html">PenningTrap</a>)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>get_t</b>() (defined in <a class="el" href="classPenningTrap.html">PenningTrap</a>)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">k_r</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">k_v</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">particles</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
@ -120,7 +122,7 @@ $(document).ready(function(){initNavTree('classPenningTrap.html',''); initResiza
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1">PenningTrap</a>(unsigned int i, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73">PenningTrap</a>(std::vector&lt; Particle &gt; particles, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">r_func</a>(unsigned int i, unsigned int j, double dt)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">simulate</a>(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">simulate</a>(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">t</a></td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"><span class="mlabel">private</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">total_force</a>(unsigned int i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(unsigned int i)</td><td class="entry"><a class="el" href="classPenningTrap.html">PenningTrap</a></td><td class="entry"></td></tr>

View File

@ -150,15 +150,19 @@ Public Member Functions</h2></td></tr>
<tr class="memitem:ab9ea97a406534bbe621a95215144875e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">evolve_forward_euler</a> (double dt, bool particle_interaction=true)</td></tr>
<tr class="memdesc:ab9ea97a406534bbe621a95215144875e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Go forward one timestep using the forward Euler method. <br /></td></tr>
<tr class="separator:ab9ea97a406534bbe621a95215144875e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5331837e6dd7bce807a99edd2ba7e854"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">simulate</a> (double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td></tr>
<tr class="memdesc:a5331837e6dd7bce807a99edd2ba7e854"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate the particle system inside the Penning trap over a certain amount of time. <br /></td></tr>
<tr class="separator:a5331837e6dd7bce807a99edd2ba7e854"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae09ef9cfa7e4ed1c108c8576405b3599"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6">simulation_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">simulate</a> (double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td></tr>
<tr class="memdesc:ae09ef9cfa7e4ed1c108c8576405b3599"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate the particle system inside the Penning trap over a certain amount of time. <br /></td></tr>
<tr class="separator:ae09ef9cfa7e4ed1c108c8576405b3599"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abbb832a85139b1a56ebde57d7b8f9a57"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a> (std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td></tr>
<tr class="memdesc:abbb832a85139b1a56ebde57d7b8f9a57"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate and write the displacement of all particles to files. <br /></td></tr>
<tr class="separator:abbb832a85139b1a56ebde57d7b8f9a57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0194be61c956a9259c747c23e4163c5b"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">fraction_of_particles_left</a> (double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</td></tr>
<tr class="memdesc:a0194be61c956a9259c747c23e4163c5b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate and calculate what fraction of particles are still left inside the Penning trap after the simulation. <br /></td></tr>
<tr class="separator:a0194be61c956a9259c747c23e4163c5b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aea6e41b0cef85c498e69b264a81cfd7f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#aea6e41b0cef85c498e69b264a81cfd7f">get_r</a> (int i)</td></tr>
<tr class="separator:aea6e41b0cef85c498e69b264a81cfd7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a62be138b421f0e550399abadc10efd83"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrap.html#a62be138b421f0e550399abadc10efd83">get_t</a> ()</td></tr>
<tr class="separator:a62be138b421f0e550399abadc10efd83"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-methods" name="pri-methods"></a>
Private Member Functions</h2></td></tr>
@ -195,7 +199,7 @@ Private Attributes</h2></td></tr>
<div class="textblock"><p>A class that simulates a Penning trap. </p>
<p>This class simulates a Penning trap. It can take in a number of particles and simulate how they would behave inside a Penning trap. </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00030">30</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00031">31</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ae670d7de621acdb343b01af098086f63" name="ae670d7de621acdb343b01af098086f63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae670d7de621acdb343b01af098086f63">&#9670;&#160;</a></span>PenningTrap() <span class="overload">[1/3]</span></h2>
@ -246,7 +250,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00018">18</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00015">15</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -306,7 +310,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00027">27</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00024">24</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -366,7 +370,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00039">39</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00036">36</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -395,7 +399,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00082">82</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00079">79</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -434,7 +438,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00186">186</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00183">183</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -473,7 +477,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00151">151</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00148">148</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -502,7 +506,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00095">95</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00092">92</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -531,7 +535,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00087">87</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00084">84</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -572,7 +576,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00100">100</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00097">97</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -626,7 +630,46 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>double </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00266">266</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00281">281</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
<a id="aea6e41b0cef85c498e69b264a81cfd7f" name="aea6e41b0cef85c498e69b264a81cfd7f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aea6e41b0cef85c498e69b264a81cfd7f">&#9670;&#160;</a></span>get_r()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> PenningTrap::get_r </td>
<td>(</td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>i</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00299">299</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
<a id="a62be138b421f0e550399abadc10efd83" name="a62be138b421f0e550399abadc10efd83"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a62be138b421f0e550399abadc10efd83">&#9670;&#160;</a></span>get_t()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double PenningTrap::get_t </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00304">304</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -676,24 +719,24 @@ Private Attributes</h2></td></tr>
<table class="params">
<tr><td class="paramname">i</td><td>Index i for \(k_{r,i,j}\) </td></tr>
<tr><td class="paramname">j</td><td>Index j for \(k_{r,i,j}\) </td></tr>
<tr><td class="paramname">dt</td><td>the step length (delta time)</td></tr>
<tr><td class="paramname">dt</td><td>The step length (delta time)</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00064">64</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00061">61</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
<a id="a5331837e6dd7bce807a99edd2ba7e854" name="a5331837e6dd7bce807a99edd2ba7e854"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5331837e6dd7bce807a99edd2ba7e854">&#9670;&#160;</a></span>simulate()</h2>
<a id="ae09ef9cfa7e4ed1c108c8576405b3599" name="ae09ef9cfa7e4ed1c108c8576405b3599"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae09ef9cfa7e4ed1c108c8576405b3599">&#9670;&#160;</a></span>simulate()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> PenningTrap::simulate </td>
<td class="memname"><a class="el" href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6">simulation_t</a> PenningTrap::simulate </td>
<td>(</td>
<td class="paramtype">double&#160;</td>
<td class="paramname"><em>time</em>, </td>
@ -730,12 +773,13 @@ Private Attributes</h2></td></tr>
<tr><td class="paramname">time</td><td>The time to simulate in microseconds </td></tr>
<tr><td class="paramname">steps</td><td>The amount of steps for the whole simulation </td></tr>
<tr><td class="paramname">method</td><td>The method to use when moving forward a timestep </td></tr>
<tr><td class="paramname">particle_interaction</td><td>Turn particle interactions on/off </td></tr>
<tr><td class="paramname">particle_interaction</td><td>Turn particle interactions on/off</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>simulation_t </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00211">211</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00212">212</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -764,7 +808,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00146">146</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00140">140</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -794,7 +838,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00114">114</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00108">108</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -823,7 +867,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00129">129</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00123">123</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -879,7 +923,7 @@ Private Attributes</h2></td></tr>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00046">46</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00043">43</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -939,7 +983,7 @@ Private Attributes</h2></td></tr>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00240">240</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8cpp_source.html#l00246">246</a> of file <a class="el" href="PenningTrap_8cpp_source.html">PenningTrap.cpp</a>.</p>
</div>
</div>
@ -966,7 +1010,7 @@ Private Attributes</h2></td></tr>
<p>Magnetic field strength. </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00032">32</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00033">33</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>
@ -992,7 +1036,7 @@ Private Attributes</h2></td></tr>
<p>Characteristic dimension. </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00034">34</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00035">35</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>
@ -1017,7 +1061,7 @@ Private Attributes</h2></td></tr>
</div><div class="memdoc">
<p>A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00039">39</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00040">40</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>
@ -1042,7 +1086,7 @@ Private Attributes</h2></td></tr>
</div><div class="memdoc">
<p>A 2D vector containing all \(k_{i,j}\) where \(j\) is the index of a particle </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00037">37</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00038">38</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>
@ -1068,7 +1112,7 @@ Private Attributes</h2></td></tr>
<p>The particles in the Penning trap. </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00036">36</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00037">37</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>
@ -1094,7 +1138,7 @@ Private Attributes</h2></td></tr>
<p>Current time. </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00035">35</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00036">36</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>
@ -1120,7 +1164,7 @@ Private Attributes</h2></td></tr>
<p>Applied potential. </p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00033">33</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="PenningTrap_8hpp_source.html#l00034">34</a> of file <a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>.</p>
</div>
</div>

View File

@ -11,7 +11,7 @@ var classPenningTrap =
[ "force_on_particle", "classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce", null ],
[ "fraction_of_particles_left", "classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b", null ],
[ "r_func", "classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648", null ],
[ "simulate", "classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854", null ],
[ "simulate", "classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599", null ],
[ "total_force", "classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8", null ],
[ "total_force_external", "classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56", null ],
[ "total_force_particles", "classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b", null ],

View File

@ -104,11 +104,11 @@ $(document).ready(function(){initNavTree('classPenningTrapTest.html',''); initRe
<p>This is the complete list of members for <a class="el" href="classPenningTrapTest.html">PenningTrapTest</a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>test_external_B_field</b>() (defined in <a class="el" href="classPenningTrapTest.html">PenningTrapTest</a>)</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>test_external_E_field</b>() (defined in <a class="el" href="classPenningTrapTest.html">PenningTrapTest</a>)</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>test_force_on_particle</b>() (defined in <a class="el" href="classPenningTrapTest.html">PenningTrapTest</a>)</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>test_total_force_external</b>() (defined in <a class="el" href="classPenningTrapTest.html">PenningTrapTest</a>)</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>test_total_force_particles</b>() (defined in <a class="el" href="classPenningTrapTest.html">PenningTrapTest</a>)</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">test_external_B_field</a>()</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">test_external_E_field</a>()</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">test_force_on_particle</a>()</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="odd"><td class="entry"><a class="el" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">test_total_force_external</a>()</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">test_total_force_particles</a>()</td><td class="entry"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -104,23 +104,32 @@ $(document).ready(function(){initNavTree('classPenningTrapTest.html',''); initRe
<div class="headertitle"><div class="title">PenningTrapTest Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Test class for the Penning trap.
<a href="classPenningTrapTest.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a542996d72c713636b95e0aa9118f7901"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">test_external_E_field</a> ()</td></tr>
<tr class="memdesc:a542996d72c713636b95e0aa9118f7901"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that the external E field gives correct values. <br /></td></tr>
<tr class="separator:a542996d72c713636b95e0aa9118f7901"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acb806e49a688424588e0c501bc57a230"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">test_external_B_field</a> ()</td></tr>
<tr class="memdesc:acb806e49a688424588e0c501bc57a230"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that the external B field gives correct values. <br /></td></tr>
<tr class="separator:acb806e49a688424588e0c501bc57a230"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:addf81fa5692d8146cce5571ccdc5999b"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">test_force_on_particle</a> ()</td></tr>
<tr class="memdesc:addf81fa5692d8146cce5571ccdc5999b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that the force between particles gives expected results. <br /></td></tr>
<tr class="separator:addf81fa5692d8146cce5571ccdc5999b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae104e04dcd21ac63281c908132fdf255"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">test_total_force_external</a> ()</td></tr>
<tr class="memdesc:ae104e04dcd21ac63281c908132fdf255"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that the total external force returns expected results. <br /></td></tr>
<tr class="separator:ae104e04dcd21ac63281c908132fdf255"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ee2bbf5e26c115164208b89c5a29e3d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">test_total_force_particles</a> ()</td></tr>
<tr class="memdesc:a0ee2bbf5e26c115164208b89c5a29e3d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test that the total force of all particles on a single particle returns expected results. <br /></td></tr>
<tr class="separator:a0ee2bbf5e26c115164208b89c5a29e3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00020">20</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<div class="textblock"><p>Test class for the Penning trap. </p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00022">22</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="acb806e49a688424588e0c501bc57a230" name="acb806e49a688424588e0c501bc57a230"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acb806e49a688424588e0c501bc57a230">&#9670;&#160;</a></span>test_external_B_field()</h2>
@ -145,7 +154,9 @@ Static Public Member Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00059">59</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<p>Test that the external B field gives correct values. </p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00065">65</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div>
</div>
@ -172,7 +183,9 @@ Static Public Member Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00022">22</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<p>Test that the external E field gives correct values. </p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00026">26</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div>
</div>
@ -199,7 +212,9 @@ Static Public Member Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00070">70</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<p>Test that the force between particles gives expected results. </p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00078">78</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div>
</div>
@ -226,7 +241,9 @@ Static Public Member Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00095">95</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<p>Test that the total external force returns expected results. </p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00105">105</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div>
</div>
@ -253,7 +270,9 @@ Static Public Member Functions</h2></td></tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00108">108</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<p>Test that the total force of all particles on a single particle returns expected results. </p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00121">121</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div>
</div>

View File

@ -101,11 +101,14 @@ $(document).ready(function(){initNavTree('classes.html',''); initResizable(); })
<div class="headertitle"><div class="title">Class Index</div></div>
</div><!--header-->
<div class="contents">
<div class="qindex"><a class="qindex" href="#letter_P">P</a></div>
<div class="qindex"><a class="qindex" href="#letter_P">P</a>&#160;|&#160;<a class="qindex" href="#letter_S">S</a></div>
<div class="classindex">
<dl class="classindex even">
<dt class="alphachar"><a id="letter_P" name="letter_P">P</a></dt>
<dd><a class="el" href="classParticle.html">Particle</a></dd><dd><a class="el" href="classPenningTrap.html">PenningTrap</a></dd><dd><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></dd></dl>
<dl class="classindex odd">
<dt class="alphachar"><a id="letter_S" name="letter_S">S</a></dt>
<dd><a class="el" href="structsimulation.html">simulation</a></dd></dl>
</div>
</div><!-- contents -->
</div><!-- doc-content -->

View File

@ -0,0 +1,132 @@
<!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>Penning Trap Simulation: src/scripts Directory Reference</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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('dir_634e799a3947388232110823971192a8.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">scripts Directory Reference</div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="files" name="files"></a>
Files</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>animate_100_particles.py</b> <a href="animate__100__particles_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_2_particles.py</b> <a href="plot__2__particles_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_3d.py</b> <a href="plot__3d_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_particles_left.py</b> <a href="plot__particles__left_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_phase_space.py</b> <a href="plot__phase__space_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_relative_error.py</b> <a href="plot__relative__error_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_single_particle.py</b> <a href="plot__single__particle_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</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>

View File

@ -0,0 +1,10 @@
var dir_634e799a3947388232110823971192a8 =
[
[ "animate_100_particles.py", "animate__100__particles_8py_source.html", null ],
[ "plot_2_particles.py", "plot__2__particles_8py_source.html", null ],
[ "plot_3d.py", "plot__3d_8py_source.html", null ],
[ "plot_particles_left.py", "plot__particles__left_8py_source.html", null ],
[ "plot_phase_space.py", "plot__phase__space_8py_source.html", null ],
[ "plot_relative_error.py", "plot__relative__error_8py_source.html", null ],
[ "plot_single_particle.py", "plot__single__particle_8py_source.html", null ]
];

View File

@ -102,10 +102,13 @@ $(document).ready(function(){initNavTree('dir_68267d1309a1af8e8297ef4c3efbcdba.h
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="subdirs" name="subdirs"></a>
Directories</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">directory &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="files" name="files"></a>
Files</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>animate_100_particles.py</b> <a href="animate__100__particles_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html">main.cpp</a> <a href="main_8cpp_source.html">[code]</a></td></tr>
<tr class="memdesc:main_8cpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">The main program for this project. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -115,8 +118,6 @@ Files</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="PenningTrap_8cpp.html">PenningTrap.cpp</a> <a href="PenningTrap_8cpp_source.html">[code]</a></td></tr>
<tr class="memdesc:PenningTrap_8cpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><b>plot_particles_left.py</b> <a href="plot__particles__left_8py_source.html">[code]</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="test__suite_8cpp.html">test_suite.cpp</a> <a href="test__suite_8cpp_source.html">[code]</a></td></tr>
<tr class="memdesc:test__suite_8cpp"><td class="mdescLeft">&#160;</td><td class="mdescRight">The test suite for the project. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>

View File

@ -1,10 +1,9 @@
var dir_68267d1309a1af8e8297ef4c3efbcdba =
[
[ "animate_100_particles.py", "animate__100__particles_8py_source.html", null ],
[ "main.cpp", "main_8cpp.html", null ],
[ "scripts", "dir_634e799a3947388232110823971192a8.html", "dir_634e799a3947388232110823971192a8" ],
[ "main.cpp", "main_8cpp.html", "main_8cpp" ],
[ "Particle.cpp", "Particle_8cpp.html", null ],
[ "PenningTrap.cpp", "PenningTrap_8cpp.html", null ],
[ "plot_particles_left.py", "plot__particles__left_8py_source.html", null ],
[ "test_suite.cpp", "test__suite_8cpp.html", "test__suite_8cpp" ],
[ "utils.cpp", "utils_8cpp.html", "utils_8cpp" ]
];

View File

@ -102,7 +102,7 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });
</div><!--header-->
<div class="contents">
<div class="textblock">Here is a list of all documented files with brief descriptions:</div><div class="directory">
<div class="levels">[detail level <span onclick="javascript:toggleLevel(1);">1</span><span onclick="javascript:toggleLevel(2);">2</span>]</div><table class="directory">
<div class="levels">[detail level <span onclick="javascript:toggleLevel(1);">1</span><span onclick="javascript:toggleLevel(2);">2</span><span onclick="javascript:toggleLevel(3);">3</span>]</div><table class="directory">
<tr id="row_0_" class="even"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_0_" class="arrow" onclick="toggleFolder('0_')">&#9660;</span><span id="img_0_" class="iconfopen" onclick="toggleFolder('0_')">&#160;</span><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html" target="_self">include</a></td><td class="desc"></td></tr>
<tr id="row_0_0_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="constants_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="constants_8hpp.html" target="_self">constants.hpp</a></td><td class="desc">Library of constants </td></tr>
<tr id="row_0_1_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="Particle_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="Particle_8hpp.html" target="_self">Particle.hpp</a></td><td class="desc">A class that holds the properties of a particle </td></tr>
@ -110,13 +110,19 @@ $(document).ready(function(){initNavTree('files.html',''); initResizable(); });
<tr id="row_0_3_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="typedefs_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="typedefs_8hpp.html" target="_self">typedefs.hpp</a></td><td class="desc">Useful typedefs for cleaner code </td></tr>
<tr id="row_0_4_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8hpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8hpp.html" target="_self">utils.hpp</a></td><td class="desc">Function prototypes and macros that are useful </td></tr>
<tr id="row_1_" class="even"><td class="entry"><span style="width:0px;display:inline-block;">&#160;</span><span id="arr_1_" class="arrow" onclick="toggleFolder('1_')">&#9660;</span><span id="img_1_" class="iconfopen" onclick="toggleFolder('1_')">&#160;</span><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html" target="_self">src</a></td><td class="desc"></td></tr>
<tr id="row_1_0_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="animate__100__particles_8py_source.html"><span class="icondoc"></span></a><b>animate_100_particles.py</b></td><td class="desc"></td></tr>
<tr id="row_1_1_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="main_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="main_8cpp.html" target="_self">main.cpp</a></td><td class="desc">The main program for this project </td></tr>
<tr id="row_1_2_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="Particle_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="Particle_8cpp.html" target="_self">Particle.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classParticle.html" title="A class that holds attributes of a particle.">Particle</a> class </td></tr>
<tr id="row_1_3_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="PenningTrap_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="PenningTrap_8cpp.html" target="_self">PenningTrap.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class </td></tr>
<tr id="row_1_4_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="plot__particles__left_8py_source.html"><span class="icondoc"></span></a><b>plot_particles_left.py</b></td><td class="desc"></td></tr>
<tr id="row_1_5_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="test__suite_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="test__suite_8cpp.html" target="_self">test_suite.cpp</a></td><td class="desc">The test suite for the project </td></tr>
<tr id="row_1_6_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8cpp.html" target="_self">utils.cpp</a></td><td class="desc">Implementation of the utils </td></tr>
<tr id="row_1_0_" class="odd"><td class="entry"><span style="width:16px;display:inline-block;">&#160;</span><span id="arr_1_0_" class="arrow" onclick="toggleFolder('1_0_')">&#9660;</span><span id="img_1_0_" class="iconfopen" onclick="toggleFolder('1_0_')">&#160;</span><a class="el" href="dir_634e799a3947388232110823971192a8.html" target="_self">scripts</a></td><td class="desc"></td></tr>
<tr id="row_1_0_0_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="animate__100__particles_8py_source.html"><span class="icondoc"></span></a><b>animate_100_particles.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_1_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__2__particles_8py_source.html"><span class="icondoc"></span></a><b>plot_2_particles.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_2_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__3d_8py_source.html"><span class="icondoc"></span></a><b>plot_3d.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_3_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__particles__left_8py_source.html"><span class="icondoc"></span></a><b>plot_particles_left.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_4_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__phase__space_8py_source.html"><span class="icondoc"></span></a><b>plot_phase_space.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_5_" class="odd"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__relative__error_8py_source.html"><span class="icondoc"></span></a><b>plot_relative_error.py</b></td><td class="desc"></td></tr>
<tr id="row_1_0_6_" class="even"><td class="entry"><span style="width:48px;display:inline-block;">&#160;</span><a href="plot__single__particle_8py_source.html"><span class="icondoc"></span></a><b>plot_single_particle.py</b></td><td class="desc"></td></tr>
<tr id="row_1_1_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="main_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="main_8cpp.html" target="_self">main.cpp</a></td><td class="desc">The main program for this project </td></tr>
<tr id="row_1_2_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="Particle_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="Particle_8cpp.html" target="_self">Particle.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classParticle.html" title="A class that holds attributes of a particle.">Particle</a> class </td></tr>
<tr id="row_1_3_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="PenningTrap_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="PenningTrap_8cpp.html" target="_self">PenningTrap.cpp</a></td><td class="desc">The implementation of the <a class="el" href="classPenningTrap.html" title="A class that simulates a Penning trap.">PenningTrap</a> class </td></tr>
<tr id="row_1_4_" class="even"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="test__suite_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="test__suite_8cpp.html" target="_self">test_suite.cpp</a></td><td class="desc">The test suite for the project </td></tr>
<tr id="row_1_5_" class="odd"><td class="entry"><span style="width:32px;display:inline-block;">&#160;</span><a href="utils_8cpp_source.html"><span class="icondoc"></span></a><a class="el" href="utils_8cpp.html" target="_self">utils.cpp</a></td><td class="desc">Implementation of the utils </td></tr>
</table>
</div><!-- directory -->
</div><!-- contents -->

View File

@ -98,33 +98,92 @@ $(document).ready(function(){initNavTree('functions.html',''); initResizable();
</div>
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div><ul>
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
<h3><a id="index_a" name="index_a"></a>- a -</h3><ul>
<li>add_particle()&#160;:&#160;<a class="el" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap</a></li>
</ul>
<h3><a id="index_b" name="index_b"></a>- b -</h3><ul>
<li>B_0&#160;:&#160;<a class="el" href="classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716">PenningTrap</a></li>
</ul>
<h3><a id="index_d" name="index_d"></a>- d -</h3><ul>
<li>d&#160;:&#160;<a class="el" href="classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2">PenningTrap</a></li>
</ul>
<h3><a id="index_e" name="index_e"></a>- e -</h3><ul>
<li>evolve_forward_euler()&#160;:&#160;<a class="el" href="classPenningTrap.html#ab9ea97a406534bbe621a95215144875e">PenningTrap</a></li>
<li>evolve_RK4()&#160;:&#160;<a class="el" href="classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e">PenningTrap</a></li>
<li>external_B_field()&#160;:&#160;<a class="el" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap</a></li>
<li>external_E_field()&#160;:&#160;<a class="el" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap</a></li>
</ul>
<h3><a id="index_f" name="index_f"></a>- f -</h3><ul>
<li>force_on_particle()&#160;:&#160;<a class="el" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap</a></li>
<li>fraction_of_particles_left()&#160;:&#160;<a class="el" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap</a></li>
</ul>
<h3><a id="index_k" name="index_k"></a>- k -</h3><ul>
<li>k_r&#160;:&#160;<a class="el" href="classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640">PenningTrap</a></li>
<li>k_v&#160;:&#160;<a class="el" href="classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4">PenningTrap</a></li>
</ul>
<h3><a id="index_m" name="index_m"></a>- m -</h3><ul>
<li>m&#160;:&#160;<a class="el" href="classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563">Particle</a></li>
</ul>
<h3><a id="index_p" name="index_p"></a>- p -</h3><ul>
<li>Particle()&#160;:&#160;<a class="el" href="classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4">Particle</a></li>
<li>particles&#160;:&#160;<a class="el" href="classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f">PenningTrap</a></li>
<li>PenningTrap&#160;:&#160;<a class="el" href="classParticle.html#aa797d319549dc2a0beb06cdbfd430232">Particle</a>, <a class="el" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap</a></li>
</ul>
<h3><a id="index_q" name="index_q"></a>- q -</h3><ul>
<li>q&#160;:&#160;<a class="el" href="classParticle.html#a566dcc1de4bdc01251776948798ea8e1">Particle</a></li>
</ul>
<h3><a id="index_r" name="index_r"></a>- r -</h3><ul>
<li>r_func()&#160;:&#160;<a class="el" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap</a></li>
<li>r_vec&#160;:&#160;<a class="el" href="classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6">Particle</a></li>
<li>simulate()&#160;:&#160;<a class="el" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">PenningTrap</a></li>
</ul>
<h3><a id="index_s" name="index_s"></a>- s -</h3><ul>
<li>simulate()&#160;:&#160;<a class="el" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">PenningTrap</a></li>
</ul>
<h3><a id="index_t" name="index_t"></a>- t -</h3><ul>
<li>t&#160;:&#160;<a class="el" href="classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e">PenningTrap</a></li>
<li>test_external_B_field()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">PenningTrapTest</a></li>
<li>test_external_E_field()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">PenningTrapTest</a></li>
<li>test_force_on_particle()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">PenningTrapTest</a></li>
<li>test_total_force_external()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">PenningTrapTest</a></li>
<li>test_total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">PenningTrapTest</a></li>
<li>total_force()&#160;:&#160;<a class="el" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap</a></li>
<li>total_force_external()&#160;:&#160;<a class="el" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap</a></li>
<li>total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap</a></li>
</ul>
<h3><a id="index_v" name="index_v"></a>- v -</h3><ul>
<li>V_0&#160;:&#160;<a class="el" href="classPenningTrap.html#aaf105828121c4a33cc2b217453c20317">PenningTrap</a></li>
<li>v_func()&#160;:&#160;<a class="el" href="classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e">PenningTrap</a></li>
<li>v_vec&#160;:&#160;<a class="el" href="classParticle.html#a879692772803d6ab65fa4993b54aea6e">Particle</a></li>
</ul>
<h3><a id="index_w" name="index_w"></a>- w -</h3><ul>
<li>write_simulation_to_dir()&#160;:&#160;<a class="el" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap</a></li>
</ul>
</div><!-- contents -->

View File

@ -109,7 +109,12 @@ $(document).ready(function(){initNavTree('functions_func.html',''); initResizabl
<li>Particle()&#160;:&#160;<a class="el" href="classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4">Particle</a></li>
<li>PenningTrap()&#160;:&#160;<a class="el" href="classPenningTrap.html#ae670d7de621acdb343b01af098086f63">PenningTrap</a></li>
<li>r_func()&#160;:&#160;<a class="el" href="classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648">PenningTrap</a></li>
<li>simulate()&#160;:&#160;<a class="el" href="classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854">PenningTrap</a></li>
<li>simulate()&#160;:&#160;<a class="el" href="classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599">PenningTrap</a></li>
<li>test_external_B_field()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">PenningTrapTest</a></li>
<li>test_external_E_field()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">PenningTrapTest</a></li>
<li>test_force_on_particle()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">PenningTrapTest</a></li>
<li>test_total_force_external()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">PenningTrapTest</a></li>
<li>test_total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">PenningTrapTest</a></li>
<li>total_force()&#160;:&#160;<a class="el" href="classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8">PenningTrap</a></li>
<li>total_force_external()&#160;:&#160;<a class="el" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap</a></li>
<li>total_force_particles()&#160;:&#160;<a class="el" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap</a></li>

View File

@ -100,16 +100,25 @@ $(document).ready(function(){initNavTree('globals.html',''); initResizable(); })
<div class="contents">
<div class="textblock">Here is a list of all documented file members with links to the documentation:</div><ul>
<li>__METHOD_NAME__&#160;:&#160;<a class="el" href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168">utils.hpp</a></li>
<li>arma_vector_close_to()&#160;:&#160;<a class="el" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">utils.hpp</a>, <a class="el" href="utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a">utils.cpp</a></li>
<li>analytical_solution_particle_1()&#160;:&#160;<a class="el" href="main_8cpp.html#a6451833d72816ef393087956c766125b">main.cpp</a></li>
<li>ASSERT&#160;:&#160;<a class="el" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">utils.hpp</a></li>
<li>close_to()&#160;:&#160;<a class="el" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">utils.hpp</a>, <a class="el" href="utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2">utils.cpp</a></li>
<li>DEBUG&#160;:&#160;<a class="el" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b">utils.hpp</a></li>
<li>K_E&#160;:&#160;<a class="el" href="constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb">constants.hpp</a></li>
<li>m_assert()&#160;:&#160;<a class="el" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">utils.hpp</a>, <a class="el" href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">utils.cpp</a></li>
<li>mkpath()&#160;:&#160;<a class="el" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">utils.hpp</a>, <a class="el" href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">utils.cpp</a></li>
<li>p1&#160;:&#160;<a class="el" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">main.cpp</a></li>
<li>p2&#160;:&#160;<a class="el" href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46">main.cpp</a></li>
<li>scientific_format()&#160;:&#160;<a class="el" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">utils.hpp</a>, <a class="el" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">utils.cpp</a></li>
<li>sim_arr&#160;:&#160;<a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">typedefs.hpp</a></li>
<li>sim_cols&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">typedefs.hpp</a></li>
<li>sim_rows&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66">typedefs.hpp</a></li>
<li>simulate_100_particles()&#160;:&#160;<a class="el" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">main.cpp</a></li>
<li>simulate_100_particles_with_time_potential()&#160;:&#160;<a class="el" href="main_8cpp.html#a330668384dc073980ba11116309bacc5">main.cpp</a></li>
<li>simulate_single_particle()&#160;:&#160;<a class="el" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">main.cpp</a></li>
<li>simulate_single_particle_with_different_steps()&#160;:&#160;<a class="el" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">main.cpp</a></li>
<li>simulate_two_particles()&#160;:&#160;<a class="el" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">main.cpp</a></li>
<li>simulation_t&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6">typedefs.hpp</a></li>
<li>T&#160;:&#160;<a class="el" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">constants.hpp</a></li>
<li>V&#160;:&#160;<a class="el" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">constants.hpp</a></li>
<li>vec_3d&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">typedefs.hpp</a></li>

View File

@ -99,10 +99,16 @@ $(document).ready(function(){initNavTree('globals_func.html',''); initResizable(
<div class="contents">
&#160;<ul>
<li>arma_vector_close_to()&#160;:&#160;<a class="el" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">utils.hpp</a>, <a class="el" href="utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a">utils.cpp</a></li>
<li>analytical_solution_particle_1()&#160;:&#160;<a class="el" href="main_8cpp.html#a6451833d72816ef393087956c766125b">main.cpp</a></li>
<li>close_to()&#160;:&#160;<a class="el" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">utils.hpp</a>, <a class="el" href="utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2">utils.cpp</a></li>
<li>m_assert()&#160;:&#160;<a class="el" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">utils.hpp</a>, <a class="el" href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">utils.cpp</a></li>
<li>mkpath()&#160;:&#160;<a class="el" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">utils.hpp</a>, <a class="el" href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">utils.cpp</a></li>
<li>scientific_format()&#160;:&#160;<a class="el" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">utils.hpp</a>, <a class="el" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">utils.cpp</a></li>
<li>simulate_100_particles()&#160;:&#160;<a class="el" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">main.cpp</a></li>
<li>simulate_100_particles_with_time_potential()&#160;:&#160;<a class="el" href="main_8cpp.html#a330668384dc073980ba11116309bacc5">main.cpp</a></li>
<li>simulate_single_particle()&#160;:&#160;<a class="el" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">main.cpp</a></li>
<li>simulate_single_particle_with_different_steps()&#160;:&#160;<a class="el" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">main.cpp</a></li>
<li>simulate_two_particles()&#160;:&#160;<a class="el" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">main.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->

View File

@ -102,6 +102,7 @@ $(document).ready(function(){initNavTree('globals_type.html',''); initResizable(
<li>sim_arr&#160;:&#160;<a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">typedefs.hpp</a></li>
<li>sim_cols&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">typedefs.hpp</a></li>
<li>sim_rows&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66">typedefs.hpp</a></li>
<li>simulation_t&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6">typedefs.hpp</a></li>
<li>vec_3d&#160;:&#160;<a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">typedefs.hpp</a></li>
</ul>
</div><!-- contents -->

114
docs/globals_vars.html Normal file
View File

@ -0,0 +1,114 @@
<!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>Penning Trap Simulation: File Members</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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('globals_vars.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="contents">
&#160;<ul>
<li>p1&#160;:&#160;<a class="el" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">main.cpp</a></li>
<li>p2&#160;:&#160;<a class="el" href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46">main.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>

View File

@ -104,7 +104,65 @@ $(document).ready(function(){initNavTree('index.html',''); initResizable(); });
<div class="textblock"><p><a class="anchor" id="md_README"></a> </p><div class="image">
<img src="100_particles.gif" alt=""/>
</div>
<h1><a class="anchor" id="autotoc_md1"></a>
<p><a href="https://github.uio.no/FYS3150-G2-2023/Project-3">Repo</a></p>
<p><a href="https://pages.github.uio.no/FYS3150-G2-2023/Project-3/">Documentation</a></p>
<h1><a class="anchor" id="autotoc_md1"></a>
Requirements</h1>
<h2><a class="anchor" id="autotoc_md2"></a>
Operating systems</h2>
<ul>
<li>Linux<ul>
<li>Has been tested on <a href="https://fedoraproject.org/">Fedora 38</a></li>
<li>Will most likely work on other Linux distributions</li>
</ul>
</li>
<li>MacOS<ul>
<li>Might work, but hasn't been tested</li>
</ul>
</li>
<li>Windows<ul>
<li>Will most likely not work</li>
</ul>
</li>
</ul>
<h2><a class="anchor" id="autotoc_md3"></a>
Libraries</h2>
<ul>
<li>Python<ul>
<li><a href="https://matplotlib.org/">matplotlib</a></li>
<li><a href="https://numpy.org/">numpy</a></li>
</ul>
</li>
<li>C++<ul>
<li><a href="https://www.openmp.org/">openmp</a></li>
<li><a href="https://arma.sourceforge.net/">armadillo</a></li>
</ul>
</li>
</ul>
<h1><a class="anchor" id="autotoc_md4"></a>
Compiling</h1>
<p>Compiling is as easy as running this command while being inside the src directory:</p>
<div class="fragment"><div class="line">make</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md5"></a>
Running programs</h1>
<h2><a class="anchor" id="autotoc_md6"></a>
C++ binaries</h2>
<p>To run <b>main</b> or <b>test_suite</b>, just run this command while being inside src:</p>
<div class="fragment"><div class="line">./&lt;program-name&gt;</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md7"></a>
Python scripts</h2>
<h3><a class="anchor" id="autotoc_md8"></a>
Install libraries</h3>
<p>Before running the scripts, make sure that all libraries are installed. Using pip, you can install all requirements like this:</p>
<div class="fragment"><div class="line">pip install -r requirements.txt</div>
</div><!-- fragment --><p>This recursively install all the packages that are listed in <b>requirements.txt</b>.</p>
<h3><a class="anchor" id="autotoc_md9"></a>
Running scripts</h3>
<p>For the Python scripts, run them from the src directory like this:</p>
<div class="fragment"><div class="line">python scripts/&lt;script-name&gt;</div>
</div><!-- fragment --><p>If you have any problems running the scripts, you might have to run this instead:</p>
<div class="fragment"><div class="line">python3 scripts/&lt;script-name&gt;</div>
</div><!-- fragment --><h1><a class="anchor" id="autotoc_md10"></a>
Credits</h1>
<p>The Doxygen theme used here is <a href="https://github.com/jothepro/doxygen-awesome-css">doxygen-awesome-css</a>. </p>
</div></div><!-- PageDoc -->

View File

@ -109,10 +109,10 @@ $(document).ready(function(){initNavTree('main_8cpp.html',''); initResizable();
<p>The main program for this project.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;cmath&gt;</code><br />
<code>#include &lt;complex&gt;</code><br />
<code>#include &lt;fstream&gt;</code><br />
<code>#include &lt;omp.h&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
<code>#include &lt;sys/stat.h&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
<code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
@ -123,7 +123,7 @@ $(document).ready(function(){initNavTree('main_8cpp.html',''); initResizable();
Macros</h2></td></tr>
<tr class="memitem:a7b24a37e8ce9d243351bfc9b24945e63"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a7b24a37e8ce9d243351bfc9b24945e63">PARTICLES</a>&#160;&#160;&#160;100</td></tr>
<tr class="separator:a7b24a37e8ce9d243351bfc9b24945e63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0240ac851181b84ac374872dc5434ee4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a0240ac851181b84ac374872dc5434ee4">N</a>&#160;&#160;&#160;10000</td></tr>
<tr class="memitem:a0240ac851181b84ac374872dc5434ee4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a0240ac851181b84ac374872dc5434ee4">N</a>&#160;&#160;&#160;40000</td></tr>
<tr class="separator:a0240ac851181b84ac374872dc5434ee4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a16cdf08eafbd529171c64d69a0ec02b3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a16cdf08eafbd529171c64d69a0ec02b3">CHARGE</a>&#160;&#160;&#160;1.</td></tr>
<tr class="separator:a16cdf08eafbd529171c64d69a0ec02b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -132,15 +132,23 @@ Macros</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a6451833d72816ef393087956c766125b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a6451833d72816ef393087956c766125b">analytical_solution_particle_1</a> (double t)</td></tr>
<tr class="memdesc:a6451833d72816ef393087956c766125b"><td class="mdescLeft">&#160;</td><td class="mdescRight">The analytical solution for particle p1. <br /></td></tr>
<tr class="separator:a6451833d72816ef393087956c766125b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8fdbe2d5a872e50ef5ec1263243589d6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a> ()</td></tr>
<tr class="memdesc:a8fdbe2d5a872e50ef5ec1263243589d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate a single particle over the period of 50 \( \mu s \). <br /></td></tr>
<tr class="separator:a8fdbe2d5a872e50ef5ec1263243589d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a783789519f97c6430081171cacb0ffb1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a> ()</td></tr>
<tr class="memdesc:a783789519f97c6430081171cacb0ffb1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate 2 particles over the period of 50 \( \mu s \) with and without particle interactions. <br /></td></tr>
<tr class="separator:a783789519f97c6430081171cacb0ffb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac67e0d59227856c4d42e7d01c75e0ad2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a> ()</td></tr>
<tr class="memdesc:ac67e0d59227856c4d42e7d01c75e0ad2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate a single particle over 50 \( \mu s \) using different amount of steps and different methods. <br /></td></tr>
<tr class="separator:ac67e0d59227856c4d42e7d01c75e0ad2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a213713d6ecc02a32b588ffd179dc7513"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a> ()</td></tr>
<tr class="memdesc:a213713d6ecc02a32b588ffd179dc7513"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate 100 particles over 50 \( \mu s \). <br /></td></tr>
<tr class="separator:a213713d6ecc02a32b588ffd179dc7513"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a330668384dc073980ba11116309bacc5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#a330668384dc073980ba11116309bacc5">simulate_100_particles_with_time_potential</a> ()</td></tr>
<tr class="memdesc:a330668384dc073980ba11116309bacc5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. <br /></td></tr>
<tr class="separator:a330668384dc073980ba11116309bacc5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="main_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -149,9 +157,11 @@ Functions</h2></td></tr>
Variables</h2></td></tr>
<tr class="memitem:a87da4ef9f2cd753579484824310467b8"><td class="memItemLeft" align="right" valign="top"><a id="a87da4ef9f2cd753579484824310467b8" name="a87da4ef9f2cd753579484824310467b8"></a>
<a class="el" href="classParticle.html">Particle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>p1</b> (CHARGE, MASS, <a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{20., 0., 20.}, <a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 25., 0.})</td></tr>
<tr class="memdesc:a87da4ef9f2cd753579484824310467b8"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classParticle.html" title="A class that holds attributes of a particle.">Particle</a> 1. <br /></td></tr>
<tr class="separator:a87da4ef9f2cd753579484824310467b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90f661586eb3c318fdca6f95ebc4fc46"><td class="memItemLeft" align="right" valign="top"><a id="a90f661586eb3c318fdca6f95ebc4fc46" name="a90f661586eb3c318fdca6f95ebc4fc46"></a>
<a class="el" href="classParticle.html">Particle</a>&#160;</td><td class="memItemRight" valign="bottom"><b>p2</b> (CHARGE, MASS, <a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{25., 25., 0.}, <a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 40., 5.})</td></tr>
<tr class="memdesc:a90f661586eb3c318fdca6f95ebc4fc46"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classParticle.html" title="A class that holds attributes of a particle.">Particle</a> 2. <br /></td></tr>
<tr class="separator:a90f661586eb3c318fdca6f95ebc4fc46"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
@ -203,7 +213,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define N&#160;&#160;&#160;10000</td>
<td class="memname">#define N&#160;&#160;&#160;40000</td>
</tr>
</table>
</div><div class="memdoc">
@ -229,6 +239,35 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a6451833d72816ef393087956c766125b" name="a6451833d72816ef393087956c766125b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6451833d72816ef393087956c766125b">&#9670;&#160;</a></span>analytical_solution_particle_1()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> analytical_solution_particle_1 </td>
<td>(</td>
<td class="paramtype">double&#160;</td>
<td class="paramname"><em>t</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>The analytical solution for particle p1. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">t</td><td>Time</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>vec_3d </dd></dl>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00038">38</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&#160;</a></span>main()</h2>
@ -244,7 +283,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00124">124</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00194">194</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@ -263,7 +302,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00077">77</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p>Simulate 100 particles over 50 \( \mu s \). </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00131">131</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@ -282,7 +323,10 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00091">91</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p>Simulate 100 particles over 500 \( \mu s \) using a time dependent potential. </p>
<p>The simulation sweeps over different frequencies in [0.2, 2.5] MHz. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00146">146</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@ -301,7 +345,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00031">31</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p>Simulate a single particle over the period of 50 \( \mu s \). </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00055">55</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@ -320,7 +366,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00055">55</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p>Simulate a single particle over 50 \( \mu s \) using different amount of steps and different methods. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00088">88</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>
@ -339,7 +387,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00042">42</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
<p>Simulate 2 particles over the period of 50 \( \mu s \) with and without particle interactions. </p>
<p class="definition">Definition at line <a class="el" href="main_8cpp_source.html#l00070">70</a> of file <a class="el" href="main_8cpp_source.html">main.cpp</a>.</p>
</div>
</div>

11
docs/main_8cpp.js Normal file
View File

@ -0,0 +1,11 @@
var main_8cpp =
[
[ "analytical_solution_particle_1", "main_8cpp.html#a6451833d72816ef393087956c766125b", null ],
[ "simulate_100_particles", "main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513", null ],
[ "simulate_100_particles_with_time_potential", "main_8cpp.html#a330668384dc073980ba11116309bacc5", null ],
[ "simulate_single_particle", "main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6", null ],
[ "simulate_single_particle_with_different_steps", "main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2", null ],
[ "simulate_two_particles", "main_8cpp.html#a783789519f97c6430081171cacb0ffb1", null ],
[ "p1", "main_8cpp.html#a87da4ef9f2cd753579484824310467b8", null ],
[ "p2", "main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46", null ]
];

View File

@ -103,148 +103,205 @@ $(document).ready(function(){initNavTree('main_8cpp_source.html',''); initResiza
<div class="contents">
<a href="main_8cpp.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> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;cmath&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;omp.h&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;sys/stat.h&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;complex&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;fstream&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;omp.h&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;vector&gt;</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">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> </div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#define PARTICLES 100</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#define N 10000</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#define CHARGE 1.</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#define N 40000</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="preprocessor">#define CHARGE 1. </span><span class="comment">// unit: e</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span><span class="preprocessor">#define MASS 40. </span><span class="comment">// unit: amu</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><a class="code hl_class" href="classParticle.html">Particle</a> p1(CHARGE, MASS, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{20., 0., 20.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 25., 0.});</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><a class="code hl_class" href="classParticle.html">Particle</a> p2(CHARGE, MASS, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{25., 25., 0.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 40., 5.});</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="keywordtype">void</span> simulate_single_particle()</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span>{</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <a class="code hl_define" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b">DEBUG</a>(<span class="stringliteral">&quot;Inside single particle sim&quot;</span>);</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{p1});</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <a class="code hl_define" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b">DEBUG</a>(<span class="stringliteral">&quot;Write to dir&quot;</span>);</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> trap.write_simulation_to_dir(<span class="stringliteral">&quot;output/simulate_single_particle&quot;</span>, time, N);</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</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="keywordtype">void</span> simulate_two_particles()</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span>{</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_no_interaction(std::vector&lt;Particle&gt;{p1, p2});</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_with_interaction(std::vector&lt;Particle&gt;{p1, p2});</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="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> trap_no_interaction.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction&quot;</span>, time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> trap_with_interaction.write_simulation_to_dir(</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction&quot;</span>, time, N);</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span>}</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span><span class="keywordtype">void</span> simulate_single_particle_with_different_steps()</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="comment">// Particles used for testing</span></div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"><a class="line" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8"> 29</a></span><a class="code hl_class" href="classParticle.html">Particle</a> <a class="code hl_variable" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a>(CHARGE, MASS, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{20., 0., 20.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 25., 0.}); </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46"> 30</a></span><a class="code hl_class" href="classParticle.html">Particle</a> <a class="code hl_variable" href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46">p2</a>(CHARGE, MASS, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{25., 25., 0.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 40., 5.}); </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="main_8cpp.html#a6451833d72816ef393087956c766125b"> 38</a></span><a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> <a class="code hl_function" href="main_8cpp.html#a6451833d72816ef393087956c766125b">analytical_solution_particle_1</a>(<span class="keywordtype">double</span> t)</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span>{</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <span class="keywordtype">double</span> w_0 = <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a> / MASS;</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <span class="keywordtype">double</span> w_z2 = (50. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.) / (MASS * 500. * 500.);</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordtype">double</span> w_p = (w_0 + std::sqrt(w_0 * w_0 - 2. * w_z2)) / 2.;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <span class="keywordtype">double</span> w_n = (w_0 - std::sqrt(w_0 * w_0 - 2. * w_z2)) / 2.;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordtype">double</span> A_p = (25. + w_n * 20.) / (w_n - w_p);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> <span class="keywordtype">double</span> A_n = -(25. + w_p * 20.) / (w_n - w_p);</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> std::complex&lt;double&gt; f =</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> A_p * std::exp(std::complex&lt;double&gt;(0., -w_p * t)) +</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> A_n * std::exp(std::complex&lt;double&gt;(0., -w_n * t));</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> res{std::real(f), std::imag(f), 20. * std::cos(std::sqrt(w_z2) * t)};</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> <span class="keywordflow">return</span> res;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span>}</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"><a class="line" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6"> 55</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a>()</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span>{</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> </div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <span class="keywordtype">double</span> time = 50; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> <span class="comment">// Initialize trap with particle 1</span></div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a>});</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> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="keywordtype">int</span> steps = 4000 * (i + 1);</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{p1});</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> trap.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/N_steps/RK4/&quot;</span> +</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> std::to_string(steps) + <span class="stringliteral">&quot;_steps&quot;</span>,</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> time, steps, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</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> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordtype">int</span> steps = 4000 * (i + 1);</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{p1});</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> trap.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/N_steps/euler/&quot;</span> +</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> std::to_string(steps) + <span class="stringliteral">&quot;_steps&quot;</span>,</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> time, steps, <span class="stringliteral">&quot;euler&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> }</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span>}</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span><span class="keywordtype">void</span> simulate_100_particles()</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span>{</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((<span class="keywordtype">unsigned</span>)100, <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> [](<span class="keywordtype">double</span> t) {</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="keywordflow">return</span> 25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000. *</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> (1. + .4 * std::cos(1.5 * t));</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> },</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> 500., 0);</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> </div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordtype">double</span> time = 500.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> trap.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/simulate_100_particles&quot;</span>, time, N*5);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>}</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span><span class="keywordtype">void</span> simulate_100_particles_with_time_potential()</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span>{</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordtype">double</span> freq_start = .2;</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordtype">double</span> freq_end = 2.5;</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordtype">double</span> freq_increment = .02;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">size_t</span> freq_iterations = (size_t) ((freq_end - freq_start) / freq_increment);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> </div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> std::ofstream ofile;</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> </div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="keywordflow">for</span> (<span class="keywordtype">double</span> f : amplitudes) {</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> ofile.open(path + <span class="stringliteral">&quot;f_&quot;</span> + std::to_string(f) + <span class="stringliteral">&quot;.txt&quot;</span>);</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span><span class="preprocessor"> #pragma omp parallel for ordered schedule(static, 1)</span></div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i=0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <span class="keywordtype">double</span> freq = freq_start + i*freq_increment;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((<span class="keywordtype">unsigned</span>)100, <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> [f, freq](<span class="keywordtype">double</span> t) {</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <span class="keywordflow">return</span> (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.) *</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> (1. + f * std::cos(freq * t));</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> },</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> 500., 0.);</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordtype">double</span> res = trap.<a class="code hl_function" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">fraction_of_particles_left</a>(500., 40000, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">true</span>);</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span><span class="preprocessor"> #pragma omp ordered</span></div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> ofile &lt;&lt; freq &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; res &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> }</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> ofile.close();</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> }</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span>}</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span>{</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> simulate_single_particle();</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="comment">// Simulate and write results to file</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> trap.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/simulate_single_particle&quot;</span>, time, N,</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</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="l00070" name="l00070"></a><span class="lineno"><a class="line" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1"> 70</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a>()</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span>{</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="comment">// Initialize traps with particles</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_no_interaction(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a>, <a class="code hl_variable" href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46">p2</a>});</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap_with_interaction(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a>, <a class="code hl_variable" href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46">p2</a>});</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="comment">// Simulate and write results to files</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> trap_no_interaction.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction&quot;</span>, time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> trap_with_interaction.write_simulation_to_dir(</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction&quot;</span>, time, N);</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span>}</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"><a class="line" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2"> 88</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>()</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span>{</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> </div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> std::ofstream ofile;</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> </div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="comment">// Calculate relative error for RK4</span></div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> std::string path = <span class="stringliteral">&quot;output/relative_error/RK4/&quot;</span>;</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">int</span> steps = 4000 * std::pow(2, i);</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> ofile.open(path + std::to_string(steps) + <span class="stringliteral">&quot;_steps.txt&quot;</span>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a>});</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res = trap.simulate(time, steps, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; steps; i++) {</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> ofile &lt;&lt; arma::norm(res.r_vecs[0][i] -</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <a class="code hl_function" href="main_8cpp.html#a6451833d72816ef393087956c766125b">analytical_solution_particle_1</a>(dt*i))</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> }</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> ofile.close();</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> }</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <span class="comment">// Calculate relative error for forward Euler</span></div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> path = <span class="stringliteral">&quot;output/relative_error/euler/&quot;</span>;</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; 4; i++) {</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="keywordtype">int</span> steps = 4000 * std::pow(2, i);</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <span class="keywordtype">double</span> dt = time / (double)steps;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> ofile.open(path + std::to_string(steps) + <span class="stringliteral">&quot;_steps.txt&quot;</span>);</div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(std::vector&lt;Particle&gt;{<a class="code hl_variable" href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a>});</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> <a class="code hl_struct" href="structsimulation.html">simulation_t</a> res = trap.simulate(time, steps, <span class="stringliteral">&quot;euler&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; steps; i++) {</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> ofile &lt;&lt; arma::norm(res.r_vecs[0][i] -</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <a class="code hl_function" href="main_8cpp.html#a6451833d72816ef393087956c766125b">analytical_solution_particle_1</a>(dt*i))</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> }</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> ofile.close();</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> }</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span>}</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> </div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> simulate_two_particles();</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> </div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> simulate_single_particle_with_different_steps();</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <span class="keywordtype">double</span> start = omp_get_wtime();</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"><a class="line" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513"> 131</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>()</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span>{</div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap((<span class="keywordtype">unsigned</span>)100);</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> </div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="comment">//simulate_100_particles();</span></div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="keywordtype">double</span> time = 50.; <span class="comment">// microseconds</span></div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> </div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> simulate_100_particles_with_time_potential();</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> </div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <span class="keywordtype">double</span> end = omp_get_wtime();</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> </div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time: &quot;</span> &lt;&lt; end - start &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> </div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span>}</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> trap.<a class="code hl_function" href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">write_simulation_to_dir</a>(<span class="stringliteral">&quot;output/simulate_100_particles&quot;</span>, time, N);</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span>}</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"><a class="line" href="main_8cpp.html#a330668384dc073980ba11116309bacc5"> 146</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="main_8cpp.html#a330668384dc073980ba11116309bacc5">simulate_100_particles_with_time_potential</a>()</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span>{</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <span class="keywordtype">double</span> time = 500.;</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> </div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="keywordtype">double</span> amplitudes[]{.1, .4, .7};</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> </div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <span class="keywordtype">double</span> freq_start = .2;</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <span class="keywordtype">double</span> freq_end = 2.5;</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <span class="keywordtype">double</span> freq_increment = .02;</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keywordtype">size_t</span> freq_iterations = (size_t)((freq_end - freq_start) / freq_increment);</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> </div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <span class="keywordtype">double</span> res[4][freq_iterations];</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> </div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> std::string path = <span class="stringliteral">&quot;output/time_dependent_potential/&quot;</span>;</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(path);</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> </div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span> std::ofstream ofile;</div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno"> 163</span> </div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno"> 164</span> <span class="keywordtype">double</span> freq = freq_start;</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno"> 165</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> res[0][i] = freq;</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> freq += freq_increment;</div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> }</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> </div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span><span class="preprocessor">#pragma omp parallel for collapse(2) num_threads(4)</span></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; 3; i++) {</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> j = 0; j &lt; freq_iterations; j++) {</div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap(</div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> (<span class="keywordtype">unsigned</span>)100, <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>,</div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> std::bind(</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> [](<span class="keywordtype">double</span> f, <span class="keywordtype">double</span> r, <span class="keywordtype">double</span> t) {</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <span class="keywordflow">return</span> (25. * <a class="code hl_define" href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a> / 1000.) * (1. + f * std::cos(r * t));</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> },</div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> amplitudes[i], res[0][j], std::placeholders::_1),</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> 500., 0.);</div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> res[i + 1][j] =</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> trap.<a class="code hl_function" href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">fraction_of_particles_left</a>(time, N, <span class="stringliteral">&quot;rk4&quot;</span>, <span class="keyword">false</span>);</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> }</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> }</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> </div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> ofile.open(path + <span class="stringliteral">&quot;res.txt&quot;</span>);</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; freq_iterations; i++) {</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> ofile &lt;&lt; res[0][i] &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; res[1][i] &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; res[2][i] &lt;&lt; <span class="stringliteral">&quot;,&quot;</span></div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> &lt;&lt; res[3][i] &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> }</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> ofile.close();</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span>}</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> </div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span>{</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <span class="keywordtype">double</span> t0 = omp_get_wtime();</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> </div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> <span class="comment">// simulate_single_particle();</span></div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> </div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> <span class="comment">// simulate_two_particles();</span></div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> </div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> <a class="code hl_function" href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a>();</div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> </div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> <span class="keywordtype">double</span> t1 = omp_get_wtime();</div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> </div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span> <a class="code hl_function" href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a>();</div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno"> 207</span> </div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno"> 208</span> <span class="comment">//simulate_100_particles_with_time_potential();</span></div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno"> 209</span> </div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno"> 210</span> <span class="keywordtype">double</span> end = omp_get_wtime();</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno"> 211</span> </div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"> 212</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Time: &quot;</span> &lt;&lt; (end - t1) &lt;&lt; <span class="stringliteral">&quot; seconds&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno"> 213</span> </div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno"> 214</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00215" name="l00215"></a><span class="lineno"> 215</span>}</div>
<div class="ttc" id="aPenningTrap_8hpp_html"><div class="ttname"><a href="PenningTrap_8hpp.html">PenningTrap.hpp</a></div><div class="ttdoc">A class for simulating a Penning trap.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00021">Particle.hpp:21</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00030">PenningTrap.hpp:30</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0194be61c956a9259c747c23e4163c5b"><div class="ttname"><a href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00266">PenningTrap.cpp:266</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_abbb832a85139b1a56ebde57d7b8f9a57"><div class="ttname"><a href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00240">PenningTrap.cpp:240</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:31</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a0194be61c956a9259c747c23e4163c5b"><div class="ttname"><a href="classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b">PenningTrap::fraction_of_particles_left</a></div><div class="ttdeci">double fraction_of_particles_left(double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and calculate what fraction of particles are still left inside the Penning trap after the si...</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00281">PenningTrap.cpp:281</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_abbb832a85139b1a56ebde57d7b8f9a57"><div class="ttname"><a href="classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57">PenningTrap::write_simulation_to_dir</a></div><div class="ttdeci">void write_simulation_to_dir(std::string path, double time, unsigned int steps, std::string method=&quot;rk4&quot;, bool particle_interaction=true)</div><div class="ttdoc">Simulate and write the displacement of all particles to files.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00246">PenningTrap.cpp:246</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_a0acb682b8260ab1c60b918599864e2e5"><div class="ttname"><a href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a></div><div class="ttdeci">#define T</div><div class="ttdoc">1 Tesla. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00017">constants.hpp:17</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_af40a326b23c68a27cebe60f16634a2cb"><div class="ttname"><a href="constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb">V</a></div><div class="ttdeci">#define V</div><div class="ttdoc">1 Volt. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00019">constants.hpp:19</a></div></div>
<div class="ttc" id="amain_8cpp_html_a213713d6ecc02a32b588ffd179dc7513"><div class="ttname"><a href="main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513">simulate_100_particles</a></div><div class="ttdeci">void simulate_100_particles()</div><div class="ttdoc">Simulate 100 particles over 50 .</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00131">main.cpp:131</a></div></div>
<div class="ttc" id="amain_8cpp_html_a330668384dc073980ba11116309bacc5"><div class="ttname"><a href="main_8cpp.html#a330668384dc073980ba11116309bacc5">simulate_100_particles_with_time_potential</a></div><div class="ttdeci">void simulate_100_particles_with_time_potential()</div><div class="ttdoc">Simulate 100 particles over 500 using a time dependent potential.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00146">main.cpp:146</a></div></div>
<div class="ttc" id="amain_8cpp_html_a6451833d72816ef393087956c766125b"><div class="ttname"><a href="main_8cpp.html#a6451833d72816ef393087956c766125b">analytical_solution_particle_1</a></div><div class="ttdeci">vec_3d analytical_solution_particle_1(double t)</div><div class="ttdoc">The analytical solution for particle p1.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00038">main.cpp:38</a></div></div>
<div class="ttc" id="amain_8cpp_html_a783789519f97c6430081171cacb0ffb1"><div class="ttname"><a href="main_8cpp.html#a783789519f97c6430081171cacb0ffb1">simulate_two_particles</a></div><div class="ttdeci">void simulate_two_particles()</div><div class="ttdoc">Simulate 2 particles over the period of 50 with and without particle interactions.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00070">main.cpp:70</a></div></div>
<div class="ttc" id="amain_8cpp_html_a87da4ef9f2cd753579484824310467b8"><div class="ttname"><a href="main_8cpp.html#a87da4ef9f2cd753579484824310467b8">p1</a></div><div class="ttdeci">Particle p1(CHARGE, MASS, vec_3d{20., 0., 20.}, vec_3d{0., 25., 0.})</div><div class="ttdoc">Particle 1.</div></div>
<div class="ttc" id="amain_8cpp_html_a8fdbe2d5a872e50ef5ec1263243589d6"><div class="ttname"><a href="main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6">simulate_single_particle</a></div><div class="ttdeci">void simulate_single_particle()</div><div class="ttdoc">Simulate a single particle over the period of 50 .</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00055">main.cpp:55</a></div></div>
<div class="ttc" id="amain_8cpp_html_a90f661586eb3c318fdca6f95ebc4fc46"><div class="ttname"><a href="main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46">p2</a></div><div class="ttdeci">Particle p2(CHARGE, MASS, vec_3d{25., 25., 0.}, vec_3d{0., 40., 5.})</div><div class="ttdoc">Particle 2.</div></div>
<div class="ttc" id="amain_8cpp_html_ac67e0d59227856c4d42e7d01c75e0ad2"><div class="ttname"><a href="main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2">simulate_single_particle_with_different_steps</a></div><div class="ttdeci">void simulate_single_particle_with_different_steps()</div><div class="ttdoc">Simulate a single particle over 50 using different amount of steps and different methods.</div><div class="ttdef"><b>Definition:</b> <a href="main_8cpp_source.html#l00088">main.cpp:88</a></div></div>
<div class="ttc" id="astructsimulation_html"><div class="ttname"><a href="structsimulation.html">simulation</a></div><div class="ttdoc">Typedef for PenningTrap::simulation return value.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00040">typedefs.hpp:40</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">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#l00076">utils.cpp:76</a></div></div>
<div class="ttc" id="autils_8hpp_html_aecc1f7a8a2493b9e021e5bff76a00a5b"><div class="ttname"><a href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b">DEBUG</a></div><div class="ttdeci">#define DEBUG(msg)</div><div class="ttdoc">Writes a debug message.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00036">utils.hpp:36</a></div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">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#l00074">utils.cpp:74</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -29,7 +29,21 @@ var menudata={children:[
{text:"Class List",url:"annotated.html"},
{text:"Class Index",url:"classes.html"},
{text:"Class Members",url:"functions.html",children:[
{text:"All",url:"functions.html"},
{text:"All",url:"functions.html",children:[
{text:"a",url:"functions.html#index_a"},
{text:"b",url:"functions.html#index_b"},
{text:"d",url:"functions.html#index_d"},
{text:"e",url:"functions.html#index_e"},
{text:"f",url:"functions.html#index_f"},
{text:"k",url:"functions.html#index_k"},
{text:"m",url:"functions.html#index_m"},
{text:"p",url:"functions.html#index_p"},
{text:"q",url:"functions.html#index_q"},
{text:"r",url:"functions.html#index_r"},
{text:"s",url:"functions.html#index_s"},
{text:"t",url:"functions.html#index_t"},
{text:"v",url:"functions.html#index_v"},
{text:"w",url:"functions.html#index_w"}]},
{text:"Functions",url:"functions_func.html"},
{text:"Variables",url:"functions_vars.html"},
{text:"Related Functions",url:"functions_rela.html"}]}]},
@ -38,5 +52,6 @@ var menudata={children:[
{text:"File Members",url:"globals.html",children:[
{text:"All",url:"globals.html"},
{text:"Functions",url:"globals_func.html"},
{text:"Variables",url:"globals_vars.html"},
{text:"Typedefs",url:"globals_type.html"},
{text:"Macros",url:"globals_defs.html"}]}]}]}

View File

@ -25,7 +25,19 @@
var NAVTREE =
[
[ "Penning Trap Simulation", "index.html", [
[ "Credits", "index.html#autotoc_md1", null ],
[ "Requirements", "index.html#autotoc_md1", [
[ "Operating systems", "index.html#autotoc_md2", null ],
[ "Libraries", "index.html#autotoc_md3", null ]
] ],
[ "Compiling", "index.html#autotoc_md4", null ],
[ "Running programs", "index.html#autotoc_md5", [
[ "C++ binaries", "index.html#autotoc_md6", null ],
[ "Python scripts", "index.html#autotoc_md7", [
[ "Install libraries", "index.html#autotoc_md8", null ],
[ "Running scripts", "index.html#autotoc_md9", null ]
] ]
] ],
[ "Credits", "index.html#autotoc_md10", null ],
[ "Bug List", "bug.html", null ],
[ "Classes", "annotated.html", [
[ "Class List", "annotated.html", "annotated_dup" ],
@ -42,6 +54,7 @@ var NAVTREE =
[ "File Members", "globals.html", [
[ "All", "globals.html", null ],
[ "Functions", "globals_func.html", null ],
[ "Variables", "globals_vars.html", null ],
[ "Typedefs", "globals_type.html", null ],
[ "Macros", "globals_defs.html", null ]
] ]

View File

@ -1,95 +1,121 @@
var NAVTREEINDEX0 =
{
"Particle_8cpp.html":[3,0,1,2],
"Particle_8cpp_source.html":[3,0,1,2],
"Particle_8hpp.html":[3,0,0,1],
"Particle_8hpp_source.html":[3,0,0,1],
"PenningTrap_8cpp.html":[3,0,1,3],
"PenningTrap_8cpp_source.html":[3,0,1,3],
"PenningTrap_8hpp.html":[3,0,0,2],
"PenningTrap_8hpp_source.html":[3,0,0,2],
"animate__100__particles_8py_source.html":[3,0,1,0],
"annotated.html":[2,0],
"bug.html":[1],
"classParticle.html":[2,0,0],
"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[2,0,0,3],
"classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4":[2,0,0,0],
"classParticle.html#a879692772803d6ab65fa4993b54aea6e":[2,0,0,5],
"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[2,0,0,1],
"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[2,0,0,2],
"classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6":[2,0,0,4],
"classPenningTrap.html":[2,0,1],
"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[2,0,1,21],
"classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b":[2,0,1,9],
"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[2,0,1,17],
"classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9":[2,0,1,7],
"classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8":[2,0,1,12],
"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[2,0,1,19],
"classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[2,0,1,5],
"classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648":[2,0,1,10],
"classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b":[2,0,1,14],
"classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854":[2,0,1,11],
"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[2,0,1,18],
"classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73":[2,0,1,2],
"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[2,0,1,3],
"classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1":[2,0,1,1],
"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[2,0,1,22],
"classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce":[2,0,1,8],
"classPenningTrap.html#aaf105828121c4a33cc2b217453c20317":[2,0,1,23],
"classPenningTrap.html#ab9ea97a406534bbe621a95215144875e":[2,0,1,4],
"classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57":[2,0,1,16],
"classPenningTrap.html#acbf065c9c125682329ad82a8d166554c":[2,0,1,6],
"classPenningTrap.html#ae670d7de621acdb343b01af098086f63":[2,0,1,0],
"classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56":[2,0,1,13],
"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[2,0,1,20],
"classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e":[2,0,1,15],
"classPenningTrapTest.html":[2,0,2],
"classes.html":[2,1],
"constants_8hpp.html":[3,0,0,0],
"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[3,0,0,0,1],
"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[3,0,0,0,0],
"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[3,0,0,0,2],
"constants_8hpp_source.html":[3,0,0,0],
"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[3,0,1],
"dir_d44c64559bbebec7f509842c48db8b23.html":[3,0,0],
"files.html":[3,0],
"functions.html":[2,2,0],
"functions_func.html":[2,2,1],
"functions_rela.html":[2,2,3],
"functions_vars.html":[2,2,2],
"globals.html":[3,1,0],
"globals_defs.html":[3,1,3],
"globals_func.html":[3,1,1],
"globals_type.html":[3,1,2],
"Particle_8cpp.html":[6,0,1,2],
"Particle_8cpp_source.html":[6,0,1,2],
"Particle_8hpp.html":[6,0,0,1],
"Particle_8hpp_source.html":[6,0,0,1],
"PenningTrap_8cpp.html":[6,0,1,3],
"PenningTrap_8cpp_source.html":[6,0,1,3],
"PenningTrap_8hpp.html":[6,0,0,2],
"PenningTrap_8hpp_source.html":[6,0,0,2],
"animate__100__particles_8py_source.html":[6,0,1,0,0],
"annotated.html":[5,0],
"bug.html":[4],
"classParticle.html":[5,0,0],
"classParticle.html#a566dcc1de4bdc01251776948798ea8e1":[5,0,0,3],
"classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4":[5,0,0,0],
"classParticle.html#a879692772803d6ab65fa4993b54aea6e":[5,0,0,5],
"classParticle.html#aa797d319549dc2a0beb06cdbfd430232":[5,0,0,1],
"classParticle.html#aedcc7e1bc53b0e2b1a4a07c9a1b47563":[5,0,0,2],
"classParticle.html#af9497cd8f2dcad0fad54f571ddb383e6":[5,0,0,4],
"classPenningTrap.html":[5,0,1],
"classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f":[5,0,1,21],
"classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b":[5,0,1,9],
"classPenningTrap.html#a0cac3509aa96e71a26d3b2c902e27716":[5,0,1,17],
"classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9":[5,0,1,7],
"classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8":[5,0,1,12],
"classPenningTrap.html#a2f168622587709b9e3c49077f0b9a640":[5,0,1,19],
"classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e":[5,0,1,5],
"classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648":[5,0,1,10],
"classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b":[5,0,1,14],
"classPenningTrap.html#a66dfe89c68716b9502927b97f59c27d2":[5,0,1,18],
"classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73":[5,0,1,2],
"classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8":[5,0,1,3],
"classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1":[5,0,1,1],
"classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e":[5,0,1,22],
"classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce":[5,0,1,8],
"classPenningTrap.html#aaf105828121c4a33cc2b217453c20317":[5,0,1,23],
"classPenningTrap.html#ab9ea97a406534bbe621a95215144875e":[5,0,1,4],
"classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57":[5,0,1,16],
"classPenningTrap.html#acbf065c9c125682329ad82a8d166554c":[5,0,1,6],
"classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599":[5,0,1,11],
"classPenningTrap.html#ae670d7de621acdb343b01af098086f63":[5,0,1,0],
"classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56":[5,0,1,13],
"classPenningTrap.html#ae9b5afdaa5cd366e94bd294452a1eed4":[5,0,1,20],
"classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e":[5,0,1,15],
"classPenningTrapTest.html":[5,0,2],
"classes.html":[5,1],
"constants_8hpp.html":[6,0,0,0],
"constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5":[6,0,0,0,1],
"constants_8hpp.html#a4e451456ad7e9276ed0afa42826e7ccb":[6,0,0,0,0],
"constants_8hpp.html#af40a326b23c68a27cebe60f16634a2cb":[6,0,0,0,2],
"constants_8hpp_source.html":[6,0,0,0],
"dir_634e799a3947388232110823971192a8.html":[6,0,1,0],
"dir_68267d1309a1af8e8297ef4c3efbcdba.html":[6,0,1],
"dir_d44c64559bbebec7f509842c48db8b23.html":[6,0,0],
"files.html":[6,0],
"functions.html":[5,2,0],
"functions_func.html":[5,2,1],
"functions_rela.html":[5,2,3],
"functions_vars.html":[5,2,2],
"globals.html":[6,1,0],
"globals_defs.html":[6,1,4],
"globals_func.html":[6,1,1],
"globals_type.html":[6,1,3],
"globals_vars.html":[6,1,2],
"index.html":[],
"index.html#autotoc_md1":[0],
"main_8cpp.html":[3,0,1,1],
"main_8cpp_source.html":[3,0,1,1],
"index.html#autotoc_md10":[3],
"index.html#autotoc_md2":[0,0],
"index.html#autotoc_md3":[0,1],
"index.html#autotoc_md4":[1],
"index.html#autotoc_md5":[2],
"index.html#autotoc_md6":[2,0],
"index.html#autotoc_md7":[2,1],
"index.html#autotoc_md8":[2,1,0],
"index.html#autotoc_md9":[2,1,1],
"main_8cpp.html":[6,0,1,1],
"main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513":[6,0,1,1,1],
"main_8cpp.html#a330668384dc073980ba11116309bacc5":[6,0,1,1,2],
"main_8cpp.html#a6451833d72816ef393087956c766125b":[6,0,1,1,0],
"main_8cpp.html#a783789519f97c6430081171cacb0ffb1":[6,0,1,1,5],
"main_8cpp.html#a87da4ef9f2cd753579484824310467b8":[6,0,1,1,6],
"main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6":[6,0,1,1,3],
"main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46":[6,0,1,1,7],
"main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2":[6,0,1,1,4],
"main_8cpp_source.html":[6,0,1,1],
"pages.html":[],
"plot__particles__left_8py_source.html":[3,0,1,4],
"test__suite_8cpp.html":[3,0,1,5],
"test__suite_8cpp_source.html":[3,0,1,5],
"typedefs_8hpp.html":[3,0,0,3],
"typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23":[3,0,0,3,1],
"typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66":[3,0,0,3,2],
"typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df":[3,0,0,3,3],
"typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af":[3,0,0,3,0],
"typedefs_8hpp_source.html":[3,0,0,3],
"utils_8cpp.html":[3,0,1,6],
"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[3,0,1,6,3],
"utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a":[3,0,1,6,0],
"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[3,0,1,6,4],
"utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de":[3,0,1,6,2],
"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[3,0,1,6,1],
"utils_8cpp_source.html":[3,0,1,6],
"utils_8hpp.html":[3,0,0,4],
"utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772":[3,0,0,4,3],
"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[3,0,0,4,4],
"utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168":[3,0,0,4,0],
"utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa":[3,0,0,4,5],
"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[3,0,0,4,1],
"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[3,0,0,4,6],
"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[3,0,0,4,7],
"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[3,0,0,4,2],
"utils_8hpp_source.html":[3,0,0,4]
"plot__2__particles_8py_source.html":[6,0,1,0,1],
"plot__3d_8py_source.html":[6,0,1,0,2],
"plot__particles__left_8py_source.html":[6,0,1,0,3],
"plot__phase__space_8py_source.html":[6,0,1,0,4],
"plot__relative__error_8py_source.html":[6,0,1,0,5],
"plot__single__particle_8py_source.html":[6,0,1,0,6],
"structsimulation.html":[5,0,3],
"test__suite_8cpp.html":[6,0,1,4],
"test__suite_8cpp_source.html":[6,0,1,4],
"typedefs_8hpp.html":[6,0,0,3],
"typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6":[6,0,0,3,4],
"typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23":[6,0,0,3,2],
"typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66":[6,0,0,3,3],
"typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df":[6,0,0,3,5],
"typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af":[6,0,0,3,1],
"typedefs_8hpp_source.html":[6,0,0,3],
"utils_8cpp.html":[6,0,1,5],
"utils_8cpp.html#a58565270b643b24e3132f38c653e0199":[6,0,1,5,3],
"utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2":[6,0,1,5,0],
"utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746":[6,0,1,5,4],
"utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de":[6,0,1,5,2],
"utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b":[6,0,1,5,1],
"utils_8cpp_source.html":[6,0,1,5],
"utils_8hpp.html":[6,0,0,4],
"utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38":[6,0,0,4,4],
"utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168":[6,0,0,4,0],
"utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa":[6,0,0,4,5],
"utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9":[6,0,0,4,1],
"utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9":[6,0,0,4,3],
"utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d":[6,0,0,4,6],
"utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384":[6,0,0,4,7],
"utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b":[6,0,0,4,2],
"utils_8hpp_source.html":[6,0,0,4]
};

View File

@ -0,0 +1,153 @@
<!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>Penning Trap Simulation: src/scripts/plot_2_particles.py 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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('plot__2__particles_8py_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">plot_2_particles.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> files = [</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_1_r.txt&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> ]</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> labels = [</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;particle 1 no interaction&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;particle 2 no interaction&quot;</span>,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral">&quot;particle 1 with interaction&quot;</span>,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral">&quot;particle 2 with interaction&quot;</span>,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> ]</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> colors = [</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;salmon&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> ]</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> lines = f.readlines()</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> plt.plot(r[:,0], r[:,1], label=label, color=color)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> plt.xlabel(<span class="stringliteral">r&quot;x $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> plt.ylabel(<span class="stringliteral">r&quot;y $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> plt.title(<span class="stringliteral">r&quot;2 particles with and without interactions.&quot;</span>)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="comment"># plt.legend()</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> plt.savefig(<span class="stringliteral">&quot;../latex/images/plot_2_particles_xy.pdf&quot;</span>)</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> </div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> main()</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_2_particles.py</b></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>

View File

@ -0,0 +1,154 @@
<!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>Penning Trap Simulation: src/scripts/plot_3d.py 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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('plot__3d_8py_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">plot_3d.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> files = [</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/particle_1_r.txt&quot;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> ]</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> labels = [</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;particle 1 no interaction&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;particle 2 no interaction&quot;</span>,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral">&quot;particle 1 with interaction&quot;</span>,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral">&quot;particle 2 with interaction&quot;</span>,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> ]</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> colors = [</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">&quot;deepskyblue&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">&quot;darkred&quot;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> ]</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> ax = plt.figure().add_subplot(projection=<span class="stringliteral">&quot;3d&quot;</span>)</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keyword">with</span> open(file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> lines = f.readlines()</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> ax.plot(r[:,0], r[:,1], r[:,2], label=label, color=color)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> ax.set_xlabel(<span class="stringliteral">r&quot;x $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> ax.set_ylabel(<span class="stringliteral">r&quot;y $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> ax.set_zlabel(<span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> plt.title(<span class="stringliteral">r&quot;2 particles with and without interactions.&quot;</span>)</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> plt.legend()</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> plt.savefig(<span class="stringliteral">&quot;../latex/images/3d_plot.pdf&quot;</span>)</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> main()</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_3d.py</b></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>

View File

@ -5,7 +5,7 @@
<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>Penning Trap Simulation: src/plot_particles_left.py Source File</title>
<title>Penning Trap Simulation: src/scripts/plot_particles_left.py 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>
@ -104,42 +104,39 @@ $(document).ready(function(){initNavTree('plot__particles__left_8py_source.html'
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span> </div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> files = [</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> <span class="stringliteral">&quot;output/time_dependent_potential/f_0.100000.txt&quot;</span>,</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/time_dependent_potential/f_0.400000.txt&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/time_dependent_potential/f_0.700000.txt&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> ]</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> vals = [</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> .1,</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> .4,</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> .7</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> ]</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(3):</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="keyword">with</span> open(files[i]) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> lines = f.readlines()</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> x = []</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> y = []</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines:</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> a,b = line.strip().split(<span class="stringliteral">&quot;,&quot;</span>)</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> x.append(float(a))</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> y.append(float(b))</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> plt.plot(x,y,label=f<span class="stringliteral">&quot;amplitude: {vals[i]}&quot;</span>)</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> plt.xlabel(<span class="stringliteral">r&quot;$\omega_V$&quot;</span>)</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> plt.ylabel(<span class="stringliteral">r&quot;Fraction of particles left&quot;</span>)</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> plt.title(<span class="stringliteral">r&quot;The fraction of particles left in the Penning trap &quot;</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="stringliteral">&quot;after 500 microseconds for different amplitudes and frequencies&quot;</span>)</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> plt.legend()</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> plt.show()</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> main()</div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span> <span class="keyword">with</span> open(<span class="stringliteral">&quot;output/time_dependent_potential/res.txt&quot;</span>) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> lines = f.readlines()</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> x = []</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> y1 = []</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> y2 = []</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> y3 = []</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines:</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> l = line.strip().split(<span class="stringliteral">&quot;,&quot;</span>)</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> x.append(float(l[0]))</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> y1.append(float(l[1]))</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> y2.append(float(l[2]))</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> y3.append(float(l[3]))</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> plt.plot(x,y1,label=f<span class="stringliteral">&quot;amplitude: 0.1&quot;</span>)</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> plt.plot(x,y2,label=f<span class="stringliteral">&quot;amplitude: 0.4&quot;</span>)</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> plt.plot(x,y3,label=f<span class="stringliteral">&quot;amplitude: 0.7&quot;</span>)</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> plt.xlabel(<span class="stringliteral">r&quot;$\omega_V$ (MHz)&quot;</span>)</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> plt.ylabel(<span class="stringliteral">r&quot;Fraction of particles left&quot;</span>)</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> plt.title(<span class="stringliteral">r&quot;The fraction of particles left in the Penning trap &quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="stringliteral">&quot;after 500 microseconds for different amplitudes and frequencies&quot;</span>)</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> plt.legend()</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="comment"># plt.show()</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> plt.savefig(<span class="stringliteral">&quot;../latex/images/particles_left.pdf&quot;</span>)</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> main()</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><b>plot_particles_left.py</b></li>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_particles_left.py</b></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>

View File

@ -0,0 +1,167 @@
<!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>Penning Trap Simulation: src/scripts/plot_phase_space.py 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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('plot__phase__space_8py_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">plot_phase_space.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> directories = {</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/simulate_2_particles/no_interaction/&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/simulate_2_particles/with_interaction/&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> }</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> titles = {</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> <span class="stringliteral">&quot;particles without interaction&quot;</span>,</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> <span class="stringliteral">&quot;particles with interaction&quot;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> }</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> files = [</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral">&quot;particle_0_r.txt&quot;</span>,</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral">&quot;particle_0_v.txt&quot;</span>,</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="stringliteral">&quot;particle_1_r.txt&quot;</span>,</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> <span class="stringliteral">&quot;particle_1_v.txt&quot;</span>,</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> ]</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> labels = [</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">r&quot;particle 1 r&quot;</span>,</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">r&quot;particle 1 v&quot;</span>,</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">r&quot;particle 2 r&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">r&quot;particle 2 v&quot;</span>,</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> ]</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> colors = [</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;lightskyblue&quot;</span>,</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">&quot;deepskyblue&quot;</span>,</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="stringliteral">&quot;salmon&quot;</span>,</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> <span class="stringliteral">&quot;tomato&quot;</span>,</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> ]</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> fig1, axs1 = plt.subplots(2,1)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> fig2, axs2 = plt.subplots(2,1)</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">for</span> i, (dir, title) <span class="keywordflow">in</span> enumerate(zip(directories, titles)):</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> <span class="keywordflow">for</span> label, color, file <span class="keywordflow">in</span> zip(labels, colors, files):</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keyword">with</span> open(dir+file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> lines = f.readlines()</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> axs1[i].plot(t, r[:,0], label=label, color=color)</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> axs2[i].plot(t, r[:,2], label=label, color=color)</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> axs1[i].set(xlabel=<span class="stringliteral">r&quot;t $(\mu s)$&quot;</span>, ylabel = <span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> axs1[i].legend()</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> axs1[i].set_title(title)</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="comment"># plt.show()</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> fig1.savefig(<span class="stringliteral">&quot;../latex/images/phase_space_2_particles_x.pdf&quot;</span>)</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> fig2.savefig(<span class="stringliteral">&quot;../latex/images/phase_space_2_particles_z.pdf&quot;</span>)</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> main()</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_phase_space.py</b></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>

View File

@ -0,0 +1,165 @@
<!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>Penning Trap Simulation: src/scripts/plot_relative_error.py 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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('plot__relative__error_8py_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">plot_relative_error.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> directories = [</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> <span class="stringliteral">&quot;output/relative_error/RK4/&quot;</span>,</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> <span class="stringliteral">&quot;output/relative_error/euler/&quot;</span>,</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> ]</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> files = [</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> <span class="stringliteral">&quot;4000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span> <span class="stringliteral">&quot;8000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral">&quot;16000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral">&quot;32000_steps.txt&quot;</span>,</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> ]</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> labels = [</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="stringliteral">r&quot;4000 steps&quot;</span>,</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> <span class="stringliteral">r&quot;8000 steps&quot;</span>,</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral">r&quot;16000 steps&quot;</span>,</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral">r&quot;32000 steps&quot;</span>,</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> ]</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> titles = [</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">&quot;Relative error for the RK4 method&quot;</span>,</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> <span class="stringliteral">&quot;Relative error for the forward Euler method&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> ]</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> methods = [</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="stringliteral">&quot;rk4&quot;</span>,</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="stringliteral">&quot;euler&quot;</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> ]</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> fig1, axs1 = plt.subplots(2,1)</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">for</span> i, (dir, title) <span class="keywordflow">in</span> enumerate(list(zip(directories, titles))):</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> max_err = []</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> <span class="keywordflow">for</span> label, file <span class="keywordflow">in</span> zip(labels, files):</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keyword">with</span> open(dir+file) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> lines = f.readlines()</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> r = np.array([float(line.strip()) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> max_err.append(max(r))</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> axs1[i].plot(t, r, label=label)</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> axs1[i].set(xlabel=<span class="stringliteral">r&quot;t $(\mu s)$&quot;</span>, ylabel = <span class="stringliteral">r&quot;relative_error $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> axs1[i].legend()</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> axs1[i].set_title(title)</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> conv_rate = 1/3 * sum([np.log2(max_err[i+1]/max_err[i])/np.log2(.5) <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(3)])</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> print(f<span class="stringliteral">&quot;{methods[i]}: {conv_rate}&quot;</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> fig1.savefig(<span class="stringliteral">&quot;../latex/images/phase_space_2_particles_x.pdf&quot;</span>)</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> main()</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_relative_error.py</b></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>

View File

@ -0,0 +1,144 @@
<!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>Penning Trap Simulation: src/scripts/plot_single_particle.py 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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('plot__single__particle_8py_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">plot_single_particle.py</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="keyword">import</span> numpy <span class="keyword">as</span> np</div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="keyword">def </span>z(t):</div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span> V_0 = 25.*9.64852558 * 10**4</div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span> m = 40.</div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> d = 500.</div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span> w_z = np.sqrt((2.*V_0)/(m*d*d))</div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno"> 9</span> <span class="keywordflow">return</span> 20.*np.cos(w_z*t)</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"> 10</span> </div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"> 11</span><span class="keyword">def </span>main():</div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno"> 12</span> filename = <span class="stringliteral">&quot;output/simulate_single_particle/particle_0_r.txt&quot;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> r = t = []</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> <span class="keyword">with</span> open(filename) <span class="keyword">as</span> f:</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> lines = f.readlines()</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> t = np.linspace(0, 50, len(lines))</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> r = np.array([list(map(float, line.strip().split(<span class="stringliteral">&quot;,&quot;</span>))) <span class="keywordflow">for</span> line <span class="keywordflow">in</span> lines])</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> plt.plot(t, r[:, 2], label=<span class="stringliteral">&quot;approximation&quot;</span>)</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> plt.plot(t, z(t), label=<span class="stringliteral">&quot;analytical&quot;</span>)</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> plt.xlabel(<span class="stringliteral">r&quot;time $(\mu s)$&quot;</span>)</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> plt.ylabel(<span class="stringliteral">r&quot;z $(\mu m)$&quot;</span>)</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> plt.title(<span class="stringliteral">r&quot;Movement of a single particle in the x direction&quot;</span>)</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> plt.legend()</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="comment"># plt.savefig(&quot;../latex/images/single_particle.pdf&quot;)</span></div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> plt.show()</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span><span class="keywordflow">if</span> __name__ == <span class="stringliteral">&quot;__main__&quot;</span>:</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> main()</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_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_634e799a3947388232110823971192a8.html">scripts</a></li><li class="navelem"><b>plot_single_particle.py</b></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>

View File

@ -1,6 +1,6 @@
var searchData=
[
['add_5fparticle_0',['add_particle',['../classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8',1,'PenningTrap']]],
['arma_5fvector_5fclose_5fto_1',['arma_vector_close_to',['../utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772',1,'arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8):&#160;utils.cpp'],['../utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a',1,'arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol):&#160;utils.cpp']]],
['analytical_5fsolution_5fparticle_5f1_1',['analytical_solution_particle_1',['../main_8cpp.html#a6451833d72816ef393087956c766125b',1,'main.cpp']]],
['assert_2',['ASSERT',['../utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9',1,'utils.hpp']]]
];

View File

@ -1,4 +1,5 @@
var searchData=
[
['constants_2ehpp_0',['constants.hpp',['../constants_8hpp.html',1,'']]]
['close_5fto_0',['close_to',['../utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9',1,'close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8):&#160;utils.cpp'],['../utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2',1,'close_to(arma::vec &amp;a, arma::vec &amp;b, double tol):&#160;utils.cpp']]],
['constants_2ehpp_1',['constants.hpp',['../constants_8hpp.html',1,'']]]
];

View File

@ -1,12 +1,14 @@
var searchData=
[
['particle_0',['Particle',['../classParticle.html',1,'Particle'],['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle::Particle()']]],
['particle_2ecpp_1',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
['particle_2ehpp_2',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
['particles_3',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]],
['penning_20trap_20simulation_4',['Penning trap simulation',['../index.html',1,'']]],
['penningtrap_5',['PenningTrap',['../classPenningTrap.html',1,'PenningTrap'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()'],['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector&lt; Particle &gt; particles, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]],
['penningtrap_2ecpp_6',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
['penningtrap_2ehpp_7',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]],
['penningtraptest_8',['PenningTrapTest',['../classPenningTrapTest.html',1,'']]]
['p1_0',['p1',['../main_8cpp.html#a87da4ef9f2cd753579484824310467b8',1,'main.cpp']]],
['p2_1',['p2',['../main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46',1,'main.cpp']]],
['particle_2',['Particle',['../classParticle.html',1,'Particle'],['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle::Particle()']]],
['particle_2ecpp_3',['Particle.cpp',['../Particle_8cpp.html',1,'']]],
['particle_2ehpp_4',['Particle.hpp',['../Particle_8hpp.html',1,'']]],
['particles_5',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]],
['penning_20trap_20simulation_6',['Penning trap simulation',['../index.html',1,'']]],
['penningtrap_7',['PenningTrap',['../classPenningTrap.html',1,'PenningTrap'],['../classParticle.html#aa797d319549dc2a0beb06cdbfd430232',1,'Particle::PenningTrap()'],['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector&lt; Particle &gt; particles, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]],
['penningtrap_2ecpp_8',['PenningTrap.cpp',['../PenningTrap_8cpp.html',1,'']]],
['penningtrap_2ehpp_9',['PenningTrap.hpp',['../PenningTrap_8hpp.html',1,'']]],
['penningtraptest_10',['PenningTrapTest',['../classPenningTrapTest.html',1,'']]]
];

View File

@ -4,5 +4,12 @@ var searchData=
['sim_5farr_1',['sim_arr',['../typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af',1,'typedefs.hpp']]],
['sim_5fcols_2',['sim_cols',['../typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23',1,'typedefs.hpp']]],
['sim_5frows_3',['sim_rows',['../typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66',1,'typedefs.hpp']]],
['simulate_4',['simulate',['../classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854',1,'PenningTrap']]]
['simulate_4',['simulate',['../classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599',1,'PenningTrap']]],
['simulate_5f100_5fparticles_5',['simulate_100_particles',['../main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513',1,'main.cpp']]],
['simulate_5f100_5fparticles_5fwith_5ftime_5fpotential_6',['simulate_100_particles_with_time_potential',['../main_8cpp.html#a330668384dc073980ba11116309bacc5',1,'main.cpp']]],
['simulate_5fsingle_5fparticle_7',['simulate_single_particle',['../main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6',1,'main.cpp']]],
['simulate_5fsingle_5fparticle_5fwith_5fdifferent_5fsteps_8',['simulate_single_particle_with_different_steps',['../main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2',1,'main.cpp']]],
['simulate_5ftwo_5fparticles_9',['simulate_two_particles',['../main_8cpp.html#a783789519f97c6430081171cacb0ffb1',1,'main.cpp']]],
['simulation_10',['simulation',['../structsimulation.html',1,'']]],
['simulation_5ft_11',['simulation_t',['../typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6',1,'typedefs.hpp']]]
];

View File

@ -2,9 +2,14 @@ var searchData=
[
['t_0',['t',['../classPenningTrap.html#a8ca4e21291f60fde619c14099d8c4e8e',1,'PenningTrap']]],
['t_1',['T',['../constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5',1,'constants.hpp']]],
['test_5fsuite_2ecpp_2',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]],
['total_5fforce_3',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
['total_5fforce_5fexternal_4',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
['total_5fforce_5fparticles_5',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]],
['typedefs_2ehpp_6',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
['test_5fexternal_5fb_5ffield_2',['test_external_B_field',['../classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230',1,'PenningTrapTest']]],
['test_5fexternal_5fe_5ffield_3',['test_external_E_field',['../classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901',1,'PenningTrapTest']]],
['test_5fforce_5fon_5fparticle_4',['test_force_on_particle',['../classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b',1,'PenningTrapTest']]],
['test_5fsuite_2ecpp_5',['test_suite.cpp',['../test__suite_8cpp.html',1,'']]],
['test_5ftotal_5fforce_5fexternal_6',['test_total_force_external',['../classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255',1,'PenningTrapTest']]],
['test_5ftotal_5fforce_5fparticles_7',['test_total_force_particles',['../classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d',1,'PenningTrapTest']]],
['total_5fforce_8',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
['total_5fforce_5fexternal_9',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
['total_5fforce_5fparticles_10',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]],
['typedefs_2ehpp_11',['typedefs.hpp',['../typedefs_8hpp.html',1,'']]]
];

4
docs/search/classes_1.js Normal file
View File

@ -0,0 +1,4 @@
var searchData=
[
['simulation_0',['simulation',['../structsimulation.html',1,'']]]
];

View File

@ -1,5 +1,5 @@
var searchData=
[
['add_5fparticle_0',['add_particle',['../classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8',1,'PenningTrap']]],
['arma_5fvector_5fclose_5fto_1',['arma_vector_close_to',['../utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772',1,'arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8):&#160;utils.cpp'],['../utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a',1,'arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol):&#160;utils.cpp']]]
['analytical_5fsolution_5fparticle_5f1_1',['analytical_solution_particle_1',['../main_8cpp.html#a6451833d72816ef393087956c766125b',1,'main.cpp']]]
];

View File

@ -1,7 +1,4 @@
var searchData=
[
['evolve_5fforward_5feuler_0',['evolve_forward_euler',['../classPenningTrap.html#ab9ea97a406534bbe621a95215144875e',1,'PenningTrap']]],
['evolve_5frk4_1',['evolve_RK4',['../classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e',1,'PenningTrap']]],
['external_5fb_5ffield_2',['external_B_field',['../classPenningTrap.html#acbf065c9c125682329ad82a8d166554c',1,'PenningTrap']]],
['external_5fe_5ffield_3',['external_E_field',['../classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9',1,'PenningTrap']]]
['close_5fto_0',['close_to',['../utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9',1,'close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8):&#160;utils.cpp'],['../utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2',1,'close_to(arma::vec &amp;a, arma::vec &amp;b, double tol):&#160;utils.cpp']]]
];

View File

@ -1,5 +1,7 @@
var searchData=
[
['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce',1,'PenningTrap']]],
['fraction_5fof_5fparticles_5fleft_1',['fraction_of_particles_left',['../classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b',1,'PenningTrap']]]
['evolve_5fforward_5feuler_0',['evolve_forward_euler',['../classPenningTrap.html#ab9ea97a406534bbe621a95215144875e',1,'PenningTrap']]],
['evolve_5frk4_1',['evolve_RK4',['../classPenningTrap.html#a36946152fd951b1f7c346c51ff900d8e',1,'PenningTrap']]],
['external_5fb_5ffield_2',['external_B_field',['../classPenningTrap.html#acbf065c9c125682329ad82a8d166554c',1,'PenningTrap']]],
['external_5fe_5ffield_3',['external_E_field',['../classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9',1,'PenningTrap']]]
];

View File

@ -1,5 +1,5 @@
var searchData=
[
['m_5fassert_0',['m_assert',['../utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38',1,'m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg):&#160;utils.cpp'],['../utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b',1,'m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg):&#160;utils.cpp']]],
['mkpath_1',['mkpath',['../utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa',1,'mkpath(std::string path, int mode=0777):&#160;utils.cpp'],['../utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de',1,'mkpath(std::string path, int mode):&#160;utils.cpp']]]
['force_5fon_5fparticle_0',['force_on_particle',['../classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce',1,'PenningTrap']]],
['fraction_5fof_5fparticles_5fleft_1',['fraction_of_particles_left',['../classPenningTrap.html#a0194be61c956a9259c747c23e4163c5b',1,'PenningTrap']]]
];

View File

@ -1,5 +1,5 @@
var searchData=
[
['particle_0',['Particle',['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle']]],
['penningtrap_1',['PenningTrap',['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector&lt; Particle &gt; particles, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]]
['m_5fassert_0',['m_assert',['../utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38',1,'m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg):&#160;utils.cpp'],['../utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b',1,'m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg):&#160;utils.cpp']]],
['mkpath_1',['mkpath',['../utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa',1,'mkpath(std::string path, int mode=0777):&#160;utils.cpp'],['../utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de',1,'mkpath(std::string path, int mode):&#160;utils.cpp']]]
];

View File

@ -1,4 +1,5 @@
var searchData=
[
['r_5ffunc_0',['r_func',['../classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648',1,'PenningTrap']]]
['particle_0',['Particle',['../classParticle.html#a7af9f8d1fef63dd7643b06629ac7bef4',1,'Particle']]],
['penningtrap_1',['PenningTrap',['../classPenningTrap.html#ae670d7de621acdb343b01af098086f63',1,'PenningTrap::PenningTrap(double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a763700316b502d5900e587c1f61e6bf1',1,'PenningTrap::PenningTrap(unsigned int i, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)'],['../classPenningTrap.html#a67139e04ef69c0bcffde8f30f67cbf73',1,'PenningTrap::PenningTrap(std::vector&lt; Particle &gt; particles, double B_0=T, std::function&lt; double(double)&gt; V_0=[](double t) { return 25. *V/1000.;}, double d=500., double t=0.)']]]
];

View File

@ -1,5 +1,4 @@
var searchData=
[
['scientific_5fformat_0',['scientific_format',['../utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384',1,'scientific_format(double d, int width=20, int prec=10):&#160;utils.cpp'],['../utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d',1,'scientific_format(const std::vector&lt; double &gt; &amp;v, int width=20, int prec=10):&#160;utils.cpp'],['../utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746',1,'scientific_format(double d, int width, int prec):&#160;utils.cpp'],['../utils_8cpp.html#a58565270b643b24e3132f38c653e0199',1,'scientific_format(const std::vector&lt; double &gt; &amp;v, int width, int prec):&#160;utils.cpp']]],
['simulate_1',['simulate',['../classPenningTrap.html#a5331837e6dd7bce807a99edd2ba7e854',1,'PenningTrap']]]
['r_5ffunc_0',['r_func',['../classPenningTrap.html#a43e74792ab4b3f9299f35cb64bdb2648',1,'PenningTrap']]]
];

View File

@ -1,6 +1,10 @@
var searchData=
[
['total_5fforce_0',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
['total_5fforce_5fexternal_1',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
['total_5fforce_5fparticles_2',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]]
['scientific_5fformat_0',['scientific_format',['../utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384',1,'scientific_format(double d, int width=20, int prec=10):&#160;utils.cpp'],['../utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d',1,'scientific_format(const std::vector&lt; double &gt; &amp;v, int width=20, int prec=10):&#160;utils.cpp'],['../utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746',1,'scientific_format(double d, int width, int prec):&#160;utils.cpp'],['../utils_8cpp.html#a58565270b643b24e3132f38c653e0199',1,'scientific_format(const std::vector&lt; double &gt; &amp;v, int width, int prec):&#160;utils.cpp']]],
['simulate_1',['simulate',['../classPenningTrap.html#ae09ef9cfa7e4ed1c108c8576405b3599',1,'PenningTrap']]],
['simulate_5f100_5fparticles_2',['simulate_100_particles',['../main_8cpp.html#a213713d6ecc02a32b588ffd179dc7513',1,'main.cpp']]],
['simulate_5f100_5fparticles_5fwith_5ftime_5fpotential_3',['simulate_100_particles_with_time_potential',['../main_8cpp.html#a330668384dc073980ba11116309bacc5',1,'main.cpp']]],
['simulate_5fsingle_5fparticle_4',['simulate_single_particle',['../main_8cpp.html#a8fdbe2d5a872e50ef5ec1263243589d6',1,'main.cpp']]],
['simulate_5fsingle_5fparticle_5fwith_5fdifferent_5fsteps_5',['simulate_single_particle_with_different_steps',['../main_8cpp.html#ac67e0d59227856c4d42e7d01c75e0ad2',1,'main.cpp']]],
['simulate_5ftwo_5fparticles_6',['simulate_two_particles',['../main_8cpp.html#a783789519f97c6430081171cacb0ffb1',1,'main.cpp']]]
];

View File

@ -1,4 +1,11 @@
var searchData=
[
['v_5ffunc_0',['v_func',['../classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e',1,'PenningTrap']]]
['test_5fexternal_5fb_5ffield_0',['test_external_B_field',['../classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230',1,'PenningTrapTest']]],
['test_5fexternal_5fe_5ffield_1',['test_external_E_field',['../classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901',1,'PenningTrapTest']]],
['test_5fforce_5fon_5fparticle_2',['test_force_on_particle',['../classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b',1,'PenningTrapTest']]],
['test_5ftotal_5fforce_5fexternal_3',['test_total_force_external',['../classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255',1,'PenningTrapTest']]],
['test_5ftotal_5fforce_5fparticles_4',['test_total_force_particles',['../classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d',1,'PenningTrapTest']]],
['total_5fforce_5',['total_force',['../classPenningTrap.html#a1f668c4433421136ad51741741aa1bc8',1,'PenningTrap']]],
['total_5fforce_5fexternal_6',['total_force_external',['../classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56',1,'PenningTrap']]],
['total_5fforce_5fparticles_7',['total_force_particles',['../classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b',1,'PenningTrap']]]
];

View File

@ -1,4 +1,4 @@
var searchData=
[
['write_5fsimulation_5fto_5fdir_0',['write_simulation_to_dir',['../classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57',1,'PenningTrap']]]
['v_5ffunc_0',['v_func',['../classPenningTrap.html#af98a720da60b0e1a62aefa5f5cb37c1e',1,'PenningTrap']]]
];

View File

@ -0,0 +1,4 @@
var searchData=
[
['write_5fsimulation_5fto_5fdir_0',['write_simulation_to_dir',['../classPenningTrap.html#abbb832a85139b1a56ebde57d7b8f9a57',1,'PenningTrap']]]
];

View File

@ -1,9 +1,9 @@
var indexSectionsWithContent =
{
0: "_abcdefkmpqrstuvw",
1: "p",
1: "ps",
2: "cmptu",
3: "aefmprstvw",
3: "acefmprstvw",
4: "bdkmpqrtv",
5: "sv",
6: "p",

View File

@ -2,5 +2,6 @@ var searchData=
[
['sim_5farr_0',['sim_arr',['../typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af',1,'typedefs.hpp']]],
['sim_5fcols_1',['sim_cols',['../typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23',1,'typedefs.hpp']]],
['sim_5frows_2',['sim_rows',['../typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66',1,'typedefs.hpp']]]
['sim_5frows_2',['sim_rows',['../typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66',1,'typedefs.hpp']]],
['simulation_5ft_3',['simulation_t',['../typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6',1,'typedefs.hpp']]]
];

View File

@ -1,4 +1,6 @@
var searchData=
[
['particles_0',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]]
['p1_0',['p1',['../main_8cpp.html#a87da4ef9f2cd753579484824310467b8',1,'main.cpp']]],
['p2_1',['p2',['../main_8cpp.html#a90f661586eb3c318fdca6f95ebc4fc46',1,'main.cpp']]],
['particles_2',['particles',['../classPenningTrap.html#a0112525d9e79a472e761f8ef402a339f',1,'PenningTrap']]]
];

View File

@ -0,0 +1,118 @@
<!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>Penning Trap Simulation: Member List</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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('structsimulation.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">simulation Member List</div></div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="structsimulation.html">simulation</a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>r_vecs</b> (defined in <a class="el" href="structsimulation.html">simulation</a>)</td><td class="entry"><a class="el" href="structsimulation.html">simulation</a></td><td class="entry"></td></tr>
<tr bgcolor="#f0f0f0" class="odd"><td class="entry"><b>v_vecs</b> (defined in <a class="el" href="structsimulation.html">simulation</a>)</td><td class="entry"><a class="el" href="structsimulation.html">simulation</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<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>

170
docs/structsimulation.html Normal file
View File

@ -0,0 +1,170 @@
<!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>Penning Trap Simulation: simulation Struct Reference</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">Penning Trap Simulation
</div>
<div id="projectbrief">Simulate particle behavior inside a Penning Trap</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('structsimulation.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="summary">
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structsimulation-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">simulation Struct Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Typedef for PenningTrap::simulation return value.
<a href="structsimulation.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a98786da608953ebfa91c0c45e210b0f2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsimulation.html#a98786da608953ebfa91c0c45e210b0f2">r_vecs</a></td></tr>
<tr class="separator:a98786da608953ebfa91c0c45e210b0f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80244043fe839f7ab50cf10da47b4129"><td class="memItemLeft" align="right" valign="top"><a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsimulation.html#a80244043fe839f7ab50cf10da47b4129">v_vecs</a></td></tr>
<tr class="separator:a80244043fe839f7ab50cf10da47b4129"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Typedef for PenningTrap::simulation return value. </p>
<p class="definition">Definition at line <a class="el" href="typedefs_8hpp_source.html#l00040">40</a> of file <a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>.</p>
</div><h2 class="groupheader">Member Data Documentation</h2>
<a id="a98786da608953ebfa91c0c45e210b0f2" name="a98786da608953ebfa91c0c45e210b0f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a98786da608953ebfa91c0c45e210b0f2">&#9670;&#160;</a></span>r_vecs</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> simulation::r_vecs</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="typedefs_8hpp_source.html#l00041">41</a> of file <a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>.</p>
</div>
</div>
<a id="a80244043fe839f7ab50cf10da47b4129" name="a80244043fe839f7ab50cf10da47b4129"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a80244043fe839f7ab50cf10da47b4129">&#9670;&#160;</a></span>v_vecs</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> simulation::v_vecs</td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="typedefs_8hpp_source.html#l00042">42</a> of file <a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>include/<a class="el" href="typedefs_8hpp_source.html">typedefs.hpp</a></li>
</ul>
</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="structsimulation.html">simulation</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>

View File

@ -107,17 +107,18 @@ $(document).ready(function(){initNavTree('test__suite_8cpp.html',''); initResiza
<p>The test suite for the project.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
<code>#include &lt;iomanip&gt;</code><br />
<div class="textblock"><code>#include &lt;iomanip&gt;</code><br />
<code>#include &lt;sstream&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
<code>#include &quot;<a class="el" href="PenningTrap_8hpp_source.html">PenningTrap.hpp</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
</div>
<p><a href="test__suite_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classPenningTrapTest.html">PenningTrapTest</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test class for the Penning trap. <a href="classPenningTrapTest.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
@ -150,7 +151,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00135">135</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="test__suite_8cpp_source.html#l00148">148</a> of file <a class="el" href="test__suite_8cpp_source.html">test_suite.cpp</a>.</p>
</div>
</div>

View File

@ -102,151 +102,157 @@ $(document).ready(function(){initNavTree('test__suite_8cpp_source.html',''); ini
</div><!--header-->
<div class="contents">
<a href="test__suite_8cpp.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> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span> </div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#include &lt;iomanip&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;iomanip&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span><span class="preprocessor">#include &quot;<a class="code" href="PenningTrap_8hpp.html">PenningTrap.hpp</a>&quot;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</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"><a class="line" href="classPenningTrapTest.html"> 20</a></span><span class="keyword">class </span><a class="code hl_class" href="classPenningTrapTest.html">PenningTrapTest</a> {</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keyword">static</span> <span class="keywordtype">void</span> test_external_E_field()</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> {</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> <span class="comment">// Vector containing inputs and expected results</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> std::vector&lt;std::pair&lt;arma::vec, arma::vec&gt;&gt; tests;</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> </div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> tests.push_back(</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> std::make_pair(arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> tests.push_back(std::make_pair(arma::vec{10., 0., 0.},</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> arma::vec{96.4852558, 0., 0.}));</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> tests.push_back(std::make_pair(arma::vec{10., 0., 0.},</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> arma::vec{96.4852558, 0., 0.}));</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> tests.push_back(std::make_pair(arma::vec{0., 10., 0.},</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> arma::vec{0., 96.4852558, 0.}));</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> tests.push_back(std::make_pair(arma::vec{0., 0., 10.},</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> arma::vec{0., 0., -192.9705116}));</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> </div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> arma::vec result;</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> arma::vec v;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> std::stringstream msg;</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; tests.size(); i++) {</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> v = tests.at(i).first;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> result = trap.<a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(v);</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> msg.str(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> msg &lt;&lt; <span class="stringliteral">&quot;Testing the external E field at (&quot;</span> &lt;&lt; std::setprecision(2)</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> &lt;&lt; v(0) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; v(1) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; v(2) &lt;&lt; <span class="stringliteral">&quot;).&quot;</span>;</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="classPenningTrapTest.html"> 22</a></span><span class="keyword">class </span><a class="code hl_class" href="classPenningTrapTest.html">PenningTrapTest</a> {</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"><a class="line" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901"> 26</a></span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">test_external_E_field</a>()</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> {</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="comment">// Vector containing inputs and expected results</span></div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span> std::vector&lt;std::pair&lt;vec_3d, vec_3d&gt;&gt; tests;</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> tests.push_back(</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> std::make_pair(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}));</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> tests.push_back(std::make_pair(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{10., 0., 0.},</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{96.4852558, 0., 0.}));</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> tests.push_back(std::make_pair(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{10., 0., 0.},</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{96.4852558, 0., 0.}));</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> tests.push_back(std::make_pair(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 10., 0.},</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 96.4852558, 0.}));</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> tests.push_back(std::make_pair(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 10.},</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., -192.9705116}));</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> result;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> v;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> std::stringstream msg;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; tests.size(); i++) {</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> v = tests.at(i).first;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> result = trap.<a class="code hl_function" href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">external_E_field</a>(v);</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(result, tests.at(i).second), msg.str());</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> }</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> }</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> msg.str(<span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> msg &lt;&lt; <span class="stringliteral">&quot;Testing the external E field at (&quot;</span> &lt;&lt; std::setprecision(2)</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> &lt;&lt; v(0) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; v(1) &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; v(2) &lt;&lt; <span class="stringliteral">&quot;).&quot;</span>;</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <span class="keyword">static</span> <span class="keywordtype">void</span> test_external_B_field()</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> {</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> <span class="comment">// No point in testing at different points since it&#39;s not dependent</span></div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="comment">// on position.</span></div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span> arma::vec expected{0., 0., <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>};</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> arma::vec result = trap.<a class="code hl_function" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">external_B_field</a>(arma::vec{0., 0., 0.});</div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"> 66</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(expected, result),</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="stringliteral">&quot;Testing the external B field at (0,0,0)&quot;</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> </div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keyword">static</span> <span class="keywordtype">void</span> test_force_on_particle()</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> {</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> arma::vec v{0., 0., 0.};</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> </div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="comment">// Add particles to test</span></div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{0., 0., 0.}, v));</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{1., 0., 0.}, v));</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{0., 3., 4.}, v));</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="comment">// Test p0 and p1</span></div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> arma::vec expected{-1., 0., 0.};</div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> arma::vec result = trap.<a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(0, 1);</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(expected, result),</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="stringliteral">&quot;Testing the force on a particle at (0,0,0) from a &quot;</span></div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="stringliteral">&quot;particle at (1,0,0).&quot;</span>);</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> </div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="comment">// Test p0 and p2</span></div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> expected = arma::vec{0, -.024, -.032};</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> result = trap.<a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(0, 2);</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(expected, result),</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="stringliteral">&quot;Testing the force on a particle at (0,0,0) from a &quot;</span></div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="stringliteral">&quot;particle at (0,3,4).&quot;</span>);</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> }</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno"> 59</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(result, tests.at(i).second), msg.str());</div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno"> 60</span> }</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> }</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"><a class="line" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230"> 65</a></span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">test_external_B_field</a>()</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">// No point in testing at different points since it&#39;s not dependent</span></div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="comment">// on position.</span></div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> expected{0., 0., <a class="code hl_define" href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a>};</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> result = trap.<a class="code hl_function" href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">external_B_field</a>(<a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.});</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(expected, result),</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="stringliteral">&quot;Testing the external B field at (0,0,0)&quot;</span>);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> }</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"><a class="line" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b"> 78</a></span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">test_force_on_particle</a>()</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> {</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> v{0., 0., 0.};</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">// Add particles to test</span></div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}, v));</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{1., 0., 0.}, v));</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(<a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 3., 4.}, v));</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="comment">// Test p0 and p1</span></div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> expected{-1., 0., 0.};</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> result = trap.<a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(0, 1);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(expected, result),</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="stringliteral">&quot;Testing the force on a particle at (0,0,0) from a &quot;</span></div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="stringliteral">&quot;particle at (1,0,0).&quot;</span>);</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keyword">static</span> <span class="keywordtype">void</span> test_total_force_external()</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> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{1., 2., 3.}, arma::vec{3., 4., 5.}));</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> </div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> arma::vec expected{395.58954878, -270.15871624, -57.89115348};</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> arma::vec result = trap.<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(0);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(expected, result),</div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="stringliteral">&quot;Testing the total external force on a particle at &quot;</span></div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> <span class="stringliteral">&quot;(1,2,3) with velocity (3,4,5)&quot;</span>);</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> }</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> </div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <span class="keyword">static</span> <span class="keywordtype">void</span> test_total_force_particles()</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> {</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> arma::vec expected{0., 0., 0.};</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> arma::vec result = trap.<a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(0);</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(expected, result),</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> <span class="stringliteral">&quot;Testing the total force of all particles on particle 0 &quot;</span></div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> <span class="stringliteral">&quot;with only a single particle&quot;</span>);</div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> </div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{1., 0., 0.}, arma::vec{0., 0., 0.}));</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{0., 1., 0.}, arma::vec{0., 0., 0.}));</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="comment">// Test p0 and p2</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> expected = <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0, -.024, -.032};</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> result = trap.<a class="code hl_function" href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">force_on_particle</a>(0, 2);</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(expected, result),</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="stringliteral">&quot;Testing the force on a particle at (0,0,0) from a &quot;</span></div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="stringliteral">&quot;particle at (0,3,4).&quot;</span>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> }</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"><a class="line" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255"> 105</a></span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">test_total_force_external</a>()</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> {</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{1., 2., 3.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{3., 4., 5.}));</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> expected{395.58954878, -270.15871624, -57.89115348};</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> result = trap.<a class="code hl_function" href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">total_force_external</a>(0);</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(expected, result),</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <span class="stringliteral">&quot;Testing the total external force on a particle at &quot;</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> <span class="stringliteral">&quot;(1,2,3) with velocity (3,4,5)&quot;</span>);</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> </div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"><a class="line" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d"> 121</a></span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">test_total_force_particles</a>()</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> {</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <a class="code hl_class" href="classPenningTrap.html">PenningTrap</a> trap;</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., arma::vec{0., 0., 1.}, arma::vec{0., 0., 0.}));</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}));</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> expected = arma::vec(3, arma::fill::value(-3473.383325));</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> result = trap.<a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(0);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(expected, result),</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> expected{0., 0., 0.};</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a> result = trap.<a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(0);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(expected, result),</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="stringliteral">&quot;Testing the total force of all particles on particle 0 &quot;</span></div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="stringliteral">&quot;with 3 other particles.&quot;</span>);</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</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> </div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span>{</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> PenningTrapTest::test_external_E_field();</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> PenningTrapTest::test_external_B_field();</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> PenningTrapTest::test_force_on_particle();</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> PenningTrapTest::test_total_force_external();</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> PenningTrapTest::test_total_force_particles();</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span>}</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="stringliteral">&quot;with only a single particle&quot;</span>);</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{1., 0., 0.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}));</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 1., 0.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}));</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> trap.<a class="code hl_function" href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">add_particle</a>(</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <a class="code hl_class" href="classParticle.html">Particle</a>(1., 40., <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 1.}, <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>{0., 0., 0.}));</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> expected = <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>().fill(-3473.383325);</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> result = trap.<a class="code hl_function" href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">total_force_particles</a>(0);</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <a class="code hl_define" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a>(<a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(expected, result),</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="stringliteral">&quot;Testing the total force of all particles on particle 0 &quot;</span></div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <span class="stringliteral">&quot;with 3 other particles.&quot;</span>);</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> }</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span>};</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span><span class="keywordtype">int</span> main()</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span>{</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <a class="code hl_function" href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">PenningTrapTest::test_external_E_field</a>();</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <a class="code hl_function" href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">PenningTrapTest::test_external_B_field</a>();</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <a class="code hl_function" href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">PenningTrapTest::test_force_on_particle</a>();</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <a class="code hl_function" href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">PenningTrapTest::test_total_force_external</a>();</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <a class="code hl_function" href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">PenningTrapTest::test_total_force_particles</a>();</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span>}</div>
<div class="ttc" id="aPenningTrap_8hpp_html"><div class="ttname"><a href="PenningTrap_8hpp.html">PenningTrap.hpp</a></div><div class="ttdoc">A class for simulating a Penning trap.</div></div>
<div class="ttc" id="aclassParticle_html"><div class="ttname"><a href="classParticle.html">Particle</a></div><div class="ttdoc">A class that holds attributes of a particle.</div><div class="ttdef"><b>Definition:</b> <a href="Particle_8hpp_source.html#l00021">Particle.hpp:21</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html"><div class="ttname"><a href="classPenningTrapTest.html">PenningTrapTest</a></div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00020">test_suite.cpp:20</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00030">PenningTrap.hpp:30</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1d58feaa2c9e34cbf26b1c5ed75ca9d9"><div class="ttname"><a href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a></div><div class="ttdeci">vec_3d external_E_field(vec_3d r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00087">PenningTrap.cpp:87</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a46a954a0946def199e30fb300ba1c47b"><div class="ttname"><a href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec_3d total_force_particles(unsigned int i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00129">PenningTrap.cpp:129</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00082">PenningTrap.cpp:82</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9ae34ad740a230e667e96bc6ee8730ce"><div class="ttname"><a href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec_3d force_on_particle(unsigned int i, unsigned int j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00100">PenningTrap.cpp:100</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_acbf065c9c125682329ad82a8d166554c"><div class="ttname"><a href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a></div><div class="ttdeci">vec_3d external_B_field(vec_3d r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00095">PenningTrap.cpp:95</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae72d203b0bfa1b9e72bea28cb2863c56"><div class="ttname"><a href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a></div><div class="ttdeci">vec_3d total_force_external(unsigned int i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00114">PenningTrap.cpp:114</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html"><div class="ttname"><a href="classPenningTrapTest.html">PenningTrapTest</a></div><div class="ttdoc">Test class for the Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00022">test_suite.cpp:22</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html_a0ee2bbf5e26c115164208b89c5a29e3d"><div class="ttname"><a href="classPenningTrapTest.html#a0ee2bbf5e26c115164208b89c5a29e3d">PenningTrapTest::test_total_force_particles</a></div><div class="ttdeci">static void test_total_force_particles()</div><div class="ttdoc">Test that the total force of all particles on a single particle returns expected results.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00121">test_suite.cpp:121</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html_a542996d72c713636b95e0aa9118f7901"><div class="ttname"><a href="classPenningTrapTest.html#a542996d72c713636b95e0aa9118f7901">PenningTrapTest::test_external_E_field</a></div><div class="ttdeci">static void test_external_E_field()</div><div class="ttdoc">Test that the external E field gives correct values.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00026">test_suite.cpp:26</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html_acb806e49a688424588e0c501bc57a230"><div class="ttname"><a href="classPenningTrapTest.html#acb806e49a688424588e0c501bc57a230">PenningTrapTest::test_external_B_field</a></div><div class="ttdeci">static void test_external_B_field()</div><div class="ttdoc">Test that the external B field gives correct values.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00065">test_suite.cpp:65</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html_addf81fa5692d8146cce5571ccdc5999b"><div class="ttname"><a href="classPenningTrapTest.html#addf81fa5692d8146cce5571ccdc5999b">PenningTrapTest::test_force_on_particle</a></div><div class="ttdeci">static void test_force_on_particle()</div><div class="ttdoc">Test that the force between particles gives expected results.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00078">test_suite.cpp:78</a></div></div>
<div class="ttc" id="aclassPenningTrapTest_html_ae104e04dcd21ac63281c908132fdf255"><div class="ttname"><a href="classPenningTrapTest.html#ae104e04dcd21ac63281c908132fdf255">PenningTrapTest::test_total_force_external</a></div><div class="ttdeci">static void test_total_force_external()</div><div class="ttdoc">Test that the total external force returns expected results.</div><div class="ttdef"><b>Definition:</b> <a href="test__suite_8cpp_source.html#l00105">test_suite.cpp:105</a></div></div>
<div class="ttc" id="aclassPenningTrap_html"><div class="ttname"><a href="classPenningTrap.html">PenningTrap</a></div><div class="ttdoc">A class that simulates a Penning trap.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8hpp_source.html#l00031">PenningTrap.hpp:31</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a1d58feaa2c9e34cbf26b1c5ed75ca9d9"><div class="ttname"><a href="classPenningTrap.html#a1d58feaa2c9e34cbf26b1c5ed75ca9d9">PenningTrap::external_E_field</a></div><div class="ttdeci">vec_3d external_E_field(vec_3d r)</div><div class="ttdoc">Calculate E at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00084">PenningTrap.cpp:84</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a46a954a0946def199e30fb300ba1c47b"><div class="ttname"><a href="classPenningTrap.html#a46a954a0946def199e30fb300ba1c47b">PenningTrap::total_force_particles</a></div><div class="ttdeci">vec_3d total_force_particles(unsigned int i)</div><div class="ttdoc">Calculate the total force on a particle p_i from other particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00123">PenningTrap.cpp:123</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a6e9776ff5b149f01080800716455d7c8"><div class="ttname"><a href="classPenningTrap.html#a6e9776ff5b149f01080800716455d7c8">PenningTrap::add_particle</a></div><div class="ttdeci">void add_particle(Particle particle)</div><div class="ttdoc">Add a particle to the system.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00079">PenningTrap.cpp:79</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_a9ae34ad740a230e667e96bc6ee8730ce"><div class="ttname"><a href="classPenningTrap.html#a9ae34ad740a230e667e96bc6ee8730ce">PenningTrap::force_on_particle</a></div><div class="ttdeci">vec_3d force_on_particle(unsigned int i, unsigned int j)</div><div class="ttdoc">Calculate the force between 2 particles.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00097">PenningTrap.cpp:97</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_acbf065c9c125682329ad82a8d166554c"><div class="ttname"><a href="classPenningTrap.html#acbf065c9c125682329ad82a8d166554c">PenningTrap::external_B_field</a></div><div class="ttdeci">vec_3d external_B_field(vec_3d r)</div><div class="ttdoc">Calculate B at point r.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00092">PenningTrap.cpp:92</a></div></div>
<div class="ttc" id="aclassPenningTrap_html_ae72d203b0bfa1b9e72bea28cb2863c56"><div class="ttname"><a href="classPenningTrap.html#ae72d203b0bfa1b9e72bea28cb2863c56">PenningTrap::total_force_external</a></div><div class="ttdeci">vec_3d total_force_external(unsigned int i)</div><div class="ttdoc">Calculate the total external force on a particle.</div><div class="ttdef"><b>Definition:</b> <a href="PenningTrap_8cpp_source.html#l00108">PenningTrap.cpp:108</a></div></div>
<div class="ttc" id="aconstants_8hpp_html_a0acb682b8260ab1c60b918599864e2e5"><div class="ttname"><a href="constants_8hpp.html#a0acb682b8260ab1c60b918599864e2e5">T</a></div><div class="ttdeci">#define T</div><div class="ttdoc">1 Tesla. unit:</div><div class="ttdef"><b>Definition:</b> <a href="constants_8hpp_source.html#l00017">constants.hpp:17</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
<div class="ttc" id="autils_8hpp_html_a0c95c4791692b06f8811905a76dbd772"><div class="ttname"><a href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a></div><div class="ttdeci">bool arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8)</div><div class="ttdoc">Test if two armadillo vectors are close to each other.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00062">utils.cpp:62</a></div></div>
<div class="ttc" id="autils_8hpp_html_a73d4f21ad937dbc50a0c0538c78fd4f9"><div class="ttname"><a href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a></div><div class="ttdeci">#define ASSERT(expr, msg)</div><div class="ttdoc">A prettier assertion function.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00045">utils.hpp:45</a></div></div>
<div class="ttc" id="autils_8hpp_html_a73d4f21ad937dbc50a0c0538c78fd4f9"><div class="ttname"><a href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9">ASSERT</a></div><div class="ttdeci">#define ASSERT(expr, msg)</div><div class="ttdoc">A prettier assertion function.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00046">utils.hpp:46</a></div></div>
<div class="ttc" id="autils_8hpp_html_ab3e0cf669bddc59bd53998490ffb68b9"><div class="ttname"><a href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a></div><div class="ttdeci">bool close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8)</div><div class="ttdoc">Test if two armadillo vectors are close to each other.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00060">utils.cpp:60</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -99,6 +99,7 @@ $(document).ready(function(){initNavTree('typedefs_8hpp.html',''); initResizable
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#typedef-members">Typedefs</a> </div>
<div class="headertitle"><div class="title">typedefs.hpp File Reference</div></div>
</div><!--header-->
@ -106,11 +107,17 @@ $(document).ready(function(){initNavTree('typedefs_8hpp.html',''); initResizable
<p>Useful typedefs for cleaner code.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;vector&gt;</code><br />
<code>#include &lt;armadillo&gt;</code><br />
<div class="textblock"><code>#include &lt;armadillo&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
</div>
<p><a href="typedefs_8hpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structsimulation.html">simulation</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Typedef for PenningTrap::simulation return value. <a href="structsimulation.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a7c2dfa854274262c4e00e4ef0ab2ce23"><td class="memItemLeft" align="right" valign="top">typedef std::vector&lt; arma::vec::fixed&lt; 3 &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a></td></tr>
@ -125,6 +132,10 @@ Typedefs</h2></td></tr>
<tr class="memitem:a9f33f4962c8fb62cc5ccd0e4e039a8df"><td class="memItemLeft" align="right" valign="top">typedef arma::vec::fixed&lt; 3 &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></td></tr>
<tr class="memdesc:a9f33f4962c8fb62cc5ccd0e4e039a8df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Typedef for a fixed 3d arma vector. <br /></td></tr>
<tr class="separator:a9f33f4962c8fb62cc5ccd0e4e039a8df"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a784799c37b5e4fb8bf4f6368e004dec6"><td class="memItemLeft" align="right" valign="top"><a id="a784799c37b5e4fb8bf4f6368e004dec6" name="a784799c37b5e4fb8bf4f6368e004dec6"></a>
typedef struct <a class="el" href="structsimulation.html">simulation</a>&#160;</td><td class="memItemRight" valign="bottom"><b>simulation_t</b></td></tr>
<tr class="memdesc:a784799c37b5e4fb8bf4f6368e004dec6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Typedef for PenningTrap::simulation return value. <br /></td></tr>
<tr class="separator:a784799c37b5e4fb8bf4f6368e004dec6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Useful typedefs for cleaner code. </p>

View File

@ -1,7 +1,9 @@
var typedefs_8hpp =
[
[ "simulation", "structsimulation.html", null ],
[ "sim_arr", "typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af", null ],
[ "sim_cols", "typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23", null ],
[ "sim_rows", "typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66", null ],
[ "simulation_t", "typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6", null ],
[ "vec_3d", "typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df", null ]
];

View File

@ -105,8 +105,8 @@ $(document).ready(function(){initNavTree('typedefs_8hpp_source.html',''); initRe
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#ifndef __TYPEDEFS__</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span><span class="preprocessor">#define __TYPEDEFS__</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> </div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &lt;armadillo&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span><span class="preprocessor">#include &lt;armadillo&gt;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23"> 24</a></span><span class="keyword">typedef</span> std::vector&lt;arma::vec::fixed&lt;3&gt;&gt; <a class="code hl_typedef" href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a>;</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> </div>
@ -116,7 +116,14 @@ $(document).ready(function(){initNavTree('typedefs_8hpp_source.html',''); initRe
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df"> 36</a></span><span class="keyword">typedef</span> arma::vec::fixed&lt;3&gt; <a class="code hl_typedef" href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a>;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="structsimulation.html"> 40</a></span><span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code hl_struct" href="structsimulation.html">simulation</a> {</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"> 41</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> r_vecs;</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <a class="code hl_typedef" href="typedefs_8hpp.html#aec69d34220fff45de238b9e01f2686af">sim_arr</a> v_vecs;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6"> 43</a></span>} <a class="code hl_typedef" href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6">simulation_t</a>;</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="astructsimulation_html"><div class="ttname"><a href="structsimulation.html">simulation</a></div><div class="ttdoc">Typedef for PenningTrap::simulation return value.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00040">typedefs.hpp:40</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a784799c37b5e4fb8bf4f6368e004dec6"><div class="ttname"><a href="typedefs_8hpp.html#a784799c37b5e4fb8bf4f6368e004dec6">simulation_t</a></div><div class="ttdeci">struct simulation simulation_t</div><div class="ttdoc">Typedef for PenningTrap::simulation return value.</div></div>
<div class="ttc" id="atypedefs_8hpp_html_a7c2dfa854274262c4e00e4ef0ab2ce23"><div class="ttname"><a href="typedefs_8hpp.html#a7c2dfa854274262c4e00e4ef0ab2ce23">sim_cols</a></div><div class="ttdeci">std::vector&lt; arma::vec::fixed&lt; 3 &gt; &gt; sim_cols</div><div class="ttdoc">Typedef for the column of the result vector from simulating particles.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00024">typedefs.hpp:24</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a8502989b1b361725834fc185bd575f66"><div class="ttname"><a href="typedefs_8hpp.html#a8502989b1b361725834fc185bd575f66">sim_rows</a></div><div class="ttdeci">std::vector&lt; arma::vec::fixed&lt; 3 &gt; &gt; sim_rows</div><div class="ttdoc">Typedef for the row of the result vector from simulating particles.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00028">typedefs.hpp:28</a></div></div>
<div class="ttc" id="atypedefs_8hpp_html_a9f33f4962c8fb62cc5ccd0e4e039a8df"><div class="ttname"><a href="typedefs_8hpp.html#a9f33f4962c8fb62cc5ccd0e4e039a8df">vec_3d</a></div><div class="ttdeci">arma::vec::fixed&lt; 3 &gt; vec_3d</div><div class="ttdoc">Typedef for a fixed 3d arma vector.</div><div class="ttdef"><b>Definition:</b> <a href="typedefs_8hpp_source.html#l00036">typedefs.hpp:36</a></div></div>

View File

@ -106,8 +106,7 @@ $(document).ready(function(){initNavTree('utils_8cpp.html',''); initResizable();
<p>Implementation of the utils.
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &lt;sys/stat.h&gt;</code><br />
<code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
<div class="textblock"><code>#include &quot;<a class="el" href="utils_8hpp_source.html">utils.hpp</a>&quot;</code><br />
</div>
<p><a href="utils_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
@ -122,9 +121,9 @@ Functions</h2></td></tr>
<tr class="memitem:aff5e07c3c1d321709b0cc38e999f427b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">m_assert</a> (bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)</td></tr>
<tr class="memdesc:aff5e07c3c1d321709b0cc38e999f427b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test an expression, confirm that test is ok, or abort execution. <br /></td></tr>
<tr class="separator:aff5e07c3c1d321709b0cc38e999f427b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5d2e1e032fd19614f2fbb58149a7b02a"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a">arma_vector_close_to</a> (arma::vec &amp;a, arma::vec &amp;b, double tol)</td></tr>
<tr class="memdesc:a5d2e1e032fd19614f2fbb58149a7b02a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test if two armadillo vectors are close to each other. <br /></td></tr>
<tr class="separator:a5d2e1e032fd19614f2fbb58149a7b02a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6be6f938bcbb235ebb6a2ed9d08411b2"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2">close_to</a> (arma::vec &amp;a, arma::vec &amp;b, double tol)</td></tr>
<tr class="memdesc:a6be6f938bcbb235ebb6a2ed9d08411b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test if two armadillo vectors are close to each other. <br /></td></tr>
<tr class="separator:a6be6f938bcbb235ebb6a2ed9d08411b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acf13f4e492199cb7231bfa646dbd08de"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">mkpath</a> (std::string path, int mode)</td></tr>
<tr class="memdesc:acf13f4e492199cb7231bfa646dbd08de"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make path given. <br /></td></tr>
<tr class="separator:acf13f4e492199cb7231bfa646dbd08de"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -139,14 +138,14 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p class="definition">Definition in file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a5d2e1e032fd19614f2fbb58149a7b02a" name="a5d2e1e032fd19614f2fbb58149a7b02a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5d2e1e032fd19614f2fbb58149a7b02a">&#9670;&#160;</a></span>arma_vector_close_to()</h2>
<a id="a6be6f938bcbb235ebb6a2ed9d08411b2" name="a6be6f938bcbb235ebb6a2ed9d08411b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6be6f938bcbb235ebb6a2ed9d08411b2">&#9670;&#160;</a></span>close_to()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool arma_vector_close_to </td>
<td class="memname">bool close_to </td>
<td>(</td>
<td class="paramtype">arma::vec &amp;&#160;</td>
<td class="paramname"><em>a</em>, </td>
@ -183,7 +182,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00062">62</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00060">60</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -251,7 +250,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00043">43</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00041">41</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -290,9 +289,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>bool Success/Fail </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00076">76</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00074">74</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -340,7 +339,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00024">24</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00022">22</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -388,7 +387,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00017">17</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00015">15</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>

View File

@ -1,6 +1,6 @@
var utils_8cpp =
[
[ "arma_vector_close_to", "utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a", null ],
[ "close_to", "utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2", null ],
[ "m_assert", "utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b", null ],
[ "mkpath", "utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de", null ],
[ "scientific_format", "utils_8cpp.html#a58565270b643b24e3132f38c653e0199", null ],

View File

@ -102,97 +102,95 @@ $(document).ready(function(){initNavTree('utils_8cpp_source.html',''); initResiz
</div><!--header-->
<div class="contents">
<a href="utils_8cpp.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> </div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &lt;sys/stat.h&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span> </div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"> 15</span><span class="preprocessor">#include &quot;<a class="code" href="utils_8hpp.html">utils.hpp</a>&quot;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> </div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"><a class="line" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384"> 17</a></span>std::string <a class="code hl_function" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a>(<span class="keywordtype">double</span> d, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> prec)</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span>{</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> std::stringstream ss;</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> ss &lt;&lt; std::setw(width) &lt;&lt; std::setprecision(prec) &lt;&lt; std::scientific &lt;&lt; d;</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> <span class="keywordflow">return</span> ss.str();</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span>}</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d"> 24</a></span>std::string <a class="code hl_function" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;double&gt; &amp;v, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> prec)</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span>{</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> std::stringstream ss;</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordflow">for</span> (<span class="keywordtype">double</span> elem : v) {</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> ss &lt;&lt; <a class="code hl_function" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a>(elem, width, prec);</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span> }</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> <span class="keywordflow">return</span> ss.str();</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span>}</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span><span class="keyword">static</span> <span class="keywordtype">void</span> print_message(std::string msg)</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span>{</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> <span class="keywordflow">if</span> (msg.size() &gt; 0) {</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> std::cout &lt;&lt; <span class="stringliteral">&quot;message: &quot;</span> &lt;&lt; msg &lt;&lt; <span class="stringliteral">&quot;\n\n&quot;</span>;</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> }</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</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> </div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38"> 43</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">m_assert</a>(<span class="keywordtype">bool</span> expr, std::string expr_str, std::string f, std::string file,</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> <span class="keywordtype">int</span> line, std::string msg)</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span>{</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> std::string new_assert(f.size() + (expr ? 4 : 6), <span class="charliteral">&#39;-&#39;</span>);</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\x1B[36m&quot;</span> &lt;&lt; new_assert &lt;&lt; <span class="stringliteral">&quot;\033[0m\n&quot;</span>;</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> std::cout &lt;&lt; f &lt;&lt; <span class="stringliteral">&quot;: &quot;</span>;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> <span class="keywordflow">if</span> (expr) {</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\x1B[32mOK\033[0m\n&quot;</span>;</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> print_message(msg);</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> }</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\x1B[31mFAIL\033[0m\n&quot;</span>;</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> print_message(msg);</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> std::cout &lt;&lt; file &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; line &lt;&lt; <span class="stringliteral">&quot;: Assertion \&quot;&quot;</span> &lt;&lt; expr_str</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> &lt;&lt; <span class="stringliteral">&quot;\&quot; Failed\n\n&quot;</span>;</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span> abort();</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>}</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span> </div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772"> 62</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a">arma_vector_close_to</a>(arma::vec &amp;a, arma::vec &amp;b, <span class="keywordtype">double</span> tol)</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">if</span> (a.n_elem != b.n_elem) {</div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span> <span class="keywordflow">return</span> <span class="keyword">false</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> </div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; a.n_elem; i++) {</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <span class="keywordflow">if</span> (std::abs(a(i) - b(i)) &gt;= tol) {</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> }</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> }</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span>}</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa"> 76</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">mkpath</a>(std::string path, <span class="keywordtype">int</span> mode)</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span>{</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> std::string cur_dir;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> std::string::size_type pos = -1;</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keyword">struct </span>stat buf;</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="keywordflow">if</span> (path.back() != <span class="charliteral">&#39;/&#39;</span>) {</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> path += <span class="charliteral">&#39;/&#39;</span>;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> }</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> pos++;</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> pos = path.find(<span class="charliteral">&#39;/&#39;</span>, pos);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="keywordflow">if</span> (pos != std::string::npos) {</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> cur_dir = path.substr(0, pos);</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> <span class="keywordflow">if</span> (mkdir(cur_dir.c_str(), mode) != 0 &amp;&amp; stat(cur_dir.c_str(), &amp;buf) != 0) {</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <span class="keywordflow">return</span> -1;</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> }</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> }</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="keywordflow">break</span>;</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> }</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span>}</div>
<div class="ttc" id="autils_8cpp_html_a5d2e1e032fd19614f2fbb58149a7b02a"><div class="ttname"><a href="utils_8cpp.html#a5d2e1e032fd19614f2fbb58149a7b02a">arma_vector_close_to</a></div><div class="ttdeci">bool arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol)</div><div class="ttdoc">Test if two armadillo vectors are close to each other.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00062">utils.cpp:62</a></div></div>
<div class="ttc" id="autils_8cpp_html_acd2a9c7a7d5a7fe9163be8c4cc110746"><div class="ttname"><a href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a></div><div class="ttdeci">std::string scientific_format(double d, int width, int prec)</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#l00017">utils.cpp:17</a></div></div>
<div class="ttc" id="autils_8cpp_html_acf13f4e492199cb7231bfa646dbd08de"><div class="ttname"><a href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00076">utils.cpp:76</a></div></div>
<div class="ttc" id="autils_8cpp_html_aff5e07c3c1d321709b0cc38e999f427b"><div class="ttname"><a href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">m_assert</a></div><div class="ttdeci">void m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)</div><div class="ttdoc">Test an expression, confirm that test is ok, or abort execution.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00043">utils.cpp:43</a></div></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno"><a class="line" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384"> 15</a></span>std::string <a class="code hl_function" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a>(<span class="keywordtype">double</span> d, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> prec)</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span>{</div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno"> 17</span> std::stringstream ss;</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> ss &lt;&lt; std::setw(width) &lt;&lt; std::setprecision(prec) &lt;&lt; std::scientific &lt;&lt; d;</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span> <span class="keywordflow">return</span> ss.str();</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span>}</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d"> 22</a></span>std::string <a class="code hl_function" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;double&gt; &amp;v, <span class="keywordtype">int</span> width, <span class="keywordtype">int</span> prec)</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span>{</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> std::stringstream ss;</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span> <span class="keywordflow">for</span> (<span class="keywordtype">double</span> elem : v) {</div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno"> 26</span> ss &lt;&lt; <a class="code hl_function" href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a>(elem, width, prec);</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> }</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span> <span class="keywordflow">return</span> ss.str();</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno"> 29</span>}</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno"> 31</span><span class="keyword">static</span> <span class="keywordtype">void</span> print_message(std::string msg)</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span>{</div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span> <span class="keywordflow">if</span> (msg.size() &gt; 0) {</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> std::cout &lt;&lt; <span class="stringliteral">&quot;message: &quot;</span> &lt;&lt; msg &lt;&lt; <span class="stringliteral">&quot;\n\n&quot;</span>;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> }</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> }</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span>}</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"> 40</span> </div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38"> 41</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">m_assert</a>(<span class="keywordtype">bool</span> expr, std::string expr_str, std::string f, std::string file,</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"> 42</span> <span class="keywordtype">int</span> line, std::string msg)</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"> 43</span>{</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"> 44</span> std::string new_assert(f.size() + (expr ? 4 : 6), <span class="charliteral">&#39;-&#39;</span>);</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\x1B[36m&quot;</span> &lt;&lt; new_assert &lt;&lt; <span class="stringliteral">&quot;\033[0m\n&quot;</span>;</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span> std::cout &lt;&lt; f &lt;&lt; <span class="stringliteral">&quot;: &quot;</span>;</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> <span class="keywordflow">if</span> (expr) {</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\x1B[32mOK\033[0m\n&quot;</span>;</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> print_message(msg);</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span> }</div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"> 51</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> std::cout &lt;&lt; <span class="stringliteral">&quot;\x1B[31mFAIL\033[0m\n&quot;</span>;</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> print_message(msg);</div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> std::cout &lt;&lt; file &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; line &lt;&lt; <span class="stringliteral">&quot;: Assertion \&quot;&quot;</span> &lt;&lt; expr_str</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno"> 55</span> &lt;&lt; <span class="stringliteral">&quot;\&quot; Failed\n\n&quot;</span>;</div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"> 56</span> abort();</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"> 57</span> }</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno"> 58</span>}</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"><a class="line" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9"> 60</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2">close_to</a>(arma::vec &amp;a, arma::vec &amp;b, <span class="keywordtype">double</span> tol)</div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno"> 61</span>{</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno"> 62</span> <span class="keywordflow">if</span> (a.n_elem != b.n_elem) {</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno"> 63</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</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> <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = 0; i &lt; a.n_elem; i++) {</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> <span class="keywordflow">if</span> (std::abs(a(i) - b(i)) &gt;= tol) {</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> }</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="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span>}</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa"> 74</a></span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">mkpath</a>(std::string path, <span class="keywordtype">int</span> mode)</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span>{</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> std::string cur_dir;</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> std::string::size_type pos = -1;</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keyword">struct </span>stat buf;</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordflow">if</span> (path.back() != <span class="charliteral">&#39;/&#39;</span>) {</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> path += <span class="charliteral">&#39;/&#39;</span>;</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="keywordflow">while</span> (<span class="keyword">true</span>) {</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> pos++;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> pos = path.find(<span class="charliteral">&#39;/&#39;</span>, pos);</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordflow">if</span> (pos != std::string::npos) {</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> cur_dir = path.substr(0, pos);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> <span class="keywordflow">if</span> (mkdir(cur_dir.c_str(), mode) != 0 &amp;&amp; stat(cur_dir.c_str(), &amp;buf) != 0) {</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordflow">return</span> -1;</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> }</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> }</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> }</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> }</div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span>}</div>
<div class="ttc" id="autils_8cpp_html_a6be6f938bcbb235ebb6a2ed9d08411b2"><div class="ttname"><a href="utils_8cpp.html#a6be6f938bcbb235ebb6a2ed9d08411b2">close_to</a></div><div class="ttdeci">bool close_to(arma::vec &amp;a, arma::vec &amp;b, double tol)</div><div class="ttdoc">Test if two armadillo vectors are close to each other.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00060">utils.cpp:60</a></div></div>
<div class="ttc" id="autils_8cpp_html_acd2a9c7a7d5a7fe9163be8c4cc110746"><div class="ttname"><a href="utils_8cpp.html#acd2a9c7a7d5a7fe9163be8c4cc110746">scientific_format</a></div><div class="ttdeci">std::string scientific_format(double d, int width, int prec)</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#l00015">utils.cpp:15</a></div></div>
<div class="ttc" id="autils_8cpp_html_acf13f4e492199cb7231bfa646dbd08de"><div class="ttname"><a href="utils_8cpp.html#acf13f4e492199cb7231bfa646dbd08de">mkpath</a></div><div class="ttdeci">bool mkpath(std::string path, int mode)</div><div class="ttdoc">Make path given.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00074">utils.cpp:74</a></div></div>
<div class="ttc" id="autils_8cpp_html_aff5e07c3c1d321709b0cc38e999f427b"><div class="ttname"><a href="utils_8cpp.html#aff5e07c3c1d321709b0cc38e999f427b">m_assert</a></div><div class="ttdeci">void m_assert(bool expr, std::string expr_str, std::string f, std::string file, int line, std::string msg)</div><div class="ttdoc">Test an expression, confirm that test is ok, or abort execution.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00041">utils.cpp:41</a></div></div>
<div class="ttc" id="autils_8hpp_html"><div class="ttname"><a href="utils_8hpp.html">utils.hpp</a></div><div class="ttdoc">Function prototypes and macros that are useful.</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->

View File

@ -111,6 +111,7 @@ $(document).ready(function(){initNavTree('utils_8hpp.html',''); initResizable();
<code>#include &lt;iomanip&gt;</code><br />
<code>#include &lt;sstream&gt;</code><br />
<code>#include &lt;string&gt;</code><br />
<code>#include &lt;sys/stat.h&gt;</code><br />
<code>#include &lt;vector&gt;</code><br />
</div>
<p><a href="utils_8hpp_source.html">Go to the source code of this file.</a></p>
@ -124,7 +125,7 @@ Macros</h2></td></tr>
<tr class="memdesc:a73d4f21ad937dbc50a0c0538c78fd4f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">A prettier assertion function. <br /></td></tr>
<tr class="separator:a73d4f21ad937dbc50a0c0538c78fd4f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60dca3177fb9cb5256609adc7af55168"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168">__METHOD_NAME__</a>&#160;&#160;&#160;methodName(__PRETTY_FUNCTION__)</td></tr>
<tr class="memdesc:a60dca3177fb9cb5256609adc7af55168"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the name of the current method/function. <br /></td></tr>
<tr class="memdesc:a60dca3177fb9cb5256609adc7af55168"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the name of the current method/function without the return type. <br /></td></tr>
<tr class="separator:a60dca3177fb9cb5256609adc7af55168"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
@ -138,9 +139,9 @@ Functions</h2></td></tr>
<tr class="memitem:a2cc3a2cdb635bac3c8b02e89d4d6af38"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a> (bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)</td></tr>
<tr class="memdesc:a2cc3a2cdb635bac3c8b02e89d4d6af38"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test an expression, confirm that test is ok, or abort execution. <br /></td></tr>
<tr class="separator:a2cc3a2cdb635bac3c8b02e89d4d6af38"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c95c4791692b06f8811905a76dbd772"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a> (arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8)</td></tr>
<tr class="memdesc:a0c95c4791692b06f8811905a76dbd772"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test if two armadillo vectors are close to each other. <br /></td></tr>
<tr class="separator:a0c95c4791692b06f8811905a76dbd772"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3e0cf669bddc59bd53998490ffb68b9"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a> (arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8)</td></tr>
<tr class="memdesc:ab3e0cf669bddc59bd53998490ffb68b9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test if two armadillo vectors are close to each other. <br /></td></tr>
<tr class="separator:ab3e0cf669bddc59bd53998490ffb68b9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6fdd7217b750aff5b6295ece7cbdeffa"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a> (std::string path, int mode=0777)</td></tr>
<tr class="memdesc:a6fdd7217b750aff5b6295ece7cbdeffa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Make path given. <br /></td></tr>
<tr class="separator:a6fdd7217b750aff5b6295ece7cbdeffa"><td class="memSeparator" colspan="2">&#160;</td></tr>
@ -168,9 +169,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</div><div class="memdoc">
<p>Get the name of the current method/function. </p>
<p>Get the name of the current method/function without the return type. </p>
<p class="definition">Definition at line <a class="el" href="utils_8hpp_source.html#l00051">51</a> of file <a class="el" href="utils_8hpp_source.html">utils.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8hpp_source.html#l00052">52</a> of file <a class="el" href="utils_8hpp_source.html">utils.hpp</a>.</p>
</div>
</div>
@ -201,13 +202,13 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"> <a class="code hl_function" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a>(expr, #expr, <a class="code hl_define" href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168">__METHOD_NAME__</a>, __FILE__, \</div>
<div class="line"> __LINE__, msg)</div>
<div class="ttc" id="autils_8hpp_html_a2cc3a2cdb635bac3c8b02e89d4d6af38"><div class="ttname"><a href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a></div><div class="ttdeci">void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)</div><div class="ttdoc">Test an expression, confirm that test is ok, or abort execution.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00043">utils.cpp:43</a></div></div>
<div class="ttc" id="autils_8hpp_html_a60dca3177fb9cb5256609adc7af55168"><div class="ttname"><a href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168">__METHOD_NAME__</a></div><div class="ttdeci">#define __METHOD_NAME__</div><div class="ttdoc">Get the name of the current method/function.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00051">utils.hpp:51</a></div></div>
<div class="ttc" id="autils_8hpp_html_a2cc3a2cdb635bac3c8b02e89d4d6af38"><div class="ttname"><a href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a></div><div class="ttdeci">void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)</div><div class="ttdoc">Test an expression, confirm that test is ok, or abort execution.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00041">utils.cpp:41</a></div></div>
<div class="ttc" id="autils_8hpp_html_a60dca3177fb9cb5256609adc7af55168"><div class="ttname"><a href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168">__METHOD_NAME__</a></div><div class="ttdeci">#define __METHOD_NAME__</div><div class="ttdoc">Get the name of the current method/function without the return type.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8hpp_source.html#l00052">utils.hpp:52</a></div></div>
</div><!-- fragment -->
<p>A prettier assertion function. </p>
<p>This macro calls the m_assert function which is a more informative assertion function than the regular assert function from cassert. </p>
<p class="definition">Definition at line <a class="el" href="utils_8hpp_source.html#l00045">45</a> of file <a class="el" href="utils_8hpp_source.html">utils.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8hpp_source.html#l00046">46</a> of file <a class="el" href="utils_8hpp_source.html">utils.hpp</a>.</p>
</div>
</div>
@ -230,19 +231,19 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
<p>Writes a debug message. </p>
<p>This macro writes a debug message that includes the filename, line number, and a custom message. The function is wrapped in an ifdef that checks if DBG is defined, so one can choose to display the debug messages by adding the -DDBG flag when compiling. </p>
<p class="definition">Definition at line <a class="el" href="utils_8hpp_source.html#l00036">36</a> of file <a class="el" href="utils_8hpp_source.html">utils.hpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8hpp_source.html#l00037">37</a> of file <a class="el" href="utils_8hpp_source.html">utils.hpp</a>.</p>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a0c95c4791692b06f8811905a76dbd772" name="a0c95c4791692b06f8811905a76dbd772"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0c95c4791692b06f8811905a76dbd772">&#9670;&#160;</a></span>arma_vector_close_to()</h2>
<a id="ab3e0cf669bddc59bd53998490ffb68b9" name="ab3e0cf669bddc59bd53998490ffb68b9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3e0cf669bddc59bd53998490ffb68b9">&#9670;&#160;</a></span>close_to()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool arma_vector_close_to </td>
<td class="memname">bool close_to </td>
<td>(</td>
<td class="paramtype">arma::vec &amp;&#160;</td>
<td class="paramname"><em>a</em>, </td>
@ -279,7 +280,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00062">62</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00060">60</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -347,7 +348,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dd>
</dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00043">43</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00041">41</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -386,9 +387,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>bool </dd></dl>
<dl class="section return"><dt>Returns</dt><dd>bool Success/Fail </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00076">76</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00074">74</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -436,7 +437,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00024">24</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00022">22</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>
@ -484,7 +485,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)</dd></dl>
</dl>
<dl class="section return"><dt>Returns</dt><dd>std::string </dd></dl>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00017">17</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
<p class="definition">Definition at line <a class="el" href="utils_8cpp_source.html#l00015">15</a> of file <a class="el" href="utils_8cpp_source.html">utils.cpp</a>.</p>
</div>
</div>

View File

@ -3,7 +3,7 @@ var utils_8hpp =
[ "__METHOD_NAME__", "utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168", null ],
[ "ASSERT", "utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9", null ],
[ "DEBUG", "utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b", null ],
[ "arma_vector_close_to", "utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772", null ],
[ "close_to", "utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9", null ],
[ "m_assert", "utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38", null ],
[ "mkpath", "utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa", null ],
[ "scientific_format", "utils_8hpp.html#ad54b96a1074f9df4dc892a41d115b72d", null ],

View File

@ -109,57 +109,58 @@ $(document).ready(function(){initNavTree('utils_8hpp_source.html',''); initResiz
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"> 19</span><span class="preprocessor">#include &lt;iomanip&gt;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span><span class="preprocessor">#include &lt;sstream&gt;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"> 32</span><span class="preprocessor">#ifdef DBG</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span><span class="preprocessor"> #define DEBUG(msg) std::cout &lt;&lt; __FILE__ &lt;&lt; &quot; &quot;</span> &lt;&lt; __LINE__ &lt;&lt; &quot;: &quot; \</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> &lt;&lt; msg &lt;&lt; std::endl</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b"> 36</a></span><span class="preprocessor"> #define DEBUG(msg)</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"> 37</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span> </div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9"> 45</a></span><span class="preprocessor">#define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \</span></div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"> 46</span><span class="preprocessor"> __LINE__, msg)</span></div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168"> 51</a></span><span class="preprocessor">#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)</span></div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include &lt;sys/stat.h&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"> 33</span><span class="preprocessor">#ifdef DBG</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span><span class="preprocessor"> #define DEBUG(msg) std::cout &lt;&lt; __FILE__ &lt;&lt; &quot; &quot;</span> &lt;&lt; __LINE__ &lt;&lt; &quot;: &quot; \</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"> 35</span> &lt;&lt; msg &lt;&lt; std::endl</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"> 36</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno"><a class="line" href="utils_8hpp.html#aecc1f7a8a2493b9e021e5bff76a00a5b"> 37</a></span><span class="preprocessor"> #define DEBUG(msg)</span></div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"> 38</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span> </div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a73d4f21ad937dbc50a0c0538c78fd4f9"> 46</a></span><span class="preprocessor">#define ASSERT(expr, msg) m_assert(expr, #expr, __METHOD_NAME__, __FILE__, \</span></div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span><span class="preprocessor"> __LINE__, msg)</span></div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span> </div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno"><a class="line" href="utils_8hpp.html#a60dca3177fb9cb5256609adc7af55168"> 52</a></span><span class="preprocessor">#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)</span></div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno"> 53</span> </div>
<div class="line"><a id="l00064" name="l00064"></a><span class="lineno"> 64</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">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="l00065" name="l00065"></a><span class="lineno"> 65</span> </div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"> 54</span> </div>
<div class="line"><a id="l00065" name="l00065"></a><span class="lineno"> 65</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">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="l00066" name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;double&gt;&amp; v, </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <span class="keywordtype">int</span> width=20, </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">int</span> prec=10);</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span>std::string <a class="code hl_function" href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">scientific_format</a>(<span class="keyword">const</span> std::vector&lt;double&gt;&amp; v, </div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <span class="keywordtype">int</span> width=20, </div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <span class="keywordtype">int</span> prec=10);</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span><span class="keywordtype">void</span> <a class="code hl_function" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a>(<span class="keywordtype">bool</span> expr, </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> std::string expr_str, </div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> std::string func, </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> std::string file, </div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="keywordtype">int</span> line,</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> std::string msg);</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span><span class="keywordtype">void</span> <a class="code hl_function" href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a>(<span class="keywordtype">bool</span> expr, </div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> std::string expr_str, </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> std::string func, </div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> std::string file, </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="keywordtype">int</span> line,</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> std::string msg);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a>(arma::vec &amp;a, arma::vec &amp;b, <span class="keywordtype">double</span> tol=1e-8);</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a>(arma::vec &amp;a, arma::vec &amp;b, <span class="keywordtype">double</span> tol=1e-8);</div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> </div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span><span class="keyword">static</span> <span class="keyword">inline</span> std::string methodName(<span class="keyword">const</span> std::string&amp; pretty_function)</div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span>{</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <span class="keywordtype">size_t</span> colons = pretty_function.find(<span class="stringliteral">&quot;::&quot;</span>);</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="keywordtype">size_t</span> begin = pretty_function.substr(0,colons).rfind(<span class="stringliteral">&quot; &quot;</span>) + 1;</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="keywordtype">size_t</span> end = pretty_function.rfind(<span class="stringliteral">&quot;(&quot;</span>) - begin;</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="keywordflow">return</span> pretty_function.substr(begin,end) + <span class="stringliteral">&quot;()&quot;</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> </div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span><span class="keyword">static</span> <span class="keyword">inline</span> std::string methodName(<span class="keyword">const</span> std::string&amp; pretty_function)</div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span>{</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <span class="keywordtype">size_t</span> colons = pretty_function.find(<span class="stringliteral">&quot;::&quot;</span>);</div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <span class="keywordtype">size_t</span> begin = pretty_function.substr(0,colons).rfind(<span class="stringliteral">&quot; &quot;</span>) + 1;</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordtype">size_t</span> end = pretty_function.rfind(<span class="stringliteral">&quot;(&quot;</span>) - begin;</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <span class="keywordflow">return</span> pretty_function.substr(begin,end) + <span class="stringliteral">&quot;()&quot;</span>;</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span>}</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> </div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(std::string path, <span class="keywordtype">int</span> mode = 0777);</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="autils_8hpp_html_a0c95c4791692b06f8811905a76dbd772"><div class="ttname"><a href="utils_8hpp.html#a0c95c4791692b06f8811905a76dbd772">arma_vector_close_to</a></div><div class="ttdeci">bool arma_vector_close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8)</div><div class="ttdoc">Test if two armadillo vectors are close to each other.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00062">utils.cpp:62</a></div></div>
<div class="ttc" id="autils_8hpp_html_a2cc3a2cdb635bac3c8b02e89d4d6af38"><div class="ttname"><a href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a></div><div class="ttdeci">void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)</div><div class="ttdoc">Test an expression, confirm that test is ok, or abort execution.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00043">utils.cpp:43</a></div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">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#l00076">utils.cpp:76</a></div></div>
<div class="ttc" id="autils_8hpp_html_adfb618b2fdff47ef30a4a2b62c04f384"><div class="ttname"><a href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">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#l00017">utils.cpp:17</a></div></div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span><span class="keywordtype">bool</span> <a class="code hl_function" href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">mkpath</a>(std::string path, <span class="keywordtype">int</span> mode = 0777);</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> </div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span><span class="preprocessor">#endif</span></div>
<div class="ttc" id="autils_8hpp_html_a2cc3a2cdb635bac3c8b02e89d4d6af38"><div class="ttname"><a href="utils_8hpp.html#a2cc3a2cdb635bac3c8b02e89d4d6af38">m_assert</a></div><div class="ttdeci">void m_assert(bool expr, std::string expr_str, std::string func, std::string file, int line, std::string msg)</div><div class="ttdoc">Test an expression, confirm that test is ok, or abort execution.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00041">utils.cpp:41</a></div></div>
<div class="ttc" id="autils_8hpp_html_a6fdd7217b750aff5b6295ece7cbdeffa"><div class="ttname"><a href="utils_8hpp.html#a6fdd7217b750aff5b6295ece7cbdeffa">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#l00074">utils.cpp:74</a></div></div>
<div class="ttc" id="autils_8hpp_html_ab3e0cf669bddc59bd53998490ffb68b9"><div class="ttname"><a href="utils_8hpp.html#ab3e0cf669bddc59bd53998490ffb68b9">close_to</a></div><div class="ttdeci">bool close_to(arma::vec &amp;a, arma::vec &amp;b, double tol=1e-8)</div><div class="ttdoc">Test if two armadillo vectors are close to each other.</div><div class="ttdef"><b>Definition:</b> <a href="utils_8cpp_source.html#l00060">utils.cpp:60</a></div></div>
<div class="ttc" id="autils_8hpp_html_adfb618b2fdff47ef30a4a2b62c04f384"><div class="ttname"><a href="utils_8hpp.html#adfb618b2fdff47ef30a4a2b62c04f384">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#l00015">utils.cpp:15</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->

View File

@ -18,15 +18,11 @@
#include "Particle.hpp"
#include "constants.hpp"
#include "typedefs.hpp"
#include "utils.hpp"
#pragma omp declare reduction(+ : vec_3d : omp_out += omp_in) \
initializer(omp_priv = omp_orig)
typedef struct simulation {
sim_arr r_vecs;
sim_arr v_vecs;
} simulation_t;
/** @brief A class that simulates a Penning trap.
*
* This class simulates a Penning trap. It can take in a number of particles
@ -62,7 +58,7 @@ private:
*
* @param i Index i for \f$k_{r,i,j}\f$
* @param j Index j for \f$k_{r,i,j}\f$
* @param dt the step length (delta time)
* @param dt The step length (delta time)
*
* @return vec_3d
* */
@ -78,8 +74,8 @@ public:
* */
PenningTrap(
double B_0 = T,
std::function<double(double)> V_0 =
[](double t) { return 25. * V / 1000.; },
std::function<double(double)> V_0
= [](double t) { return (25. * V) / 1000.; },
double d = 500., double t = 0.);
/** @brief Constructor for the PenningTrap class
@ -92,8 +88,8 @@ public:
* */
PenningTrap(
unsigned int i, double B_0 = T,
std::function<double(double)> V_0 =
[](double t) { return 25. * V / 1000.; },
std::function<double(double)> V_0
= [](double t) { return 25. * V / 1000.; },
double d = 500., double t = 0.);
/** @brief Constructor for the PenningTrap class
@ -106,10 +102,21 @@ public:
* */
PenningTrap(
std::vector<Particle> particles, double B_0 = T,
std::function<double(double)> V_0 =
[](double t) { return 25. * V / 1000.; },
std::function<double(double)> V_0
= [](double t) { return 25. * V / 1000.; },
double d = 500., double t = 0.);
/** @brief Give all particles new positions and velocities, and change t
* and V_0.
*
* @param V_0 The tiome dependent applied potential
* @param t The starting time
* */
void reinitialize(
std::function<double(double)> V_0
= [](double t) { return 25. * V / 1000.; },
double t = 0.);
/** @brief Add a particle to the system
*
* @param particle The particle to add to the Penning trap
@ -155,7 +162,8 @@ public:
* */
vec_3d total_force_external(unsigned int i);
/** @brief Calculate the total force on a particle p_i from other particles.
/** @brief Calculate the total force on a particle p_i from other
* particles.
*
* @param i The index of particle p_i
*
@ -192,6 +200,8 @@ public:
* @param steps The amount of steps for the whole simulation
* @param method The method to use when moving forward a timestep
* @param particle_interaction Turn particle interactions on/off
*
* @return simulation_t
* */
simulation_t simulate(double time, unsigned int steps,
std::string method = "rk4",
@ -206,7 +216,8 @@ public:
* @param particle_interaction Turn particle interactions on/off
* */
void write_simulation_to_dir(std::string path, double time,
unsigned int steps, std::string method = "rk4",
unsigned int steps,
std::string method = "rk4",
bool particle_interaction = true);
/** @brief Simulate and calculate what fraction of particles are still

View File

@ -12,10 +12,10 @@
#ifndef __CONST__
#define __CONST__
#define K_E 138935.333 ///< Coulomb constant. unit: \f$\frac{u(\mu m)^3}{(\mu s)^2 e^2}\f$
#define K_E 1.38935333*1e5 ///< Coulomb constant. unit: \f$\frac{u(\mu m)^3}{(\mu s)^2 e^2}\f$
#define T 96.4852558 ///< 1 Tesla. unit: \f$ \frac{u}{(\mu s) e} \f$
#define T 9.64852558*1e1 ///< 1 Tesla. unit: \f$ \frac{u}{(\mu s) e} \f$
#define V 96485255.8 ///< 1 Volt. unit: \f$ \frac{u (\mu m)^2}{(\mu s)^2 e} \f$
#define V 9.64852558*1e7 ///< 1 Volt. unit: \f$ \frac{u (\mu m)^2}{(\mu s)^2 e} \f$
#endif

View File

@ -15,8 +15,8 @@
#ifndef __TYPEDEFS__
#define __TYPEDEFS__
#include <vector>
#include <armadillo>
#include <vector>
/** @brief Typedef for the column of the result vector from simulating
* particles.
@ -35,4 +35,11 @@ typedef std::vector<sim_cols> sim_arr;
* */
typedef arma::vec::fixed<3> vec_3d;
/** @brief Typedef for PenningTrap::simulation return value.
* */
typedef struct simulation {
sim_arr r_vecs;
sim_arr v_vecs;
} simulation_t;
#endif

View File

@ -19,6 +19,7 @@
#include <iomanip>
#include <sstream>
#include <string>
#include <sys/stat.h>
#include <vector>
/** @def DEBUG(msg)
@ -46,7 +47,7 @@
__LINE__, msg)
/** @def __METHOD_NAME__
* @brief Get the name of the current method/function.
* @brief Get the name of the current method/function without the return type.
* */
#define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__)
@ -110,7 +111,7 @@ void m_assert(bool expr,
*
* @return bool
* */
bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol=1e-8);
bool close_to(arma::vec &a, arma::vec &b, double tol=1e-8);
/** @brief Takes in the __PRETTY_FUNCTION__ string and removes the return type.
@ -141,7 +142,7 @@ static inline std::string methodName(const std::string& pretty_function)
* @param path The path to be created
* @param mode The mode/permissions for all the new directories
*
* @return bool
* @return bool Success/Fail
* */
bool mkpath(std::string path, int mode = 0777);

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
matplotlib
numpy

View File

@ -21,7 +21,7 @@ endif
PROFILE ?= 0
ifeq ($(PROFILE), 1)
PROFFLAG=-pg
PROFFLAG=-pg -fno-inline-functions
else
PROFFLAG=
endif
@ -30,6 +30,16 @@ endif
all: test_suite main
instrument:
scorep $(CC) -c PenningTrap.cpp -o PenningTrap.o $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
scorep $(CC) -c Particle.cpp -o Particle.o $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
scorep $(CC) -c utils.cpp -o utils.o $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
scorep $(CC) -c main.cpp -o main.o $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
scorep $(CC) $(LIBOBJS) $(CLASSOBJS) main.o -o main $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)
# Rules for executables
main: main.o $(LIBOBJS) $(CLASSOBJS)
$(CC) $^ -o $@ $(CFLAGS) $(DBGFLAG) $(PROFFLAG) -I$(INCLUDE) $(OPENMP)

View File

@ -13,8 +13,8 @@
#include "Particle.hpp"
Particle::Particle(double q, double m,
arma::vec::fixed<3> r_vec,
arma::vec::fixed<3> v_vec)
vec_3d r_vec,
vec_3d v_vec)
{
// Giving the particle its properties
this->q = q;

View File

@ -11,9 +11,10 @@
* */
#include "PenningTrap.hpp"
#include "constants.hpp"
#include "typedefs.hpp"
#include "utils.hpp"
#include <algorithm>
#include <functional>
#include <vector>
PenningTrap::PenningTrap(double B_0, std::function<double(double)> V_0,
double d, double t)
@ -28,11 +29,9 @@ PenningTrap::PenningTrap(unsigned int i, double B_0,
std::function<double(double)> V_0, double d, double t)
: PenningTrap::PenningTrap(B_0, V_0, d)
{
vec_3d r, v;
for (size_t j = 0; j < i; j++) {
r = vec_3d().randn() * .1 * this->d;
v = vec_3d().randn() * .1 * this->d;
this->add_particle(Particle(1., 40., r, v));
this->particles.push_back(Particle(1., 40., vec_3d(vec_3d().randn() * .1 * this->d),
vec_3d(vec_3d().randn() * .1 * this->d)));
}
}
@ -43,6 +42,16 @@ PenningTrap::PenningTrap(std::vector<Particle> particles, double B_0,
this->particles = particles;
}
void PenningTrap::reinitialize(std::function<double(double)> V_0, double t)
{
this->V_0 = V_0;
this->t = t;
for (size_t i = 0; i < this->particles.size(); i++) {
this->particles[i].r_vec = vec_3d().randn() * .1 * this->d;
}
}
vec_3d PenningTrap::v_func(unsigned int i, unsigned int j, double dt)
{
switch (i) {
@ -53,8 +62,9 @@ vec_3d PenningTrap::v_func(unsigned int i, unsigned int j, double dt)
case 2:
return dt * this->k_v[2][j];
case 3:
return (dt / 6.) * (this->k_v[0][j] + 2. * this->k_v[1][j] +
2. * this->k_v[2][j] + this->k_v[3][j]);
return vec_3d((dt / 6.)
* (this->k_v[0][j] + 2. * this->k_v[1][j]
+ 2. * this->k_v[2][j] + this->k_v[3][j]));
default:
std::cout << "Not valid!" << std::endl;
abort();
@ -71,8 +81,9 @@ vec_3d PenningTrap::r_func(unsigned int i, unsigned int j, double dt)
case 2:
return dt * this->k_r[2][j];
case 3:
return (dt / 6.) * (this->k_r[0][j] + 2. * this->k_r[1][j] +
2. * this->k_r[2][j] + this->k_r[3][j]);
return vec_3d((dt / 6.)
* (this->k_r[0][j] + 2. * this->k_r[1][j]
+ 2. * this->k_r[2][j] + this->k_r[3][j]));
default:
std::cout << "Not valid!" << std::endl;
abort();
@ -87,9 +98,8 @@ void PenningTrap::add_particle(Particle particle)
vec_3d PenningTrap::external_E_field(vec_3d r)
{
r(2) *= -2.;
double f = this->V_0(this->t) / (this->d * this->d);
return f * r;
return vec_3d((this->V_0(this->t) / (this->d * this->d)) * r);
}
vec_3d PenningTrap::external_B_field(vec_3d r)
@ -99,51 +109,48 @@ vec_3d PenningTrap::external_B_field(vec_3d r)
vec_3d PenningTrap::force_on_particle(unsigned int i, unsigned int j)
{
Particle p_j = this->particles[j];
// Calculate the difference between the particles' position
vec_3d res = this->particles[i].r_vec - p_j.r_vec;
vec_3d res = this->particles[i].r_vec - this->particles[j].r_vec;
// Get the distance between the particles
double norm = arma::norm(res, 2);
return vec_3d(res * p_j.q / (norm * norm * norm));
return vec_3d((this->particles[j].q / (norm * norm * norm)) * res);
}
vec_3d PenningTrap::total_force_external(unsigned int i)
{
Particle p = this->particles[i];
Particle *p = &this->particles[i];
if (arma::norm(p.r_vec) > this->d) {
if (arma::norm(p->r_vec) > this->d) {
return vec_3d{0., 0., 0.};
}
vec_3d force =
p.q * (this->external_E_field(p.r_vec) +
arma::cross(p.v_vec, this->external_B_field(p.r_vec)));
return force;
return vec_3d(
p->q
* (this->external_E_field(p->r_vec)
+ arma::cross(p->v_vec, this->external_B_field(p->r_vec))));
}
vec_3d PenningTrap::total_force_particles(unsigned int i)
{
Particle p = this->particles[i];
vec_3d res;
for (size_t j = 0; j < this->particles.size(); j++) {
if (i == j) {
continue;
}
if (i != j)
res += this->force_on_particle(i, j);
}
return vec_3d(res * K_E * (p.q / p.m));
return vec_3d(res * K_E * (this->particles[i].q));
}
vec_3d PenningTrap::total_force(unsigned int i)
{
return this->total_force_external(i) - this->total_force_particles(i);
if (arma::norm(this->particles[i].r_vec) > this->d) {
return vec_3d{0., 0., 0.};
}
return vec_3d(this->total_force_external(i)
- this->total_force_particles(i));
}
void PenningTrap::evolve_RK4(double dt, bool particle_interaction)
@ -152,32 +159,35 @@ void PenningTrap::evolve_RK4(double dt, bool particle_interaction)
std::vector<Particle> original_particles = this->particles;
std::vector<Particle> tmp_particles = this->particles;
vec_3d (PenningTrap::*force)(unsigned int);
if (particle_interaction) {
force = &PenningTrap::total_force;
}
else {
force = &PenningTrap::total_force_external;
}
vec_3d (PenningTrap::*force)(unsigned int)
= particle_interaction ? &PenningTrap::total_force
: &PenningTrap::total_force_external;
size_t size = this->particles.size();
// Allocating takes a long time, so reuse sim_arr if possible
if (this->k_v.size() != 4 || this->k_r.size() != 4
|| this->k_v[0].size() != size || this->k_r[0].size() != size) {
this->k_v = sim_arr(4, sim_cols(size));
this->k_r = sim_arr(4, sim_cols(size));
}
// Each k_{i+1} is dependent on k_i, so outer loop is not parallelizable
for (size_t i = 0; i < 4; i++) {
// Inner loop is able to be parallelized
#pragma omp parallel for
for (size_t j = 0; j < this->particles.size(); j++) {
for (size_t j = 0; j < size; j++) {
this->k_v[i][j] = (this->*force)(j) / this->particles[j].m;
this->k_r[i][j] = this->particles[j].v_vec;
Particle *p = &tmp_particles[j];
tmp_particles[j].v_vec
= original_particles[j].v_vec + this->v_func(i, j, dt);
tmp_particles[j].r_vec
= original_particles[j].r_vec + this->r_func(i, j, dt);
}
this->particles = tmp_particles;
}
p->v_vec = original_particles[j].v_vec + this->v_func(i, j, dt);
p->r_vec = original_particles[j].r_vec + this->r_func(i, j, dt);
}
this->particles.swap(tmp_particles);
}
this->t += dt;
}
@ -187,19 +197,19 @@ void PenningTrap::evolve_forward_euler(double dt, bool particle_interaction)
vec_3d force_res[size];
Particle *p;
vec_3d (PenningTrap::*force)(unsigned int);
if (particle_interaction) {
force = &PenningTrap::total_force;
}
else {
force = &PenningTrap::total_force_external;
}
vec_3d (PenningTrap::*force)(unsigned int)
= particle_interaction ? &PenningTrap::total_force
: &PenningTrap::total_force_external;
// Calculating the force for each particle is independent and therefore
// a good candidate for parallel execution
#pragma omp parallel for
for (size_t i = 0; i < size; i++) {
force_res[i] = (this->*force)(i);
}
// Updating the particles is also independent, so we can parallelize
// this as well
#pragma omp parallel for private(p)
for (size_t i = 0; i < size; i++) {
p = &this->particles[i];
@ -217,7 +227,7 @@ simulation_t PenningTrap::simulate(double time, unsigned int steps,
double dt = time / (double)steps;
unsigned int size = this->particles.size();
// sim_arr res(this->particles.size(), sim_cols(steps));
simulation_t res{sim_arr(size, sim_cols(steps)),
sim_arr(size, sim_cols(steps))};
@ -253,27 +263,31 @@ void PenningTrap::write_simulation_to_dir(std::string path, double time,
path += '/';
}
if (mkpath(path, 0777) != 0) {
std::cout << "Hello" << std::endl;
return;
std::cout << "Failed to make path" << std::endl;
abort();
}
simulation_t res =
this->simulate(time, steps, method, particle_interaction);
simulation_t res
= this->simulate(time, steps, method, particle_interaction);
std::ofstream ofile;
// Writing each particle to its own file is independent and can be run in
// parallel.
#pragma omp parallel for private(ofile)
for (size_t i = 0; i < this->particles.size(); i++) {
ofile.open(path + "particle_" + std::to_string(i) + "_r.txt");
for (vec_3d &vec : res.r_vecs[i]) {
ofile << vec(0) << "," << vec(1) << "," << vec(2) << "\n";
ofile << scientific_format(vec(0), 10, 8) << ','
<< scientific_format(vec(1), 10, 8) << ','
<< scientific_format(vec(2), 10, 8) << '\n';
}
ofile.close();
ofile.open(path + "particle_" + std::to_string(i) + "_v.txt");
for (vec_3d &vec : res.v_vecs[i]) {
ofile << scientific_format(vec(0), 10, 8) << ","
<< scientific_format(vec(1), 8, 10) << ","
<< scientific_format(vec(2), 8, 10) << "\n";
ofile << scientific_format(vec(0), 10, 8) << ','
<< scientific_format(vec(1), 10, 8) << ','
<< scientific_format(vec(2), 10, 8) << '\n';
}
ofile.close();
}
@ -283,26 +297,33 @@ double PenningTrap::fraction_of_particles_left(double time, unsigned int steps,
std::string method,
bool particle_interaction)
{
simulation_t res =
this->simulate(time, steps, method, particle_interaction);
double dt = time / (double)steps;
void (PenningTrap::*func)(double, bool);
if (method == "rk4") {
func = &PenningTrap::evolve_RK4;
}
else if (method == "euler") {
func = &PenningTrap::evolve_forward_euler;
}
else {
std::cout << "Not a valid method!" << std::endl;
abort();
}
for (size_t j = 0; j < steps; j++) {
(this->*func)(dt, particle_interaction);
}
int particles_left = 0;
for (Particle p : this->particles) {
if (arma::norm(p.r_vec) < this->d) {
// A reduction is perfect here
#pragma omp parallel for reduction(+:particles_left)
for (size_t i=0; i < this->particles.size(); i++) {
if (arma::norm(this->particles[i].r_vec) < this->d) {
particles_left++;
}
}
return (double)particles_left / (double)this->particles.size();
}
vec_3d PenningTrap::get_r(int i)
{
return this->particles[i].r_vec;
}
double PenningTrap::get_t()
{
return this->t;
}

View File

@ -13,10 +13,8 @@
#include <cmath>
#include <complex>
#include <fstream>
#include <functional>
#include <omp.h>
#include <string>
#include <sys/stat.h>
#include <vector>
#include "PenningTrap.hpp"
@ -24,12 +22,21 @@
#define PARTICLES 100
#define N 40000
#define CHARGE 1.
#define MASS 40. // unit: amu
#define CHARGE 1. // unit: e
#define MASS 40.078 // unit: amu
Particle p1(CHARGE, MASS, vec_3d{20., 0., 20.}, vec_3d{0., 25., 0.});
Particle p2(CHARGE, MASS, vec_3d{25., 25., 0.}, vec_3d{0., 40., 5.});
// Particles used for testing
Particle p1(CHARGE, MASS, vec_3d{20., 0., 20.},
vec_3d{0., 25., 0.}); ///< Particle 1
Particle p2(CHARGE, MASS, vec_3d{25., 25., 0.},
vec_3d{0., 40., 5.}); ///< Particle 2
/** @brief The analytical solution for particle p1
*
* @param t Time
*
* @return vec_3d
* */
vec_3d analytical_solution_particle_1(double t)
{
double w_0 = T / MASS;
@ -38,98 +45,122 @@ vec_3d analytical_solution_particle_1(double t)
double w_n = (w_0 - std::sqrt(w_0 * w_0 - 2. * w_z2)) / 2.;
double A_p = (25. + w_n * 20.) / (w_n - w_p);
double A_n = -(25. + w_p * 20.) / (w_n - w_p);
std::complex<double> f = A_p * std::exp(std::complex<double>(0., -w_p * t)) +
A_n * std::exp(std::complex<double>(0., -w_n * t));
vec_3d res{std::real(f), std::imag(f), 20. * std::cos(std::sqrt(w_z2) * t)};
std::complex<double> f
= A_p * std::exp(std::complex<double>(0., -w_p * t))
+ A_n * std::exp(std::complex<double>(0., -w_n * t));
vec_3d res{std::real(f), std::imag(f),
20. * std::cos(std::sqrt(w_z2) * t)};
return res;
}
/** @brief Simulate a single particle over the period of 50 \f$ \mu s \f$.
* */
void simulate_single_particle()
{
DEBUG("Inside single particle sim");
// Initialize trap with particle 1
PenningTrap trap(std::vector<Particle>{p1});
double time = 50.; // microseconds
DEBUG("Write to dir");
// Simulate and write results to file
trap.write_simulation_to_dir("output/simulate_single_particle", time, N,
"rk4", false);
}
/** @brief Simulate 2 particles over the period of 50 \f$ \mu s \f$ with and
* without particle interactions.
* */
void simulate_two_particles()
{
// Initialize traps with particles
PenningTrap trap_no_interaction(std::vector<Particle>{p1, p2});
PenningTrap trap_with_interaction(std::vector<Particle>{p1, p2});
double time = 50.; // microseconds
// Simulate and write results to files
trap_no_interaction.write_simulation_to_dir(
"output/simulate_2_particles/no_interaction", time, N, "rk4", false);
trap_with_interaction.write_simulation_to_dir(
"output/simulate_2_particles/with_interaction", time, N);
}
/** @brief Simulate a single particle over 50 \f$ \mu s \f$ using different
* amount of steps and different methods.
* */
void simulate_single_particle_with_different_steps()
{
double time = 50.; // microseconds
std::ofstream ofile;
for (int i = 0; i < 4; i++) {
int steps = 4000 * std::pow(2, i);
double dt = time / (double)steps;
// Calculate relative error for RK4
std::string path = "output/relative_error/RK4/";
mkpath(path);
ofile.open(path + std::to_string(steps) + "_steps.txt");
PenningTrap trap(std::vector<Particle>{p1});
for (int i = 0; i < steps; i++) {
trap.evolve_RK4(dt);
ofile << arma::norm(trap.get_r(0) -
analytical_solution_particle_1(trap.get_t()))
<< "\n";
}
ofile.close();
}
#pragma omp parallel for
for (int i = 0; i < 4; i++) {
int steps = 4000 * std::pow(2, i);
double dt = time / (double)steps;
std::string path = "output/relative_error/euler/";
mkpath(path);
ofile.open(path + std::to_string(steps) + "_steps.txt");
PenningTrap trap(std::vector<Particle>{p1});
simulation_t res = trap.simulate(time, steps, "rk4", false);
for (int i = 0; i < steps; i++) {
trap.evolve_forward_euler(dt);
ofile << arma::norm(trap.get_r(0) -
analytical_solution_particle_1(trap.get_t()))
<< "\n";
ofile << arma::norm(res.r_vecs[0][i]
- analytical_solution_particle_1(dt * i))
<< '\n';
}
ofile.close();
}
// Calculate relative error for forward Euler
path = "output/relative_error/euler/";
mkpath(path);
#pragma omp parallel for
for (int i = 0; i < 4; i++) {
int steps = 4000 * std::pow(2, i);
double dt = time / (double)steps;
ofile.open(path + std::to_string(steps) + "_steps.txt");
PenningTrap trap(std::vector<Particle>{p1});
simulation_t res = trap.simulate(time, steps, "euler", false);
for (int i = 0; i < steps; i++) {
ofile << arma::norm(res.r_vecs[0][i]
- analytical_solution_particle_1(dt * i))
<< '\n';
}
ofile.close();
}
}
/** @brief Simulate 100 particles over 50 \f$ \mu s \f$.
* */
void simulate_100_particles()
{
PenningTrap trap((unsigned)100, T,
[](double t) {
return 25. * V / 1000. * (1. + .4 * std::cos(1.5 * t));
},
500., 0);
PenningTrap trap((unsigned)100);
double time = 500.; // microseconds
double time = 50.; // microseconds
trap.write_simulation_to_dir("output/simulate_100_particles", time, N * 4);
trap.write_simulation_to_dir("output/simulate_100_particles", time, N,
"rk4", false);
}
void simulate_100_particles_with_time_potential()
/** @brief Simulate 100 particles over 500 \f$ \mu s \f$ using a time
* dependent potential.
*
* @details The simulation sweeps over different frequencies in [0.2, 2.5]
* MHz.
*
* */
void potential_resonance_wide_sweep()
{
double time = 500.;
double amplitudes[]{.1, .4, .7};
double freq_start = .2;
double freq_end = 2.5;
double freq_increment = .02;
size_t freq_iterations = (size_t)((freq_end - freq_start) / freq_increment);
size_t freq_iterations
= (size_t)((freq_end - freq_start) / freq_increment) + 1;
double res[4][freq_iterations];
@ -138,39 +169,159 @@ void simulate_100_particles_with_time_potential()
std::ofstream ofile;
double freq = freq_start;
#pragma omp parallel for
// Insert frequencies
for (size_t i = 0; i < freq_iterations; i++) {
res[0][i] = freq;
freq += freq_increment;
res[0][i] = freq_start + freq_increment * i;
}
#pragma omp parallel for collapse(2) num_threads(4)
#pragma omp parallel
{
// Each thread creates a PenningTrap instance and reuses it throughout
// the sweep.
PenningTrap trap((unsigned int)100);
#pragma omp for collapse(2)
for (size_t i = 0; i < 3; i++) {
for (size_t j = 0; j < freq_iterations; j++) {
PenningTrap trap(
(unsigned)100, T,
std::bind(
// Reset particles and give new time dependent potential.
trap.reinitialize(std::bind(
[](double f, double r, double t) {
return (25. * V / 1000.) * (1. + f * std::cos(r * t));
},
amplitudes[i], res[0][j], std::placeholders::_1),
500., 0.);
res[i + 1][j] =
trap.fraction_of_particles_left(500., 40000, "rk4", false);
amplitudes[i], res[0][j], std::placeholders::_1));
res[i + 1][j]
= trap.fraction_of_particles_left(time, N, "rk4", false);
}
}
}
ofile.open(path + "res.txt");
// Write results to file
ofile.open(path + "wide_sweep.txt");
for (size_t i = 0; i < freq_iterations; i++) {
ofile << res[0][i] << "," << res[1][i] << "," << res[2][i] << ","
<< res[3][i] << "\n";
ofile << res[0][i] << ',' << res[1][i] << ',' << res[2][i] << ','
<< res[3][i] << '\n';
}
ofile.close();
}
/** @brief Simulate 100 particles over 500 \f$ \mu s \f$ using a time
* dependent potential.
*
* @details The simulation sweeps over different frequencies in [1., 1.7]
* MHz.
*
* */
void potential_resonance_no_interaction_narrow_sweep()
{
double time = 500.;
double amplitudes[]{.1, .4, .7};
double freq_start = 1.;
double freq_end = 1.7;
double freq_increment = .002;
size_t freq_iterations
= (size_t)((freq_end - freq_start) / freq_increment);
double res[4][freq_iterations];
std::string path = "output/time_dependent_potential/";
mkpath(path);
std::ofstream ofile;
#pragma omp parallel
{
// Each thread creates a PenningTrap instance and reuses it throughout
// the sweep.
PenningTrap trap((unsigned int)100);
#pragma omp for collapse(2)
for (size_t i = 0; i < 3; i++) {
for (size_t j = 0; j < freq_iterations; j++) {
// Reset particles and give new time dependent potential.
trap.reinitialize(std::bind(
[](double f, double r, double t) {
return (25. * V / 1000.) * (1. + f * std::cos(r * t));
},
amplitudes[i], res[0][j], std::placeholders::_1));
res[i + 1][j]
= trap.fraction_of_particles_left(time, N, "rk4", false);
}
}
}
// Write results to file
ofile.open(path + "narrow_sweep.txt");
for (size_t i = 0; i < freq_iterations; i++) {
ofile << res[0][i] << ',' << res[1][i] << ',' << res[2][i] << ','
<< res[3][i] << '\n';
}
ofile.close();
}
/** @brief Simulate 100 particles over 500 \f$ \mu s \f$ using a time
* dependent potential.
*
* @details The simulation sweeps over different frequencies in [1., 1.7]
* MHz.
*
* */
void potential_resonance_with_interaction_narrow_sweep()
{
double time = 500.;
double amplitudes[]{.1, .4, .7};
double freq_start = 1.;
double freq_end = 1.7;
double freq_increment = .002;
size_t freq_iterations
= (size_t)((freq_end - freq_start) / freq_increment);
double res[4][freq_iterations];
std::string path = "output/time_dependent_potential/";
mkpath(path);
std::ofstream ofile;
#pragma omp parallel for
for (size_t i = 0; i < freq_iterations; i++) {
res[0][i] = freq_start + freq_increment * i;
}
#pragma omp parallel
{
// Each thread creates a PenningTrap instance and reuses it throughout
// the sweep.
PenningTrap trap((unsigned int)100);
#pragma omp for collapse(2)
for (size_t i = 0; i < 3; i++) {
for (size_t j = 0; j < freq_iterations; j++) {
// Reset particles and give new time dependent potential.
trap.reinitialize(std::bind(
[](double f, double r, double t) {
return (25. * V / 1000.) * (1. + f * std::cos(r * t));
},
amplitudes[i], res[0][j], std::placeholders::_1));
res[i + 1][j] = trap.fraction_of_particles_left(time, N);
}
}
}
// Write results to file
ofile.open(path + "narrow_sweep_interactions.txt");
for (size_t i = 0; i < freq_iterations; i++) {
ofile << res[0][i] << ',' << res[1][i] << ',' << res[2][i] << ','
<< res[3][i] << '\n';
}
ofile.close();
}
int main()
{
double start = omp_get_wtime();
double start, end, t1, t2;
start = omp_get_wtime();
simulate_single_particle();
@ -178,13 +329,51 @@ int main()
simulate_single_particle_with_different_steps();
// simulate_100_particles();
t2 = omp_get_wtime();
// simulate_100_particles_with_time_potential();
std::cout << "Time single and double : " << (t2 - start)
<< " seconds" << std::endl;
double end = omp_get_wtime();
t1 = omp_get_wtime();
std::cout << "Time: " << (end - start) << " seconds" << std::endl;
simulate_100_particles();
t2 = omp_get_wtime();
std::cout << "Time 100 particles : " << (t2 - t1)
<< " seconds" << std::endl;
t1 = omp_get_wtime();
potential_resonance_wide_sweep();
t2 = omp_get_wtime();
std::cout << "Time wide sweep : " << (t2 - t1)
<< " seconds" << std::endl;
t1 = omp_get_wtime();
potential_resonance_no_interaction_narrow_sweep();
t2 = omp_get_wtime();
std::cout << "Time narrow sweep no interaction : " << (t2 - t1)
<< " seconds" << std::endl;
t1 = omp_get_wtime();
potential_resonance_with_interaction_narrow_sweep();
t2 = omp_get_wtime();
std::cout << "Time narrow sweep with interaction: " << (t2 - t1)
<< " seconds" << std::endl;
end = omp_get_wtime();
std::cout << "Time : " << (end - start)
<< " seconds" << std::endl;
return 0;
}

View File

@ -2,10 +2,10 @@ import matplotlib.pyplot as plt
import numpy as np
def main():
directories = {
directories = [
"output/relative_error/RK4/",
"output/relative_error/euler/",
}
]
files = [
"4000_steps.txt",
"8000_steps.txt",
@ -22,8 +22,12 @@ def main():
"Relative error for the RK4 method",
"Relative error for the forward Euler method"
]
methods = [
"rk4",
"euler"
]
fig1, axs1 = plt.subplots(2,1)
for i, (dir, title) in enumerate(zip(directories, titles)):
for i, (dir, title) in enumerate(list(zip(directories, titles))):
max_err = []
for label, file in zip(labels, files):
with open(dir+file) as f:
@ -34,16 +38,13 @@ def main():
axs1[i].plot(t, r, label=label)
axs1[i].set(xlabel=r"t $(\mu s)$", ylabel = r"relative_error $(\mu m)$")
axs1[i].legend()
axs1[i].set_title(title)
conv_rate = 1/3 * sum([np.log10(max_err[i+1]/max_err[i])/np.log10(.5) for i in range(3)])
print(conv_rate)
conv_rate = 1/3 * sum([np.log2(max_err[i+1]/max_err[i])/np.log2(.5) for i in range(3)])
print(f"{methods[i]}: {conv_rate}")
plt.show()
# fig1.savefig("../latex/images/phase_space_2_particles_x.pdf")
fig1.savefig("../latex/images/phase_space_2_particles_x.pdf")
if __name__ == "__main__":

View File

@ -10,39 +10,43 @@
* @bug No known bugs
* */
#include "PenningTrap.hpp"
#include "utils.hpp"
#include <iomanip>
#include <sstream>
#include <string>
#include "PenningTrap.hpp"
#include "utils.hpp"
/** @brief Test class for the Penning trap.
* */
class PenningTrapTest {
public:
/** @brief Test that the external E field gives correct values.
* */
static void test_external_E_field()
{
PenningTrap trap;
// Vector containing inputs and expected results
std::vector<std::pair<arma::vec, arma::vec>> tests;
std::vector<std::pair<vec_3d, vec_3d>> tests;
tests.push_back(
std::make_pair(arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));
std::make_pair(vec_3d{0., 0., 0.}, vec_3d{0., 0., 0.}));
tests.push_back(std::make_pair(arma::vec{10., 0., 0.},
arma::vec{96.4852558, 0., 0.}));
tests.push_back(std::make_pair(vec_3d{10., 0., 0.},
vec_3d{96.4852558, 0., 0.}));
tests.push_back(std::make_pair(arma::vec{10., 0., 0.},
arma::vec{96.4852558, 0., 0.}));
tests.push_back(std::make_pair(vec_3d{10., 0., 0.},
vec_3d{96.4852558, 0., 0.}));
tests.push_back(std::make_pair(arma::vec{0., 10., 0.},
arma::vec{0., 96.4852558, 0.}));
tests.push_back(std::make_pair(vec_3d{0., 10., 0.},
vec_3d{0., 96.4852558, 0.}));
tests.push_back(std::make_pair(arma::vec{0., 0., 10.},
arma::vec{0., 0., -192.9705116}));
tests.push_back(std::make_pair(vec_3d{0., 0., 10.},
vec_3d{0., 0., -192.9705116}));
arma::vec result;
arma::vec v;
vec_3d result;
vec_3d v;
std::stringstream msg;
for (size_t i = 0; i < tests.size(); i++) {
v = tests.at(i).first;
@ -52,81 +56,90 @@ public:
msg << "Testing the external E field at (" << std::setprecision(2)
<< v(0) << "," << v(1) << "," << v(2) << ").";
ASSERT(arma_vector_close_to(result, tests.at(i).second), msg.str());
ASSERT(close_to(result, tests.at(i).second), msg.str());
}
}
/** @brief Test that the external B field gives correct values.
* */
static void test_external_B_field()
{
// No point in testing at different points since it's not dependent
// on position.
PenningTrap trap;
arma::vec expected{0., 0., T};
arma::vec result = trap.external_B_field(arma::vec{0., 0., 0.});
ASSERT(arma_vector_close_to(expected, result),
vec_3d expected{0., 0., T};
vec_3d result = trap.external_B_field(vec_3d{0., 0., 0.});
ASSERT(close_to(expected, result),
"Testing the external B field at (0,0,0)");
}
/** @brief Test that the force between particles gives expected results.
* */
static void test_force_on_particle()
{
PenningTrap trap;
arma::vec v{0., 0., 0.};
vec_3d v{0., 0., 0.};
// Add particles to test
trap.add_particle(Particle(1., 40., arma::vec{0., 0., 0.}, v));
trap.add_particle(Particle(1., 40., arma::vec{1., 0., 0.}, v));
trap.add_particle(Particle(1., 40., arma::vec{0., 3., 4.}, v));
trap.add_particle(Particle(1., 40., vec_3d{0., 0., 0.}, v));
trap.add_particle(Particle(1., 40., vec_3d{1., 0., 0.}, v));
trap.add_particle(Particle(1., 40., vec_3d{0., 3., 4.}, v));
// Test p0 and p1
arma::vec expected{-1., 0., 0.};
arma::vec result = trap.force_on_particle(0, 1);
ASSERT(arma_vector_close_to(expected, result),
vec_3d expected{-1., 0., 0.};
vec_3d result = trap.force_on_particle(0, 1);
ASSERT(close_to(expected, result),
"Testing the force on a particle at (0,0,0) from a "
"particle at (1,0,0).");
// Test p0 and p2
expected = arma::vec{0, -.024, -.032};
expected = vec_3d{0, -.024, -.032};
result = trap.force_on_particle(0, 2);
ASSERT(arma_vector_close_to(expected, result),
ASSERT(close_to(expected, result),
"Testing the force on a particle at (0,0,0) from a "
"particle at (0,3,4).");
}
/** @brief Test that the total external force returns expected results
* */
static void test_total_force_external()
{
PenningTrap trap;
trap.add_particle(
Particle(1., 40., arma::vec{1., 2., 3.}, arma::vec{3., 4., 5.}));
Particle(1., 40., vec_3d{1., 2., 3.}, vec_3d{3., 4., 5.}));
arma::vec expected{395.58954878, -270.15871624, -57.89115348};
arma::vec result = trap.total_force_external(0);
ASSERT(arma_vector_close_to(expected, result),
vec_3d expected{395.58954878, -270.15871624, -57.89115348};
vec_3d result = trap.total_force_external(0);
ASSERT(close_to(expected, result),
"Testing the total external force on a particle at "
"(1,2,3) with velocity (3,4,5)");
}
/** @brief Test that the total force of all particles on a single particle
* returns expected results.
* */
static void test_total_force_particles()
{
PenningTrap trap;
trap.add_particle(
Particle(1., 40., arma::vec{0., 0., 0.}, arma::vec{0., 0., 0.}));
Particle(1., 40., vec_3d{0., 0., 0.}, vec_3d{0., 0., 0.}));
arma::vec expected{0., 0., 0.};
arma::vec result = trap.total_force_particles(0);
ASSERT(arma_vector_close_to(expected, result),
vec_3d expected{0., 0., 0.};
vec_3d result = trap.total_force_particles(0);
ASSERT(close_to(expected, result),
"Testing the total force of all particles on particle 0 "
"with only a single particle");
trap.add_particle(
Particle(1., 40., arma::vec{1., 0., 0.}, arma::vec{0., 0., 0.}));
Particle(1., 40., vec_3d{1., 0., 0.}, vec_3d{0., 0., 0.}));
trap.add_particle(
Particle(1., 40., arma::vec{0., 1., 0.}, arma::vec{0., 0., 0.}));
Particle(1., 40., vec_3d{0., 1., 0.}, vec_3d{0., 0., 0.}));
trap.add_particle(
Particle(1., 40., arma::vec{0., 0., 1.}, arma::vec{0., 0., 0.}));
Particle(1., 40., vec_3d{0., 0., 1.}, vec_3d{0., 0., 0.}));
expected = arma::vec(3, arma::fill::value(-3473.383325));
expected = vec_3d().fill(-3473.383325);
result = trap.total_force_particles(0);
ASSERT(arma_vector_close_to(expected, result),
ASSERT(close_to(expected, result),
"Testing the total force of all particles on particle 0 "
"with 3 other particles.");
}

View File

@ -10,8 +10,6 @@
* @bug No known bugs
* */
#include <sys/stat.h>
#include "utils.hpp"
std::string scientific_format(double d, int width, int prec)
@ -59,7 +57,7 @@ void m_assert(bool expr, std::string expr_str, std::string f, std::string file,
}
}
bool arma_vector_close_to(arma::vec &a, arma::vec &b, double tol)
bool close_to(arma::vec &a, arma::vec &b, double tol)
{
if (a.n_elem != b.n_elem) {
return false;