Package gov.nih.mipav.model.structures
Class Voro.voro_compute_container_radius_mono
- java.lang.Object
-
- gov.nih.mipav.model.structures.Voro.voro_compute_container_radius_mono
-
- Enclosing class:
- Voro
class Voro.voro_compute_container_radius_mono extends java.lang.Object\brief Template for carrying out Voronoi cell computations.
-
-
Field Summary
Fields Modifier and Type Field Description doubleboxxThe size of an internal computational block in the x direction.doubleboxyThe size of an internal computational block in the y direction.doubleboxzThe size of an internal computational block in the z direction.private doublebxsqA constant set to boxx*boxx+boxy*boxy+boxz*boxz, which is frequently used in the computation.int[]coAn array holding the number of particles within each computational box of the container.Voro.container_radius_monoconA reference to the container class on which to carry outinthxThe number of boxes in the x direction for the searching mask.inthxyA constant, set to the value of hx multiplied by hy, which is used in the routines which step through mask boxes in sequence.inthxyzA constant, set to the value of hx*hy*hz, which is used in the routines which step through mask boxes in sequence.inthyThe number of boxes in the y direction for the searching mask.inthzThe number of boxes in the z direction for the searching mask.int[][]idThis array holds the numerical IDs of each particle in each computational box.private int[]maskThis array is used during the cell computation to determine which blocks have been considered.private double[]mradAn pointer to the array holding the minimum distances associated with the worklists.private intmvThis sets the current value being used to mark tested blocks in the mask.double[][]pA two dimensional array holding particle positions.intpsThe number of floating point entries to store for each particle.private int[]quAn array is used to store the queue of blocks to test during the Voronoi cell computation.private intqu_lA pointer to the end of the queue array, used to determine when the queue is full.(package private) intqu_sizeThe current size of the search list.doublexspThe inverse box length in the x direction, set to nx/(bx-ax).doubleyspThe inverse box length in the y direction, set to ny/(by-ay).doublezspThe inverse box length in the z direction, set to nz/(bz-az).
-
Constructor Summary
Constructors Constructor Description voro_compute_container_radius_mono(Voro.container_radius_mono con_, int hx_, int hy_, int hz_)The class constructor initializes constants from the container class, and sets up the mask and queue used for Voronoi computations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadd_list_memory(int[] qu_s_index, int[] qu_e_index)Adds memory to the queue.private voidadd_to_mask(int ei, int ej, int ek, int[] qu_e_index)Scans the six orthogonal neighbors of a given block and adds them to the queue if they haven't been considered already.booleancompute_cell(Voro.voronoicell_neighbor c, int ijk, int s, int ci, int cj, int ck)booleancompute_cell(Voro.voronoicell c, int ijk, int s, int ci, int cj, int ck)This routine computes a Voronoi cell for a single particle in the container.private booleancompute_min_max_radius(int di, int dj, int dk, double fx, double fy, double fz, double gxs, double gys, double gzs, double[] crs, double mrs)This routine checks to see whether a point is within a particular distance of a nearby region.private booleancompute_min_radius(int di, int dj, int dk, double fx, double fy, double fz, double mrs)private booleancorner_test(Voro.voronoicell_neighbor c, double xl, double yl, double zl, double xh, double yh, double zh)private booleancorner_test(Voro.voronoicell c, double xl, double yl, double zl, double xh, double yh, double zh)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is at a corner.voiddelete()The class destructor frees the dynamically allocated memory for the mask and queue.private booleanedge_x_test(Voro.voronoicell_neighbor c, double x0, double yl, double zl, double x1, double yh, double zh)private booleanedge_x_test(Voro.voronoicell c, double x0, double yl, double zl, double x1, double yh, double zh)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on an edge which points along the x direction.private booleanedge_y_test(Voro.voronoicell_neighbor c, double xl, double y0, double zl, double xh, double y1, double zh)private booleanedge_y_test(Voro.voronoicell c, double xl, double y0, double zl, double xh, double y1, double zh)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on an edge which points along the y direction.private booleanedge_z_test(Voro.voronoicell_neighbor c, double xl, double yl, double z0, double xh, double yh, double z1)private booleanedge_z_test(Voro.voronoicell c, double xl, double yl, double z0, double xh, double yh, double z1)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on an edge which points along the z direction.private booleanface_x_test(Voro.voronoicell_neighbor c, double xl, double y0, double z0, double y1, double z1)private booleanface_x_test(Voro.voronoicell c, double xl, double y0, double z0, double y1, double z1)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on a face aligned with the x direction.private booleanface_y_test(Voro.voronoicell_neighbor c, double x0, double yl, double z0, double x1, double z1)private booleanface_y_test(Voro.voronoicell c, double x0, double yl, double z0, double x1, double z1)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on a face aligned with the y direction.private booleanface_z_test(Voro.voronoicell_neighbor c, double x0, double y0, double zl, double x1, double y1)private booleanface_z_test(Voro.voronoicell c, double x0, double y0, double zl, double x1, double y1)This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on a face aligned with the z direction.voidfind_voronoi_cell(double x, double y, double z, int ci, int cj, int ck, int ijk, Voro.particle_record w, double[] mrs)Finds the Voronoi cell that given vector is within.private voidreset_mask()Resets the mask in cases where the mask counter wraps around.private voidscan_all(int ijk, double x, double y, double z, int di, int dj, int dk, Voro.particle_record w, double[] mrs)Scans all of the particles within a block to see if any of them have a smaller distance to the given test vector.private voidscan_bits_mask_add(int q, int mijk, int ei, int ej, int ek, int[] qu_e_index)Scans a worklist entry and adds any blocks to the queue \param[in] (ei,ej,ek) the block to consider.
-
-
-
Field Detail
-
con
public Voro.container_radius_mono con
A reference to the container class on which to carry out
-
boxx
public double boxx
The size of an internal computational block in the x direction.
-
boxy
public double boxy
The size of an internal computational block in the y direction.
-
boxz
public double boxz
The size of an internal computational block in the z direction.
-
xsp
public double xsp
The inverse box length in the x direction, set to nx/(bx-ax).
-
ysp
public double ysp
The inverse box length in the y direction, set to ny/(by-ay).
-
zsp
public double zsp
The inverse box length in the z direction, set to nz/(bz-az).
-
hx
public int hx
The number of boxes in the x direction for the searching mask.
-
hy
public int hy
The number of boxes in the y direction for the searching mask.
-
hz
public int hz
The number of boxes in the z direction for the searching mask.
-
hxy
public int hxy
A constant, set to the value of hx multiplied by hy, which is used in the routines which step through mask boxes in sequence.
-
hxyz
public int hxyz
A constant, set to the value of hx*hy*hz, which is used in the routines which step through mask boxes in sequence.
-
ps
public int ps
The number of floating point entries to store for each particle.
-
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
An array holding the number of particles within each computational box of the container.
-
bxsq
private double bxsq
A constant set to boxx*boxx+boxy*boxy+boxz*boxz, which is frequently used in the computation.
-
mv
private int mv
This sets the current value being used to mark tested blocks in the mask.
-
qu_size
int qu_size
The current size of the search list.
-
mrad
private double[] mrad
An pointer to the array holding the minimum distances associated with the worklists.
-
mask
private int[] mask
This array is used during the cell computation to determine which blocks have been considered.
-
qu
private int[] qu
An array is used to store the queue of blocks to test during the Voronoi cell computation.
-
qu_l
private int qu_l
A pointer to the end of the queue array, used to determine when the queue is full.
-
-
Constructor Detail
-
voro_compute_container_radius_mono
public voro_compute_container_radius_mono(Voro.container_radius_mono con_, int hx_, int hy_, int hz_)
The class constructor initializes constants from the container class, and sets up the mask and queue used for Voronoi computations. \param[in] con_ a reference to the container class to use. \param[in] (hx_,hy_,hz_) the size of the mask to use.
-
-
Method Detail
-
delete
public void delete()
The class destructor frees the dynamically allocated memory for the mask and queue.
-
compute_cell
public boolean compute_cell(Voro.voronoicell c, int ijk, int s, int ci, int cj, int ck)
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. \param[in,out] c a reference to a voronoicell object. \param[in] ijk the index of the block that the test particle is in. \param[in] s the index of the particle within the test block. \param[in] (ci,cj,ck) the coordinates of the block that the test particle is in relative to the container data structure. \return False if the Voronoi cell was completely removed during the computation and has zero volume, true otherwise.
-
compute_cell
public boolean compute_cell(Voro.voronoicell_neighbor c, int ijk, int s, int ci, int cj, int ck)
-
find_voronoi_cell
public void find_voronoi_cell(double x, double y, double z, int ci, int cj, int ck, int ijk, Voro.particle_record w, double[] mrs)Finds the Voronoi cell that given vector is within. For containers that are not radially dependent, this corresponds to findig the particle that is closest to the vector; for the radical tessellation containers, this corresponds to a finding the minimum weighted distance. \param[in] (x,y,z) the vector to consider. \param[in] (ci,cj,ck) the coordinates of the block that the test particle is in relative to the container data structure. \param[in] ijk the index of the block that the test particle is in. \param[out] w a reference to a particle record in which to store information about the particle whose Voronoi cell the vector is within. \param[out] mrs the minimum computed distance.
-
corner_test
private boolean corner_test(Voro.voronoicell c, double xl, double yl, double zl, double xh, double yh, double zh)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is at a corner. \param[in,out] c a reference to a Voronoi cell. \param[in] (xl,yl,zl) the relative coordinates of the corner of the block closest to the cell center. \param[in] (xh,yh,zh) the relative coordinates of the corner of the block furthest away from the cell center. \return False if the block may intersect, true if does not.
-
corner_test
private boolean corner_test(Voro.voronoicell_neighbor c, double xl, double yl, double zl, double xh, double yh, double zh)
-
edge_x_test
private boolean edge_x_test(Voro.voronoicell c, double x0, double yl, double zl, double x1, double yh, double zh)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on an edge which points along the x direction. \param[in,out] c a reference to a Voronoi cell. \param[in] (x0,x1) the minimum and maximum relative x coordinates of the block. \param[in] (yl,zl) the relative y and z coordinates of the corner of the block closest to the cell center. \param[in] (yh,zh) the relative y and z coordinates of the corner of the block furthest away from the cell center. \return False if the block may intersect, true if does not.
-
edge_x_test
private boolean edge_x_test(Voro.voronoicell_neighbor c, double x0, double yl, double zl, double x1, double yh, double zh)
-
edge_y_test
private boolean edge_y_test(Voro.voronoicell c, double xl, double y0, double zl, double xh, double y1, double zh)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on an edge which points along the y direction. \param[in,out] c a reference to a Voronoi cell. \param[in] (y0,y1) the minimum and maximum relative y coordinates of the block. \param[in] (xl,zl) the relative x and z coordinates of the corner of the block closest to the cell center. \param[in] (xh,zh) the relative x and z coordinates of the corner of the block furthest away from the cell center. \return False if the block may intersect, true if does not.
-
edge_y_test
private boolean edge_y_test(Voro.voronoicell_neighbor c, double xl, double y0, double zl, double xh, double y1, double zh)
-
edge_z_test
private boolean edge_z_test(Voro.voronoicell c, double xl, double yl, double z0, double xh, double yh, double z1)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on an edge which points along the z direction. \param[in,out] c a reference to a Voronoi cell. \param[in] (z0,z1) the minimum and maximum relative z coordinates of the block. \param[in] (xl,yl) the relative x and y coordinates of the corner of the block closest to the cell center. \param[in] (xh,yh) the relative x and y coordinates of the corner of the block furthest away from the cell center. \return False if the block may intersect, true if does not.
-
edge_z_test
private boolean edge_z_test(Voro.voronoicell_neighbor c, double xl, double yl, double z0, double xh, double yh, double z1)
-
face_x_test
private boolean face_x_test(Voro.voronoicell c, double xl, double y0, double z0, double y1, double z1)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on a face aligned with the x direction. \param[in,out] c a reference to a Voronoi cell. \param[in] xl the minimum distance from the cell center to the face. \param[in] (y0,y1) the minimum and maximum relative y coordinates of the block. \param[in] (z0,z1) the minimum and maximum relative z coordinates of the block. \return False if the block may intersect, true if does not.
-
face_x_test
private boolean face_x_test(Voro.voronoicell_neighbor c, double xl, double y0, double z0, double y1, double z1)
-
face_y_test
private boolean face_y_test(Voro.voronoicell c, double x0, double yl, double z0, double x1, double z1)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on a face aligned with the y direction. \param[in,out] c a reference to a Voronoi cell. \param[in] yl the minimum distance from the cell center to the face. \param[in] (x0,x1) the minimum and maximum relative x coordinates of the block. \param[in] (z0,z1) the minimum and maximum relative z coordinates of the block. \return False if the block may intersect, true if does not.
-
face_y_test
private boolean face_y_test(Voro.voronoicell_neighbor c, double x0, double yl, double z0, double x1, double z1)
-
face_z_test
private boolean face_z_test(Voro.voronoicell c, double x0, double y0, double zl, double x1, double y1)
This function checks to see whether a particular block can possibly have any intersection with a Voronoi cell, for the case when the closest point from the cell center to the block is on a face aligned with the z direction. \param[in,out] c a reference to a Voronoi cell. \param[in] zl the minimum distance from the cell center to the face. \param[in] (x0,x1) the minimum and maximum relative x coordinates of the block. \param[in] (y0,y1) the minimum and maximum relative y coordinates of the block. \return False if the block may intersect, true if does not.
-
face_z_test
private boolean face_z_test(Voro.voronoicell_neighbor c, double x0, double y0, double zl, double x1, double y1)
-
compute_min_max_radius
private boolean compute_min_max_radius(int di, int dj, int dk, double fx, double fy, double fz, double gxs, double gys, double gzs, double[] crs, double mrs)This routine checks to see whether a point is within a particular distance of a nearby region. If the point is within the distance of the region, then the routine returns true, and computes the maximum distance from the point to the region. Otherwise, the routine returns false. \param[in] (di,dj,dk) the position of the nearby region to be tested, relative to the region that the point is in. \param[in] (fx,fy,fz) the displacement of the point within its region. \param[in] (gxs,gys,gzs) the maximum squared distances from the point to the sides of its region. \param[out] crs a reference in which to return the maximum distance to the region (only computed if the routine returns false). \param[in] mrs the distance to be tested. \return True if the region is further away than mrs, false if the region in within mrs.
-
compute_min_radius
private boolean compute_min_radius(int di, int dj, int dk, double fx, double fy, double fz, double mrs)
-
add_to_mask
private void add_to_mask(int ei, int ej, int ek, int[] qu_e_index)Scans the six orthogonal neighbors of a given block and adds them to the queue if they haven't been considered already. It assumes that the queue will definitely have enough memory to add six entries at the end. \param[in] (ei,ej,ek) the block to consider. \param[in,out] qu_e a pointer to the end of the queue.
-
scan_bits_mask_add
private void scan_bits_mask_add(int q, int mijk, int ei, int ej, int ek, int[] qu_e_index)Scans a worklist entry and adds any blocks to the queue \param[in] (ei,ej,ek) the block to consider. \param[in,out] qu_e a pointer to the end of the queue.
-
scan_all
private void scan_all(int ijk, double x, double y, double z, int di, int dj, int dk, Voro.particle_record w, double[] mrs)Scans all of the particles within a block to see if any of them have a smaller distance to the given test vector. If one is found, the routine updates the minimum distance and store information about this particle. \param[in] ijk the index of the block. \param[in] (x,y,z) the test vector to consider (which may have already had a periodic displacement applied to it). \param[in] (di,dj,dk) the coordinates of the current block, to store if the particle record is updated. \param[in,out] w a reference to a particle record in which to store information about the particle whose Voronoi cell the vector is within. \param[in,out] mrs the current minimum distance, that may be updated if a closer particle is found.
-
add_list_memory
private void add_list_memory(int[] qu_s_index, int[] qu_e_index)Adds memory to the queue. \param[in,out] qu_s a reference to the queue start pointer. \param[in,out] qu_e a reference to the queue end pointer.
-
reset_mask
private void reset_mask()
Resets the mask in cases where the mask counter wraps around.
-
-