Loading [MathJax]/extensions/tex2jax.js
NiHu  2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fmm_helmholtz2d.cpp
2 #include "fmm/lists.hpp"
3 #include "fmm/fmm_indexed.hpp"
4 #include "fmm/fmm_precompute.hpp"
5 #include "fmm/fmm_matrix.hpp"
6 
8 typedef double wave_number_t;
12 typedef cluster_t::location_t location_t;
14 
15 int main()
16 {
18  size_t N_src = 5000; // number of source nodes
19  location_t *src_begin = new location_t[N_src];
20  for (size_t i = 0; i < N_src; ++i)
21  src_begin[i].setRandom();
22  size_t N_rec = 3000; // number of receiver nodes
23  location_t *rec_begin = new location_t[N_rec];
24  for (size_t i = 0; i < N_rec; ++i)
25  {
26  rec_begin[i].setRandom();
27  rec_begin[i](0) += 2.0;
28  }
30 
32  cluster_tree_t tree(src_begin, src_begin + N_src,
33  rec_begin, rec_begin + N_rec,
35 
36  NiHu::fmm::interaction_lists lists(tree);
38 
40  wave_number_t k = 2.0;
41  fmm_t fmm(k);
42 
43  fmm.init_level_data(tree);
44 
45  for (size_t c = 0; c < tree.get_n_clusters(); ++c)
46  tree[c].set_p_level_data(&fmm.get_level_data(tree[c].get_level()));
48 
51  fmm.create_p2p<0, 0>(),
52  fmm.create_p2m<0>(),
53  fmm.create_p2l<0>(),
54  fmm.create_m2p<0>(),
55  fmm.create_l2p<0>(),
56  fmm.create_m2m(),
57  fmm.create_l2l(),
58  fmm.create_m2l()
59  );
60 
61  auto p2p = fmm.create_p2p<0, 0>();
62  std::cout << p2p(*rec_begin, *src_begin) << std::endl;
63 
64  auto idx_fctr = NiHu::fmm::create_indexed_functor(
65  src_begin, src_begin + N_src,
66  rec_begin, rec_begin + N_rec,
67  tree);
68 
69  auto pre_fctr = NiHu::fmm::create_precompute_functor(tree, lists);
70 
71  auto pre_collection = ops.transform(idx_fctr).transform(pre_fctr);
73 
75  auto mat = NiHu::fmm::create_fmm_matrix(pre_collection, tree, lists);
76 
77  Eigen::Matrix<std::complex<double>, Eigen::Dynamic, 1> xct(N_src, 1);
78  xct.setConstant(1.0);
79 
80  auto resp = mat * xct;
82 
83  delete[] src_begin;
84  delete[] rec_begin;
85 
86  return 0;
87 }
fmm_matrix.hpp
Class NiHu::fmm::fmm_matrix.
NiHu::fmm::black_box_fmm
Black box FMM for a smooth kernel.
Definition: black_box_fmm.hpp:61
NiHu::fmm::chebyshev_cluster
Cluster class of the Black Box FMM.
Definition: chebyshev_cluster.hpp:28
NiHu::fmm::cluster_tree< cluster_t >
helmholtz_2d_wb_fmm.hpp
2D Wide Band Helmholtz FMM
lists.hpp
Definition of class NiHu::fmm::interaction_lists.
NiHu::fmm::divide_num_nodes
Class representing a cluster division based on number of nodes.
Definition: divide.hpp:74
fmm_indexed.hpp
Interface for indexing FMM operators.
fmm_precompute.hpp
Operator pre-computation interface.
NiHu::fmm::create_fmm_matrix
auto create_fmm_matrix(fmm_operator_collection< CollOps... > const &collection, cluster_tree< Cluster > const &tree, interaction_lists const &lists)
Factory function to create fmm_matrix from an operator collection.
Definition: fmm_matrix.hpp:660
NiHu::fmm::helmholtz_2d_wb_fmm
the 2d wide band helmholetz fmm
Definition: helmholtz_2d_wb_fmm.hpp:42
NiHu::fmm::create_fmm_operator_collection
fmm_operator_collection< Ops... > create_fmm_operator_collection(Ops &&... ops)
Create function for the collection.
Definition: fmm_operator_collection.hpp:166
NiHu::fmm::interaction_lists
class storing the different interaction lists of a tree
Definition: lists.hpp:22