Page MenuHomec4science

v__base_8hh_source.html
No OneTemporary

File Metadata

Created
Sun, Nov 24, 09:33

v__base_8hh_source.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Voro++: v_base.hh 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="doxygen.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 style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Voro++
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v_base.hh</div> </div>
</div><!--header-->
<div class="contents">
<a href="v__base_8hh.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Voro++, a 3D cell-based Voronoi library</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">//</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// Author : Chris H. Rycroft (LBL / UC Berkeley)</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">// Email : chr@alum.mit.edu</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">// Date : August 30th 2011</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">/** \file v_base.hh</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * \brief Header file for the base Voronoi container class. */</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;</div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="preprocessor">#ifndef VOROPP_V_BASE_HH</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define VOROPP_V_BASE_HH</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="worklist_8hh.html" title="Header file for setting constants used in the block worklists that are used during cell computation...">worklist.hh</a>&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="keyword">namespace </span>voro {</div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment">/** \brief Class containing data structures common across all particle container classes.</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="comment"> * This class contains constants and data structures that are common across all</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="comment"> * particle container classes. It contains constants setting the size of the</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment"> * underlying subgrid of blocks that forms the basis of the Voronoi cell</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment"> * computations. It also constructs bound tables that are used in the Voronoi</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="comment"> * cell computation, and contains a number of routines that are common across</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="comment"> * all container classes. */</span></div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html"> 25</a></span>&#160;<span class="keyword">class </span><a class="code" href="classvoro_1_1voro__base.html" title="Class containing data structures common across all particle container classes.">voro_base</a> {</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; <span class="keyword">public</span>:<span class="comment"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="comment"> /** The number of blocks in the x direction. */</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a8aed82f1468c9bb7e2a779ea53a22594"> 28</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a8aed82f1468c9bb7e2a779ea53a22594">nx</a>;<span class="comment"></span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="comment"> /** The number of blocks in the y direction. */</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a83da5297e87173733d92d9024cebbbdb"> 30</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a83da5297e87173733d92d9024cebbbdb">ny</a>;<span class="comment"></span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="comment"> /** The number of blocks in the z direction. */</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#aae461fbdf42c8975fb43d963d002298f"> 32</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#aae461fbdf42c8975fb43d963d002298f">nz</a>;<span class="comment"></span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="comment"> /** A constant, set to the value of nx multiplied by ny, which</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="comment"> * is used in the routines that step through blocks in</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="comment"> * sequence. */</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#aad5f41101fce781214d2f0b69487a729"> 36</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#aad5f41101fce781214d2f0b69487a729">nxy</a>;<span class="comment"></span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="comment"> /** A constant, set to the value of nx*ny*nz, which is used in</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="comment"> * the routines that step through blocks in sequence. */</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a4309aca04ab561bd3b3921e9b73016a4"> 39</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a4309aca04ab561bd3b3921e9b73016a4">nxyz</a>;<span class="comment"></span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="comment"> /** The size of a computational block in the x direction. */</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#ac8986e621bd70cf5113e231cb8694d37"> 41</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#ac8986e621bd70cf5113e231cb8694d37">boxx</a>;<span class="comment"></span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="comment"> /** The size of a computational block in the y direction. */</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a3ad6b0eefbdff03e92d30f5035defdd1"> 43</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#a3ad6b0eefbdff03e92d30f5035defdd1">boxy</a>;<span class="comment"></span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="comment"> /** The size of a computational block in the z direction. */</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#afd53f018c9641c8b8066e9429c88a4e0"> 45</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#afd53f018c9641c8b8066e9429c88a4e0">boxz</a>;<span class="comment"></span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;<span class="comment"> /** The inverse box length in the x direction. */</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#ad708515772990e5b2fa4e93c330f7aa0"> 47</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#ad708515772990e5b2fa4e93c330f7aa0">xsp</a>;<span class="comment"></span></div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="comment"> /** The inverse box length in the y direction. */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a300808cb0ccab85eb61dd0b25a5076de"> 49</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#a300808cb0ccab85eb61dd0b25a5076de">ysp</a>;<span class="comment"></span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="comment"> /** The inverse box length in the z direction. */</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#ac51553412117b42816210e54805ad278"> 51</a></span>&#160; <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="classvoro_1_1voro__base.html#ac51553412117b42816210e54805ad278">zsp</a>;<span class="comment"></span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="comment"> /** An array to hold the minimum distances associated with the</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="comment"> * worklists. This array is initialized during container</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="comment"> * construction, by the initialize_radii() routine. */</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#ab59b5feedb35ea611b05d65df1216775"> 55</a></span>&#160; <span class="keywordtype">double</span> *<a class="code" href="classvoro_1_1voro__base.html#ab59b5feedb35ea611b05d65df1216775">mrad</a>;<span class="comment"></span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="comment"> /** The pre-computed block worklists. */</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#abc825bfa4bdb4b85d50058f016457445"> 57</a></span>&#160; <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#abc825bfa4bdb4b85d50058f016457445">wl</a>[wl_seq_length*wl_hgridcu];</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="classvoro_1_1voro__base.html#a95d9ee6c1610afccf265198ae63b5e88">contains_neighbor</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* format);</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <a class="code" href="classvoro_1_1voro__base.html#a74f367e3bcffcd95c800ce9be85c29dc">voro_base</a>(<span class="keywordtype">int</span> nx_,<span class="keywordtype">int</span> ny_,<span class="keywordtype">int</span> nz_,<span class="keywordtype">double</span> boxx_,<span class="keywordtype">double</span> boxy_,<span class="keywordtype">double</span> boxz_);</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; ~<a class="code" href="classvoro_1_1voro__base.html" title="Class containing data structures common across all particle container classes.">voro_base</a>() {<span class="keyword">delete</span> [] <a class="code" href="classvoro_1_1voro__base.html#ab59b5feedb35ea611b05d65df1216775">mrad</a>;}</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keyword">protected</span>:<span class="comment"></span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="comment"> /** A custom int function that returns consistent stepping</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="comment"> * for negative numbers, so that (-1.5, -0.5, 0.5, 1.5) maps</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="comment"> * to (-2,-1,0,1).</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="comment"> * \param[in] a the number to consider.</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="comment"> * \return The value of the custom int operation. */</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a37fd9fdedc5d415e55f3bbb22a786d8c"> 67</a></span>&#160; <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a37fd9fdedc5d415e55f3bbb22a786d8c">step_int</a>(<span class="keywordtype">double</span> a) {<span class="keywordflow">return</span> a&lt;0?int(a)-1:int(a);}<span class="comment"></span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;<span class="comment"> /** A custom modulo function that returns consistent stepping</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="comment"> * for negative numbers. For example, (-2,-1,0,1,2) step_mod 2</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;<span class="comment"> * is (0,1,0,1,0).</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment"> * \param[in] (a,b) the input integers.</span></div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="comment"> * \return The value of a modulo b, consistent for negative</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="comment"> * numbers. */</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#ab432b8bee0def0666ac39a132c721135"> 74</a></span>&#160; <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#ab432b8bee0def0666ac39a132c721135">step_mod</a>(<span class="keywordtype">int</span> a,<span class="keywordtype">int</span> b) {<span class="keywordflow">return</span> a&gt;=0?a%b:b-1-(b-1-a)%b;}<span class="comment"></span></div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="comment"> /** A custom integer division function that returns consistent</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="comment"> * stepping for negative numbers. For example, (-2,-1,0,1,2)</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="comment"> * step_div 2 is (-1,-1,0,0,1).</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="comment"> * \param[in] (a,b) the input integers.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="comment"> * \return The value of a div b, consistent for negative</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;<span class="comment"> * numbers. */</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="code" href="classvoro_1_1voro__base.html#a59a281a5e25e13f681c4f6a2c8bd1ca7"> 81</a></span>&#160; <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classvoro_1_1voro__base.html#a59a281a5e25e13f681c4f6a2c8bd1ca7">step_div</a>(<span class="keywordtype">int</span> a,<span class="keywordtype">int</span> b) {<span class="keywordflow">return</span> a&gt;=0?a/b:-1+(a+1)/b;}</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keywordtype">void</span> compute_minimum(<span class="keywordtype">double</span> &amp;minr,<span class="keywordtype">double</span> &amp;xlo,<span class="keywordtype">double</span> &amp;xhi,<span class="keywordtype">double</span> &amp;ylo,<span class="keywordtype">double</span> &amp;yhi,<span class="keywordtype">double</span> &amp;zlo,<span class="keywordtype">double</span> &amp;zhi,<span class="keywordtype">int</span> ti,<span class="keywordtype">int</span> tj,<span class="keywordtype">int</span> tk);</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160;};</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160;</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160;}</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160;</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Jul 27 2012 21:53:31 for Voro++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>

Event Timeline