<ahref="container_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 and related classes. */</span></div>
<divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="preprocessor">#include "<aclass="code"href="container_8hh.html"title="Header file for the container_base and related classes.">container.hh</a>"</span></div>
<divclass="line"><aname="l00014"></a><spanclass="lineno"> 14</span> <spanclass="comment">/** The class constructor sets up the geometry of container, initializing the</span></div>
<divclass="line"><aname="l00015"></a><spanclass="lineno"> 15</span> <spanclass="comment"> * minimum and maximum coordinates in each direction, and setting whether each</span></div>
<divclass="line"><aname="l00016"></a><spanclass="lineno"> 16</span> <spanclass="comment"> * direction is periodic or not. It divides the container into a rectangular</span></div>
<divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="comment"> * grid of blocks, and allocates memory for each of these for storing particle</span></div>
<divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment"> * positions and IDs.</span></div>
<divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment"> * \param[in] (ax_,bx_) the minimum and maximum x coordinates.</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment"> * \param[in] (ay_,by_) the minimum and maximum y coordinates.</span></div>
<divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment"> * \param[in] (az_,bz_) the minimum and maximum z coordinates.</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment"> * \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three</span></div>
<divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="comment"> * \param[in] init_mem the initial memory allocation for each block.</span></div>
<divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> <spanclass="comment"> * \param[in] ps_ the number of floating point entries to store for each</span></div>
<divclass="line"><aname="l00032"></a><spanclass="lineno"> 32</span>  : <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_-ax_)/nx_,(by_-ay_)/ny_,(bz_-az_)/nz_),</div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment">/** The class constructor sets up the geometry of container.</span></div>
<divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span> <spanclass="comment"> * \param[in] (ax_,bx_) the minimum and maximum x coordinates.</span></div>
<divclass="line"><aname="l00056"></a><spanclass="lineno"> 56</span> <spanclass="comment"> * \param[in] (ay_,by_) the minimum and maximum y coordinates.</span></div>
<divclass="line"><aname="l00057"></a><spanclass="lineno"> 57</span> <spanclass="comment"> * \param[in] (az_,bz_) the minimum and maximum z coordinates.</span></div>
<divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span> <spanclass="comment"> * \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three</span></div>
<divclass="line"><aname="l00063"></a><spanclass="lineno"> 63</span> <spanclass="comment"> * \param[in] init_mem the initial memory allocation for each block. */</span></div>
<divclass="line"><aname="l00066"></a><spanclass="lineno"> 66</span>  : <aclass="code"href="classvoro_1_1container__base.html"title="Class for representing a particle system in a three-dimensional rectangular box.">container_base</a>(ax_,bx_,ay_,by_,az_,bz_,nx_,ny_,nz_,xperiodic_,yperiodic_,zperiodic_,init_mem,3),</div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> <spanclass="comment">/** The class constructor sets up the geometry of container.</span></div>
<divclass="line"><aname="l00070"></a><spanclass="lineno"> 70</span> <spanclass="comment"> * \param[in] (ax_,bx_) the minimum and maximum x coordinates.</span></div>
<divclass="line"><aname="l00071"></a><spanclass="lineno"> 71</span> <spanclass="comment"> * \param[in] (ay_,by_) the minimum and maximum y coordinates.</span></div>
<divclass="line"><aname="l00072"></a><spanclass="lineno"> 72</span> <spanclass="comment"> * \param[in] (az_,bz_) the minimum and maximum z coordinates.</span></div>
<divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> <spanclass="comment"> * \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three</span></div>
<divclass="line"><aname="l00078"></a><spanclass="lineno"> 78</span> <spanclass="comment"> * \param[in] init_mem the initial memory allocation for each block. */</span></div>
<divclass="line"><aname="l00081"></a><spanclass="lineno"> 81</span>  : <aclass="code"href="classvoro_1_1container__base.html"title="Class for representing a particle system in a three-dimensional rectangular box.">container_base</a>(ax_,bx_,ay_,by_,az_,bz_,nx_,ny_,nz_,xperiodic_,yperiodic_,zperiodic_,init_mem,4),</div>
<divclass="line"><aname="l00084"></a><spanclass="lineno"> 84</span> <spanclass="comment">/** Put a particle into the correct region of the container.</span></div>
<divclass="line"><aname="l00085"></a><spanclass="lineno"> 85</span> <spanclass="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<divclass="line"><aname="l00086"></a><spanclass="lineno"> 86</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector of the inserted particle. */</span></div>
<divclass="line"><aname="l00096"></a><spanclass="lineno"> 96</span> <spanclass="comment">/** Put a particle into the correct region of the container.</span></div>
<divclass="line"><aname="l00097"></a><spanclass="lineno"> 97</span> <spanclass="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<divclass="line"><aname="l00098"></a><spanclass="lineno"> 98</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"> 99</span> <spanclass="comment"> * \param[in] r the radius of the particle. */</span></div>
<divclass="line"><aname="l00110"></a><spanclass="lineno"> 110</span> <spanclass="comment">/** Put a particle into the correct region of the container, also recording</span></div>
<divclass="line"><aname="l00111"></a><spanclass="lineno"> 111</span> <spanclass="comment"> * into which region it was stored.</span></div>
<divclass="line"><aname="l00112"></a><spanclass="lineno"> 112</span> <spanclass="comment"> * \param[in] vo the ordering class in which to record the region.</span></div>
<divclass="line"><aname="l00113"></a><spanclass="lineno"> 113</span> <spanclass="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<divclass="line"><aname="l00114"></a><spanclass="lineno"> 114</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector of the inserted particle. */</span></div>
<divclass="line"><aname="l00115"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1container.html#a6e4a48cc9c31557457213923254fdda3"> 115</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1container.html#a5c67c9998e4f174fb217967dcb41c7f3">container::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="l00125"></a><spanclass="lineno"> 125</span> <spanclass="comment">/** Put a particle into the correct region of the container, also recording</span></div>
<divclass="line"><aname="l00126"></a><spanclass="lineno"> 126</span> <spanclass="comment"> * into which region it was stored.</span></div>
<divclass="line"><aname="l00127"></a><spanclass="lineno"> 127</span> <spanclass="comment"> * \param[in] vo the ordering class in which to record the region.</span></div>
<divclass="line"><aname="l00128"></a><spanclass="lineno"> 128</span> <spanclass="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<divclass="line"><aname="l00129"></a><spanclass="lineno"> 129</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<divclass="line"><aname="l00130"></a><spanclass="lineno"> 130</span> <spanclass="comment"> * \param[in] r the radius of the particle. */</span></div>
<divclass="line"><aname="l00131"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1container__poly.html#aa0c81a2be68ed2a8b799ad7682c9b853"> 131</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1container__poly.html#a61689312fb6f8ee36f1fbb0fe00e4fe3">container_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="l00142"></a><spanclass="lineno"> 142</span> <spanclass="comment">/** This routine takes a particle position vector, tries to remap it into the</span></div>
<divclass="line"><aname="l00143"></a><spanclass="lineno"> 143</span> <spanclass="comment"> * primary domain. If successful, it computes the region into which it can be</span></div>
<divclass="line"><aname="l00144"></a><spanclass="lineno"> 144</span> <spanclass="comment"> * stored and checks that there is enough memory within this region to store</span></div>
<divclass="line"><aname="l00146"></a><spanclass="lineno"> 146</span> <spanclass="comment"> * \param[out] ijk the region index.</span></div>
<divclass="line"><aname="l00147"></a><spanclass="lineno"> 147</span> <spanclass="comment"> * \param[in,out] (x,y,z) the particle position, remapped into the primary</span></div>
<divclass="line"><aname="l00148"></a><spanclass="lineno"> 148</span> <spanclass="comment"> * domain if necessary.</span></div>
<divclass="line"><aname="l00149"></a><spanclass="lineno"> 149</span> <spanclass="comment"> * \return True if the particle can be successfully placed into the container,</span></div>
<divclass="line"><aname="l00162"></a><spanclass="lineno"> 162</span> <spanclass="comment">/** Takes a particle position vector and computes the region index into which</span></div>
<divclass="line"><aname="l00163"></a><spanclass="lineno"> 163</span> <spanclass="comment"> * it should be stored. If the container is periodic, then the routine also</span></div>
<divclass="line"><aname="l00164"></a><spanclass="lineno"> 164</span> <spanclass="comment"> * maps the particle position to ensure it is in the primary domain. If the</span></div>
<divclass="line"><aname="l00165"></a><spanclass="lineno"> 165</span> <spanclass="comment"> * container is not periodic, the routine bails out.</span></div>
<divclass="line"><aname="l00166"></a><spanclass="lineno"> 166</span> <spanclass="comment"> * \param[out] ijk the region index.</span></div>
<divclass="line"><aname="l00167"></a><spanclass="lineno"> 167</span> <spanclass="comment"> * \param[in,out] (x,y,z) the particle position, remapped into the primary</span></div>
<divclass="line"><aname="l00168"></a><spanclass="lineno"> 168</span> <spanclass="comment"> * domain if necessary.</span></div>
<divclass="line"><aname="l00169"></a><spanclass="lineno"> 169</span> <spanclass="comment"> * \return True if the particle can be successfully placed into the container,</span></div>
<divclass="line"><aname="l00190"></a><spanclass="lineno"> 190</span> <spanclass="comment">/** Takes a position vector and attempts to remap it into the primary domain.</span></div>
<divclass="line"><aname="l00191"></a><spanclass="lineno"> 191</span> <spanclass="comment"> * \param[out] (ai,aj,ak) the periodic image displacement that the vector is in,</span></div>
<divclass="line"><aname="l00192"></a><spanclass="lineno"> 192</span> <spanclass="comment"> * with (0,0,0) corresponding to the primary domain.</span></div>
<divclass="line"><aname="l00193"></a><spanclass="lineno"> 193</span> <spanclass="comment"> * \param[out] (ci,cj,ck) the index of the block that the position vector is</span></div>
<divclass="line"><aname="l00194"></a><spanclass="lineno"> 194</span> <spanclass="comment"> * within, once it has been remapped.</span></div>
<divclass="line"><aname="l00195"></a><spanclass="lineno"> 195</span> <spanclass="comment"> * \param[in,out] (x,y,z) the position vector to consider, which is remapped</span></div>
<divclass="line"><aname="l00196"></a><spanclass="lineno"> 196</span> <spanclass="comment"> * into the primary domain during the routine.</span></div>
<divclass="line"><aname="l00197"></a><spanclass="lineno"> 197</span> <spanclass="comment"> * \param[out] ijk the block index that the vector is within.</span></div>
<divclass="line"><aname="l00198"></a><spanclass="lineno"> 198</span> <spanclass="comment"> * \return True if the particle is within the container or can be remapped into</span></div>
<divclass="line"><aname="l00199"></a><spanclass="lineno"> 199</span> <spanclass="comment"> * it, false if it lies outside of the container bounds. */</span></div>
<divclass="line"><aname="l00223"></a><spanclass="lineno"> 223</span> <spanclass="comment">/** Takes a vector and finds the particle whose Voronoi cell contains that</span></div>
<divclass="line"><aname="l00224"></a><spanclass="lineno"> 224</span> <spanclass="comment"> * vector. This is equivalent to finding the particle which is nearest to the</span></div>
<divclass="line"><aname="l00225"></a><spanclass="lineno"> 225</span> <spanclass="comment"> * vector. Additional wall classes are not considered by this routine.</span></div>
<divclass="line"><aname="l00226"></a><spanclass="lineno"> 226</span> <spanclass="comment"> * \param[in] (x,y,z) the vector to test.</span></div>
<divclass="line"><aname="l00227"></a><spanclass="lineno"> 227</span> <spanclass="comment"> * \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell</span></div>
<divclass="line"><aname="l00228"></a><spanclass="lineno"> 228</span> <spanclass="comment"> * contains the vector. If the container is periodic,</span></div>
<divclass="line"><aname="l00229"></a><spanclass="lineno"> 229</span> <spanclass="comment"> * this may point to a particle in a periodic image of</span></div>
<divclass="line"><aname="l00230"></a><spanclass="lineno"> 230</span> <spanclass="comment"> * the primary domain.</span></div>
<divclass="line"><aname="l00231"></a><spanclass="lineno"> 231</span> <spanclass="comment"> * \param[out] pid the ID of the particle.</span></div>
<divclass="line"><aname="l00232"></a><spanclass="lineno"> 232</span> <spanclass="comment"> * \return True if a particle was found. If the container has no particles,</span></div>
<divclass="line"><aname="l00233"></a><spanclass="lineno"> 233</span> <spanclass="comment"> * then the search will not find a Voronoi cell and false is returned. */</span></div>
<divclass="line"><aname="l00236"></a><spanclass="lineno"> 236</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="l00239"></a><spanclass="lineno"> 239</span> <spanclass="comment">// If the given vector lies outside the domain, but the container</span></div>
<divclass="line"><aname="l00240"></a><spanclass="lineno"> 240</span> <spanclass="comment">// is periodic, then remap it back into the domain</span></div>
<divclass="line"><aname="l00246"></a><spanclass="lineno"> 246</span> <spanclass="comment">// Assemble the position vector of the particle to be returned,</span></div>
<divclass="line"><aname="l00247"></a><spanclass="lineno"> 247</span> <spanclass="comment">// applying a periodic remapping if necessary</span></div>
<divclass="line"><aname="l00258"></a><spanclass="lineno"> 258</span> <spanclass="comment">// If no particle if found then just return false</span></div>
<divclass="line"><aname="l00262"></a><spanclass="lineno"> 262</span> <spanclass="comment">/** Takes a vector and finds the particle whose Voronoi cell contains that</span></div>
<divclass="line"><aname="l00263"></a><spanclass="lineno"> 263</span> <spanclass="comment"> * vector. Additional wall classes are not considered by this routine.</span></div>
<divclass="line"><aname="l00264"></a><spanclass="lineno"> 264</span> <spanclass="comment"> * \param[in] (x,y,z) the vector to test.</span></div>
<divclass="line"><aname="l00265"></a><spanclass="lineno"> 265</span> <spanclass="comment"> * \param[out] (rx,ry,rz) the position of the particle whose Voronoi cell</span></div>
<divclass="line"><aname="l00266"></a><spanclass="lineno"> 266</span> <spanclass="comment"> * contains the vector. If the container is periodic,</span></div>
<divclass="line"><aname="l00267"></a><spanclass="lineno"> 267</span> <spanclass="comment"> * this may point to a particle in a periodic image of</span></div>
<divclass="line"><aname="l00268"></a><spanclass="lineno"> 268</span> <spanclass="comment"> * the primary domain.</span></div>
<divclass="line"><aname="l00269"></a><spanclass="lineno"> 269</span> <spanclass="comment"> * \param[out] pid the ID of the particle.</span></div>
<divclass="line"><aname="l00270"></a><spanclass="lineno"> 270</span> <spanclass="comment"> * \return True if a particle was found. If the container has no particles,</span></div>
<divclass="line"><aname="l00271"></a><spanclass="lineno"> 271</span> <spanclass="comment"> * then the search will not find a Voronoi cell and false is returned. */</span></div>
<divclass="line"><aname="l00274"></a><spanclass="lineno"> 274</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="l00277"></a><spanclass="lineno"> 277</span> <spanclass="comment">// If the given vector lies outside the domain, but the container</span></div>
<divclass="line"><aname="l00278"></a><spanclass="lineno"> 278</span> <spanclass="comment">// is periodic, then remap it back into the domain</span></div>
<divclass="line"><aname="l00284"></a><spanclass="lineno"> 284</span> <spanclass="comment">// Assemble the position vector of the particle to be returned,</span></div>
<divclass="line"><aname="l00285"></a><spanclass="lineno"> 285</span> <spanclass="comment">// applying a periodic remapping if necessary</span></div>
<divclass="line"><aname="l00296"></a><spanclass="lineno"> 296</span> <spanclass="comment">// If no particle if found then just return false</span></div>
<divclass="line"><aname="l00300"></a><spanclass="lineno"> 300</span> <spanclass="comment">/** Increase memory for a particular region.</span></div>
<divclass="line"><aname="l00301"></a><spanclass="lineno"> 301</span> <spanclass="comment"> * \param[in] i the index of the region to reallocate. */</span></div>
<divclass="line"><aname="l00305"></a><spanclass="lineno"> 305</span> <spanclass="comment">// Carry out a check on the memory allocation size, and</span></div>
<divclass="line"><aname="l00306"></a><spanclass="lineno"> 306</span> <spanclass="comment">// print a status message if requested</span></div>
<divclass="line"><aname="l00310"></a><spanclass="lineno"> 310</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="l00313"></a><spanclass="lineno"> 313</span> <spanclass="comment">// Allocate new memory and copy in the contents of the old arrays</span></div>
<divclass="line"><aname="l00325"></a><spanclass="lineno"> 325</span> <spanclass="comment">/** Import a list of particles from an open file stream into the container.</span></div>
<divclass="line"><aname="l00326"></a><spanclass="lineno"> 326</span> <spanclass="comment"> * Entries of four numbers (Particle ID, x position, y position, z position)</span></div>
<divclass="line"><aname="l00327"></a><spanclass="lineno"> 327</span> <spanclass="comment"> * are searched for. If the file cannot be successfully read, then the routine</span></div>
<divclass="line"><aname="l00328"></a><spanclass="lineno"> 328</span> <spanclass="comment"> * causes a fatal error.</span></div>
<divclass="line"><aname="l00329"></a><spanclass="lineno"> 329</span> <spanclass="comment"> * \param[in] fp the file handle to read from. */</span></div>
<divclass="line"><aname="l00337"></a><spanclass="lineno"> 337</span> <spanclass="comment">/** Import a list of particles from an open file stream, also storing the order</span></div>
<divclass="line"><aname="l00338"></a><spanclass="lineno"> 338</span> <spanclass="comment"> * of that the particles are read. Entries of four numbers (Particle ID, x</span></div>
<divclass="line"><aname="l00339"></a><spanclass="lineno"> 339</span> <spanclass="comment"> * position, y position, z position) are searched for. If the file cannot be</span></div>
<divclass="line"><aname="l00340"></a><spanclass="lineno"> 340</span> <spanclass="comment"> * successfully read, then the routine causes a fatal error.</span></div>
<divclass="line"><aname="l00341"></a><spanclass="lineno"> 341</span> <spanclass="comment"> * \param[in,out] vo a reference to an ordering class to use.</span></div>
<divclass="line"><aname="l00342"></a><spanclass="lineno"> 342</span> <spanclass="comment"> * \param[in] fp the file handle to read from. */</span></div>
<divclass="line"><aname="l00343"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1container.html#a7b3aa6219cfb0fd538839aeeae4457cc"> 343</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1container.html#a1e4fe0c7b59c93cdd3f965c59dbb2f66">container::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="l00350"></a><spanclass="lineno"> 350</span> <spanclass="comment">/** Import a list of particles from an open file stream into the container.</span></div>
<divclass="line"><aname="l00351"></a><spanclass="lineno"> 351</span> <spanclass="comment"> * Entries of five numbers (Particle ID, x position, y position, z position,</span></div>
<divclass="line"><aname="l00352"></a><spanclass="lineno"> 352</span> <spanclass="comment"> * radius) are searched for. If the file cannot be successfully read, then the</span></div>
<divclass="line"><aname="l00353"></a><spanclass="lineno"> 353</span> <spanclass="comment"> * routine causes a fatal error.</span></div>
<divclass="line"><aname="l00354"></a><spanclass="lineno"> 354</span> <spanclass="comment"> * \param[in] fp the file handle to read from. */</span></div>
<divclass="line"><aname="l00362"></a><spanclass="lineno"> 362</span> <spanclass="comment">/** Import a list of particles from an open file stream, also storing the order</span></div>
<divclass="line"><aname="l00363"></a><spanclass="lineno"> 363</span> <spanclass="comment"> * of that the particles are read. Entries of four numbers (Particle ID, x</span></div>
<divclass="line"><aname="l00364"></a><spanclass="lineno"> 364</span> <spanclass="comment"> * position, y position, z position, radius) are searched for. If the file</span></div>
<divclass="line"><aname="l00365"></a><spanclass="lineno"> 365</span> <spanclass="comment"> * cannot be successfully read, then the routine causes a fatal error.</span></div>
<divclass="line"><aname="l00366"></a><spanclass="lineno"> 366</span> <spanclass="comment"> * \param[in,out] vo a reference to an ordering class to use.</span></div>
<divclass="line"><aname="l00367"></a><spanclass="lineno"> 367</span> <spanclass="comment"> * \param[in] fp the file handle to read from. */</span></div>
<divclass="line"><aname="l00368"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1container__poly.html#aecedca4f256e9382d54efb805877c68f"> 368</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1container__poly.html#a65ddee05ee3b3677c7a48f67ce64a1d5">container_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="l00375"></a><spanclass="lineno"> 375</span> <spanclass="comment">/** Outputs the a list of all the container regions along with the number of</span></div>
<divclass="line"><aname="l00376"></a><spanclass="lineno"> 376</span> <spanclass="comment"> * particles stored within each. */</span></div>
<divclass="line"><aname="l00388"></a><spanclass="lineno"> 388</span> <spanclass="comment">/** Clears a container of particles, also clearing resetting the maximum radius</span></div>
<divclass="line"><aname="l00389"></a><spanclass="lineno"> 389</span> <spanclass="comment"> * to zero. */</span></div>
<divclass="line"><aname="l00395"></a><spanclass="lineno"> 395</span> <spanclass="comment">/** Computes all the Voronoi cells and saves customized information about them.</span></div>
<divclass="line"><aname="l00396"></a><spanclass="lineno"> 396</span> <spanclass="comment"> * \param[in] format the custom output string to use.</span></div>
<divclass="line"><aname="l00397"></a><spanclass="lineno"> 397</span> <spanclass="comment"> * \param[in] fp a file handle to write to. */</span></div>
<divclass="line"><aname="l00399"></a><spanclass="lineno"> 399</span> <aclass="code"href="classvoro_1_1c__loop__all.html"title="Class for looping over all of the particles in a container.">c_loop_all</a> vl(*<spanclass="keyword">this</span>);</div>
<divclass="line"><aname="l00403"></a><spanclass="lineno"> 403</span> <spanclass="comment">/** Computes all the Voronoi cells and saves customized</span></div>
<divclass="line"><aname="l00404"></a><spanclass="lineno"> 404</span> <spanclass="comment"> * information about them.</span></div>
<divclass="line"><aname="l00405"></a><spanclass="lineno"> 405</span> <spanclass="comment"> * \param[in] format the custom output string to use.</span></div>
<divclass="line"><aname="l00406"></a><spanclass="lineno"> 406</span> <spanclass="comment"> * \param[in] fp a file handle to write to. */</span></div>
<divclass="line"><aname="l00408"></a><spanclass="lineno"> 408</span> <aclass="code"href="classvoro_1_1c__loop__all.html"title="Class for looping over all of the particles in a container.">c_loop_all</a> vl(*<spanclass="keyword">this</span>);</div>
<divclass="line"><aname="l00412"></a><spanclass="lineno"> 412</span> <spanclass="comment">/** Computes all the Voronoi cells and saves customized information about them.</span></div>
<divclass="line"><aname="l00413"></a><spanclass="lineno"> 413</span> <spanclass="comment"> * \param[in] format the custom output string to use.</span></div>
<divclass="line"><aname="l00414"></a><spanclass="lineno"> 414</span> <spanclass="comment"> * \param[in] filename the name of the file to write to. */</span></div>
<divclass="line"><aname="l00421"></a><spanclass="lineno"> 421</span> <spanclass="comment">/** Computes all the Voronoi cells and saves customized</span></div>
<divclass="line"><aname="l00422"></a><spanclass="lineno"> 422</span> <spanclass="comment"> * information about them</span></div>
<divclass="line"><aname="l00423"></a><spanclass="lineno"> 423</span> <spanclass="comment"> * \param[in] format the custom output string to use.</span></div>
<divclass="line"><aname="l00424"></a><spanclass="lineno"> 424</span> <spanclass="comment"> * \param[in] filename the name of the file to write to. */</span></div>
<divclass="line"><aname="l00431"></a><spanclass="lineno"> 431</span> <spanclass="comment">/** Computes all of the Voronoi cells in the container, but does nothing</span></div>
<divclass="line"><aname="l00432"></a><spanclass="lineno"> 432</span> <spanclass="comment"> * with the output. It is useful for measuring the pure computation time</span></div>
<divclass="line"><aname="l00433"></a><spanclass="lineno"> 433</span> <spanclass="comment"> * of the Voronoi algorithm, without any additional calculations such as</span></div>
<divclass="line"><aname="l00434"></a><spanclass="lineno"> 434</span> <spanclass="comment"> * volume evaluation or cell output. */</span></div>
<divclass="line"><aname="l00436"></a><spanclass="lineno"> 436</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="l00437"></a><spanclass="lineno"> 437</span> <aclass="code"href="classvoro_1_1c__loop__all.html"title="Class for looping over all of the particles in a container.">c_loop_all</a> vl(*<spanclass="keyword">this</span>);</div>
<divclass="line"><aname="l00442"></a><spanclass="lineno"> 442</span> <spanclass="comment">/** Computes all of the Voronoi cells in the container, but does nothing</span></div>
<divclass="line"><aname="l00443"></a><spanclass="lineno"> 443</span> <spanclass="comment"> * with the output. It is useful for measuring the pure computation time</span></div>
<divclass="line"><aname="l00444"></a><spanclass="lineno"> 444</span> <spanclass="comment"> * of the Voronoi algorithm, without any additional calculations such as</span></div>
<divclass="line"><aname="l00445"></a><spanclass="lineno"> 445</span> <spanclass="comment"> * volume evaluation or cell output. */</span></div>
<divclass="line"><aname="l00447"></a><spanclass="lineno"> 447</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="l00448"></a><spanclass="lineno"> 448</span> <aclass="code"href="classvoro_1_1c__loop__all.html"title="Class for looping over all of the particles in a container.">c_loop_all</a> vl(*<spanclass="keyword">this</span>);</div>
<divclass="line"><aname="l00452"></a><spanclass="lineno"> 452</span> <spanclass="comment">/** Calculates all of the Voronoi cells and sums their volumes. In most cases</span></div>
<divclass="line"><aname="l00453"></a><spanclass="lineno"> 453</span> <spanclass="comment"> * without walls, the sum of the Voronoi cell volumes should equal the volume</span></div>
<divclass="line"><aname="l00454"></a><spanclass="lineno"> 454</span> <spanclass="comment"> * of the container to numerical precision.</span></div>
<divclass="line"><aname="l00455"></a><spanclass="lineno"> 455</span> <spanclass="comment"> * \return The sum of all of the computed Voronoi volumes. */</span></div>
<divclass="line"><aname="l00457"></a><spanclass="lineno"> 457</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="l00459"></a><spanclass="lineno"> 459</span> <aclass="code"href="classvoro_1_1c__loop__all.html"title="Class for looping over all of the particles in a container.">c_loop_all</a> vl(*<spanclass="keyword">this</span>);</div>
<divclass="line"><aname="l00464"></a><spanclass="lineno"> 464</span> <spanclass="comment">/** Calculates all of the Voronoi cells and sums their volumes. In most cases</span></div>
<divclass="line"><aname="l00465"></a><spanclass="lineno"> 465</span> <spanclass="comment"> * without walls, the sum of the Voronoi cell volumes should equal the volume</span></div>
<divclass="line"><aname="l00466"></a><spanclass="lineno"> 466</span> <spanclass="comment"> * of the container to numerical precision.</span></div>
<divclass="line"><aname="l00467"></a><spanclass="lineno"> 467</span> <spanclass="comment"> * \return The sum of all of the computed Voronoi volumes. */</span></div>
<divclass="line"><aname="l00469"></a><spanclass="lineno"> 469</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="l00471"></a><spanclass="lineno"> 471</span> <aclass="code"href="classvoro_1_1c__loop__all.html"title="Class for looping over all of the particles in a container.">c_loop_all</a> vl(*<spanclass="keyword">this</span>);</div>
<divclass="line"><aname="l00476"></a><spanclass="lineno"> 476</span> <spanclass="comment">/** This function tests to see if a given vector lies within the container</span></div>
<divclass="line"><aname="l00477"></a><spanclass="lineno"> 477</span> <spanclass="comment"> * bounds and any walls.</span></div>
<divclass="line"><aname="l00478"></a><spanclass="lineno"> 478</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector to be tested.</span></div>
<divclass="line"><aname="l00479"></a><spanclass="lineno"> 479</span> <spanclass="comment"> * \return True if the point is inside the container, false if the point is</span></div>
<divclass="line"><aname="l00486"></a><spanclass="lineno"> 486</span> <spanclass="comment">/** Draws an outline of the domain in gnuplot format.</span></div>
<divclass="line"><aname="l00487"></a><spanclass="lineno"> 487</span> <spanclass="comment"> * \param[in] fp the file handle to write to. */</span></div>
<divclass="line"><aname="l00495"></a><spanclass="lineno"> 495</span> <spanclass="comment">/** Draws an outline of the domain in POV-Ray format.</span></div>
<divclass="line"><aname="l00496"></a><spanclass="lineno"> 496</span> <spanclass="comment"> * \param[in] fp the file handle to write to. */</span></div>
<divclass="line"><aname="l00517"></a><spanclass="lineno"> 517</span> <spanclass="comment">/** The wall_list constructor sets up an array of pointers to wall classes. */</span></div>
<divclass="line"><aname="l00518"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1wall__list.html#a248fb5d008de9a5a97d4720d47794698"> 518</a></span> <aclass="code"href="classvoro_1_1wall__list.html#a248fb5d008de9a5a97d4720d47794698">wall_list::wall_list</a>() : walls(new <aclass="code"href="classvoro_1_1wall.html"title="Pure virtual class from which wall objects are derived.">wall</a>*[init_wall_size]), wep(walls), wel(walls+init_wall_size),</div>
<divclass="line"><aname="l00521"></a><spanclass="lineno"> 521</span> <spanclass="comment">/** The wall_list destructor frees the array of pointers to the wall classes.</span></div>
<divclass="line"><aname="l00527"></a><spanclass="lineno"> 527</span> <spanclass="comment">/** Adds all of the walls on another wall_list to this class.</span></div>
<divclass="line"><aname="l00528"></a><spanclass="lineno"> 528</span> <spanclass="comment"> * \param[in] wl a reference to the wall class. */</span></div>
<divclass="line"><aname="l00529"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1wall__list.html#af872ae39e2bb8fe1e6947644a84cb1a8"> 529</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1wall__list.html#aca50327f246b61f6aeef5337327d957d">wall_list::add_wall</a>(<aclass="code"href="classvoro_1_1wall__list.html"title="A class for storing a list of pointers to walls.">wall_list</a>&wl) {</div>
<divclass="line"><aname="l00530"></a><spanclass="lineno"> 530</span> <spanclass="keywordflow">for</span>(<aclass="code"href="classvoro_1_1wall.html"title="Pure virtual class from which wall objects are derived.">wall</a> **wp=wl.<aclass="code"href="classvoro_1_1wall__list.html#abfc54768de5b596237d7eef5f589fe90">walls</a>;wp<wl.<aclass="code"href="classvoro_1_1wall__list.html#abb48a3e29042c51cf48fa6a6b6c2dc1d">wep</a>;wp++) <aclass="code"href="classvoro_1_1wall__list.html#aca50327f246b61f6aeef5337327d957d">add_wall</a>(*wp);</div>
<divclass="line"><aname="l00533"></a><spanclass="lineno"> 533</span> <spanclass="comment">/** Deallocates all of the wall classes pointed to by the wall_list. */</span></div>
<divclass="line"><aname="l00535"></a><spanclass="lineno"> 535</span> <spanclass="keywordflow">for</span>(<aclass="code"href="classvoro_1_1wall.html"title="Pure virtual class from which wall objects are derived.">wall</a> **wp=<aclass="code"href="classvoro_1_1wall__list.html#abfc54768de5b596237d7eef5f589fe90">walls</a>;wp<<aclass="code"href="classvoro_1_1wall__list.html#abb48a3e29042c51cf48fa6a6b6c2dc1d">wep</a>;wp++) <spanclass="keyword">delete</span> *wp;</div>
<divclass="line"><aname="l00538"></a><spanclass="lineno"> 538</span> <spanclass="comment">/** Increases the memory allocation for the walls array. */</span></div>
<divclass="line"><aname="l00543"></a><spanclass="lineno"> 543</span> <aclass="code"href="classvoro_1_1wall.html"title="Pure virtual class from which wall objects are derived.">wall</a> **nwalls=<spanclass="keyword">new</span><aclass="code"href="classvoro_1_1wall.html"title="Pure virtual class from which wall objects are derived.">wall</a>*[<aclass="code"href="classvoro_1_1wall__list.html#a8a06b6562bbf488ff30852cd1a548506">current_wall_size</a>],**nwp=nwalls,**wp=<aclass="code"href="classvoro_1_1wall__list.html#abfc54768de5b596237d7eef5f589fe90">walls</a>;</div>