-
Notifications
You must be signed in to change notification settings - Fork 0
/
AIFMM.hpp
59 lines (54 loc) · 1.34 KB
/
AIFMM.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "AIFMMTree.hpp"
template <typename kerneltype>
class AIFMM {
public:
FMM2DTree<kerneltype>* A;
AIFMM(kerneltype* mykernel, int N, int nLevels, int TOL_POW, double* locations) {
A = new FMM2DTree<kerneltype>(mykernel, int(N), int(nLevels), TOL_POW, locations);
A->createTree();
A->assign_Tree_Interactions();
A->assign_Center_Location();
A->assignChargeLocations();
A->assignNonLeafChargeLocations();//actually it doesnt assign; clears it
A->getNodes();
A->assemble_M2L();
A->initialise_phase();
A->initialise_P2P_Leaf_Level();
}
void factorize() {
A->eliminate_phase_efficient();
}
Vec solve(Vec &rhs) {
A->assign_Leaf_rhs(rhs);
A->rhs_eliminate_phase_efficient();
A->back_substitution_phase();
Vec phi;
A->getx(phi);
return phi;
}
void backSubstitute(Vec &rhs) {
A->assign_Leaf_rhs(rhs);
A->rhs_eliminate_phase_efficient();
A->back_substitution_phase();
}
void backSubstitute1(Vec &rhs) {
A->assign_Leaf_rhs(rhs);
}
void backSubstitute2() {
A->rhs_eliminate_phase_efficient();
}
void backSubstitute3() {
A->back_substitution_phase();
}
void getSolution(Vec &phi) {
A->getx(phi);
A->reorder(phi);
}
double getError(Vec &rhs) {
A->assign_Leaf_rhs(rhs);
return A->error_check();
}
~AIFMM() {
delete A;
};
};