2
2
/*
3
3
* PCMSolver, an API for the Polarizable Continuum Model
4
4
* Copyright (C) 2013-2015 Roberto Di Remigio, Luca Frediani and contributors
5
- *
5
+ *
6
6
* This file is part of PCMSolver.
7
- *
7
+ *
8
8
* PCMSolver is free software: you can redistribute it and/or modify
9
9
* it under the terms of the GNU Lesser General Public License as published by
10
10
* the Free Software Foundation, either version 3 of the License, or
11
11
* (at your option) any later version.
12
- *
12
+ *
13
13
* PCMSolver is distributed in the hope that it will be useful,
14
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
16
* GNU Lesser General Public License for more details.
17
- *
17
+ *
18
18
* You should have received a copy of the GNU Lesser General Public License
19
19
* along with PCMSolver. If not, see <http://www.gnu.org/licenses/>.
20
- *
20
+ *
21
21
* For information on the complete list of contributors to the
22
22
* PCMSolver API, see: <http://pcmsolver.readthedocs.org/>
23
23
*/
35
35
#include < Eigen/Core>
36
36
37
37
/* ! \file Sphere.hpp
38
- * \class Sphere
39
- * \brief Class describing a sphere.
38
+ * \struct Sphere
39
+ * \brief POD describing a sphere.
40
40
* \author Roberto Di Remigio
41
- * \date 2011
41
+ * \date 2011, 2016
42
42
*/
43
43
44
- class Sphere
44
+ struct Sphere
45
45
{
46
- public:
47
46
Sphere () {}
48
- Sphere (const Eigen::Vector3d & center, double radius,
49
- const std::string & colour = " Violet" )
50
- : center_(center), radius_(radius), colour_(colour) {}
47
+ Sphere (const Eigen::Vector3d & c, double r) : center(c), radius(r) {}
51
48
~Sphere () {}
52
- double radius () const { return radius_; }
53
- void radius (double r) { radius_ = r; }
54
- const Eigen::Vector3d & center () const { return center_; }
55
- double center (int i) const { return center_ (i); }
56
- void center (Eigen::Vector3d & coord) { center_ = coord; }
57
- const std::string & colour () const { return colour_; }
58
- void colour (std::string & col) { colour_ = col; }
59
-
60
49
// / Scale sphere to other units
61
- void scale (double scaling) { center_ *= scaling; radius_ *= scaling; }
62
-
63
- friend std::ostream& operator <<(std::ostream & os, Sphere & sph) {
64
- return sph.printObject (os);
65
- }
50
+ void scale (double scaling) { center *= scaling; radius *= scaling; }
51
+ Eigen::Vector3d center;
52
+ double radius;
66
53
EIGEN_MAKE_ALIGNED_OPERATOR_NEW /* See http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html */
67
- private:
68
- Eigen::Vector3d center_;
69
- double radius_;
70
- std::string colour_;
71
- std::ostream & printObject (std::ostream & os);
72
54
};
73
55
56
+ std::ostream& operator <<(std::ostream & os, Sphere & sph);
57
+
74
58
/* ! \fn inline void transfer_spheres(const std::vector<Sphere> & spheres, Eigen::Matrix3Xd & sphereCenter, Eigen::VectorXd & sphereRadius)
75
59
* \brief Transfer info from std::vector<Sphere> to Eigen objects.
76
60
* \param[in] spheres list of spheres as std::vector<Sphere>
@@ -79,16 +63,7 @@ class Sphere
79
63
*
80
64
* This is used in the Cavity.hpp constructor
81
65
*/
82
- inline void transfer_spheres (const std::vector<Sphere> & spheres,
83
- Eigen::Matrix3Xd & sphereCenter, Eigen::VectorXd & sphereRadius)
84
- {
85
- size_t nSpheres = spheres.size ();
86
- sphereCenter.resize (Eigen::NoChange, nSpheres);
87
- sphereRadius.resize (nSpheres);
88
- for (size_t i = 0 ; i < nSpheres; ++i) {
89
- sphereCenter.col (i) = spheres[i].center ();
90
- sphereRadius (i) = spheres[i].radius ();
91
- }
92
- }
66
+ void transfer_spheres (const std::vector<Sphere> & spheres,
67
+ Eigen::Matrix3Xd & sphereCenter, Eigen::VectorXd & sphereRadius);
93
68
94
69
#endif // SPHERE_HPP
0 commit comments