1 #ifndef LOCALEXPANSION_H_
2 #define LOCALEXPANSION_H_
33 mutable unsigned int p;
39 mutable std::complex <double> *
_L_n_m;
51 void Add(
const std::vector <double> &real,
const std::vector <double> &imag);
58 double Evaluate(
const dealii::Point<3> &evalPoint);
65 inline void SetCenter(
const dealii::Point<3> &new_center)
67 this->center = new_center;
85 inline std::complex <double> &
GetCoeff(
unsigned int n,
unsigned int m)
const
87 return this->_L_n_m[(n)*(n+1)/2+m];
90 void SetCoeff(
unsigned int n,
unsigned int m, std::complex <double> &
value)
const
92 this->_L_n_m[(n)*(n+1)/2+m] =
value;
95 void AddToCoeff(
unsigned int n,
unsigned int m, std::complex <double> &
value)
const
97 this->_L_n_m[(n)*(n+1)/2+m] +=
value;
106 for (
unsigned int n = 0; n < dimension+1 ; n++)
109 for (
unsigned int m = 0; m < n+1 ; m++)
115 for (
int ii = n-m; ii > 0; ii-- )
118 for (
int ii = n+m; ii > 0; ii-- )
121 A_n_m(n,m) = pow(-1.,
double(n))/sqrt(f1*f2);
133 std::complex <double> imUnit = std::complex <double> (0.,1.);
134 std::vector <std::vector <std::vector <std::map <int,double > > > > realCoeff;
135 realCoeff.resize(p+1);
136 for (
int n = 0; n < int(p)+1 ; n++)
138 realCoeff[n].resize(n+1);
139 for (
int m = 0; m < n+1 ; m++)
141 realCoeff[n][m].resize(p+1);
142 for (
int nn = 0; nn < int(p)+1 ; nn++)
144 for (
int mm = -1*nn; mm < nn+1 ; mm++)
148 double realFact =
A_n_m(nn,abs(mm)) /
A_n_m(n+nn,abs(m-mm)) *
A_n_m(n,abs(m));
149 realFact *= (pow(imUnit,
double(abs(m-mm)-abs(m)-abs(mm)))).real()/pow(-1.,nn);
150 realCoeff[n][m][nn][mm] = realFact;
151 loc_exp_coeff.
set(n,m,nn,mm,realFact);
161 return loc_exp_coeff;
165 static std::vector <std::vector <std::map <int,std::map <int,double > > > >
169 std::complex <double> imUnit = std::complex <double> (0.,1.);
170 std::vector <std::vector <std::map <int,std::map <int,double > > > > realCoeff;
171 realCoeff.resize(p+1);
172 for (
int n = 0; n < int(p)+1 ; n++)
174 realCoeff[n].resize(n+1);
175 for (
int m = 0; m < n+1 ; m++)
177 for (
int nn = n; nn < int(p)+1 ; nn++)
179 for (
int mm = -1*nn; mm < nn+1 ; mm++)
183 double realFact =
A_n_m(nn-n,abs(mm-m)) /
A_n_m(nn,abs(mm)) *
A_n_m(n,abs(m));
184 realFact *= (pow(imUnit,
double(abs(mm)-abs(mm-m)-abs(m)))).real()*pow(-1.,nn+n);
185 realCoeff[n][m][nn][mm] = realFact;
static std::vector< std::vector< std::map< int, std::map< int, double > > > > lExp_to_lExp_Coeff_Build(FullMatrix< double > A_n_m, unsigned int p)
void set(const unsigned int &n, const unsigned int &m, const unsigned int &nn, const unsigned int &mm, const double &value)
static LocalExpansionCoeff mExp_to_lExp_Coeff
double Evaluate(const dealii::Point< 3 > &evalPoint)
FullMatrix< double > GetA_n_m() const
unsigned int GetOrder() const
const AssLegFunction * assLegFunction
static std::vector< std::vector< std::map< int, std::map< int, double > > > > lExp_to_lExp_Coeff
void SetCenter(const dealii::Point< 3 > &new_center)
static FullMatrix< double > A_n_m_Matrix(unsigned int dimension)
LocalExpansion & operator=(const LocalExpansion &other)
dealii::Point< 3 > & GetCenter() const
static LocalExpansionCoeff mExp_to_lExp_Coeff_Build(FullMatrix< double > A_n_m, unsigned int p)
static FullMatrix< double > A_n_m
void AddToCoeff(unsigned int n, unsigned int m, std::complex< double > &value) const
void SetCoeff(unsigned int n, unsigned int m, std::complex< double > &value) const
std::complex< double > * _L_n_m
std::complex< double > & GetCoeff(unsigned int n, unsigned int m) const
dealii::Point< 3 > center
void Add(const std::vector< double > &real, const std::vector< double > &imag)
std::complex< double > * GetCoeffs() const