Bugfix in search_for_outside_edge routine.
[voro++.git] / branches / exact / src / unitcell.hh
blob5c6785e369940ca31beac231e77c9d53f82272f6
1 // Voro++, a 3D cell-based Voronoi library
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
7 /** \file unitcell.hh
8 * \brief Header file for the unitcell class. */
10 #ifndef VOROPP_UNITCELL_HH
11 #define VOROPP_UNITCELL_HH
13 #include <vector>
14 using namespace std;
16 #include "config.hh"
17 #include "cell.hh"
19 namespace voro {
21 /** \brief Class for computation of the unit Voronoi cell associated with
22 * a 3D non-rectangular periodic domain. */
23 class unitcell {
24 public:
25 /** The x coordinate of the first vector defining the periodic
26 * domain. */
27 const double bx;
28 /** The x coordinate of the second vector defining the periodic
29 * domain. */
30 const double bxy;
31 /** The y coordinate of the second vector defining the periodic
32 * domain. */
33 const double by;
34 /** The x coordinate of the third vector defining the periodic
35 * domain. */
36 const double bxz;
37 /** The y coordinate of the third vector defining the periodic
38 * domain. */
39 const double byz;
40 /** The z coordinate of the third vector defining the periodic
41 * domain. */
42 const double bz;
43 /** The computed unit Voronoi cell corresponding the given
44 * 3D non-rectangular periodic domain geometry. */
45 voronoicell unit_voro;
46 unitcell(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_);
47 /** Draws an outline of the domain in Gnuplot format.
48 * \param[in] filename the filename to write to. */
49 inline void draw_domain_gnuplot(const char* filename) {
50 FILE *fp(safe_fopen(filename,"w"));
51 draw_domain_gnuplot(fp);
52 fclose(fp);
54 void draw_domain_gnuplot(FILE *fp=stdout);
55 /** Draws an outline of the domain in Gnuplot format.
56 * \param[in] filename the filename to write to. */
57 inline void draw_domain_pov(const char* filename) {
58 FILE *fp(safe_fopen(filename,"w"));
59 draw_domain_pov(fp);
60 fclose(fp);
62 void draw_domain_pov(FILE *fp=stdout);
63 bool intersects_image(double dx,double dy,double dz,double &vol);
64 void images(vector<int> &vi,vector<double> &vd);
65 protected:
66 /** The maximum y-coordinate that could possibly cut the
67 * computed unit Voronoi cell. */
68 double max_uv_y;
69 /** The maximum z-coordinate that could possibly cut the
70 * computed unit Voronoi cell. */
71 double max_uv_z;
72 private:
73 inline void unit_voro_apply(int i,int j,int k);
74 bool unit_voro_intersect(int l);
75 inline bool unit_voro_test(int i,int j,int k);
80 #endif