Voro++: wall.hh Source File

Voro++

- Main Page
- Data Structures
- Files

- File List
- Globals

wall.hh
Go to the documentation of this file.
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
6
7 /** \file wall.hh
8 * \brief Header file for the derived wall classes. */
9
10 #ifndef VOROPP_WALL_HH
11 #define VOROPP_WALL_HH
12
13 #include "cell.hh"
14 #include "container.hh"
15
16 namespace voro {
17
18 /** \brief A class representing a spherical wall object.
19 *
20 * This class represents a spherical wall object. */
21 struct wall_sphere : public wall {
22 public:
23 /** Constructs a spherical wall object.
24 * \param[in] w_id_ an ID number to associate with the wall for
25 * neighbor tracking.
26 * \param[in] (xc_,yc_,zc_) a position vector for the sphere's
27 * center.
28 * \param[in] rc_ the radius of the sphere. */
29 wall_sphere(double xc_,double yc_,double zc_,double rc_,int w_id_=-99)
30 : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), rc(rc_) {}
31 bool point_inside(double x,double y,double z);
32 template<class v_cell>
33 bool cut_cell_base(v_cell &c,double x,double y,double z);
34 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
35 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
36 private:
37 const int w_id;
38 const double xc,yc,zc,rc;
39 };
40
41 /** \brief A class representing a plane wall object.
42 *
43 * This class represents a single plane wall object. */
44 struct wall_plane : public wall {
45 public:
46 /** Constructs a plane wall object.
47 * \param[in] (xc_,yc_,zc_) a normal vector to the plane.
48 * \param[in] ac_ a displacement along the normal vector.
49 * \param[in] w_id_ an ID number to associate with the wall for
50 * neighbor tracking. */
51 wall_plane(double xc_,double yc_,double zc_,double ac_,int w_id_=-99)
52 : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), ac(ac_) {}
53 bool point_inside(double x,double y,double z);
54 template<class v_cell>
55 bool cut_cell_base(v_cell &c,double x,double y,double z);
56 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
57 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
58 private:
59 const int w_id;
60 const double xc,yc,zc,ac;
61 };
62
63 /** \brief A class representing a cylindrical wall object.
64 *
65 * This class represents a open cylinder wall object. */
66 struct wall_cylinder : public wall {
67 public:
68 /** Constructs a cylinder wall object.
69 * \param[in] (xc_,yc_,zc_) a point on the axis of the
70 * cylinder.
71 * \param[in] (xa_,ya_,za_) a vector pointing along the
72 * direction of the cylinder.
73 * \param[in] rc_ the radius of the cylinder
74 * \param[in] w_id_ an ID number to associate with the wall for
75 * neighbor tracking. */
76 wall_cylinder(double xc_,double yc_,double zc_,double xa_,double ya_,double za_,double rc_,int w_id_=-99)
77 : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), xa(xa_), ya(ya_), za(za_),
78 asi(1/(xa_*xa_+ya_*ya_+za_*za_)), rc(rc_) {}
79 bool point_inside(double x,double y,double z);
80 template<class v_cell>
81 bool cut_cell_base(v_cell &c,double x,double y,double z);
82 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
83 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
84 private:
85 const int w_id;
86 const double xc,yc,zc,xa,ya,za,asi,rc;
87 };
88
89
90 /** \brief A class representing a conical wall object.
91 *
92 * This class represents a cone wall object. */
93 struct wall_cone : public wall {
94 public:
95 /** Constructs a cone wall object.
96 * \param[in] (xc_,yc_,zc_) the apex of the cone.
97 * \param[in] (xa_,ya_,za_) a vector pointing along the axis of
98 * the cone.
99 * \param[in] ang the angle (in radians) of the cone, measured
100 * from the axis.
101 * \param[in] w_id_ an ID number to associate with the wall for
102 * neighbor tracking. */
103 wall_cone(double xc_,double yc_,double zc_,double xa_,double ya_,double za_,double ang,int w_id_=-99)
104 : w_id(w_id_), xc(xc_), yc(yc_), zc(zc_), xa(xa_), ya(ya_), za(za_),
105 asi(1/(xa_*xa_+ya_*ya_+za_*za_)),
106 gra(tan(ang)), sang(sin(ang)), cang(cos(ang)) {}
107 bool point_inside(double x,double y,double z);
108 template<class v_cell>
109 bool cut_cell_base(v_cell &c,double x,double y,double z);
110 bool cut_cell(voronoicell &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
111 bool cut_cell(voronoicell_neighbor &c,double x,double y,double z) {return cut_cell_base(c,x,y,z);}
112 private:
113 const int w_id;
114 const double xc,yc,zc,xa,ya,za,asi,gra,sang,cang;
115 };
116
117 }
118
119 #endif
voro::voronoicell_neighbor
Extension of the voronoicell_base class to represent a Voronoi cell with neighbor information...
Definition: cell.hh:403
voro::wall_cylinder::cut_cell
bool cut_cell(voronoicell &c, double x, double y, double z)
Definition: wall.hh:82
voro::wall_sphere::cut_cell
bool cut_cell(voronoicell &c, double x, double y, double z)
Definition: wall.hh:34
voro::wall_plane
A class representing a plane wall object.
Definition: wall.hh:44
voro::wall_plane::cut_cell
bool cut_cell(voronoicell_neighbor &c, double x, double y, double z)
Definition: wall.hh:57
voro::wall_sphere::cut_cell
bool cut_cell(voronoicell_neighbor &c, double x, double y, double z)
Definition: wall.hh:35
voro::wall_plane::point_inside
bool point_inside(double x, double y, double z)
Definition: wall.cc:41
voro::wall_sphere::wall_sphere
wall_sphere(double xc_, double yc_, double zc_, double rc_, int w_id_=-99)
Definition: wall.hh:29
voro::wall_cone::cut_cell_base
bool cut_cell_base(v_cell &c, double x, double y, double z)
Definition: wall.cc:106
cell.hh
Header file for the voronoicell and related classes.
voro::wall_cylinder::cut_cell
bool cut_cell(voronoicell_neighbor &c, double x, double y, double z)
Definition: wall.hh:83
voro::wall_sphere::cut_cell_base
bool cut_cell_base(v_cell &c, double x, double y, double z)
Definition: wall.cc:29
voro::wall_plane::cut_cell
bool cut_cell(voronoicell &c, double x, double y, double z)
Definition: wall.hh:56
voro::wall_cone::cut_cell
bool cut_cell(voronoicell &c, double x, double y, double z)
Definition: wall.hh:110
voro::wall_plane::cut_cell_base
bool cut_cell_base(v_cell &c, double x, double y, double z)
Definition: wall.cc:50
voro::wall_cone::wall_cone
wall_cone(double xc_, double yc_, double zc_, double xa_, double ya_, double za_, double ang, int w_id_=-99)
Definition: wall.hh:103
voro::wall_sphere::point_inside
bool point_inside(double x, double y, double z)
Definition: wall.cc:17
voro::wall_cone::cut_cell
bool cut_cell(voronoicell_neighbor &c, double x, double y, double z)
Definition: wall.hh:111
container.hh
Header file for the container_base and related classes.
voro::wall_plane::wall_plane
wall_plane(double xc_, double yc_, double zc_, double ac_, int w_id_=-99)
Definition: wall.hh:51
voro::wall_cylinder::cut_cell_base
bool cut_cell_base(v_cell &c, double x, double y, double z)
Definition: wall.cc:74
voro::wall
Pure virtual class from which wall objects are derived.
Definition: container.hh:31
voro::wall_sphere
A class representing a spherical wall object.
Definition: wall.hh:21
voro::wall_cylinder::point_inside
bool point_inside(double x, double y, double z)
Definition: wall.cc:58
voro::wall_cone::point_inside
bool point_inside(double x, double y, double z)
Definition: wall.cc:88
voro::voronoicell
Extension of the voronoicell_base class to represent a Voronoi cell without neighbor information...
Definition: cell.hh:300
voro::wall_cone
A class representing a conical wall object.
Definition: wall.hh:93
voro::wall_cylinder
A class representing a cylindrical wall object.
Definition: wall.hh:66
voro::wall_cylinder::wall_cylinder
wall_cylinder(double xc_, double yc_, double zc_, double xa_, double ya_, double za_, double rc_, int w_id_=-99)
Definition: wall.hh:76