WaveBEM: Unsteady Nonlinear Potential Flow Solver for Ship-Wave Interaction.
multipole_expansion.h
Go to the documentation of this file.
1 #ifndef MULTIPOLE_EXPANSION_H_
2 #define MULTIPOLE_EXPANSION_H_
3 
4 #include <math.h>
5 #include <string>
6 #include <vector>
7 #include <complex>
8 
9 #include <deal.II/base/point.h>
10 
11 #include "ass_leg_function.h"
12 
13 using namespace dealii;
14 
15 
17 {
18 public:
20 
21  mutable bool is_zero;
22 
23 private:
24 
25  mutable unsigned int p;
26 
27  mutable dealii::Point<3> center;
28 
30 
31  mutable std::complex <double> *_M_n_m;
32 
33 
34 
35 public:
36 
38 
39  MultipoleExpansion(const unsigned int order,const dealii::Point<3> &center,const AssLegFunction *assLegFunction);
40 
42 
44 
45  void Add(const MultipoleExpansion &multipole,const double sol);
46 
47  void Add(const double strength, const dealii::Point<3> &point);
48 
49  void Add(const MultipoleExpansion &child);
50 
51  void AddNormDer(const double strength, const dealii::Point<3> &point, const dealii::Tensor<1, 3> &normal);
52 
53  double Evaluate(const dealii::Point<3> &evalPoint);
54 
55  inline dealii::Point<3> GetCenter() const
56  {
57  return this->center;
58  }
59 
60  inline void SetCenter(const dealii::Point<3> &new_center)
61  {
62  this->center = new_center;
63  }
64 
65  inline FullMatrix<double> &GetA_n_m() const
66  {
67  return this->A_n_m;
68  }
69 
70  inline std::complex <double> *GetCoeffs() const
71  {
72  return this->_M_n_m;
73  }
74 
75  inline std::complex <double> &GetCoeff(unsigned int n, unsigned int m) const
76  {
77  return this->_M_n_m[(n)*(n+1)/2+m];
78  }
79 
80  inline void SetCoeff(unsigned int n, unsigned int m, std::complex <double> &value) const
81  {
82  this->_M_n_m[(n)*(n+1)/2+m] = value;
83  }
84 
85  inline void AddToCoeff(unsigned int n, unsigned int m, std::complex <double> &value) const
86  {
87  this->_M_n_m[(n)*(n+1)/2+m] += value;
88  }
89 
90  MultipoleExpansion &operator=( const MultipoleExpansion &other );
91 
92 
93  static FullMatrix<double> A_n_m_Matrix(unsigned int dim)
94  {
95  FullMatrix<double> A_n_m(dim+1,dim+1);
96  for (unsigned int n = 0; n < dim+1 ; n++)
97 
98  {
99  for (unsigned int m = 0; m < n+1 ; m++)
100 
101  {
102  double f1 = 1.;
103  double f2 = 1.;
104 
105  for (int ii = n-m; ii > 0; ii-- )
106  f1 *= ii;
107 
108  for (int ii = n+m; ii > 0; ii-- )
109  f2 *= (ii);
110 
111  A_n_m(n,m) = pow(-1.,double(n))/sqrt(f1*f2);
112  }
113  }
114 
115  return A_n_m;
116  }
117 
118 
119 };
120 
121 
122 
123 #endif /*MULTIPOLE_EXPANSION_H_*/
std::complex< double > & GetCoeff(unsigned int n, unsigned int m) const
FullMatrix< double > & GetA_n_m() const
void SetCenter(const dealii::Point< 3 > &new_center)
dealii::Point< 3 > GetCenter() const
void AddToCoeff(unsigned int n, unsigned int m, std::complex< double > &value) const
std::complex< double > * GetCoeffs() const
dealii::Point< 3 > center
const AssLegFunction * assLegFunction
void SetCoeff(unsigned int n, unsigned int m, std::complex< double > &value) const
static const bool value
std::complex< double > * _M_n_m
static FullMatrix< double > A_n_m_Matrix(unsigned int dim)
static FullMatrix< double > A_n_m