Class Voro

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class Voro
    extends AlgorithmBase
    Voro++ Copyright (c) 2008, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, U.S. Dept. of Energy nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. You are under no obligation whatsoever to provide any bug fixes, patches, or upgrades to the features, functionality or performance of the source code ("Enhancements") to anyone; however, if you choose to make your Enhancements available either publicly, or directly to Lawrence Berkeley National Laboratory, without imposing a separate written license agreement for such Enhancements, then you hereby grant the following license: a non-exclusive, royalty-free perpetual license to install, use, modify, prepare derivative works, incorporate into other computer software, distribute, and sublicense such enhancements or derivative works thereof, in binary and source code form. Voro++, a 3D cell-based Voronoi library (http://math.lbl.gov/voro++/) By Chris H. Rycroft (Harvard University / Lawrence Berkeley Laboratory) ================================================================ Voro++ is a software library for carrying out three-dimensional computations of the Voronoi tessellation. A distinguishing feature of the Voro++ library is that it carries out cell-based calculations, computing the Voronoi cell for each particle individually, rather than computing the Voronoi tessellation as a global network of vertices and edges. It is particularly well-suited for applications that rely on cell-based statistics, where features of Voronoi cells (e.g. volume, centroid, number of faces) can be used to analyze a system of particles. Usage ===== Voro++ is released as free software through the Lawrence Berkeley National Laboratory - a detailed copyright notice is provided below, and the complete terms of the license can be found in the LICENSE file. I am very interested to hear from users of the software, so if you find this useful, please email me at chr@alum.mit.edu. Also, if you plan to publish an academic paper using this software, please consider citing one of the following publications: - Chris H. Rycroft, "Voro++: A three-dimensional Voronoi cell library in C++", Chaos 19, 041111 (2009). - Chris H. Rycroft, Gary S. Grest, James W. Landry, and Martin Z. Bazant, "Analysis of Granular Flow in a Pebble-Bed Nuclear Reactor", Phys. Rev. E 74, 021306 (2006). - Chris H. Rycroft, "Multiscale Modeling in Granular Flow", PhD thesis submitted to the Massachusetts Institute of Technology, September 2007. (http://seas.harvard.edu/~chr/publish/phd.html) The first reference contains a one-page overview of the library. The second reference contains some of the initial images that were made using a very early version of this code, to track small changes in packing fraction in a large particle simulation. The third reference discusses the use of 3D Voronoi cells, and describes the algorithms that were employed in the early version of this code. Since the publication of the above references, the algorithms in Voro++ have been significantly improved.
    • Field Detail

      • help

        boolean help
      • hc

        boolean hc
      • version

        boolean version
      • custom_output

        char[] custom_output
      • gnuplot_output

        boolean gnuplot_output
      • ls

        double ls
      • init_mem

        int init_mem
      • nx

        int[] nx
      • ny

        int[] ny
      • nz

        int[] nz
      • ordered

        boolean ordered
      • xperiodic

        boolean xperiodic
      • yperiodic

        boolean yperiodic
      • zperiodic

        boolean zperiodic
      • polydisperse

        boolean polydisperse
      • verbose

        boolean verbose
      • numberRectangularBox

        int numberRectangularBox
      • rbw0

        double[] rbw0
      • rbw1

        double[] rbw1
      • rbw2

        double[] rbw2
      • rbw3

        double[] rbw3
      • rbw4

        double[] rbw4
      • rbw5

        double[] rbw5
      • numberSphereWall

        int numberSphereWall
      • sw0

        double[] sw0
      • sw1

        double[] sw1
      • sw2

        double[] sw2
      • sw3

        double[] sw3
      • numberPlaneWall

        int numberPlaneWall
      • pw0

        double[] pw0
      • pw1

        double[] pw1
      • pw2

        double[] pw2
      • pw3

        double[] pw3
      • numberCylinderWall

        int numberCylinderWall
      • cyw0

        double[] cyw0
      • cyw1

        double[] cyw1
      • cyw2

        double[] cyw2
      • cyw3

        double[] cyw3
      • cyw4

        double[] cyw4
      • cyw5

        double[] cyw5
      • cyw6

        double[] cyw6
      • numberConeWall

        int numberConeWall
      • cow0

        double[] cow0
      • cow1

        double[] cow1
      • cow2

        double[] cow2
      • cow3

        double[] cow3
      • cow4

        double[] cow4
      • cow5

        double[] cow5
      • cow6

        double[] cow6
      • povp_output

        boolean povp_output
      • povv_output

        boolean povv_output
      • ax

        double ax
      • bx

        double bx
      • ay

        double ay
      • by

        double by
      • az

        double az
      • bz

        double bz
      • fileNameBase

        java.lang.String fileNameBase
      • wl

        final int[] wl
        \file v_base_wl.cc \brief The table of block worklists that are used during the cell computation, which is part of the voro_base class. This file is automatically generated by worklist_gen.pl and it is not intended to be edited by hand.
      • wl_hgrid

        final int wl_hgrid
        Each region is divided into a grid of subregions, and a worklist is # finalructed for each. This parameter sets is set to half the number of # subregions that the block is divided into.
        See Also:
        Constant Field Values
      • wl_fgrid

        final int wl_fgrid
        The number of subregions that a block is subdivided into, which is twice the value of hgrid.
        See Also:
        Constant Field Values
      • wl_hgridcu

        final int wl_hgridcu
        The total number of worklists, set to the cube of hgrid.
        See Also:
        Constant Field Values
      • wl_seq_length

        final int wl_seq_length
        The number of elements in each worklist.
        See Also:
        Constant Field Values
      • init_vertices

        final int init_vertices
        The initial memory allocation for the number of vertices.
        See Also:
        Constant Field Values
      • init_vertex_order

        final int init_vertex_order
        The initial memory allocation for the maximum vertex order.
        See Also:
        Constant Field Values
      • init_3_vertices

        final int init_3_vertices
        The initial memory allocation for the number of regular vertices of order 3.
        See Also:
        Constant Field Values
      • init_n_vertices

        final int init_n_vertices
        The initial memory allocation for the number of vertices of higher order.
        See Also:
        Constant Field Values
      • init_delete_size

        final int init_delete_size
        The initial size for the delete stack.
        See Also:
        Constant Field Values
      • init_delete2_size

        final int init_delete2_size
        The initial size for the auxiliary delete stack.
        See Also:
        Constant Field Values
      • init_xsearch_size

        final int init_xsearch_size
        The initial size for the extra search stack.
        See Also:
        Constant Field Values
      • init_wall_size

        final int init_wall_size
        The initial size for the wall pointer array.
        See Also:
        Constant Field Values
      • init_ordering_size

        final int init_ordering_size
        The default initial size for the ordering class.
        See Also:
        Constant Field Values
      • init_chunk_size

        final int init_chunk_size
        The initial size of the pre_container chunk index.
        See Also:
        Constant Field Values
      • max_vertices

        final int max_vertices
        The maximum memory allocation for the number of vertices.
        See Also:
        Constant Field Values
      • max_vertex_order

        final int max_vertex_order
        The maximum memory allocation for the maximum vertex order.
        See Also:
        Constant Field Values
      • max_n_vertices

        final int max_n_vertices
        The maximum memory allocation for the any particular order of vertex.
        See Also:
        Constant Field Values
      • max_delete_size

        final int max_delete_size
        The maximum size for the delete stack.
        See Also:
        Constant Field Values
      • max_delete2_size

        final int max_delete2_size
        The maximum size for the auxiliary delete stack.
        See Also:
        Constant Field Values
      • max_xsearch_size

        final int max_xsearch_size
        The maximum size for the extra search stack.
        See Also:
        Constant Field Values
      • max_particle_memory

        final int max_particle_memory
        The maximum amount of particle memory allocated for a single region.
        See Also:
        Constant Field Values
      • max_wall_size

        final int max_wall_size
        The maximum size for the wall pointer array.
        See Also:
        Constant Field Values
      • max_ordering_size

        final int max_ordering_size
        The maximum size for the ordering class.
        See Also:
        Constant Field Values
      • max_chunk_size

        final int max_chunk_size
        The maximum size for the pre_container chunk index.
        See Also:
        Constant Field Values
      • pre_container_chunk_size

        final int pre_container_chunk_size
        The chunk size in the pre_container classes.
        See Also:
        Constant Field Values
      • VOROPP_VERBOSE

        final int VOROPP_VERBOSE
        Voro++ can print a number of different status and debugging messages to notify the user of special behavior, and this macro sets the amount which are displayed. At level 0, no messages are printed. At level 1, messages about unusual cases during cell finalruction are printed, such as when the plane routine bails out due to floating point problems. At level 2, general messages about memory expansion are printed. At level 3, technical details about memory management are printed.
        See Also:
        Constant Field Values
      • tolerance

        final double tolerance
        If a point is within this distance of a cutting plane, then the code assumes that point exactly lies on the plane.
        See Also:
        Constant Field Values
      • large_number

        final double large_number
        A large number that is used in the computation.
        See Also:
        Constant Field Values
      • default_radius

        final double default_radius
        A radius to use as a placeholder when no other information is available.
        See Also:
        Constant Field Values
      • max_unit_voro_shells

        final int max_unit_voro_shells
        The maximum number of shells of periodic images to test over.
        See Also:
        Constant Field Values
      • optimal_particles

        final double optimal_particles
        A guess for the optimal number of particles per block, used to set up the container grid.
        See Also:
        Constant Field Values
      • VOROPP_REPORT_OUT_OF_BOUNDS

        final int VOROPP_REPORT_OUT_OF_BOUNDS
        If this is set to 1, then the code reports any instances of particles being put outside of the container geometry.
        See Also:
        Constant Field Values
      • VOROPP_FILE_ERROR

        final int VOROPP_FILE_ERROR
        Voro++ returns this status code if there is a file-related error, such as not being able to open file.
        See Also:
        Constant Field Values
      • VOROPP_MEMORY_ERROR

        final int VOROPP_MEMORY_ERROR
        Voro++ returns this status code if there is a memory allocation error, if one of the safe memory limits is exceeded.
        See Also:
        Constant Field Values
      • VOROPP_INTERNAL_ERROR

        final int VOROPP_INTERNAL_ERROR
        Voro++ returns this status code if there is any type of internal error, if it detects that representation of the Voronoi cell is inconsistent. This status code will generally indicate a bug, and the developer should be contacted.
        See Also:
        Constant Field Values
      • VOROPP_CMD_LINE_ERROR

        final int VOROPP_CMD_LINE_ERROR
        Voro++ returns this status code if it could not interpret the command line arguments passed to the command line utility.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Voro

        public Voro()
      • Voro

        public Voro​(boolean help,
                    boolean hc,
                    boolean version,
                    char[] custom_output,
                    boolean gnuplot_output,
                    Voro.blocks_mode bm,
                    double ls,
                    int init_mem,
                    int[] nx,
                    int[] ny,
                    int[] nz,
                    boolean ordered,
                    boolean xperiodic,
                    boolean yperiodic,
                    boolean zperiodic,
                    boolean polydisperse,
                    boolean verbose,
                    int numberRectangularBox,
                    double[] rbw0,
                    double[] rbw1,
                    double[] rbw2,
                    double[] rbw3,
                    double[] rbw4,
                    double[] rbw5,
                    int numberSphereWall,
                    double[] sw0,
                    double[] sw1,
                    double[] sw2,
                    double[] sw3,
                    int numberPlaneWall,
                    double[] pw0,
                    double[] pw1,
                    double[] pw2,
                    double[] pw3,
                    int numberCylinderWall,
                    double[] cyw0,
                    double[] cyw1,
                    double[] cyw2,
                    double[] cyw3,
                    double[] cyw4,
                    double[] cyw5,
                    double[] cyw6,
                    int numberConeWall,
                    double[] cow0,
                    double[] cow1,
                    double[] cow2,
                    double[] cow3,
                    double[] cow4,
                    double[] cow5,
                    double[] cow6,
                    boolean povp_output,
                    boolean povv_output,
                    double ax,
                    double bx,
                    double ay,
                    double by,
                    double az,
                    double bz,
                    java.lang.String fileNameBase)
    • Method Detail

      • runAlgorithm

        public void runAlgorithm()
        Description copied from class: AlgorithmBase
        Actually runs the algorithm. Implemented by inheriting algorithms.
        Specified by:
        runAlgorithm in class AlgorithmBase
      • cmd_line_output

        void cmd_line_output​(Voro.c_loop_order vl,
                             Voro.container_poly_radius_poly con,
                             char[] format,
                             java.io.RandomAccessFile outfile,
                             java.io.RandomAccessFile gnu_file,
                             java.io.RandomAccessFile povp_file,
                             java.io.RandomAccessFile povv_file,
                             boolean verbose,
                             double[] vol,
                             int[] vcc,
                             int[] tp)
      • cmd_line_output

        void cmd_line_output​(Voro.c_loop_order vl,
                             Voro.container_radius_mono con,
                             char[] format,
                             java.io.RandomAccessFile outfile,
                             java.io.RandomAccessFile gnu_file,
                             java.io.RandomAccessFile povp_file,
                             java.io.RandomAccessFile povv_file,
                             boolean verbose,
                             double[] vol,
                             int[] vcc,
                             int[] tp)
      • cmd_line_output

        void cmd_line_output​(Voro.c_loop_all vl,
                             Voro.container_poly_radius_poly con,
                             char[] format,
                             java.io.RandomAccessFile outfile,
                             java.io.RandomAccessFile gnu_file,
                             java.io.RandomAccessFile povp_file,
                             java.io.RandomAccessFile povv_file,
                             boolean verbose,
                             double[] vol,
                             int[] vcc,
                             int[] tp)
      • cmd_line_output

        void cmd_line_output​(Voro.c_loop_all vl,
                             Voro.container_radius_mono con,
                             char[] format,
                             java.io.RandomAccessFile outfile,
                             java.io.RandomAccessFile gnu_file,
                             java.io.RandomAccessFile povp_file,
                             java.io.RandomAccessFile povv_file,
                             boolean verbose,
                             double[] vol,
                             int[] vcc,
                             int[] tp)
      • help_message

        void help_message()
      • custom_output_message

        void custom_output_message()
      • version_message

        void version_message()
      • error_message

        void error_message()
      • single_cell

        public void single_cell()
      • convex_test

        public void convex_test()
      • platonic

        public void platonic()
      • importList

        public void importList()
      • cylinder

        public void cylinder()
      • frustrum

        public void frustrum()
      • tetrahedron

        public void tetrahedron()
      • torus

        public void torus()
      • cell_statistics

        public void cell_statistics()
      • custom_output

        public void custom_output()
      • radical

        public void radical()
      • box_cut

        public void box_cut()
      • cut_region

        public void cut_region()
      • irregular

        public void irregular()
      • I_shape

        public void I_shape()
      • superellipsoid

        public void superellipsoid()
      • odd_even

        public void odd_even()
      • loops

        public void loops()
      • draw_polygon

        void draw_polygon​(java.io.RandomAccessFile fp,
                          java.util.Vector<java.lang.Integer> f_vert,
                          java.util.Vector<java.lang.Double> v,
                          int j)
      • polygons

        public void polygons()
      • find_voro_cell

        public void find_voro_cell()
      • cylinder_inv

        public void cylinder_inv()
      • ellipsoid

        public void ellipsoid()
      • has_dodec_sides

        public boolean has_dodec_sides​(java.util.Vector<java.lang.Integer> vi)
      • finite_sys

        public void finite_sys()
      • ghost_test

        public void ghost_test()
      • import_nguyen

        public void import_nguyen()
      • import_rahman

        public void import_rahman()
      • lloyd_box

        public void lloyd_box()
      • minkowski

        public void minkowski()
      • neigh_test

        public void neigh_test()
      • period

        public void period()
      • polycrystal_rahman

        public void polycrystal_rahman()
      • r_pts_interface

        public void r_pts_interface()
      • rad_test

        public void rad_test()
      • random_points_10

        public void random_points_10()
      • random_points_200

        public void random_points_200()
      • single_cell_2d

        public void single_cell_2d()
      • sphere

        public void sphere()
      • sphere_mesh

        public void sphere_mesh()
      • split_cell

        public void split_cell()
      • tri_mesh

        public void tri_mesh()
      • voro_lf

        public void voro_lf()
      • timing_test

        public void timing_test()
      • degenerate

        public void degenerate()
      • degenerate2

        public void degenerate2()
      • check_duplicate

        void check_duplicate​(int n,
                             double x,
                             double y,
                             double z,
                             int id,
                             double[] qp)
      • voro_fatal_error

        void voro_fatal_error​(java.lang.String p,
                              int status)
        \brief Function for printing fatal error messages and exiting. Function for printing fatal error messages and exiting. \param[in] p a pointer to the message to print. \param[in] status the status code to return with.
      • voro_print_positions

        void voro_print_positions​(java.util.Vector<java.lang.Double> v,
                                  java.io.RandomAccessFile raFile)
        \brief Prints a vector of positions. Prints a vector of positions as bracketed triplets. \param[in] v the vector to print. \param[in] fp the file stream to print to.
      • voro_print_positions_stdout

        void voro_print_positions_stdout​(java.util.Vector<java.lang.Double> v)
      • safe_fopen

        java.io.RandomAccessFile safe_fopen​(java.lang.String filename,
                                            java.lang.String mode)
        \brief Opens a file and checks the operation was successful. Opens a file, and checks the return value to ensure that the operation was successful. \param[in] filename the file to open. \param[in] mode the cstdio fopen mode to use. \return The file handle.
      • safe_fopen_file

        java.io.File safe_fopen_file​(java.lang.String filename)
      • voro_print_vectorInteger

        void voro_print_vectorInteger​(java.util.Vector<java.lang.Integer> v,
                                      java.io.RandomAccessFile raFile)
        \brief Prints a vector of Integers. Prints a vector of Integers. \param[in] v the vector to print. \param[in] fp the file stream to print to.
      • voro_print_vectorInteger_stdout

        void voro_print_vectorInteger_stdout​(java.util.Vector<java.lang.Integer> v)
      • voro_print_vectorDouble

        void voro_print_vectorDouble​(java.util.Vector<java.lang.Double> v,
                                     java.io.RandomAccessFile raFile)
        \brief Prints a vector of doubles. Prints a vector of doubles. \param[in] v the vector to print. \param[in] fp the file stream to print to.
      • voro_print_vectorDouble_stdout

        void voro_print_vectorDouble_stdout​(java.util.Vector<java.lang.Double> v)
      • voro_print_face_vertices

        void voro_print_face_vertices​(java.util.Vector<java.lang.Integer> v,
                                      java.io.RandomAccessFile raFile)
        \brief Prints a vector a face vertex information. Prints a vector of face vertex information. A value is read, which corresponds to the number of vertices in the next face. The routine reads this number of values and prints them as a bracked list. This is repeated until the end of the vector is reached. \param[in] v the vector to interpret and print. \param[in] fp the file stream to print to.
      • voro_print_face_vertices_stdout

        void voro_print_face_vertices_stdout​(java.util.Vector<java.lang.Integer> v)
      • dot_product

        static double dot_product​(double[] a,
                                  int aoffset,
                                  double[] b,
                                  int boffset)
      • dot_product

        static double dot_product​(java.util.Vector<java.lang.Double> a,
                                  int aoffset,
                                  java.util.Vector<java.lang.Double> b,
                                  int boffset)
      • cross_product

        static void cross_product​(double[] a,
                                  int aoffset,
                                  double[] b,
                                  int boffset,
                                  double[] c)
      • cross_product

        static void cross_product​(java.util.Vector<java.lang.Double> a,
                                  int aoffset,
                                  java.util.Vector<java.lang.Double> b,
                                  int boffset,
                                  java.util.Vector<java.lang.Double> c)
      • triple_product

        static double triple_product​(double[] a,
                                     int aoffset,
                                     double[] b,
                                     int boffset,
                                     double[] c,
                                     int coffset)
      • triple_product

        static double triple_product​(java.util.Vector<java.lang.Double> a,
                                     int aoffset,
                                     java.util.Vector<java.lang.Double> b,
                                     int boffset,
                                     java.util.Vector<java.lang.Double> c,
                                     int coffset)
      • normalize_vector

        static void normalize_vector​(double[] x,
                                     int xoffset,
                                     double[] normalized,
                                     int normoffset)
      • normalize_vector

        static void normalize_vector​(double[] x,
                                     int xoffset,
                                     java.util.Vector normalized,
                                     int normoffset)
      • calculate_solid_angle

        static double calculate_solid_angle​(double[] R1,
                                            int R1offset,
                                            double[] R2,
                                            int R2offset,
                                            double[] R3,
                                            int R3offset)
      • calculate_solid_angle

        static double calculate_solid_angle​(java.util.Vector<java.lang.Double> R1,
                                            int R1offset,
                                            java.util.Vector<java.lang.Double> R2,
                                            int R2offset,
                                            java.util.Vector<java.lang.Double> R3,
                                            int R3offset)