Skip to content

Commit 605842a

Browse files
committed
inlined all of multipole.cpp
1 parent 5bc1c6c commit 605842a

3 files changed

Lines changed: 85 additions & 103 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -march=native")
33

44
add_executable( fmm_test
55
src/main.cpp
6-
src/multipole.cpp
76
)
87

src/multipole.cpp

Lines changed: 0 additions & 102 deletions
This file was deleted.

src/multipole.hpp

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)