Class Voro.container_base

  • Direct Known Subclasses:
    Voro.container_poly_radius_poly, Voro.container_radius_mono
    Enclosing class:
    Voro

    class Voro.container_base
    extends Voro.voro_base_wall_list
    \brief Class for representing a particle system in a three-dimensional rectangular box. 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double ax
      The minimum x coordinate of the container.
      double ay
      The minimum y coordinate of the container.
      double az
      The minimum z coordinate of the container.
      double bx
      The maximum x coordinate of the container.
      double by
      The maximum y coordinate of the container.
      double bz
      The maximum z coordinate of the container.
      int[] co
      This array holds the number of particles within each computational box of the container.
      int[][] id
      This array holds the numerical IDs of each particle in each computational box.
      double max_len_sq
      The maximum length squared that could be encountered in the Voronoi cell calculation.
      int[] mem
      This array holds the maximum amount of particle memory for each computational box of the container.
      double[][] p
      A two dimensional array holding particle positions.
      int ps
      The amount of memory in the array structure for each particle.
      boolean xperiodic
      A boolean value that determines if the x coordinate in periodic or not.
      boolean yperiodic
      A boolean value that determines if the y coordinate in periodic or not.
      boolean zperiodic
      A boolean value that determines if the z coordinate in periodic or not.
    • Constructor Summary

      Constructors 
      Constructor Description
      container_base​(double ax_, double bx_, double ay_, double by_, double az_, double bz_, int nx_, int ny_, int nz_, boolean xperiodic_, boolean yperiodic_, boolean 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void add_particle_memory​(int i)
      Increase memory for a particular region.
      void delete()
      The container destructor frees the dynamically allocated memory.
      void draw_domain_gnuplot​(java.io.RandomAccessFile raFile)
      Draws an outline of the domain in gnuplot format.
      void draw_domain_gnuplot​(java.lang.String filename)
      Draws an outline of the domain in Gnuplot format.
      void draw_domain_pov​(java.io.RandomAccessFile raFile)
      Draws an outline of the domain in POV-Ray format.
      void draw_domain_pov​(java.lang.String filename)
      Draws an outline of the domain in Gnuplot format.
      void frac_pos​(double x, double y, double z, double ci, double cj, double ck, double[] fx, double[] fy, double[] fz)
      Returns the position of a particle currently being computed relative to the computational block that it is within.
      void initialize_search​(int ci, int cj, int ck, int ijk, int[] i, int[] j, int[] k, int[] disp)
      Initializes parameters for a find_voronoi_cell call within the voro_compute template.
      boolean initialize_voronoicell​(Voro.voronoicell_neighbor 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)  
      boolean initialize_voronoicell​(Voro.voronoicell 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)
      Initializes the Voronoi cell prior to a compute_cell operation for a specific particle being carried out by a voro_compute class.
      boolean 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.
      protected boolean put_locate_block​(int[] ijk, double[] x, double[] y, double[] z)
      This routine takes a particle position vector, tries to remap it into the primary domain.
      protected boolean put_remap​(int[] ijk, double[] x, double[] y, double[] z)
      Takes a particle position vector and computes the region index into which it should be stored.
      void region_count()
      Outputs the a list of all the container regions along with the number of particles stored within each.
      int region_index​(int ci, int cj, int ck, int ei, int ej, int ek, double[] qx, double[] qy, double[] qz, int[] disp)
      Calculates the index of block in the container structure corresponding to given coordinates.
      protected boolean remap​(int[] ai, int[] aj, int[] ak, int[] ci, int[] cj, int[] ck, double[] x, double[] y, double[] z, int[] ijk)
      Takes a position vector and attempts to remap it into the primary domain.
      int total_particles()
      Sums up the total number of stored particles.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ax

        public double ax
        The minimum x coordinate of the container.
      • bx

        public double bx
        The maximum x coordinate of the container.
      • ay

        public double ay
        The minimum y coordinate of the container.
      • by

        public double by
        The maximum y coordinate of the container.
      • az

        public double az
        The minimum z coordinate of the container.
      • bz

        public double bz
        The maximum z coordinate of the container.
      • max_len_sq

        public double max_len_sq
        The maximum length squared that could be encountered in the Voronoi cell calculation.
      • xperiodic

        public boolean xperiodic
        A boolean value that determines if the x coordinate in periodic or not.
      • yperiodic

        public boolean yperiodic
        A boolean value that determines if the y coordinate in periodic or not.
      • zperiodic

        public boolean zperiodic
        A boolean value that determines if the z coordinate in periodic or not.
      • id

        public int[][] id
        This array holds the numerical IDs of each particle in each computational box.
      • p

        public double[][] p
        A two dimensional array holding particle positions. For the derived container_poly class, this also holds particle radii.
      • co

        public int[] co
        This array holds the number of particles within each computational box of the container.
      • mem

        public int[] 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.
      • ps

        public int 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.
    • Constructor Detail

      • container_base

        public container_base​(double ax_,
                              double bx_,
                              double ay_,
                              double by_,
                              double az_,
                              double bz_,
                              int nx_,
                              int ny_,
                              int nz_,
                              boolean xperiodic_,
                              boolean yperiodic_,
                              boolean 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. \param[in] (ax_,bx_) the minimum and maximum x coordinates. \param[in] (ay_,by_) the minimum and maximum y coordinates. \param[in] (az_,bz_) the minimum and maximum z coordinates. \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three coordinate directions. \param[in] (xperiodic_,yperiodic_,zperiodic_) flags setting whether the container is periodic in each coordinate direction. \param[in] init_mem the initial memory allocation for each block. \param[in] ps_ the number of floating point entries to store for each particle.
    • Method Detail

      • delete

        public void delete()
        The container destructor frees the dynamically allocated memory.
        Overrides:
        delete in class Voro.voro_base_wall_list
      • point_inside

        public boolean 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. \param[in] (x,y,z) the position vector to be tested. \return True if the point is inside the container, false if the point is outside.
      • region_count

        public void region_count()
        Outputs the a list of all the container regions along with the number of particles stored within each.
      • initialize_voronoicell

        public boolean initialize_voronoicell​(Voro.voronoicell 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)
        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. \param[in,out] c a reference to a voronoicell object. \param[in] ijk the block that the particle is within. \param[in] q the index of the particle within its block. \param[in] (ci,cj,ck) the coordinates of the block in the container coordinate system. \param[out] (i,j,k) the coordinates of the test block relative to the voro_compute coordinate system. \param[out] (x,y,z) the position of the particle. \param[out] disp a block displacement used internally by the compute_cell routine. \return False if the plane cuts applied by walls completely removed the cell, true otherwise.
      • initialize_voronoicell

        public boolean initialize_voronoicell​(Voro.voronoicell_neighbor 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)
      • initialize_search

        public void initialize_search​(int ci,
                                      int cj,
                                      int ck,
                                      int ijk,
                                      int[] i,
                                      int[] j,
                                      int[] k,
                                      int[] disp)
        Initializes parameters for a find_voronoi_cell call within the voro_compute template. \param[in] (ci,cj,ck) the coordinates of the test block in the container coordinate system. \param[in] ijk the index of the test block \param[out] (i,j,k) the coordinates of the test block relative to the voro_compute coordinate system. \param[out] disp a block displacement used internally by the find_voronoi_cell routine.
      • frac_pos

        public void frac_pos​(double x,
                             double y,
                             double z,
                             double ci,
                             double cj,
                             double ck,
                             double[] fx,
                             double[] fy,
                             double[] fz)
        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. \param[in] (x,y,z) the position of the particle. \param[in] (ci,cj,ck) the block that the particle is within. \param[out] (fx,fy,fz) the position relative to the block.
      • region_index

        public int region_index​(int ci,
                                int cj,
                                int ck,
                                int ei,
                                int ej,
                                int ek,
                                double[] qx,
                                double[] qy,
                                double[] qz,
                                int[] disp)
        Calculates the index of block in the container structure corresponding to given coordinates. \param[in] (ci,cj,ck) the coordinates of the original block in the current computation, relative to the container coordinate system. \param[in] (ei,ej,ek) the displacement of the current block from the original block. \param[in,out] (qx,qy,qz) the periodic displacement that must be added to the particles within the computed block. \param[in] disp a block displacement used internally by the find_voronoi_cell and compute_cell routines. \return The block index.
      • draw_domain_gnuplot

        public void draw_domain_gnuplot​(java.io.RandomAccessFile raFile)
        Draws an outline of the domain in gnuplot format. \param[in] fp the file handle to write to.
      • draw_domain_gnuplot

        public void draw_domain_gnuplot​(java.lang.String filename)
        Draws an outline of the domain in Gnuplot format. \param[in] filename the filename to write to.
      • draw_domain_pov

        public void draw_domain_pov​(java.io.RandomAccessFile raFile)
        Draws an outline of the domain in POV-Ray format. \param[in] fp the file handle to write to.
      • draw_domain_pov

        public void draw_domain_pov​(java.lang.String filename)
        Draws an outline of the domain in Gnuplot format. \param[in] filename the filename to write to.
      • total_particles

        public int total_particles()
        Sums up the total number of stored particles. \return The number of particles.
      • add_particle_memory

        protected void add_particle_memory​(int i)
        Increase memory for a particular region. \param[in] i the index of the region to reallocate.
      • put_locate_block

        protected boolean put_locate_block​(int[] ijk,
                                           double[] x,
                                           double[] y,
                                           double[] z)
        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. \param[out] ijk the region index. \param[in,out] (x,y,z) the particle position, remapped into the primary domain if necessary. \return True if the particle can be successfully placed into the container, false otherwise.
      • put_remap

        protected boolean put_remap​(int[] ijk,
                                    double[] x,
                                    double[] y,
                                    double[] z)
        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. \param[out] ijk the region index. \param[in,out] (x,y,z) the particle position, remapped into the primary domain if necessary. \return True if the particle can be successfully placed into the container, false otherwise.
      • remap

        protected boolean remap​(int[] ai,
                                int[] aj,
                                int[] ak,
                                int[] ci,
                                int[] cj,
                                int[] ck,
                                double[] x,
                                double[] y,
                                double[] z,
                                int[] ijk)
        Takes a position vector and attempts to remap it into the primary domain. \param[out] (ai,aj,ak) the periodic image displacement that the vector is in, with (0,0,0) corresponding to the primary domain. \param[out] (ci,cj,ck) the index of the block that the position vector is within, once it has been remapped. \param[in,out] (x,y,z) the position vector to consider, which is remapped into the primary domain during the routine. \param[out] ijk the block index that the vector is within. \return True if the particle is within the container or can be remapped into it, false if it lies outside of the container bounds.