-
Notifications
You must be signed in to change notification settings - Fork 0
/
fmm2d.h
55 lines (47 loc) · 1.3 KB
/
fmm2d.h
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
/*
* File: FMM2D.h
* Author: euklid
*
* Created on June 7, 2015, 3:51 PM
*/
#ifndef FMM2D_H
#define FMM2D_H
#include "fmm.h"
#include "tree2d.h"
class FMM2D : public FMM
{
public:
FMM2D(std::vector<Element*> const & src_elements,
std::vector<Element*> const & tgt_elements,
unsigned int exp_terms,
unsigned int loc_terms,
unsigned int max_cell_elements,
bool src_eq_tgt = false);
virtual void calculate(bool precond = false);
virtual void recalculate();
protected:
virtual void build_tree();
virtual void upward_pass();
virtual void downward_pass();
virtual void evaluate();
virtual void reset();
virtual void m2l_downward_pass(Cell* cell);
virtual void l2l_downward_pass(Cell* cell);
virtual void direct_downward_pass(Cell* target);
virtual void evaluate_far_interactions(Cell* cell);
virtual void init_precond();
template<class T>
static void add_moments(std::vector<T> const & summand,
std::vector<T> & moments)
{
#if DEBUG
assert(summand.size() == moments.size());
#endif
unsigned int num_moments = moments.size();
for (unsigned int i = 0; i < num_moments; i++)
{
moments[i] += summand[i];
}
}
};
#endif /* FMM2D_H */