<a href="container__prd_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> <span class="comment">// Voro++, a 3D cell-based Voronoi library</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * \brief Function implementations for the container_periodic_base and</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * related classes. */</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="preprocessor">#include "<a class="code" href="container__prd_8hh.html" title="Header file for the container_periodic_base and related classes.">container_prd.hh</a>"</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment">/** The class constructor sets up the geometry of container, initializing the</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * minimum and maximum coordinates in each direction, and setting whether each</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * direction is periodic or not. It divides the container into a rectangular</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * grid of blocks, and allocates memory for each of these for storing particle</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> * positions and IDs.</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="comment"> * \param[in] (bx_) The x coordinate of the first unit vector.</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="comment"> * \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="comment"> * \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit</span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="comment"> * \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="comment"> * \param[in] init_mem_ the initial memory allocation for each block.</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="comment"> * \param[in] ps_ the number of floating point entries to store for each</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  : <a class="code" href="classvoro_1_1unitcell.html" title="Class for computation of the unit Voronoi cell associated with a 3D non-rectangular periodic domain...">unitcell</a>(bx_,bxy_,by_,bxz_,byz_,bz_), <a class="code" href="classvoro_1_1voro__base.html" title="Class containing data structures common across all particle container classes.">voro_base</a>(nx_,ny_,nz_,bx_/nx_,by_/ny_,bz_/nz_),</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="comment">// Set up memory for the blocks in the primary domain</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> <span class="comment">/** The class constructor sets up the geometry of container.</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> <span class="comment"> * \param[in] (bx_) The x coordinate of the first unit vector.</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> <span class="comment"> * \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="comment"> * \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span> <span class="comment"> * \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  : <a class="code" href="classvoro_1_1container__periodic__base.html" title="Class for representing a particle system in a 3D periodic non-orthogonal periodic domain...">container_periodic_base</a>(bx_,bxy_,by_,bxz_,byz_,bz_,nx_,ny_,nz_,init_mem_,3),</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span> <span class="comment">/** The class constructor sets up the geometry of container.</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> <span class="comment"> * \param[in] (bx_) The x coordinate of the first unit vector.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="comment"> * \param[in] (bxy_,by_) The x and y coordinates of the second unit vector.</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span> <span class="comment"> * \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span> <span class="comment"> * \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  : <a class="code" href="classvoro_1_1container__periodic__base.html" title="Class for representing a particle system in a 3D periodic non-orthogonal periodic domain...">container_periodic_base</a>(bx_,bxy_,by_,bxz_,byz_,bz_,nx_,ny_,nz_,init_mem_,4),</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> <span class="comment">/** Put a particle into the correct region of the container.</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span> <span class="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> <span class="comment"> * \param[in] (x,y,z) the position vector of the inserted particle. */</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> <span class="comment">/** Put a particle into the correct region of the container.</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span> <span class="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> <span class="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> <span class="comment"> * \param[in] r the radius of the particle. */</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span> <span class="comment">/** Put a particle into the correct region of the container.</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> <span class="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> <span class="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span> <span class="comment"> * \param[out] (ai,aj,ak) the periodic image displacement that the particle is</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> <span class="comment"> * in, with (0,0,0) corresponding to the primary domain.</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span> <span class="comment">/** Put a particle into the correct region of the container.</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span> <span class="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span> <span class="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span> <span class="comment"> * \param[in] r the radius of the particle.</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span> <span class="comment"> * \param[out] (ai,aj,ak) the periodic image displacement that the particle is</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span> <span class="comment"> * in, with (0,0,0) corresponding to the primary domain.</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span> <span class="comment">/** Put a particle into the correct region of the container, also recording</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span> <span class="comment"> * into which region it was stored.</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span> <span class="comment"> * \param[in] vo the ordering class in which to record the region.</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span> <span class="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span> <span class="comment"> * \param[in] (x,y,z) the position vector of the inserted particle. */</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"><a class="code" href="classvoro_1_1container__periodic.html#ad3987d5710d793bdd604f12eeaa326f0"> 149</a></span> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1container__periodic.html#afa9abf680a0dc08650ada11a2eff0be6">container_periodic::put</a>(<a class="code" href="classvoro_1_1particle__order.html" title="A class for storing ordering information when particles are added to a container.">particle_order</a> &vo,<span class="keywordtype">int</span> n,<span class="keywordtype">double</span> x,<span class="keywordtype">double</span> y,<span class="keywordtype">double</span> z) {</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span> <span class="comment">/** Put a particle into the correct region of the container, also recording</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="comment"> * into which region it was stored.</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span> <span class="comment"> * \param[in] vo the ordering class in which to record the region.</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span> <span class="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span> <span class="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> <span class="comment"> * \param[in] r the radius of the particle. */</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"><a class="code" href="classvoro_1_1container__periodic__poly.html#a2b0a71bfb4fb576df45d8a4bcbc888cd"> 164</a></span> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1container__periodic__poly.html#a1cbdd9c92900e08173e1ea3a6e2e6df4">container_periodic_poly::put</a>(<a class="code" href="classvoro_1_1particle__order.html" title="A class for storing ordering information when particles are added to a container.">particle_order</a> &vo,<span class="keywordtype">int</span> n,<span class="keywordtype">double</span> x,<span class="keywordtype">double</span> y,<span class="keywordtype">double</span> z,<span class="keywordtype">double</span> r) {</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span> <span class="comment">/** Takes a particle position vector and computes the region index into which</span></div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span> <span class="comment"> * it should be stored. If the container is periodic, then the routine also</span></div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span> <span class="comment"> * maps the particle position to ensure it is in the primary domain. If the</span></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span> <span class="comment"> * container is not periodic, the routine bails out.</span></div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span> <span class="comment"> * \param[out] ijk the region index.</span></div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span> <span class="comment"> * \param[in,out] (x,y,z) the particle position, remapped into the primary</span></div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span> <span class="comment"> * domain if necessary.</span></div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span> <span class="comment"> * \return True if the particle can be successfully placed into the container,</span></div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  <span class="comment">// Remap particle in the z direction if necessary</span></div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="comment">// Remap particle in the y direction if necessary</span></div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <span class="comment">// Remap particle in the x direction if necessary</span></div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  <span class="comment">// Compute the block index and check memory allocation</span></div>
<div class="line"><a name="l00212"></a><span class="lineno"> 212</span> <span class="comment">/** Takes a particle position vector and computes the region index into which</span></div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span> <span class="comment"> * it should be stored. If the container is periodic, then the routine also</span></div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span> <span class="comment"> * maps the particle position to ensure it is in the primary domain. If the</span></div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span> <span class="comment"> * container is not periodic, the routine bails out.</span></div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span> <span class="comment"> * \param[out] ijk the region index.</span></div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span> <span class="comment"> * \param[in,out] (x,y,z) the particle position, remapped into the primary</span></div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span> <span class="comment"> * domain if necessary.</span></div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span> <span class="comment"> * \param[out] (ai,aj,ak) the periodic image displacement that the particle is</span></div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span> <span class="comment"> * in, with (0,0,0) corresponding to the primary domain.</span></div>
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span> <span class="comment"> * \return True if the particle can be successfully placed into the container,</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="comment">// Remap particle in the z direction if necessary</span></div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  <span class="comment">// Remap particle in the y direction if necessary</span></div>
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  <span class="comment">// Remap particle in the x direction if necessary</span></div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="comment">// Compute the block index and check memory allocation</span></div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span> <span class="comment">/** Takes a position vector and remaps it into the primary domain.</span></div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span> <span class="comment"> * \param[out] (ai,aj,ak) the periodic image displacement that the vector is in,</span></div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span> <span class="comment"> * with (0,0,0) corresponding to the primary domain.</span></div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span> <span class="comment"> * \param[out] (ci,cj,ck) the index of the block that the position vector is</span></div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span> <span class="comment"> * within, once it has been remapped.</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span> <span class="comment"> * \param[in,out] (x,y,z) the position vector to consider, which is remapped</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span> <span class="comment"> * into the primary domain during the routine.</span></div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span> <span class="comment"> * \param[out] ijk the block index that the vector is within. */</span></div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="comment">// Remap particle in the z direction if necessary</span></div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  <span class="comment">// Remap particle in the y direction if necessary</span></div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <span class="comment">// Remap particle in the x direction if necessary</span></div>
<div class="line"><a name="l00287"></a><span class="lineno"> 287</span> <span class="comment">/** Takes a vector and finds the particle whose Voronoi cell contains that</span></div>
<div class="line"><a name="l00288"></a><span class="lineno"> 288</span> <span class="comment"> * vector. This is equivalent to finding the particle which is nearest to the</span></div>
<div class="line"><a name="l00290"></a><span class="lineno"> 290</span> <span class="comment"> * \param[in] (x,y,z) the vector to test.</span></div>
<div class="line"><a name="l00291"></a><span class="lineno"> 291</span> <span class="comment"> * \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell</span></div>
<div class="line"><a name="l00292"></a><span class="lineno"> 292</span> <span class="comment"> * contains the vector. This may point to a particle in</span></div>
<div class="line"><a name="l00293"></a><span class="lineno"> 293</span> <span class="comment"> * a periodic image of the primary domain.</span></div>
<div class="line"><a name="l00294"></a><span class="lineno"> 294</span> <span class="comment"> * \param[out] pid the ID of the particle.</span></div>
<div class="line"><a name="l00295"></a><span class="lineno"> 295</span> <span class="comment"> * \return True if a particle was found. If the container has no particles,</span></div>
<div class="line"><a name="l00296"></a><span class="lineno"> 296</span> <span class="comment"> * then the search will not find a Voronoi cell and false is returned. */</span></div>
<div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <a class="code" href="structvoro_1_1particle__record.html" title="Structure for holding information about a particle.">particle_record</a> w;</div>
<div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  <span class="comment">// Remap the vector into the primary domain and then search for the</span></div>
<div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <span class="comment">// Voronoi cell that it is within</span></div>
<div class="line"><a name="l00309"></a><span class="lineno"> 309</span>  <span class="comment">// Assemble the position vector of the particle to be returned,</span></div>
<div class="line"><a name="l00310"></a><span class="lineno"> 310</span>  <span class="comment">// applying a periodic remapping if necessary</span></div>
<div class="line"><a name="l00321"></a><span class="lineno"> 321</span> <span class="comment">/** Takes a vector and finds the particle whose Voronoi cell contains that</span></div>
<div class="line"><a name="l00322"></a><span class="lineno"> 322</span> <span class="comment"> * vector. Additional wall classes are not considered by this routine.</span></div>
<div class="line"><a name="l00323"></a><span class="lineno"> 323</span> <span class="comment"> * \param[in] (x,y,z) the vector to test.</span></div>
<div class="line"><a name="l00324"></a><span class="lineno"> 324</span> <span class="comment"> * \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell</span></div>
<div class="line"><a name="l00325"></a><span class="lineno"> 325</span> <span class="comment"> * contains the vector. If the container is periodic,</span></div>
<div class="line"><a name="l00326"></a><span class="lineno"> 326</span> <span class="comment"> * this may point to a particle in a periodic image of</span></div>
<div class="line"><a name="l00327"></a><span class="lineno"> 327</span> <span class="comment"> * the primary domain.</span></div>
<div class="line"><a name="l00328"></a><span class="lineno"> 328</span> <span class="comment"> * \param[out] pid the ID of the particle.</span></div>
<div class="line"><a name="l00329"></a><span class="lineno"> 329</span> <span class="comment"> * \return True if a particle was found. If the container has no particles,</span></div>
<div class="line"><a name="l00330"></a><span class="lineno"> 330</span> <span class="comment"> * then the search will not find a Voronoi cell and false is returned. */</span></div>
<div class="line"><a name="l00333"></a><span class="lineno"> 333</span>  <a class="code" href="structvoro_1_1particle__record.html" title="Structure for holding information about a particle.">particle_record</a> w;</div>
<div class="line"><a name="l00336"></a><span class="lineno"> 336</span>  <span class="comment">// Remap the vector into the primary domain and then search for the</span></div>
<div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  <span class="comment">// Voronoi cell that it is within</span></div>
<div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  <span class="comment">// Assemble the position vector of the particle to be returned,</span></div>
<div class="line"><a name="l00344"></a><span class="lineno"> 344</span>  <span class="comment">// applying a periodic remapping if necessary</span></div>
<div class="line"><a name="l00355"></a><span class="lineno"> 355</span> <span class="comment">/** Increase memory for a particular region.</span></div>
<div class="line"><a name="l00356"></a><span class="lineno"> 356</span> <span class="comment"> * \param[in] i the index of the region to reallocate. */</span></div>
<div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  <span class="comment">// Handle the case when no memory has been allocated for this block</span></div>
<div class="line"><a name="l00367"></a><span class="lineno"> 367</span>  <span class="comment">// Otherwise, double the memory allocation for this block. Carry out a</span></div>
<div class="line"><a name="l00368"></a><span class="lineno"> 368</span>  <span class="comment">// check on the memory allocation size, and print a status message if</span></div>
<div class="line"><a name="l00374"></a><span class="lineno"> 374</span> <span class="preprocessor"></span> fprintf(stderr,<span class="stringliteral">"Particle memory in region %d scaled up to %d\n"</span>,i,nmem);</div>
<div class="line"><a name="l00377"></a><span class="lineno"> 377</span>  <span class="comment">// Allocate new memory and copy in the contents of the old arrays</span></div>
<div class="line"><a name="l00389"></a><span class="lineno"> 389</span> <span class="comment">/** Import a list of particles from an open file stream into the container.</span></div>
<div class="line"><a name="l00390"></a><span class="lineno"> 390</span> <span class="comment"> * Entries of four numbers (Particle ID, x position, y position, z position)</span></div>
<div class="line"><a name="l00391"></a><span class="lineno"> 391</span> <span class="comment"> * are searched for. If the file cannot be successfully read, then the routine</span></div>
<div class="line"><a name="l00401"></a><span class="lineno"> 401</span> <span class="comment">/** Import a list of particles from an open file stream, also storing the order</span></div>
<div class="line"><a name="l00402"></a><span class="lineno"> 402</span> <span class="comment"> * of that the particles are read. Entries of four numbers (Particle ID, x</span></div>
<div class="line"><a name="l00403"></a><span class="lineno"> 403</span> <span class="comment"> * position, y position, z position) are searched for. If the file cannot be</span></div>
<div class="line"><a name="l00404"></a><span class="lineno"> 404</span> <span class="comment"> * successfully read, then the routine causes a fatal error.</span></div>
<div class="line"><a name="l00405"></a><span class="lineno"> 405</span> <span class="comment"> * \param[in,out] vo a reference to an ordering class to use.</span></div>
<div class="line"><a name="l00406"></a><span class="lineno"> 406</span> <span class="comment"> * \param[in] fp the file handle to read from. */</span></div>
<div class="line"><a name="l00407"></a><span class="lineno"><a class="code" href="classvoro_1_1container__periodic.html#a9ad39c3dcd9311183c671a78a5263c2c"> 407</a></span> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1container__periodic.html#ad5073f573187aa00569d3562cdfa4f49">container_periodic::import</a>(<a class="code" href="classvoro_1_1particle__order.html" title="A class for storing ordering information when particles are added to a container.">particle_order</a> &vo,FILE *fp) {</div>
<div class="line"><a name="l00414"></a><span class="lineno"> 414</span> <span class="comment">/** Import a list of particles from an open file stream into the container.</span></div>
<div class="line"><a name="l00415"></a><span class="lineno"> 415</span> <span class="comment"> * Entries of five numbers (Particle ID, x position, y position, z position,</span></div>
<div class="line"><a name="l00416"></a><span class="lineno"> 416</span> <span class="comment"> * radius) are searched for. If the file cannot be successfully read, then the</span></div>
<div class="line"><a name="l00426"></a><span class="lineno"> 426</span> <span class="comment">/** Import a list of particles from an open file stream, also storing the order</span></div>
<div class="line"><a name="l00427"></a><span class="lineno"> 427</span> <span class="comment"> * of that the particles are read. Entries of four numbers (Particle ID, x</span></div>
<div class="line"><a name="l00428"></a><span class="lineno"> 428</span> <span class="comment"> * position, y position, z position, radius) are searched for. If the file</span></div>
<div class="line"><a name="l00429"></a><span class="lineno"> 429</span> <span class="comment"> * cannot be successfully read, then the routine causes a fatal error.</span></div>
<div class="line"><a name="l00430"></a><span class="lineno"> 430</span> <span class="comment"> * \param[in,out] vo a reference to an ordering class to use.</span></div>
<div class="line"><a name="l00431"></a><span class="lineno"> 431</span> <span class="comment"> * \param[in] fp the file handle to read from. */</span></div>
<div class="line"><a name="l00432"></a><span class="lineno"><a class="code" href="classvoro_1_1container__periodic__poly.html#adaee2751c053589ba3eb1e5419e7d405"> 432</a></span> <span class="keywordtype">void</span> <a class="code" href="classvoro_1_1container__periodic__poly.html#afbd03ab4c06af15913d2641be39513c9">container_periodic_poly::import</a>(<a class="code" href="classvoro_1_1particle__order.html" title="A class for storing ordering information when particles are added to a container.">particle_order</a> &vo,FILE *fp) {</div>
<div class="line"><a name="l00439"></a><span class="lineno"> 439</span> <span class="comment">/** Outputs the a list of all the container regions along with the number of</span></div>
<div class="line"><a name="l00452"></a><span class="lineno"> 452</span> <span class="comment">/** Clears a container of particles, also clearing resetting the maximum radius</span></div>
<div class="line"><a name="l00453"></a><span class="lineno"> 453</span> <span class="comment"> * to zero. */</span></div>
<div class="line"><a name="l00459"></a><span class="lineno"> 459</span> <span class="comment">/** Computes all the Voronoi cells and saves customized information about them.</span></div>
<div class="line"><a name="l00460"></a><span class="lineno"> 460</span> <span class="comment"> * \param[in] format the custom output string to use.</span></div>
<div class="line"><a name="l00461"></a><span class="lineno"> 461</span> <span class="comment"> * \param[in] fp a file handle to write to. */</span></div>
<div class="line"><a name="l00463"></a><span class="lineno"> 463</span>  <a class="code" href="classvoro_1_1c__loop__all__periodic.html" title="A class for looping over all particles in a container_periodic or container_periodic_poly class...">c_loop_all_periodic</a> vl(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00467"></a><span class="lineno"> 467</span> <span class="comment">/** Computes all the Voronoi cells and saves customized</span></div>
<div class="line"><a name="l00468"></a><span class="lineno"> 468</span> <span class="comment"> * information about them.</span></div>
<div class="line"><a name="l00469"></a><span class="lineno"> 469</span> <span class="comment"> * \param[in] format the custom output string to use.</span></div>
<div class="line"><a name="l00470"></a><span class="lineno"> 470</span> <span class="comment"> * \param[in] fp a file handle to write to. */</span></div>
<div class="line"><a name="l00472"></a><span class="lineno"> 472</span>  <a class="code" href="classvoro_1_1c__loop__all__periodic.html" title="A class for looping over all particles in a container_periodic or container_periodic_poly class...">c_loop_all_periodic</a> vl(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00476"></a><span class="lineno"> 476</span> <span class="comment">/** Computes all the Voronoi cells and saves customized information about them.</span></div>
<div class="line"><a name="l00477"></a><span class="lineno"> 477</span> <span class="comment"> * \param[in] format the custom output string to use.</span></div>
<div class="line"><a name="l00478"></a><span class="lineno"> 478</span> <span class="comment"> * \param[in] filename the name of the file to write to. */</span></div>
<div class="line"><a name="l00485"></a><span class="lineno"> 485</span> <span class="comment">/** Computes all the Voronoi cells and saves customized</span></div>
<div class="line"><a name="l00486"></a><span class="lineno"> 486</span> <span class="comment"> * information about them</span></div>
<div class="line"><a name="l00487"></a><span class="lineno"> 487</span> <span class="comment"> * \param[in] format the custom output string to use.</span></div>
<div class="line"><a name="l00488"></a><span class="lineno"> 488</span> <span class="comment"> * \param[in] filename the name of the file to write to. */</span></div>
<div class="line"><a name="l00495"></a><span class="lineno"> 495</span> <span class="comment">/** Computes all of the Voronoi cells in the container, but does nothing</span></div>
<div class="line"><a name="l00496"></a><span class="lineno"> 496</span> <span class="comment"> * with the output. It is useful for measuring the pure computation time</span></div>
<div class="line"><a name="l00497"></a><span class="lineno"> 497</span> <span class="comment"> * of the Voronoi algorithm, without any additional calculations such as</span></div>
<div class="line"><a name="l00500"></a><span class="lineno"> 500</span>  <a class="code" href="classvoro_1_1voronoicell.html" title="Extension of the voronoicell_base class to represent a Voronoi cell without neighbor information...">voronoicell</a> c;</div>
<div class="line"><a name="l00501"></a><span class="lineno"> 501</span>  <a class="code" href="classvoro_1_1c__loop__all__periodic.html" title="A class for looping over all particles in a container_periodic or container_periodic_poly class...">c_loop_all_periodic</a> vl(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00506"></a><span class="lineno"> 506</span> <span class="comment">/** Computes all of the Voronoi cells in the container, but does nothing</span></div>
<div class="line"><a name="l00507"></a><span class="lineno"> 507</span> <span class="comment"> * with the output. It is useful for measuring the pure computation time</span></div>
<div class="line"><a name="l00508"></a><span class="lineno"> 508</span> <span class="comment"> * of the Voronoi algorithm, without any additional calculations such as</span></div>
<div class="line"><a name="l00511"></a><span class="lineno"> 511</span>  <a class="code" href="classvoro_1_1voronoicell.html" title="Extension of the voronoicell_base class to represent a Voronoi cell without neighbor information...">voronoicell</a> c;</div>
<div class="line"><a name="l00512"></a><span class="lineno"> 512</span>  <a class="code" href="classvoro_1_1c__loop__all__periodic.html" title="A class for looping over all particles in a container_periodic or container_periodic_poly class...">c_loop_all_periodic</a> vl(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00516"></a><span class="lineno"> 516</span> <span class="comment">/** Calculates all of the Voronoi cells and sums their volumes. In most cases</span></div>
<div class="line"><a name="l00517"></a><span class="lineno"> 517</span> <span class="comment"> * without walls, the sum of the Voronoi cell volumes should equal the volume</span></div>
<div class="line"><a name="l00518"></a><span class="lineno"> 518</span> <span class="comment"> * of the container to numerical precision.</span></div>
<div class="line"><a name="l00519"></a><span class="lineno"> 519</span> <span class="comment"> * \return The sum of all of the computed Voronoi volumes. */</span></div>
<div class="line"><a name="l00521"></a><span class="lineno"> 521</span>  <a class="code" href="classvoro_1_1voronoicell.html" title="Extension of the voronoicell_base class to represent a Voronoi cell without neighbor information...">voronoicell</a> c;</div>
<div class="line"><a name="l00523"></a><span class="lineno"> 523</span>  <a class="code" href="classvoro_1_1c__loop__all__periodic.html" title="A class for looping over all particles in a container_periodic or container_periodic_poly class...">c_loop_all_periodic</a> vl(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00528"></a><span class="lineno"> 528</span> <span class="comment">/** Calculates all of the Voronoi cells and sums their volumes. In most cases</span></div>
<div class="line"><a name="l00529"></a><span class="lineno"> 529</span> <span class="comment"> * without walls, the sum of the Voronoi cell volumes should equal the volume</span></div>
<div class="line"><a name="l00530"></a><span class="lineno"> 530</span> <span class="comment"> * of the container to numerical precision.</span></div>
<div class="line"><a name="l00531"></a><span class="lineno"> 531</span> <span class="comment"> * \return The sum of all of the computed Voronoi volumes. */</span></div>
<div class="line"><a name="l00533"></a><span class="lineno"> 533</span>  <a class="code" href="classvoro_1_1voronoicell.html" title="Extension of the voronoicell_base class to represent a Voronoi cell without neighbor information...">voronoicell</a> c;</div>
<div class="line"><a name="l00535"></a><span class="lineno"> 535</span>  <a class="code" href="classvoro_1_1c__loop__all__periodic.html" title="A class for looping over all particles in a container_periodic or container_periodic_poly class...">c_loop_all_periodic</a> vl(*<span class="keyword">this</span>);</div>
<div class="line"><a name="l00540"></a><span class="lineno"> 540</span> <span class="comment">/** This routine creates all periodic images of the particles. It is meant for</span></div>
<div class="line"><a name="l00541"></a><span class="lineno"> 541</span> <span class="comment"> * diagnostic purposes only, since usually periodic images are dynamically</span></div>
<div class="line"><a name="l00542"></a><span class="lineno"> 542</span> <span class="comment"> * created in when they are referenced. */</span></div>
<div class="line"><a name="l00548"></a><span class="lineno"> 548</span> <span class="comment">/** Checks that the particles within each block lie within that block's bounds.</span></div>
<div class="line"><a name="l00549"></a><span class="lineno"> 549</span> <span class="comment"> * This is useful for diagnosing problems with periodic image computation. */</span></div>
<div class="line"><a name="l00555"></a><span class="lineno"> 555</span>  <span class="comment">// Compute the block's bounds, adding in a small tolerance</span></div>
<div class="line"><a name="l00560"></a><span class="lineno"> 560</span>  <span class="comment">// Print entries for any particles that lie outside the block's</span></div>
<div class="line"><a name="l00568"></a><span class="lineno"> 568</span> <span class="comment">/** Creates particles within an image block that is aligned with the primary</span></div>
<div class="line"><a name="l00569"></a><span class="lineno"> 569</span> <span class="comment"> * domain in the z axis. In this case, the image block may be comprised of</span></div>
<div class="line"><a name="l00570"></a><span class="lineno"> 570</span> <span class="comment"> * particles from two primary blocks. The routine considers these two primary</span></div>
<div class="line"><a name="l00571"></a><span class="lineno"> 571</span> <span class="comment"> * blocks, and adds the needed particles to the image. The remaining particles</span></div>
<div class="line"><a name="l00572"></a><span class="lineno"> 572</span> <span class="comment"> * from the primary blocks are also filled into the neighboring images.</span></div>
<div class="line"><a name="l00573"></a><span class="lineno"> 573</span> <span class="comment"> * \param[in] (di,dj,dk) the index of the block to consider. The z index must</span></div>
<div class="line"><a name="l00614"></a><span class="lineno"> 614</span>  <span class="comment">// All contributions to the block now added, so set both two bits of</span></div>
<div class="line"><a name="l00615"></a><span class="lineno"> 615</span>  <span class="comment">// the image information</span></div>
<div class="line"><a name="l00619"></a><span class="lineno"> 619</span> <span class="comment">/** Creates particles within an image block that is not aligned with the</span></div>
<div class="line"><a name="l00620"></a><span class="lineno"> 620</span> <span class="comment"> * primary domain in the z axis. In this case, the image block may be comprised</span></div>
<div class="line"><a name="l00621"></a><span class="lineno"> 621</span> <span class="comment"> * of particles from four primary blocks. The routine considers these four</span></div>
<div class="line"><a name="l00622"></a><span class="lineno"> 622</span> <span class="comment"> * primary blocks, and adds the needed particles to the image. The remaining</span></div>
<div class="line"><a name="l00623"></a><span class="lineno"> 623</span> <span class="comment"> * particles from the primary blocks are also filled into the neighboring</span></div>
<div class="line"><a name="l00625"></a><span class="lineno"> 625</span> <span class="comment"> * \param[in] (di,dj,dk) the index of the block to consider. The z index must</span></div>
<div class="line"><a name="l00686"></a><span class="lineno"> 686</span>  <span class="comment">// Recomputation of some intermediate quantities for boundary cases</span></div>
<div class="line"><a name="l00747"></a><span class="lineno"> 747</span>  <span class="comment">// All contributions to the block now added, so set all four bits of</span></div>
<div class="line"><a name="l00748"></a><span class="lineno"> 748</span>  <span class="comment">// the image information</span></div>
<div class="line"><a name="l00752"></a><span class="lineno"> 752</span> <span class="comment">/** Copies a particle position from the primary domain into an image block.</span></div>
<div class="line"><a name="l00753"></a><span class="lineno"> 753</span> <span class="comment"> * \param[in] reg the block index within the primary domain that the particle</span></div>
<div class="line"><a name="l00754"></a><span class="lineno"> 754</span> <span class="comment"> * is within.</span></div>
<div class="line"><a name="l00755"></a><span class="lineno"> 755</span> <span class="comment"> * \param[in] fijk the index of the image block.</span></div>
<div class="line"><a name="l00756"></a><span class="lineno"> 756</span> <span class="comment"> * \param[in] l the index of the particle entry within the primary block.</span></div>
<div class="line"><a name="l00757"></a><span class="lineno"> 757</span> <span class="comment"> * \param[in] (dx,dy,dz) the displacement vector to add to the particle. */</span></div>