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