VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
multipole.h
Go to the documentation of this file.
1#pragma once
2
3#include "morton_tree.h"
4#include <oneapi/tbb/enumerable_thread_specific.h>
5#include <ranges>
6#include "../common/simple_math.h"
7
8namespace fmm {
9
11{
12public:
13 FastMultipole(const std::vector<particle2d>& particles, double eps = 1.e-8, int N = FMM_AUTO, int tree_depth = FMM_AUTO);
14 FastMultipole(std::vector<particle2d>&& particles, double eps = 1.e-8, int N = FMM_AUTO, int tree_depth = FMM_AUTO);
15 FastMultipole(const std::vector<particle2d>& source_particles, const std::vector<particle2d>& target_particles, double eps = 1.e-8, int N = FMM_AUTO, int tree_depth = FMM_AUTO);
16
17 std::vector<std::complex<double>> forces;
18 std::vector<double> potentials;
19private:
20 void Solve(std::vector<particle2d>&& particles, double eps = 1.e-8, int N = FMM_AUTO, int tree_depth = FMM_AUTO);
21 void Multipole(std::complex<double>* a, const std::pair<size_t, size_t>& particle_range, const std::complex<double>& z0);
22 void M2M(const std::complex<double>* a, const std::complex<double>& z0, std::complex<double>* b, std::vector<std::complex<double>>& work);
23 void M2L(const std::complex<double>* a, const std::complex<double>& z0, std::complex<double>* b, std::vector<std::complex<double>>& work);
24 void L2L(const std::complex<double>* a, const std::complex<double>& z0, std::complex<double>* b);
25
26 void Upward();
27 void Downward();
28
29 void ComputePotentials();
30 void ComputeForces();
31
32 std::shared_ptr<MortonTree2d> tree;
33 std::vector<std::vector<std::complex<double>>> outer_expansions; // for all tree levels
34 std::vector<std::vector<std::complex<double>>> inner_expansions; // for all tree levels
35
36 size_t tree_depth;
37 int N; // multipole_num
40
41 tbb::enumerable_thread_specific<std::vector<std::complex<double>>> local_work;
42};
43
44} // fmm
std::vector< std::complex< double > > forces
Definition multipole.h:17
void L2L(const std::complex< double > *a, const std::complex< double > &z0, std::complex< double > *b)
Definition multipole.cpp:89
std::vector< std::vector< std::complex< double > > > outer_expansions
Definition multipole.h:33
void M2L(const std::complex< double > *a, const std::complex< double > &z0, std::complex< double > *b, std::vector< std::complex< double > > &work)
Definition multipole.cpp:69
tbb::enumerable_thread_specific< std::vector< std::complex< double > > > local_work
Definition multipole.h:41
std::shared_ptr< MortonTree2d > tree
Definition multipole.h:32
void M2M(const std::complex< double > *a, const std::complex< double > &z0, std::complex< double > *b, std::vector< std::complex< double > > &work)
Definition multipole.cpp:41
void Solve(std::vector< particle2d > &&particles, double eps=1.e-8, int N=FMM_AUTO, int tree_depth=FMM_AUTO)
std::vector< std::vector< std::complex< double > > > inner_expansions
Definition multipole.h:34
void Multipole(std::complex< double > *a, const std::pair< size_t, size_t > &particle_range, const std::complex< double > &z0)
Definition multipole.cpp:25
std::vector< double > potentials
Definition multipole.h:18
Definition avx.h:5
const int FMM_AUTO
Definition defs.h:26