Voro++
wall.hh
Go to the documentation of this file.
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 wall.hh
00008  * \brief Header file for the derived wall classes. */
00009 
00010 #ifndef VOROPP_WALL_HH
00011 #define VOROPP_WALL_HH
00012 
00013 #include "cell.hh"
00014 #include "container.hh"
00015 
00016 namespace voro {
00017 
00018 /** \brief A class representing a spherical wall object.
00019  *
00020  * This class represents a spherical wall object. */
00021 struct wall_sphere : public wall {
00022         public:
00023                 /** Constructs a spherical wall object.
00024                  * \param[in] w_id_ an ID number to associate with the wall for
00025                  * neighbor tracking.
00026                  * \param[in] (xc_,yc_,zc_) a position vector for the sphere's
00027                  * center.
00028                  * \param[in] rc_ the radius of the sphere. */
00029                 wall_sphere(double xc_,double yc_,double zc_,double rc_,int w_id_=-99)
00030                         : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), rc(rc_) {}
00031                 bool point_inside(double x,double y,double z);
00032                 template<class v_cell>
00033                 bool cut_cell_base(v_cell &c,double x,double y,double z);
00034                 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00035                 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00036         private:
00037                 const int w_id;
00038                 const double xc,yc,zc,rc;
00039 };
00040 
00041 /** \brief A class representing a plane wall object.
00042  *
00043  * This class represents a single plane wall object. */
00044 struct wall_plane : public wall {
00045         public:
00046                 /** Constructs a plane wall object
00047                  * \param[in] (xc_,yc_,zc_) a normal vector to the plane.
00048                  * \param[in] ac_ a displacement along the normal vector.
00049                  * \param[in] w_id_ an ID number to associate with the wall for
00050                  * neighbor tracking. */
00051                 wall_plane(double xc_,double yc_,double zc_,double ac_,int w_id_=-99)
00052                         : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), ac(ac_) {}
00053                 bool point_inside(double x,double y,double z);
00054                 template<class v_cell>
00055                 bool cut_cell_base(v_cell &c,double x,double y,double z);
00056                 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00057                 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00058         private:
00059                 const int w_id;
00060                 const double xc,yc,zc,ac;
00061 };
00062 
00063 /** \brief A class representing a cylindrical wall object.
00064  *
00065  * This class represents a open cylinder wall object. */
00066 struct wall_cylinder : public wall {
00067         public:
00068                 /** Constructs a cylinder wall object.
00069                  * \param[in] (xc_,yc_,zc_) a point on the axis of the
00070                  * cylinder.
00071                  * \param[in] (xa_,ya_,za_) a vector pointing along the
00072                  * direction of the cylinder.
00073                  * \param[in] rc_ the radius of the cylinder
00074                  * \param[in] w_id_ an ID number to associate with the wall for
00075                  * neighbor tracking. */
00076                 wall_cylinder(double xc_,double yc_,double zc_,double xa_,double ya_,double za_,double rc_,int w_id_=-99)
00077                         : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), xa(xa_), ya(ya_), za(za_),
00078                         asi(1/(xa_*xa_+ya_*ya_+za_*za_)), rc(rc_) {}
00079                 bool point_inside(double x,double y,double z);
00080                 template<class v_cell>
00081                 bool cut_cell_base(v_cell &c,double x,double y,double z);
00082                 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00083                 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00084         private:
00085                 const int w_id;
00086                 const double xc,yc,zc,xa,ya,za,asi,rc;
00087 };
00088 
00089 
00090 /** \brief A class representing a conical wall object.
00091  *
00092  * This class represents a cone wall object. */
00093 struct wall_cone : public wall {
00094         public:
00095                 /** Constructs a cone wall object.
00096                  * \param[in] (xc_,yc_,zc_) the apex of the cone.
00097                  * \param[in] (xa_,ya_,za_) a vector pointing along the axis of
00098                  * the cone.
00099                  * \param[in] ang the angle (in radians) of the cone, measured
00100                  * from the axis.
00101                  * \param[in] w_id_ an ID number to associate with the wall for
00102                  * neighbor tracking. */
00103                 wall_cone(double xc_,double yc_,double zc_,double xa_,double ya_,double za_,double ang,int w_id_=-99)
00104                         : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), xa(xa_), ya(ya_), za(za_),
00105                         asi(1/(xa_*xa_+ya_*ya_+za_*za_)),
00106                         gra(tan(ang)), sang(sin(ang)), cang(cos(ang)) {}
00107                 bool point_inside(double x,double y,double z);
00108                 template<class v_cell>
00109                 bool cut_cell_base(v_cell &c,double x,double y,double z);
00110                 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00111                 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
00112         private:
00113                 const int w_id;
00114                 const double xc,yc,zc,xa,ya,za,asi,gra,sang,cang;
00115 };
00116 
00117 }
00118 
00119 #endif