Class Voro.container_periodic_base

  • Direct Known Subclasses:
    Voro.container_periodic_poly_radius_poly, Voro.container_periodic_radius_mono
    Enclosing class:
    Voro

    class Voro.container_periodic_base
    extends Voro.voro_base_unitcell
    \brief Class for representing a particle system in a 3D periodic non-orthogonal periodic domain. This class represents a particle system in a three-dimensional non-orthogonal periodic domain. The domain is defined by three periodicity vectors (bx,0,0), (bxy,by,0), and (bxz,byz,bz) that represent a parallelepiped. Internally, the class stores particles in the box 0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int[] co
      This array holds the number of particles within each computational box of the container.
      int ey
      The lower y index (inclusive) of the primary domain within the block structure.
      int ez
      The lower z index (inclusive) of the primary domain within the block structure.
      int[][] id
      This array holds the numerical IDs of each particle in each computational box.
      byte[] img
      An array holding information about periodic image construction at a given location.
      int init_mem
      The initial amount of memory to allocate for particles for each block.
      double max_len_sq  
      int[] mem
      This array holds the maximum amount of particle memory for each computational box of the container.
      int oxyz
      The total number of blocks.
      int oy
      The total size of the block structure (including images) in the y direction.
      int oz
      The total size of the block structure (including images) in the z direction.
      double[][] p
      A two dimensional array holding particle positions.
      int ps
      The amount of memory in the array structure for each particle.
      int wy
      The upper y index (exclusive) of the primary domain within the block structure.
      int wz
      The upper z index (exclusive) of the primary domain within the block structure.
    • Constructor Summary

      Constructors 
      Constructor Description
      container_periodic_base​(double bx_, double bxy_, double by_, double bxz_, double byz_, double bz_, int nx_, int ny_, int nz_, 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 check_compartmentalized()
      Checks that the particles within each block lie within that block's bounds.
      void create_all_images()
      This routine creates all periodic images of the particles.
      void create_periodic_image​(int di, int dj, int dk)
      Creates particles within an image block by copying them from the primary domain and shifting them.
      void create_side_image​(int di, int dj, int dk)
      Creates particles within an image block that is aligned with the primary domain in the z axis.
      void create_vertical_image​(int di, int dj, int dk)
      Creates particles within an image block that is not aligned with the primary domain in the z axis.
      void delete()
      The container destructor frees the dynamically allocated memory.
      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.
      void print_all_particles()
      Prints all particles in the container, including those that have been constructed in image blocks.
      void put_image​(int reg, int fijk, int l, double dx, double dy, double dz)
      Copies a particle position from the primary domain into an image block.
      protected void put_locate_block​(int[] ijk, double[] x, double[] y, double[] z)
      Takes a particle position vector and computes the region index into which it should be stored.
      protected void put_locate_block​(int[] ijk, double[] x, double[] y, double[] z, int[] ai, int[] aj, int[] ak)
      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 void 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 remaps it into the primary domain.
      • Methods inherited from class java.lang.Object

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

      • max_len_sq

        public double max_len_sq
      • ey

        public int ey
        The lower y index (inclusive) of the primary domain within the block structure.
      • ez

        public int ez
        The lower z index (inclusive) of the primary domain within the block structure.
      • wy

        public int wy
        The upper y index (exclusive) of the primary domain within the block structure.
      • wz

        public int wz
        The upper z index (exclusive) of the primary domain within the block structure.
      • oy

        public int oy
        The total size of the block structure (including images) in the y direction.
      • oz

        public int oz
        The total size of the block structure (including images) in the z direction.
      • oxyz

        public int oxyz
        The total number of blocks.
      • 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.
      • img

        public byte[] img
        An array holding information about periodic image construction at a given location.
      • init_mem

        public int init_mem
        The initial amount of memory to allocate for particles for each block.
      • 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_periodic_base

        public container_periodic_base​(double bx_,
                                       double bxy_,
                                       double by_,
                                       double bxz_,
                                       double byz_,
                                       double bz_,
                                       int nx_,
                                       int ny_,
                                       int nz_,
                                       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] (bx_) The x coordinate of the first unit vector. \param[in] (bxy_,by_) The x and y coordinates of the second unit vector. \param[in] (bxz_,byz_,bz_) The x, y, and z coordinates of the third unit vector. \param[in] (nx_,ny_,nz_) the number of grid blocks in each of the three coordinate directions. \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.
      • print_all_particles

        public void print_all_particles()
        Prints all particles in the container, including those that have been constructed in image blocks.
      • 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 be the pre-computed unit Voronoi cell based on planes formed by periodic images of the particle. \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 (but not needed in this instance.)
      • 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 (but not needed in this instance.) \return The block index.
      • create_all_images

        public void create_all_images()
        This routine creates all periodic images of the particles. It is meant for diagnostic purposes only, since usually periodic images are dynamically created in when they are referenced.
      • check_compartmentalized

        public void check_compartmentalized()
        Checks that the particles within each block lie within that block's bounds. This is useful for diagnosing problems with periodic image computation.
      • 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 void put_locate_block​(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.
      • put_locate_block

        protected void put_locate_block​(int[] ijk,
                                        double[] x,
                                        double[] y,
                                        double[] z,
                                        int[] ai,
                                        int[] aj,
                                        int[] ak)
        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. \param[out] (ai,aj,ak) the periodic image displacement that the particle is in, with (0,0,0) corresponding to the primary domain. \return True if the particle can be successfully placed into the container, false otherwise.
      • create_periodic_image

        public void create_periodic_image​(int di,
                                          int dj,
                                          int dk)
        Creates particles within an image block by copying them from the primary domain and shifting them. If the given block is aligned with the primary domain in the z-direction, the routine calls the simpler create_side_image routine where the image block may comprise of particles from up to two primary blocks. Otherwise is calls the more complex create_vertical_image where the image block may comprise of particles from up to four primary blocks. \param[in] (di,dj,dk) the coordinates of the image block to create.
      • create_side_image

        public void create_side_image​(int di,
                                      int dj,
                                      int dk)
        Creates particles within an image block that is aligned with the primary domain in the z axis. In this case, the image block may be comprised of particles from two primary blocks. The routine considers these two primary blocks, and adds the needed particles to the image. The remaining particles from the primary blocks are also filled into the neighboring images. \param[in] (di,dj,dk) the index of the block to consider. The z index must satisfy ez<=dk
      • create_vertical_image

        public void create_vertical_image​(int di,
                                          int dj,
                                          int dk)
        Creates particles within an image block that is not aligned with the primary domain in the z axis. In this case, the image block may be comprised of particles from four primary blocks. The routine considers these four primary blocks, and adds the needed particles to the image. The remaining particles from the primary blocks are also filled into the neighboring images. \param[in] (di,dj,dk) the index of the block to consider. The z index must satisfy dk=wz.
      • put_image

        public void put_image​(int reg,
                              int fijk,
                              int l,
                              double dx,
                              double dy,
                              double dz)
        Copies a particle position from the primary domain into an image block. \param[in] reg the block index within the primary domain that the particle is within. \param[in] fijk the index of the image block. \param[in] l the index of the particle entry within the primary block. \param[in] (dx,dy,dz) the displacement vector to add to the particle.
      • remap

        protected void 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 remaps 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.