#include <container.hh>
Public Member Functions | |
container_base (fpoint xa, fpoint xb, fpoint ya, fpoint yb, fpoint za, fpoint zb, int xn, int yn, int zn, bool xper, bool yper, bool zper, int memi) | |
~container_base () | |
void | draw_particles (const char *filename) |
void | draw_particles () |
void | draw_particles (ostream &os) |
void | draw_particles_pov (const char *filename) |
void | draw_particles_pov () |
void | draw_particles_pov (ostream &os) |
void | import (istream &is) |
void | import () |
void | import (const char *filename) |
void | region_count () |
void | clear () |
void | draw_cells_gnuplot (const char *filename, fpoint xmin, fpoint xmax, fpoint ymin, fpoint ymax, fpoint zmin, fpoint zmax) |
void | draw_cells_gnuplot (const char *filename) |
void | draw_cells_pov (const char *filename, fpoint xmin, fpoint xmax, fpoint ymin, fpoint ymax, fpoint zmin, fpoint zmax) |
void | draw_cells_pov (const char *filename) |
void | store_cell_volumes (fpoint *bb) |
fpoint | packing_fraction (fpoint *bb, fpoint cx, fpoint cy, fpoint cz, fpoint r) |
fpoint | packing_fraction (fpoint *bb, fpoint xmin, fpoint xmax, fpoint ymin, fpoint ymax, fpoint zmin, fpoint zmax) |
fpoint | sum_cell_volumes () |
void | compute_all_cells () |
void | count_all_faces (ostream &os) |
void | count_all_faces () |
void | count_all_faces (const char *filename) |
void | print_all (ostream &os) |
void | print_all () |
void | print_all (const char *filename) |
void | print_all_neighbor (ostream &os) |
void | print_all_neighbor () |
void | print_all_neighbor (const char *filename) |
template<class n_option > | |
bool | compute_cell_sphere (voronoicell_base< n_option > &c, int i, int j, int k, int ijk, int s) |
template<class n_option > | |
bool | compute_cell_sphere (voronoicell_base< n_option > &c, int i, int j, int k, int ijk, int s, fpoint x, fpoint y, fpoint z) |
template<class n_option > | |
bool | compute_cell (voronoicell_base< n_option > &c, int i, int j, int k, int ijk, int s) |
template<class n_option > | |
bool | compute_cell (voronoicell_base< n_option > &c, int i, int j, int k, int ijk, int s, fpoint x, fpoint y, fpoint z) |
void | put (int n, fpoint x, fpoint y, fpoint z) |
void | put (int n, fpoint x, fpoint y, fpoint z, fpoint r) |
void | add_wall (wall &w) |
bool | point_inside (fpoint x, fpoint y, fpoint z) |
bool | point_inside_walls (fpoint x, fpoint y, fpoint z) |
Protected Member Functions | |
template<class n_option > | |
void | print_all (ostream &os, voronoicell_base< n_option > &c) |
template<class n_option > | |
bool | initialize_voronoicell (voronoicell_base< n_option > &c, fpoint x, fpoint y, fpoint z) |
void | add_particle_memory (int i) |
void | add_list_memory () |
Protected Attributes | |
const fpoint | ax |
const fpoint | bx |
const fpoint | ay |
const fpoint | by |
const fpoint | az |
const fpoint | bz |
const fpoint | xsp |
const fpoint | ysp |
const fpoint | zsp |
const int | nx |
const int | ny |
const int | nz |
const int | nxy |
const int | nxyz |
const int | hx |
const int | hy |
const int | hz |
const int | hxy |
const int | hxyz |
const bool | xperiodic |
const bool | yperiodic |
const bool | zperiodic |
int * | co |
int * | mem |
int ** | id |
unsigned int * | mask |
int * | sl |
unsigned int | mv |
int | s_start |
int | s_end |
int | s_size |
fpoint ** | p |
wall ** | walls |
int | wall_number |
int | current_wall_size |
r_option | radius |
int | sz |
fpoint * | mrad |
Friends | |
class | voropp_loop |
class | radius_poly |
The container class represents the whole simulation region. The container constructor sets up the geometry and periodicity, and divides the geometry into rectangular grid of blocks, each of which handles the particles in a particular area. Routines exist for putting in particles, importing particles from standard input, and carrying out Voronoi calculations.
Definition at line 30 of file container.hh.
container_base< r_option >::container_base | ( | fpoint | xa, | |
fpoint | xb, | |||
fpoint | ya, | |||
fpoint | yb, | |||
fpoint | za, | |||
fpoint | zb, | |||
int | xn, | |||
int | yn, | |||
int | zn, | |||
bool | xper, | |||
bool | yper, | |||
bool | zper, | |||
int | memi | |||
) | [inline] |
Container constructor. The first six arguments set the corners of the box to be (xa,ya,za) and (xb,yb,zb). The box is then divided into an nx by ny by nz grid of blocks, set by the following three arguments. The next three arguments are booleans, which set the periodicity in each direction. The final argument sets the amount of memory allocated to each block.
Definition at line 16 of file container.cc.
container_base< r_option >::~container_base | ( | ) | [inline] |
Container destructor - free memory.
Definition at line 131 of file container.cc.
void container_base< r_option >::add_list_memory | ( | ) | [inline, protected] |
Add list memory.
Definition at line 264 of file container.cc.
void container_base< r_option >::add_particle_memory | ( | int | i | ) | [inline, protected] |
Increase memory for a particular region.
Definition at line 246 of file container.cc.
void container_base< r_option >::add_wall | ( | wall & | w | ) | [inline] |
Adds a wall to the container.
[in] | &w | a wall object to be added. |
Definition at line 1407 of file container.cc.
void container_base< r_option >::clear | ( | ) | [inline] |
Clears a container of particles.
Definition at line 318 of file container.cc.
void container_base< r_option >::compute_all_cells | ( | ) | [inline] |
This function computes all the cells in the container, but does nothing with the output. It is useful for measuring the pure computation time of the Voronoi algorithm, without any extraneous calculations, such as volume evaluation or cell output.
Definition at line 389 of file container.cc.
bool container_base< r_option >::compute_cell | ( | voronoicell_base< n_option > & | c, | |
int | i, | |||
int | j, | |||
int | k, | |||
int | ijk, | |||
int | s, | |||
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
This routine computes a Voronoi cell for a single particle in the container. It can be called by the user, but is also forms the core part of several of the main functions, such as store_cell_volumes(), print_all(), and the drawing routines. The algorithm constructs the cell by testing over the neighbors of the particle, working outwards until it reaches those particles which could not possibly intersect the cell. For maximum efficiency, this algorithm is divided into three parts. In the first section, the algorithm tests over the blocks which are in the immediate vicinity of the particle, by making use of one of the precomputed worklists. The code then continues to test blocks on the worklist, but also begins to construct a list of neighboring blocks outside the worklist which may need to be test. In the third section, the routine starts testing these neighboring blocks, evaluating whether or not a particle in them could possibly intersect the cell. For blocks that intersect the cell, it tests the particles in that block, and then adds the block neighbors to the list of potential places to consider.
[in] | &c | a reference to a voronoicell object. |
[in] | (i,j,k) | the coordinates of the block that the test particle is in. |
[in] | ijk | the index of the block that the test particle is in, set to i+nx*(j+ny*k). |
[in] | s | the index of the particle within the test block. |
[in] | (x,y,z) | The coordinates of the particle. |
[in] | s | the index of the particle within the test block. |
Definition at line 741 of file container.cc.
bool container_base< r_option >::compute_cell | ( | voronoicell_base< n_option > & | c, | |
int | i, | |||
int | j, | |||
int | k, | |||
int | ijk, | |||
int | s | |||
) | [inline] |
A overloaded version of compute_cell, that sets up the x, y, and z variables. It can be run by the user, and it is also called multiple times by the functions print_all(), store_cell_volumes(), and the output routines.
[in] | &c | a reference to a voronoicell object. |
[in] | (i,j,k) | the coordinates of the block that the test particle is in. |
[in] | ijk | the index of the block that the test particle is in, set to i+nx*(j+ny*k). |
[in] | s | the index of the particle within the test block. |
Definition at line 710 of file container.cc.
bool container_base< r_option >::compute_cell_sphere | ( | voronoicell_base< n_option > & | c, | |
int | i, | |||
int | j, | |||
int | k, | |||
int | ijk, | |||
int | s, | |||
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
This routine is a simpler alternative to compute_cell(), that constructs the cell by testing over successively larger spherical shells of particles. For a container that is homogeneously filled with particles, this routine runs as fast as compute_cell(). However, it rapidly becomes inefficient for cases when the particles are not homogeneously distributed, or where parts of the container might not be filled. In that case, the spheres may grow very large before being cut off, leading to poor efficiency.
[in] | &c | a reference to a voronoicell object. |
[in] | (i,j,k) | the coordinates of the block that the test particle is in. |
[in] | ijk | the index of the block that the test particle is in, set to i+nx*(j+ny*k). |
[in] | s | the index of the particle within the test block. |
[in] | (x,y,z) | The coordinates of the particle. |
Definition at line 653 of file container.cc.
bool container_base< r_option >::compute_cell_sphere | ( | voronoicell_base< n_option > & | c, | |
int | i, | |||
int | j, | |||
int | k, | |||
int | ijk, | |||
int | s | |||
) | [inline] |
A overloaded version of compute_cell_sphere(), that sets up the x, y, and z variables.
[in] | &c | a reference to a voronoicell object. |
[in] | (i,j,k) | the coordinates of the block that the test particle is in. |
[in] | ijk | the index of the block that the test particle is in, set to i+nx*(j+ny*k). |
[in] | s | the index of the particle within the test block. |
Definition at line 694 of file container.cc.
void container_base< r_option >::count_all_faces | ( | const char * | filename | ) | [inline] |
An overloaded version of count_all_faces(), which outputs the result to a particular file.
[in] | filename | The name fo the file to write to. |
Definition at line 511 of file container.cc.
void container_base< r_option >::count_all_faces | ( | ) | [inline] |
Prints a list of all particle labels, positions, and the number of faces to the standard output.
Definition at line 503 of file container.cc.
void container_base< r_option >::count_all_faces | ( | ostream & | os | ) | [inline] |
Prints a list of all particle labels, positions, and the number of faces to the standard output.
Definition at line 484 of file container.cc.
void container_base< r_option >::draw_cells_gnuplot | ( | const char * | filename | ) | [inline] |
If only a filename is supplied to draw_cells_gnuplot(), then assume that we are calculating the entire simulation region.
Definition at line 349 of file container.cc.
void container_base< r_option >::draw_cells_gnuplot | ( | const char * | filename, | |
fpoint | xmin, | |||
fpoint | xmax, | |||
fpoint | ymin, | |||
fpoint | ymax, | |||
fpoint | zmin, | |||
fpoint | zmax | |||
) | [inline] |
Computes the Voronoi cells for all particles within a box with corners (xmin,ymin,zmin) and (xmax,ymax,zmax), and saves the output in a format that can be read by gnuplot.
Definition at line 327 of file container.cc.
void container_base< r_option >::draw_cells_pov | ( | const char * | filename | ) | [inline] |
If only a filename is supplied to draw_cells_pov(), then assume that we are calculating the entire simulation region.
Definition at line 380 of file container.cc.
void container_base< r_option >::draw_cells_pov | ( | const char * | filename, | |
fpoint | xmin, | |||
fpoint | xmax, | |||
fpoint | ymin, | |||
fpoint | ymax, | |||
fpoint | zmin, | |||
fpoint | zmax | |||
) | [inline] |
Computes the Voronoi cells for all particles within a box with corners (xmin,ymin,zmin) and (xmax,ymax,zmax), and saves the output in a format that can be read by gnuplot.
Definition at line 357 of file container.cc.
void container_base< r_option >::draw_particles | ( | ostream & | os | ) | [inline] |
Dumps all the particle positions and identifies to a file.
Definition at line 147 of file container.cc.
void container_base< r_option >::draw_particles | ( | ) | [inline] |
An overloaded version of the draw_particles() routine, that just prints to standard output.
Definition at line 161 of file container.cc.
void container_base< r_option >::draw_particles | ( | const char * | filename | ) | [inline] |
An overloaded version of the draw_particles() routine, that outputs the particle positions to a file.
[in] | filename | the file to write to. |
Definition at line 169 of file container.cc.
void container_base< r_option >::draw_particles_pov | ( | ostream & | os | ) | [inline] |
Dumps all the particle positions in the POV-Ray format.
Definition at line 178 of file container.cc.
void container_base< r_option >::draw_particles_pov | ( | ) | [inline] |
An overloaded version of the draw_particles_pov() routine, that just prints to standard output.
Definition at line 194 of file container.cc.
void container_base< r_option >::draw_particles_pov | ( | const char * | filename | ) | [inline] |
An overloaded version of the draw_particles_pov() routine, that outputs the particle positions to a file.
[in] | filename | the file to write to. |
Definition at line 202 of file container.cc.
void container_base< r_option >::import | ( | const char * | filename | ) | [inline] |
An overloaded version of the import routine, that reads in particles from a particular file.
[in] | filename | The name of the file to read from. |
Definition at line 298 of file container.cc.
void container_base< r_option >::import | ( | ) | [inline] |
An overloaded version of the import routine, that reads the standard input.
Definition at line 290 of file container.cc.
void container_base< r_option >::import | ( | istream & | is | ) | [inline] |
Import a list of particles from standard input.
Definition at line 283 of file container.cc.
bool container_base< r_option >::initialize_voronoicell | ( | voronoicell_base< n_option > & | c, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline, protected] |
Initialize the Voronoi cell to be the entire container. For non-periodic coordinates, this is set by the position of the walls. For periodic coordinates, the space is equally divided in either direction from the particle's initial position. That makes sense since those boundaries would be made by the neighboring periodic images of this particle.
Definition at line 602 of file container.cc.
fpoint container_base< r_option >::packing_fraction | ( | fpoint * | bb, | |
fpoint | xmin, | |||
fpoint | xmax, | |||
fpoint | ymin, | |||
fpoint | ymax, | |||
fpoint | zmin, | |||
fpoint | zmax | |||
) | [inline] |
Computes the local packing fraction at a point, by summing the volumes of all particles within test box, and dividing by the sum of their Voronoi volumes that were previous computed using the store_cell_volumes() function.
[in] | *bb | an array holding the Voronoi volumes of the particles. |
[in] | (xmin,ymin,zmin) | the minimum coordinates of the box. |
[in] | (xmax,ymax,zmax) | the maximum coordinates of the box. |
Definition at line 450 of file container.cc.
fpoint container_base< r_option >::packing_fraction | ( | fpoint * | bb, | |
fpoint | cx, | |||
fpoint | cy, | |||
fpoint | cz, | |||
fpoint | r | |||
) | [inline] |
Computes the local packing fraction at a point, by summing the volumes of all particles within a test sphere, and dividing by the sum of their Voronoi volumes that were previous computed using the store_cell_volumes() function.
[in] | *bb | an array holding the Voronoi volumes of the particles. |
[in] | (cx,cy,cz) | the center of the test sphere. |
[in] | r | the radius of the test sphere. |
Definition at line 423 of file container.cc.
bool container_base< r_option >::point_inside | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
This function tests to see if a given vector lies within the container bounds and any walls.
[in] | (x,y,z) | The position vector to be tested. |
Definition at line 620 of file container.cc.
bool container_base< r_option >::point_inside_walls | ( | fpoint | x, | |
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
This function tests to see if a give vector lies within the walls that have been added to the container, but does not specifically check whether the vector lies within the container bounds.
[in] | (x,y,z) | The position vector to be tested. |
Definition at line 632 of file container.cc.
void container_base< r_option >::print_all | ( | ostream & | os, | |
voronoicell_base< n_option > & | c | |||
) | [inline, protected] |
Prints a list of all particle labels, positions, and Voronoi volumes to the standard output.
Definition at line 522 of file container.cc.
void container_base< r_option >::print_all | ( | const char * | filename | ) | [inline] |
An overloaded version of print_all(), which outputs the result to a particular file.
[in] | filename | The name fo the file to write to. |
Definition at line 558 of file container.cc.
void container_base< r_option >::print_all | ( | ) | [inline] |
An overloaded version of print_all(), which just prints to standard output.
Definition at line 549 of file container.cc.
void container_base< r_option >::print_all | ( | ostream & | os | ) | [inline] |
Prints a list of all particle labels, positions, and Voronoi volumes to the standard output.
Definition at line 542 of file container.cc.
void container_base< r_option >::print_all_neighbor | ( | const char * | filename | ) | [inline] |
An overloaded version of print_all_neighbor(), which outputs the result to a particular file
[in] | filename | The name of the file to write to. |
Definition at line 587 of file container.cc.
void container_base< r_option >::print_all_neighbor | ( | ) | [inline] |
An overloaded version of print_all_neighbor(), which just prints to standard output.
Definition at line 578 of file container.cc.
void container_base< r_option >::print_all_neighbor | ( | ostream & | os | ) | [inline] |
Prints a list of all particle labels, positions, Voronoi volumes, and a list of neighboring particles to an output stream.
[in] | os | The output stream to print to. |
Definition at line 570 of file container.cc.
void container_base< r_option >::put | ( | int | n, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z, | |||
fpoint | r | |||
) | [inline] |
Put a particle into the correct region of the container.
[in] | n | The numerical ID of the inserted particle. |
[in] | (x,y,z) | The position vector of the inserted particle. |
[in] | r | The radius of the particle. |
Definition at line 230 of file container.cc.
void container_base< r_option >::put | ( | int | n, | |
fpoint | x, | |||
fpoint | y, | |||
fpoint | z | |||
) | [inline] |
Put a particle into the correct region of the container.
Definition at line 211 of file container.cc.
void container_base< r_option >::region_count | ( | ) | [inline] |
Outputs the number of particles within each region.
Definition at line 307 of file container.cc.
void container_base< r_option >::store_cell_volumes | ( | fpoint * | bb | ) | [inline] |
Computes the Voronoi volumes for all the particles, and stores the results according to the particle label in the fpoint array bb.
Definition at line 401 of file container.cc.
fpoint container_base< r_option >::sum_cell_volumes | ( | ) | [inline] |
Computes the Voronoi volumes for all the particles, and stores the results according to the particle label in the fpoint array bb.
Definition at line 472 of file container.cc.
const fpoint container_base< r_option >::ax [protected] |
The minimum x coordinate of the container.
Definition at line 78 of file container.hh.
const fpoint container_base< r_option >::ay [protected] |
The minimum y coordinate of the container.
Definition at line 82 of file container.hh.
const fpoint container_base< r_option >::az [protected] |
The minimum z coordinate of the container.
Definition at line 86 of file container.hh.
const fpoint container_base< r_option >::bx [protected] |
The maximum x coordinate of the container.
Definition at line 80 of file container.hh.
const fpoint container_base< r_option >::by [protected] |
The maximum y coordinate of the container.
Definition at line 84 of file container.hh.
const fpoint container_base< r_option >::bz [protected] |
The maximum z coordinate of the container.
Definition at line 88 of file container.hh.
int* container_base< r_option >::co [protected] |
This array holds the number of particles within each computational box of the container.
Definition at line 135 of file container.hh.
int container_base< r_option >::current_wall_size [protected] |
The current amount of memory allocated for walls.
Definition at line 171 of file container.hh.
const int container_base< r_option >::hx [protected] |
The number of boxes in the x direction for the searching mask.
Definition at line 112 of file container.hh.
const int container_base< r_option >::hxy [protected] |
A constant, set to the value of hx multiplied by hy, which is used in the routines which step through mask boxes in sequence.
Definition at line 120 of file container.hh.
const int container_base< r_option >::hxyz [protected] |
A constant, set to the value of hx*hy*hz, which is used in the routines which step through mask boxes in sequence.
Definition at line 123 of file container.hh.
const int container_base< r_option >::hy [protected] |
The number of boxes in the y direction for the searching mask.
Definition at line 114 of file container.hh.
const int container_base< r_option >::hz [protected] |
The number of boxes in the z direction for the searching mask.
Definition at line 116 of file container.hh.
int** container_base< r_option >::id [protected] |
This array holds the numerical IDs of each particle in each computational box.
Definition at line 144 of file container.hh.
unsigned int* container_base< r_option >::mask [protected] |
This array is used as a mask.
Definition at line 146 of file container.hh.
int* container_base< r_option >::mem [protected] |
This array holds the maximum amount of particle memory for each computational box of the container. If the number of particles in a particular box ever approaches this limit, more is allocated using the add_particle_memory() function.
Definition at line 141 of file container.hh.
fpoint* container_base< r_option >::mrad [protected] |
An array to hold the minimum distances associated with the worklists. This array is initialized during container construction, by the initialize_radii() routine.
Definition at line 192 of file container.hh.
unsigned int container_base< r_option >::mv [protected] |
This sets the current value being used to mark tested blocks in the mask.
Definition at line 152 of file container.hh.
const int container_base< r_option >::nx [protected] |
The number of boxes in the x direction.
Definition at line 99 of file container.hh.
const int container_base< r_option >::nxy [protected] |
A constant, set to the value of nx multiplied by ny, which is used in the routines which step through boxes in sequence.
Definition at line 107 of file container.hh.
const int container_base< r_option >::nxyz [protected] |
A constant, set to the value of nx*ny*nz, which is used in the routines which step through boxes in sequence.
Definition at line 110 of file container.hh.
const int container_base< r_option >::ny [protected] |
The number of boxes in the y direction.
Definition at line 101 of file container.hh.
const int container_base< r_option >::nz [protected] |
The number of boxes in the z direction.
Definition at line 103 of file container.hh.
fpoint** container_base< r_option >::p [protected] |
A two dimensional array holding particle positions. For the derived container_poly class, this also holds particle radii.
Definition at line 164 of file container.hh.
r_option container_base< r_option >::radius [protected] |
This object contains all the functions for handling how the particle radii should be treated. If the template is instantiated with the radius_mono class, then this object contains mostly blank routines that do nothing to the cell computation, to compute the basic Voronoi diagram. If the template is instantiated with the radius_poly calls, then this object provides routines for modifying the Voronoi cell computation in order to create the radical Voronoi tessellation.
Definition at line 181 of file container.hh.
int container_base< r_option >::s_end [protected] |
The position of the last element on the search list to be considered.
Definition at line 158 of file container.hh.
int container_base< r_option >::s_size [protected] |
The current size of the search list.
Definition at line 160 of file container.hh.
int container_base< r_option >::s_start [protected] |
The position of the first element on the search list to be considered.
Definition at line 155 of file container.hh.
int* container_base< r_option >::sl [protected] |
This array is used to store the list of blocks to test during the Voronoi cell computation.
Definition at line 149 of file container.hh.
int container_base< r_option >::sz [protected] |
The amount of memory in the array structure for each particle. This is set to 3 when the basic class is initialized, so that the array holds (x,y,z) positions. If the container class is initialized as part of the derived class container_poly, then this is set to 4, to also hold the particle radii.
Definition at line 188 of file container.hh.
int container_base< r_option >::wall_number [protected] |
The current number of wall objects, initially set to zero.
Definition at line 169 of file container.hh.
wall** container_base< r_option >::walls [protected] |
This array holds pointers to any wall objects that have been added to the container.
Definition at line 167 of file container.hh.
const bool container_base< r_option >::xperiodic [protected] |
A boolean value that determines if the x coordinate in periodic or not.
Definition at line 126 of file container.hh.
const fpoint container_base< r_option >::xsp [protected] |
The inverse box length in the x direction, set to nx/(bx-ax).
Definition at line 91 of file container.hh.
const bool container_base< r_option >::yperiodic [protected] |
A boolean value that determines if the y coordinate in periodic or not.
Definition at line 129 of file container.hh.
const fpoint container_base< r_option >::ysp [protected] |
The inverse box length in the y direction, set to ny/(by-ay).
Definition at line 94 of file container.hh.
const bool container_base< r_option >::zperiodic [protected] |
A boolean value that determines if the z coordinate in periodic or not.
Definition at line 132 of file container.hh.
const fpoint container_base< r_option >::zsp [protected] |
The inverse box length in the z direction, set to nz/(bz-az).
Definition at line 97 of file container.hh.