@@ -51,4 +51,89 @@ class multipole: public std::array<real,MP> {
5151 ~multipole ();
5252};
5353
54+
55+ inline multipole::multipole () {
56+ }
57+
58+ inline real multipole::operator ()() const {
59+ return (*this )[0 ];
60+ }
61+
62+ inline real& multipole::operator ()() {
63+ return (*this )[0 ];
64+ }
65+
66+ inline real multipole::operator ()(integer i, integer j) const {
67+ return (*this )[1 + map2[i][j]];
68+ }
69+
70+ inline real& multipole::operator ()(integer i, integer j) {
71+ return (*this )[1 + map2[i][j]];
72+ }
73+
74+ #ifdef CORRECTION_ON
75+ inline real multipole::operator ()(integer i, integer j, integer k) const {
76+ return (*this )[7 + map3[i][j][k]];
77+ }
78+
79+ inline real& multipole::operator ()(integer i, integer j, integer k) {
80+ return (*this )[7 + map3[i][j][k]];
81+ }
82+ #endif
83+
84+ inline multipole& multipole::operator =(const multipole& expansion) {
85+ for (integer i = 0 ; i < MP ; i++) {
86+ (*this )[i] = expansion[i];
87+ }
88+ return *this ;
89+ }
90+
91+ inline multipole& multipole::operator =(real expansion) {
92+ for (integer i = 0 ; i < MP ; i++) {
93+ (*this )[i] = expansion;
94+ }
95+ return *this ;
96+ }
97+
98+ inline multipole multipole::operator >>(const space_vector& dX) const {
99+ multipole you = *this ;
100+ you >>= dX;
101+ return you;
102+ }
103+
104+ inline std::array<real, MP >& multipole::operator +=(const std::array<real, MP >& vec) {
105+ for (integer i = 0 ; i < MP ; i++) {
106+ (*this )[i] += vec[i];
107+ }
108+ return *this ;
109+ }
110+
111+ inline multipole::~multipole () {
112+ }
113+
114+
115+ inline multipole& multipole::operator >>=(const space_vector& Y) {
116+ multipole& me = *this ;
117+ #ifdef CORRECTION_ON
118+ for (integer p = 0 ; p < 3 ; p++) {
119+ for (integer q = p; q < 3 ; q++) {
120+ for (integer r = q; r < 3 ; r++) {
121+ me (p, q, r) += me () * Y[p] * Y[q] * Y[r];
122+ me (p, q, r) += Y[p] * me (r, q);
123+ me (p, q, r) += Y[q] * me (p, r);
124+ me (p, q, r) += Y[r] * me (q, p);
125+ }
126+ }
127+ }
128+ #endif
129+ for (integer p = 0 ; p < 3 ; p++) {
130+ for (integer q = p; q < 3 ; q++) {
131+ me (p, q) += me () * Y[p] * Y[q];
132+ }
133+ }
134+ return me;
135+ }
136+
137+
138+
54139#endif /* multipole_H_ */
0 commit comments