Voro++

- Main Page
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields | Protected Member Functions
voro::container_base Class Reference

Class for representing a particle system in a three-dimensional rectangular box. More...

`#include <container.hh>`

Inheritance diagram for voro::container_base:

## Public Member Functions
| container_base (double ax_, double bx_, double ay_, double by_, double az_, double bz_, int nx_, int ny_, int nz_, bool xperiodic_, bool yperiodic_, bool zperiodic_, int init_mem, int ps_)
| ~container_base ()
bool | point_inside (double x, double y, double z)
void | region_count ()
template<class v_cell >
bool | initialize_voronoicell (v_cell &c, int ijk, int q, int ci, int cj, int ck, int &i, int &j, int &k, double &x, double &y, double &z, int &disp)
void | initialize_search (int ci, int cj, int ck, int ijk, int &i, int &j, int &k, int &disp)
void | frac_pos (double x, double y, double z, double ci, double cj, double ck, double &fx, double &fy, double &fz)
int | region_index (int ci, int cj, int ck, int ei, int ej, int ek, double &qx, double &qy, double &qz, int &disp)
void | draw_domain_gnuplot (FILE *fp=stdout)
void | draw_domain_gnuplot (const char *filename)
void | draw_domain_pov (FILE *fp=stdout)
void | draw_domain_pov (const char *filename)
int | total_particles ()
Public Member Functions inherited from voro::voro_base
bool | contains_neighbor (const char *format)
| voro_base (int nx_, int ny_, int nz_, double boxx_, double boxy_, double boxz_)
Public Member Functions inherited from voro::wall_list
| wall_list ()
| ~wall_list ()
void | add_wall (wall *w)
void | add_wall (wall &w)
void | add_wall (wall_list &wl)
bool | point_inside_walls (double x, double y, double z)
template<class c_class >
bool | apply_walls (c_class &c, double x, double y, double z)
void | deallocate ()

## Data Fields
const double | ax
const double | bx
const double | ay
const double | by
const double | az
const double | bz
const bool | xperiodic
const bool | yperiodic
const bool | zperiodic
int ** | id
double ** | p
int * | co
int * | mem
const int | ps
Data Fields inherited from voro::voro_base
const int | nx
const int | ny
const int | nz
const int | nxy
const int | nxyz
const double | boxx
const double | boxy
const double | boxz
const double | xsp
const double | ysp
const double | zsp
double * | mrad
Data Fields inherited from voro::wall_list
wall ** | walls
wall ** | wep

## Protected Member Functions
void | add_particle_memory (int i)
bool | put_locate_block (int &ijk, double &x, double &y, double &z)
bool | put_remap (int &ijk, double &x, double &y, double &z)
bool | remap (int &ai, int &aj, int &ak, int &ci, int &cj, int &ck, double &x, double &y, double &z, int &ijk)
Protected Member Functions inherited from voro::voro_base
int | step_int (double a)
int | step_mod (int a, int b)
int | step_div (int a, int b)
Protected Member Functions inherited from voro::wall_list
void | increase_wall_memory ()

## Additional Inherited Members
Static Public Attributes inherited from voro::voro_base
static const unsigned int | wl [wl_seq_length *wl_hgridcu]
Protected Attributes inherited from voro::wall_list
wall ** | wel
int | current_wall_size

## Detailed Description

This class represents a system of particles in a three-dimensional rectangular box. Any combination of non-periodic and periodic coordinates can be used in the three coordinate directions. The class is not intended for direct use, but instead forms the base of the container and container_poly classes that add specialized routines for computing the regular and radical Voronoi tessellations respectively. It contains routines that are commonly between these two classes, such as those for drawing the domain, and placing particles within the internal data structure.

The class is derived from the wall_list class, which encapsulates routines for associating walls with the container, and the voro_base class, which encapsulates routines about the underlying computational grid.

Definition at line 115 of file container.hh.

## Constructor & Destructor Documentation

voro::container_base::container_base | ( | double | ax_,
|  | double | bx_,
|  | double | ay_,
|  | double | by_,
|  | double | az_,
|  | double | bz_,
|  | int | nx_,
|  | int | ny_,
|  | int | nz_,
|  | bool | xperiodic_,
|  | bool | yperiodic_,
|  | bool | zperiodic_,
|  | int | init_mem,
|  | int | ps_
| ) |  |

The class constructor sets up the geometry of container, initializing the minimum and maximum coordinates in each direction, and setting whether each direction is periodic or not. It divides the container into a rectangular grid of blocks, and allocates memory for each of these for storing particle positions and IDs.

Parameters

  [in] | (ax_,bx_) | the minimum and maximum x coordinates.
  [in] | (ay_,by_) | the minimum and maximum y coordinates.
  [in] | (az_,bz_) | the minimum and maximum z coordinates.
  [in] | (nx_,ny_,nz_) | the number of grid blocks in each of the three coordinate directions.
  [in] | (xperiodic_,yperiodic_,zperiodic_) | flags setting whether the container is periodic in each coordinate direction.
  [in] | init_mem | the initial memory allocation for each block.
  [in] | ps_ | the number of floating point entries to store for each particle.

Definition at line 30 of file container.cc.

voro::container_base::~container_base | ( |  | ) |

The container destructor frees the dynamically allocated memory.

Definition at line 44 of file container.cc.

## Member Function Documentation

void voro::container_base::add_particle_memory | ( | int | i | ) |
| protected

Increase memory for a particular region.

Parameters

  [in] | i | the index of the region to reallocate.

Definition at line 302 of file container.cc.

void voro::container_base::draw_domain_gnuplot | ( | FILE * | fp = `stdout` | ) |

Draws an outline of the domain in gnuplot format.

Parameters

  [in] | fp | the file handle to write to.

Definition at line 488 of file container.cc.

void voro::container_base::draw_domain_gnuplot | ( | const char * | filename | ) |
| inline

Draws an outline of the domain in Gnuplot format.

Parameters

  [in] | filename | the filename to write to.

Definition at line 252 of file container.hh.

void voro::container_base::draw_domain_pov | ( | FILE * | fp = `stdout` | ) |

Draws an outline of the domain in POV-Ray format.

Parameters

  [in] | fp | the file handle to write to.

Definition at line 497 of file container.cc.

void voro::container_base::draw_domain_pov | ( | const char * | filename | ) |
| inline

Draws an outline of the domain in Gnuplot format.

Parameters

  [in] | filename | the filename to write to.

Definition at line 260 of file container.hh.

void voro::container_base::frac_pos | ( | double | x,
|  | double | y,
|  | double | z,
|  | double | ci,
|  | double | cj,
|  | double | ck,
|  | double & | fx,
|  | double & | fy,
|  | double & | fz
| ) |  |
| inline

Returns the position of a particle currently being computed relative to the computational block that it is within. It is used to select the optimal worklist entry to use.

Parameters

  [in] | (x,y,z) | the position of the particle.
  [in] | (ci,cj,ck) | the block that the particle is within.
  [out] | (fx,fy,fz) | the position relative to the block.

Definition at line 224 of file container.hh.

void voro::container_base::initialize_search | ( | int | ci,
|  | int | cj,
|  | int | ck,
|  | int | ijk,
|  | int & | i,
|  | int & | j,
|  | int & | k,
|  | int & | disp
| ) |  |
| inline

Initializes parameters for a find_voronoi_cell call within the voro_compute template.

Parameters

  [in] | (ci,cj,ck) | the coordinates of the test block in the container coordinate system.
  [in] | ijk | the index of the test block
  [out] | (i,j,k) | the coordinates of the test block relative to the voro_compute coordinate system.
  [out] | disp | a block displacement used internally by the find_voronoi_cell routine.

Definition at line 211 of file container.hh.

template<class v_cell >

bool voro::container_base::initialize_voronoicell | ( | v_cell & | c,
|  | int | ijk,
|  | int | q,
|  | int | ci,
|  | int | cj,
|  | int | ck,
|  | int & | i,
|  | int & | j,
|  | int & | k,
|  | double & | x,
|  | double & | y,
|  | double & | z,
|  | int & | disp
| ) |  |
| inline

Initializes the Voronoi cell prior to a compute_cell operation for a specific particle being carried out by a voro_compute class. The cell is initialized to fill 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. Plane cuts made by any walls that have been added are then applied to the cell.

Parameters

  [in,out] | c | a reference to a voronoicell object.
  [in] | ijk | the block that the particle is within.
  [in] | q | the index of the particle within its block.
  [in] | (ci,cj,ck) | the coordinates of the block in the container coordinate system.
  [out] | (i,j,k) | the coordinates of the test block relative to the voro_compute coordinate system.
  [out] | (x,y,z) | the position of the particle.
  [out] | disp | a block displacement used internally by the compute_cell routine.

Returns
  False if the plane cuts applied by walls completely removed the cell, true otherwise.

Definition at line 189 of file container.hh.

bool voro::container_base::point_inside | ( | double | x,
|  | double | y,
|  | double | z
| ) |  |

This function tests to see if a given vector lies within the container bounds and any walls.

Parameters

  [in] | (x,y,z) | the position vector to be tested.

Returns
  True if the point is inside the container, false if the point is outside.

Definition at line 481 of file container.cc.

bool voro::container_base::put_locate_block | ( | int & | ijk,
|  | double & | x,
|  | double & | y,
|  | double & | z
| ) |  |
| protected

This routine takes a particle position vector, tries to remap it into the primary domain. If successful, it computes the region into which it can be stored and checks that there is enough memory within this region to store it.

Parameters

  [out] | ijk | the region index.
  [in,out] | (x,y,z) | the particle position, remapped into the primary domain if necessary.

Returns
  True if the particle can be successfully placed into the container, false otherwise.

Definition at line 151 of file container.cc.

bool voro::container_base::put_remap | ( | int & | ijk,
|  | double & | x,
|  | double & | y,
|  | double & | z
| ) |  |
| inline protected

Takes a particle position vector and computes the region index into which it should be stored. If the container is periodic, then the routine also maps the particle position to ensure it is in the primary domain. If the container is not periodic, the routine bails out.

Parameters

  [out] | ijk | the region index.
  [in,out] | (x,y,z) | the particle position, remapped into the primary domain if necessary.

Returns
  True if the particle can be successfully placed into the container, false otherwise.

Definition at line 171 of file container.cc.

void voro::container_base::region_count | ( |  | ) |

Outputs the a list of all the container regions along with the number of particles stored within each.

Definition at line 377 of file container.cc.

int voro::container_base::region_index | ( | int | ci,
|  | int | cj,
|  | int | ck,
|  | int | ei,
|  | int | ej,
|  | int | ek,
|  | double & | qx,
|  | double & | qy,
|  | double & | qz,
|  | int & | disp
| ) |  |
| inline

Calculates the index of block in the container structure corresponding to given coordinates.

Parameters

  [in] | (ci,cj,ck) | the coordinates of the original block in the current computation, relative to the container coordinate system.
  [in] | (ei,ej,ek) | the displacement of the current block from the original block.
  [in,out] | (qx,qy,qz) | the periodic displacement that must be added to the particles within the computed block.
  [in] | disp | a block displacement used internally by the find_voronoi_cell and compute_cell routines.

Returns
  The block index.

Definition at line 243 of file container.hh.

bool voro::container_base::remap | ( | int & | ai,
|  | int & | aj,
|  | int & | ak,
|  | int & | ci,
|  | int & | cj,
|  | int & | ck,
|  | double & | x,
|  | double & | y,
|  | double & | z,
|  | int & | ijk
| ) |  |
| inline protected

Takes a position vector and attempts to remap it into the primary domain.

Parameters

  [out] | (ai,aj,ak) | the periodic image displacement that the vector is in, with (0,0,0) corresponding to the primary domain.
  [out] | (ci,cj,ck) | the index of the block that the position vector is within, once it has been remapped.
  [in,out] | (x,y,z) | the position vector to consider, which is remapped into the primary domain during the routine.
  [out] | ijk | the block index that the vector is within.

Returns
  True if the particle is within the container or can be remapped into it, false if it lies outside of the container bounds.

Definition at line 200 of file container.cc.

int voro::container_base::total_particles | ( |  | ) |
| inline

Sums up the total number of stored particles.

Returns
  The number of particles.

Definition at line 267 of file container.hh.

## Field Documentation

const double voro::container_base::ax

The minimum x coordinate of the container.

Definition at line 118 of file container.hh.

const double voro::container_base::ay

The minimum y coordinate of the container.

Definition at line 122 of file container.hh.

const double voro::container_base::az

The minimum z coordinate of the container.

Definition at line 126 of file container.hh.

const double voro::container_base::bx

The maximum x coordinate of the container.

Definition at line 120 of file container.hh.

const double voro::container_base::by

The maximum y coordinate of the container.

Definition at line 124 of file container.hh.

const double voro::container_base::bz

The maximum z coordinate of the container.

Definition at line 128 of file container.hh.

int* voro::container_base::co

This array holds the number of particles within each computational box of the container.

Definition at line 147 of file container.hh.

int** voro::container_base::id

This array holds the numerical IDs of each particle in each computational box.

Definition at line 140 of file container.hh.

int* voro::container_base::mem

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 153 of file container.hh.

double** voro::container_base::p

A two dimensional array holding particle positions. For the derived container_poly class, this also holds particle radii.

Definition at line 144 of file container.hh.

const int voro::container_base::ps

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 160 of file container.hh.

const bool voro::container_base::xperiodic

A boolean value that determines if the x coordinate in periodic or not.

Definition at line 131 of file container.hh.

const bool voro::container_base::yperiodic

A boolean value that determines if the y coordinate in periodic or not.

Definition at line 134 of file container.hh.

const bool voro::container_base::zperiodic

A boolean value that determines if the z coordinate in periodic or not.

Definition at line 137 of file container.hh.

The documentation for this class was generated from the following files:

- container.hh
- container.cc