Page MenuHomec4science

c__loops_8cc_source.html
No OneTemporary

File Metadata

Created
Sun, Nov 24, 19:33

c__loops_8cc_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++: c_loops.cc 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">c_loops.cc</div> </div>
</div><!--header-->
<div class="contents">
<a href="c__loops_8cc.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 c_loops.cc</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * \brief Function implementations for the loop classes. */</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">#include &quot;<a class="code" href="c__loops_8hh.html" title="Header file for the loop classes.">c_loops.hh</a>&quot;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;</div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="keyword">namespace </span>voro {</div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">/** Initializes a c_loop_subset object to scan over all particles within a</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> * given sphere.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> * \param[in] (vx,vy,vz) the position vector of the center of the sphere.</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"> * \param[in] r the radius of the sphere.</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment"> * \param[in] bounds_test whether to do detailed bounds checking. If this is</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="comment"> * false then the class will loop over all particles in</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="comment"> * blocks that overlap the given sphere. If it is true,</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="comment"> * the particle will only loop over the particles which</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment"> * actually lie within the sphere.</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="code" href="classvoro_1_1c__loop__subset.html#a585f47e725dc0de645defc8dc0d463cb"> 24</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a585f47e725dc0de645defc8dc0d463cb">c_loop_subset::setup_sphere</a>(<span class="keywordtype">double</span> vx,<span class="keywordtype">double</span> vy,<span class="keywordtype">double</span> vz,<span class="keywordtype">double</span> r,<span class="keywordtype">bool</span> bounds_test) {</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; <span class="keywordflow">if</span>(bounds_test) {<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=sphere;v0=vx;v1=vy;v2=vz;v3=r*r;} <span class="keywordflow">else</span> <a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=no_check;</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; ai=step_int((vx-ax-r)*xsp);</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160; bi=step_int((vx-ax+r)*xsp);</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; aj=step_int((vy-ay-r)*ysp);</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; bj=step_int((vy-ay+r)*ysp);</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; ak=step_int((vz-az-r)*zsp);</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; bk=step_int((vz-az+r)*zsp);</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; setup_common();</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;}</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="comment">/** Initializes the class to loop over all particles in a rectangular subgrid</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="comment"> * of blocks.</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="comment"> * \param[in] (ai_,bi_) the subgrid range in the x-direction, inclusive of both</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="comment"> * ends.</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="comment"> * \param[in] (aj_,bj_) the subgrid range in the y-direction, inclusive of both</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="comment"> * ends.</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="comment"> * \param[in] (ak_,bk_) the subgrid range in the z-direction, inclusive of both</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="comment"> * ends.</span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;<span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="code" href="classvoro_1_1c__loop__subset.html#a688ef02340f6a9bc64c77c2de4c4ae3d"> 44</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a688ef02340f6a9bc64c77c2de4c4ae3d">c_loop_subset::setup_intbox</a>(<span class="keywordtype">int</span> ai_,<span class="keywordtype">int</span> bi_,<span class="keywordtype">int</span> aj_,<span class="keywordtype">int</span> bj_,<span class="keywordtype">int</span> ak_,<span class="keywordtype">int</span> bk_) {</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; ai=ai_;bi=bi_;aj=aj_;bj=bj_;ak=ak_;bk=bk_;</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=no_check;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160; setup_common();</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;}</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="comment">/** Sets up all of the common constants used for the loop.</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="keywordtype">void</span> c_loop_subset::setup_common() {</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160; <span class="keywordflow">if</span>(!xperiodic) {</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160; <span class="keywordflow">if</span>(ai&lt;0) {ai=0;<span class="keywordflow">if</span>(bi&lt;0) bi=0;}</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <span class="keywordflow">if</span>(bi&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>) {bi=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>-1;<span class="keywordflow">if</span>(ai&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>) ai=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>-1;}</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; }</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160; <span class="keywordflow">if</span>(!yperiodic) {</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; <span class="keywordflow">if</span>(aj&lt;0) {aj=0;<span class="keywordflow">if</span>(bj&lt;0) bj=0;}</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="keywordflow">if</span>(bj&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>) {bj=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>-1;<span class="keywordflow">if</span>(aj&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>) aj=<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>-1;}</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; }</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <span class="keywordflow">if</span>(!zperiodic) {</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <span class="keywordflow">if</span>(ak&lt;0) {ak=0;<span class="keywordflow">if</span>(bk&lt;0) bk=0;}</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; <span class="keywordflow">if</span>(bk&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>) {bk=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>-1;<span class="keywordflow">if</span>(ak&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>) ak=<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>-1;}</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; }</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; ci=ai;cj=aj;ck=ak;</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; di=<a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>=step_mod(ci,<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>);apx=px=step_div(ci,<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>)*sx;</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; dj=<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>=step_mod(cj,<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>);apy=py=step_div(cj,<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>)*sy;</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; dk=<a class="code" href="classvoro_1_1c__loop__base.html#abf2dcc131f23212c15169e90ba30d6e4">k</a>=step_mod(ck,<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>);apz=pz=step_div(ck,<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>)*sz;</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; inc1=di-step_mod(bi,<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>);</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; inc2=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>*(<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>+dj-step_mod(bj,<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>))+inc1;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; inc1+=<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; <a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>=di+<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>*(dj+<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>*dk);</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; <a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>=0;</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160;}</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="comment">/** Starts the loop by finding the first particle within the container to</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="comment"> * consider.</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="comment"> * \return True if there is any particle to consider, false otherwise. */</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="code" href="classvoro_1_1c__loop__subset.html#a4c9709bc992e33668471e292474c39f4"> 79</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a4c9709bc992e33668471e292474c39f4">c_loop_subset::start</a>() {</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="keywordflow">while</span>(<a class="code" href="classvoro_1_1c__loop__base.html#a060e5b0e557141713b6897b0a0728f2d">co</a>[<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>]==0) {<span class="keywordflow">if</span>(!next_block()) <span class="keywordflow">return</span> <span class="keyword">false</span>;}</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; <span class="keywordflow">while</span>(<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>!=no_check&amp;&amp;out_of_bounds()) {</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; <a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>++;</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160; <span class="keywordflow">while</span>(<a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>&gt;=<a class="code" href="classvoro_1_1c__loop__base.html#a060e5b0e557141713b6897b0a0728f2d">co</a>[<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>]) {<a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>=0;<span class="keywordflow">if</span>(!next_block()) <span class="keywordflow">return</span> <span class="keyword">false</span>;}</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; <span class="keywordflow">return</span> <span class="keyword">true</span>;</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;<span class="comment"></span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;<span class="comment">/** Initializes the class to loop over all particles in a rectangular box.</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;<span class="comment"> * \param[in] (xmin,xmax) the minimum and maximum x coordinates of the box.</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;<span class="comment"> * \param[in] (ymin,ymax) the minimum and maximum y coordinates of the box.</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;<span class="comment"> * \param[in] (zmin,zmax) the minimum and maximum z coordinates of the box.</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>&#160;<span class="comment"> * \param[in] bounds_test whether to do detailed bounds checking. If this is</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>&#160;<span class="comment"> * false then the class will loop over all particles in</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>&#160;<span class="comment"> * blocks that overlap the given box. If it is true, the</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>&#160;<span class="comment"> * particle will only loop over the particles which</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="comment"> * actually lie within the box.</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<span class="comment"> * \return True if there is any valid point to loop over, false otherwise. */</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="classvoro_1_1c__loop__subset.html#a2aba9be724d35e088e3597dc9181182d"> 98</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="classvoro_1_1c__loop__subset.html#a2aba9be724d35e088e3597dc9181182d">c_loop_subset::setup_box</a>(<span class="keywordtype">double</span> xmin,<span class="keywordtype">double</span> xmax,<span class="keywordtype">double</span> ymin,<span class="keywordtype">double</span> ymax,<span class="keywordtype">double</span> zmin,<span class="keywordtype">double</span> zmax,<span class="keywordtype">bool</span> bounds_test) {</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>&#160; <span class="keywordflow">if</span>(bounds_test) {<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=box;v0=xmin;v1=xmax;v2=ymin;v3=ymax;v4=zmin;v5=zmax;} <span class="keywordflow">else</span> <a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>=no_check;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160; ai=step_int((xmin-ax)*xsp);</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; bi=step_int((xmax-ax)*xsp);</div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; aj=step_int((ymin-ay)*ysp);</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160; bj=step_int((ymax-ay)*ysp);</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>&#160; ak=step_int((zmin-az)*zsp);</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>&#160; bk=step_int((zmax-az)*zsp);</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; setup_common();</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160;}</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>&#160;<span class="comment">/** Computes whether the current point is out of bounds, relative to the</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<span class="comment"> * current loop setup.</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="comment"> * \return True if the point is out of bounds, false otherwise. */</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;<span class="keywordtype">bool</span> c_loop_subset::out_of_bounds() {</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; <span class="keywordtype">double</span> *pp=<a class="code" href="classvoro_1_1c__loop__base.html#a2b6abbe65d550ae7071aaa28d0fbb534">p</a>[<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>]+<a class="code" href="classvoro_1_1c__loop__base.html#ab42c93bbaf7cfc11e3c95f5d38f694e2">ps</a>*<a class="code" href="classvoro_1_1c__loop__base.html#a2eaa096a64736b5792cdf3d799b95786">q</a>;</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__subset.html#ac5d8b2aa34f936022e9059ca093b914c">mode</a>==sphere) {</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160; <span class="keywordtype">double</span> fx(*pp+px-v0),fy(pp[1]+py-v1),fz(pp[2]+pz-v2);</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160; <span class="keywordflow">return</span> fx*fx+fy*fy+fz*fz&gt;v3;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; <span class="keywordtype">double</span> f(*pp+px);<span class="keywordflow">if</span>(f&lt;v0||f&gt;v1) <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; f=pp[1]+py;<span class="keywordflow">if</span>(f&lt;v2||f&gt;v3) <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; f=pp[2]+pz;<span class="keywordflow">return</span> f&lt;v4||f&gt;v5;</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; }</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;}</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;<span class="comment">/** Returns the next block to be tested in a loop, and updates the periodicity</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>&#160;<span class="comment"> * vector if necessary. */</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="keywordtype">bool</span> c_loop_subset::next_block() {</div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>&#160; <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>&lt;bi) {</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>++;</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; <span class="keywordflow">if</span>(ci&lt;<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>-1) {ci++;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>++;} <span class="keywordflow">else</span> {ci=0;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=1-<a class="code" href="classvoro_1_1c__loop__base.html#a0d6046f6de1f80849e5d1d8f3b7212e7">nx</a>;px+=sx;}</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>&lt;bj) {</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; <a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>=ai;ci=di;px=apx;<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>++;</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="keywordflow">if</span>(cj&lt;<a class="code" href="classvoro_1_1c__loop__base.html#ac8f42728e3a98149c2185aba833ac5ff">ny</a>-1) {cj++;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc1;} <span class="keywordflow">else</span> {cj=0;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc1-<a class="code" href="classvoro_1_1c__loop__base.html#abb655606af4e184c2982f1a32cd47e12">nxy</a>;py+=sy;}</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(<a class="code" href="classvoro_1_1c__loop__base.html#abf2dcc131f23212c15169e90ba30d6e4">k</a>&lt;bk) {</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160; <a class="code" href="classvoro_1_1c__loop__base.html#aef465d2da85b963fa9e0e886ee273541">i</a>=ai;ci=di;<a class="code" href="classvoro_1_1c__loop__base.html#abbaba2fc0d1fa07760220d37a3cc7ccf">j</a>=aj;cj=dj;px=apx;py=apy;<a class="code" href="classvoro_1_1c__loop__base.html#abf2dcc131f23212c15169e90ba30d6e4">k</a>++;</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>&#160; <span class="keywordflow">if</span>(ck&lt;<a class="code" href="classvoro_1_1c__loop__base.html#aaec35b971352bff60f4a446c430f26f8">nz</a>-1) {ck++;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc2;} <span class="keywordflow">else</span> {ck=0;<a class="code" href="classvoro_1_1c__loop__base.html#a3cb6bc5c8b22e57325bb136feba93d9b">ijk</a>+=inc2-<a class="code" href="classvoro_1_1c__loop__base.html#a68cafa132e9028ed7b143e93e85a102d">nxyz</a>;pz+=sz;}</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; } <span class="keywordflow">else</span> <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;}</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>&#160;<span class="comment">/** Extends the memory available for storing the ordering. */</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160;<span class="keywordtype">void</span> particle_order::add_ordering_memory() {</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>&#160; <span class="keywordtype">int</span> *no=<span class="keyword">new</span> <span class="keywordtype">int</span>[<a class="code" href="classvoro_1_1particle__order.html#a742bc941dfd87ecd64b42f6e50df19db">size</a>&lt;&lt;2],*nop=no,*opp=<a class="code" href="classvoro_1_1particle__order.html#af8bef46cbdfdee608090aa5df0666df2">o</a>;</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; <span class="keywordflow">while</span>(opp&lt;<a class="code" href="classvoro_1_1particle__order.html#a6aeb89179930977f344416a0ba1c38a4">op</a>) *(nop++)=*(opp++);</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; <span class="keyword">delete</span> [] <a class="code" href="classvoro_1_1particle__order.html#af8bef46cbdfdee608090aa5df0666df2">o</a>;</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; <a class="code" href="classvoro_1_1particle__order.html#a742bc941dfd87ecd64b42f6e50df19db">size</a>&lt;&lt;=1;<a class="code" href="classvoro_1_1particle__order.html#af8bef46cbdfdee608090aa5df0666df2">o</a>=no;<a class="code" href="classvoro_1_1particle__order.html#a6aeb89179930977f344416a0ba1c38a4">op</a>=nop;</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;}</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Jul 27 2012 21:53:30 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