Voro++
|
00001 // Voro++, a 3D cell-based Voronoi library 00002 // 00003 // Author : Chris H. Rycroft (LBL / UC Berkeley) 00004 // Email : chr@alum.mit.edu 00005 // Date : August 30th 2011 00006 00007 /** \file unitcell.hh 00008 * \brief Header file for the unitcell class. */ 00009 00010 #ifndef VOROPP_UNITCELL_HH 00011 #define VOROPP_UNITCELL_HH 00012 00013 #include <vector> 00014 using namespace std; 00015 00016 #include "config.hh" 00017 #include "cell.hh" 00018 00019 namespace voro { 00020 00021 /** \brief Class for computation of the unit Voronoi cell associated with 00022 * a 3D non-rectangular periodic domain. */ 00023 class unitcell { 00024 public: 00025 /** The x coordinate of the first vector defining the periodic 00026 * domain. */ 00027 const double bx; 00028 /** The x coordinate of the second vector defining the periodic 00029 * domain. */ 00030 const double bxy; 00031 /** The y coordinate of the second vector defining the periodic 00032 * domain. */ 00033 const double by; 00034 /** The x coordinate of the third vector defining the periodic 00035 * domain. */ 00036 const double bxz; 00037 /** The y coordinate of the third vector defining the periodic 00038 * domain. */ 00039 const double byz; 00040 /** The z coordinate of the third vector defining the periodic 00041 * domain. */ 00042 const double bz; 00043 /** The computed unit Voronoi cell corresponding the given 00044 * 3D non-rectangular periodic domain geometry. */ 00045 voronoicell unit_voro; 00046 unitcell(double bx_,double bxy_,double by_,double bxz_,double byz_,double bz_); 00047 /** Draws an outline of the domain in Gnuplot format. 00048 * \param[in] filename the filename to write to. */ 00049 inline void draw_domain_gnuplot(const char* filename) { 00050 FILE *fp(safe_fopen(filename,"w")); 00051 draw_domain_gnuplot(fp); 00052 fclose(fp); 00053 } 00054 void draw_domain_gnuplot(FILE *fp=stdout); 00055 /** Draws an outline of the domain in Gnuplot format. 00056 * \param[in] filename the filename to write to. */ 00057 inline void draw_domain_pov(const char* filename) { 00058 FILE *fp(safe_fopen(filename,"w")); 00059 draw_domain_pov(fp); 00060 fclose(fp); 00061 } 00062 void draw_domain_pov(FILE *fp=stdout); 00063 bool intersects_image(double dx,double dy,double dz,double &vol); 00064 void images(vector<int> &vi,vector<double> &vd); 00065 protected: 00066 /** The maximum y-coordinate that could possibly cut the 00067 * computed unit Voronoi cell. */ 00068 double max_uv_y; 00069 /** The maximum z-coordinate that could possibly cut the 00070 * computed unit Voronoi cell. */ 00071 double max_uv_z; 00072 private: 00073 inline void unit_voro_apply(int i,int j,int k); 00074 bool unit_voro_intersect(int l); 00075 inline bool unit_voro_test(int i,int j,int k); 00076 }; 00077 00078 } 00079 00080 #endif