<ahref="pre__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 pre_container and related classes.</span></div>
<divclass="line"><aname="l00013"></a><spanclass="lineno"> 13</span> <spanclass="preprocessor">#include "<aclass="code"href="config_8hh.html"title="Master configuration file for setting various compile-time options.">config.hh</a>"</span></div>
<divclass="line"><aname="l00014"></a><spanclass="lineno"> 14</span> <spanclass="preprocessor">#include "<aclass="code"href="pre__container_8hh.html"title="Header file for the pre_container and related classes.">pre_container.hh</a>"</span></div>
<divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment">/** The class constructor sets up the geometry of container, initializing the</span></div>
<divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment"> * minimum and maximum coordinates in each direction. It allocates an initial</span></div>
<divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment"> * chunk into which to store particle information.</span></div>
<divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment"> * \param[in] (ax_,bx_) the minimum and maximum x coordinates.</span></div>
<divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> <spanclass="comment"> * \param[in] (ay_,by_) the minimum and maximum y coordinates.</span></div>
<divclass="line"><aname="l00023"></a><spanclass="lineno"> 23</span> <spanclass="comment"> * \param[in] (az_,bz_) the minimum and maximum z coordinates.</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="l00040"></a><spanclass="lineno"> 40</span> <spanclass="comment">/** The destructor frees the dynamically allocated memory. */</span></div>
<divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span> <spanclass="comment">/** Makes a guess at the optimal grid of blocks to use, computing in</span></div>
<divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span> <spanclass="comment"> * a way that</span></div>
<divclass="line"><aname="l00056"></a><spanclass="lineno"> 56</span> <spanclass="comment"> * \param[out] (nx,ny,nz) the number of blocks to use. */</span></div>
<divclass="line"><aname="l00065"></a><spanclass="lineno"> 65</span> <spanclass="comment">/** Stores a particle ID and position, allocating a new memory chunk if</span></div>
<divclass="line"><aname="l00066"></a><spanclass="lineno"> 66</span> <spanclass="comment"> * necessary. For coordinate directions in which the container is not periodic,</span></div>
<divclass="line"><aname="l00067"></a><spanclass="lineno"> 67</span> <spanclass="comment"> * the routine checks to make sure that the particle is within the container</span></div>
<divclass="line"><aname="l00068"></a><spanclass="lineno"> 68</span> <spanclass="comment"> * bounds. If the particle is out of bounds, it is not stored.</span></div>
<divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> <spanclass="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<divclass="line"><aname="l00070"></a><spanclass="lineno"> 70</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector of the inserted particle. */</span></div>
<divclass="line"><aname="l00082"></a><spanclass="lineno"> 82</span> <spanclass="comment">/** Stores a particle ID and position, allocating a new memory chunk if necessary.</span></div>
<divclass="line"><aname="l00083"></a><spanclass="lineno"> 83</span> <spanclass="comment"> * \param[in] n the numerical ID of the inserted particle.</span></div>
<divclass="line"><aname="l00084"></a><spanclass="lineno"> 84</span> <spanclass="comment"> * \param[in] (x,y,z) the position vector of the inserted particle.</span></div>
<divclass="line"><aname="l00085"></a><spanclass="lineno"> 85</span> <spanclass="comment"> * \param[in] r the radius of the particle. */</span></div>
<divclass="line"><aname="l00097"></a><spanclass="lineno"> 97</span> <spanclass="comment">/** Transfers the particles stored within the class to a container class.</span></div>
<divclass="line"><aname="l00098"></a><spanclass="lineno"> 98</span> <spanclass="comment"> * \param[in] con the container class to transfer to. */</span></div>
<divclass="line"><aname="l00099"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1pre__container.html#a7a2e73ad34fbfe1001f59ea3b69f992f"> 99</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1pre__container.html#a7a2e73ad34fbfe1001f59ea3b69f992f">pre_container::setup</a>(<aclass="code"href="classvoro_1_1container.html"title="Extension of the container_base class for computing regular Voronoi tessellations.">container</a>&con) {</div>
<divclass="line"><aname="l00118"></a><spanclass="lineno"> 118</span> <spanclass="comment">/** Transfers the particles stored within the class to a container_poly class.</span></div>
<divclass="line"><aname="l00119"></a><spanclass="lineno"> 119</span> <spanclass="comment"> * \param[in] con the container_poly class to transfer to. */</span></div>
<divclass="line"><aname="l00120"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1pre__container__poly.html#ac71c0ee24182a115ce79da4cc91ee356"> 120</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1pre__container__poly.html#ac71c0ee24182a115ce79da4cc91ee356">pre_container_poly::setup</a>(<aclass="code"href="classvoro_1_1container__poly.html"title="Extension of the container_base class for computing radical Voronoi tessellations.">container_poly</a>&con) {</div>
<divclass="line"><aname="l00139"></a><spanclass="lineno"> 139</span> <spanclass="comment">/** Transfers the particles stored within the class to a container class, also</span></div>
<divclass="line"><aname="l00140"></a><spanclass="lineno"> 140</span> <spanclass="comment"> * recording the order in which particles were stored.</span></div>
<divclass="line"><aname="l00141"></a><spanclass="lineno"> 141</span> <spanclass="comment"> * \param[in] vo the ordering class to use.</span></div>
<divclass="line"><aname="l00142"></a><spanclass="lineno"> 142</span> <spanclass="comment"> * \param[in] con the container class to transfer to. */</span></div>
<divclass="line"><aname="l00143"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1pre__container.html#a81aae000e3b787c58deef7a8f197bdc3"> 143</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1pre__container.html#a7a2e73ad34fbfe1001f59ea3b69f992f">pre_container::setup</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,<aclass="code"href="classvoro_1_1container.html"title="Extension of the container_base class for computing regular Voronoi tessellations.">container</a>&con) {</div>
<divclass="line"><aname="l00162"></a><spanclass="lineno"> 162</span> <spanclass="comment">/** Transfers the particles stored within the class to a container_poly class,</span></div>
<divclass="line"><aname="l00163"></a><spanclass="lineno"> 163</span> <spanclass="comment"> * also recording the order in which particles were stored.</span></div>
<divclass="line"><aname="l00164"></a><spanclass="lineno"> 164</span> <spanclass="comment"> * \param[in] vo the ordering class to use.</span></div>
<divclass="line"><aname="l00165"></a><spanclass="lineno"> 165</span> <spanclass="comment"> * \param[in] con the container_poly class to transfer to. */</span></div>
<divclass="line"><aname="l00166"></a><spanclass="lineno"><aclass="code"href="classvoro_1_1pre__container__poly.html#ac18d16204c7769ec554d14f84b6517f0"> 166</a></span> <spanclass="keywordtype">void</span><aclass="code"href="classvoro_1_1pre__container__poly.html#ac71c0ee24182a115ce79da4cc91ee356">pre_container_poly::setup</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,<aclass="code"href="classvoro_1_1container__poly.html"title="Extension of the container_base class for computing radical Voronoi tessellations.">container_poly</a>&con) {</div>
<divclass="line"><aname="l00185"></a><spanclass="lineno"> 185</span> <spanclass="comment">/** Import a list of particles from an open file stream into the container.</span></div>
<divclass="line"><aname="l00186"></a><spanclass="lineno"> 186</span> <spanclass="comment"> * Entries of four numbers (Particle ID, x position, y position, z position)</span></div>
<divclass="line"><aname="l00187"></a><spanclass="lineno"> 187</span> <spanclass="comment"> * are searched for. If the file cannot be successfully read, then the routine</span></div>
<divclass="line"><aname="l00188"></a><spanclass="lineno"> 188</span> <spanclass="comment"> * causes a fatal error.</span></div>
<divclass="line"><aname="l00189"></a><spanclass="lineno"> 189</span> <spanclass="comment"> * \param[in] fp the file handle to read from. */</span></div>
<divclass="line"><aname="l00197"></a><spanclass="lineno"> 197</span> <spanclass="comment">/** Import a list of particles from an open file stream, also storing the order</span></div>
<divclass="line"><aname="l00198"></a><spanclass="lineno"> 198</span> <spanclass="comment"> * of that the particles are read. Entries of four numbers (Particle ID, x</span></div>
<divclass="line"><aname="l00199"></a><spanclass="lineno"> 199</span> <spanclass="comment"> * position, y position, z position) are searched for. If the file cannot be</span></div>
<divclass="line"><aname="l00200"></a><spanclass="lineno"> 200</span> <spanclass="comment"> * successfully read, then the routine causes a fatal error.</span></div>
<divclass="line"><aname="l00201"></a><spanclass="lineno"> 201</span> <spanclass="comment"> * \param[in] fp the file handle to read from. */</span></div>
<divclass="line"><aname="l00209"></a><spanclass="lineno"> 209</span> <spanclass="comment">/** Allocates a new chunk of memory for storing particles. */</span></div>
<divclass="line"><aname="l00222"></a><spanclass="lineno"> 222</span>  voro_fatal_error(<spanclass="stringliteral">"Absolute memory limit on chunk index reached"</span>,<aclass="code"href="config_8hh.html#a5dc0616f8a67ae3d1c2ba8a3dcf5612b">VOROPP_MEMORY_ERROR</a>);</div>
<divclass="line"><aname="l00224"></a><spanclass="lineno"> 224</span> <spanclass="preprocessor"></span> fprintf(stderr,<spanclass="stringliteral">"Pre-container chunk index scaled up to %d\n"</span>,<aclass="code"href="classvoro_1_1pre__container__base.html#a9ae49ab1c51dc851e7ddf3035b719a6b">index_sz</a>);</div>