7 #define GSL_SIGN(x) (x<0 ? -1: (x>0 ? 1: 0))
14 std::vector <std::vector <std::map <int,std::map <int,double> > > >
37 this->
_L_n_m=
new std::complex <double>[(this->
p+1)*(this->
p+2)/2];
38 for (
unsigned int i=0; i<(this->
p+1)*(this->
p+2)/2; ++i)
39 this->
_L_n_m[i] = std::complex <double>(0.0,0.0);
50 this->
_L_n_m =
new std::complex <double>[(this->
p+1)*(this->
p+2)/2];
51 memcpy(this->
_L_n_m, other.
GetCoeffs(),
sizeof(std::complex <double>)*(this->
p+1)*(this->
p+2)/2);
69 this->
_L_n_m =
new std::complex <double>[(this->
p+1)*(this->
p+2)/2];
70 memcpy(this->
_L_n_m, other.
GetCoeffs(),
sizeof(std::complex <double>)*(this->
p+1)*(this->
p+2)/2);
81 unsigned int count = 0;
83 for (
unsigned int m = 0; m < this->
p+1 ; m++)
85 for (
unsigned int n = m; n < this->p + 1 ; n++)
87 std::complex <double> a(real.at(count),imag.at(count));
111 unsigned int p = this->
p;
112 if (other.
center.distance(this->center) > 1e-7)
115 dealii::Point<3> blockRelPos = other.
GetCenter() + (-1.0*this->
center);
116 double rho = sqrt(blockRelPos.square());
117 double cos_alpha_ = blockRelPos(2)/rho;
118 double beta = atan2(blockRelPos(1),blockRelPos(0));
122 for (
int n = 0; n < int(p)+1 ; n++)
124 for (
int m = 0; m < n+1 ; m++)
126 std::complex <double> z = std::complex <double>(0.,0.);
127 for (
int nn = n; nn < int(p)+1 ; nn++)
129 double rhoFact = pow(rho,
double(nn-n));
130 for (
int mm = -1*nn; mm < nn+1 ; mm++)
132 if (abs(mm-m) > nn-n)
137 std::complex <double> a = std::complex <double>(other.
GetCoeff(abs(nn),abs(mm)).real(),
141 z += a*std::complex<double>(cos((mm-m)*beta),sin((mm-m)*beta))*realFact;
152 for (
int n = 0; n < int(this->p)+1 ; n++)
154 for (
int m = 0; m < n+1 ; m++)
176 dealii::Point<3> blockRelPos = multipole.
GetCenter() + (-1.0*this->
center);
177 double rho = sqrt(blockRelPos.square());
178 double cos_alpha_ = blockRelPos(2)/rho;
179 double beta = atan2(blockRelPos(1),blockRelPos(0));
182 std::complex <double> a;
184 for (
int n = 0; n < int(this->
p)+1 ; n++)
186 for (
int m = 0; m < n+1 ; m++)
188 std::complex <double> z = std::complex <double>(0.,0.);
189 for (
int nn = 0; nn < int(this->
p)+1 ; nn++)
191 double rhoFact = pow(rho,
double(-n-nn-1));
192 for (
int mm = -1*nn; mm < 0 ; mm++)
195 a = std::complex <double>(a.real(),-a.imag());
198 z += a*std::complex <double>(cos((mm-m)*beta),sin((mm-m)*beta))*realFact;
200 for (
int mm = 0; mm < nn+1 ; mm++)
205 z += a*std::complex <double>(cos((mm-m)*beta),sin((mm-m)*beta))*realFact;
220 std::complex <double> fieldValue = std::complex <double>(0.,0.);
227 unsigned int p = this->
p;
228 dealii::Point<3> blockRelPos = evalPoint + (-1.0*this->
center);
229 double rho = sqrt(blockRelPos.square());
230 double cos_alpha_ = blockRelPos(2)/rho;
231 double beta = atan2(blockRelPos(1),blockRelPos(0));
234 for (
int n = 0; n < int(p) + 1 ; n++)
237 double realFact = P_n_m * pow(rho,
double(n));
238 fieldValue += this->
GetCoeff(n, 0)*realFact;
239 for (
int m = 1; m < n + 1 ; m++)
242 double realFact = P_n_m * pow(rho,
double(n));
244 std::complex <double> complexFact = std::complex<double>(cos(m*beta),sin(m*beta))*2.*realFact;
245 fieldValue += this->
GetCoeff(n, m)*complexFact;
250 return fieldValue.real();
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)
static LocalExpansionCoeff mExp_to_lExp_Coeff
double Evaluate(const dealii::Point< 3 > &evalPoint)
std::complex< double > & GetCoeff(unsigned int n, unsigned int m) const
const AssLegFunction * assLegFunction
static std::vector< std::vector< std::map< int, std::map< int, double > > > > lExp_to_lExp_Coeff
dealii::Point< 3 > GetCenter() const
static FullMatrix< double > A_n_m_Matrix(unsigned int dimension)
LocalExpansion & operator=(const LocalExpansion &other)
double GetAssLegFunSph(const unsigned int n, const unsigned int m, double x) const
dealii::Point< 3 > & GetCenter() const
T sum(const T &t, const MPI_Comm &mpi_communicator)
static LocalExpansionCoeff mExp_to_lExp_Coeff_Build(FullMatrix< double > A_n_m, unsigned int p)
static FullMatrix< double > A_n_m
double get(const unsigned int &n, const unsigned int &m, const unsigned int &nn, const unsigned int &mm)
double norm(const FEValuesBase< dim > &fe, const VectorSlice< const std::vector< std::vector< Tensor< 1, dim > > > > &Du)
void AddToCoeff(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