ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/poly_occ/voro++-0.4.6/src/wall.hh
Revision: 979
Committed: Thu Oct 18 23:40:32 2018 UTC (6 years, 7 months ago) by francois
File size: 4563 byte(s)
Log Message:
creation de polycristaux avec OCC

File Contents

# User Rev Content
1 francois 979 // 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