33 for (
unsigned int i = 0; i <
N; ++i)
40 for (
unsigned int i = 0; i <
N; ++i)
41 for (
unsigned int j = 0; j <
N; ++j)
51 for (
unsigned int i = 0; i <
N; ++i)
52 for (
unsigned int j = 0; j <
N; ++j)
53 for (
unsigned int k = 0; k <
N; ++k)
63 template <
int dim,
int spacedim>
70 std::complex<double>
sum = 0;
71 for (
unsigned int q = 0; q < quadrature.
size(); ++q)
74 sum +=
std::exp(std::complex<double>(0, 1) * (k_vector * x_q)) *
86 template <
int spacedim>
89 const std::vector<unsigned int> & n_coefficients_per_direction,
93 const unsigned int fe,
94 std::vector<
FullMatrix<std::complex<double>>> &fourier_transform_matrices)
98 if (fourier_transform_matrices[fe].m() == 0)
100 fourier_transform_matrices[fe].reinit(n_coefficients_per_direction[fe],
101 fe_collection[fe].dofs_per_cell);
103 for (
unsigned int k = 0; k < n_coefficients_per_direction[fe]; ++k)
104 for (
unsigned int j = 0; j < fe_collection[fe].dofs_per_cell; ++j)
105 fourier_transform_matrices[fe](k, j) =
106 integrate(fe_collection[fe], q_collection[fe], k_vectors(k), j);
110 template <
int spacedim>
113 const std::vector<unsigned int> & n_coefficients_per_direction,
117 const unsigned int fe,
118 std::vector<
FullMatrix<std::complex<double>>> &fourier_transform_matrices)
122 if (fourier_transform_matrices[fe].m() == 0)
124 fourier_transform_matrices[fe].reinit(
125 Utilities::fixed_power<2>(n_coefficients_per_direction[fe]),
126 fe_collection[fe].dofs_per_cell);
129 for (
unsigned int k1 = 0; k1 < n_coefficients_per_direction[fe]; ++k1)
130 for (
unsigned int k2 = 0; k2 < n_coefficients_per_direction[fe];
132 for (
unsigned int j = 0; j < fe_collection[fe].dofs_per_cell; ++j)
133 fourier_transform_matrices[fe](k, j) = integrate(
134 fe_collection[fe], q_collection[fe], k_vectors(k1, k2), j);
138 template <
int spacedim>
141 const std::vector<unsigned int> & n_coefficients_per_direction,
145 const unsigned int fe,
146 std::vector<
FullMatrix<std::complex<double>>> &fourier_transform_matrices)
150 if (fourier_transform_matrices[fe].m() == 0)
152 fourier_transform_matrices[fe].reinit(
153 Utilities::fixed_power<3>(n_coefficients_per_direction[fe]),
154 fe_collection[fe].dofs_per_cell);
157 for (
unsigned int k1 = 0; k1 < n_coefficients_per_direction[fe]; ++k1)
158 for (
unsigned int k2 = 0; k2 < n_coefficients_per_direction[fe]; ++k2)
159 for (
unsigned int k3 = 0; k3 < n_coefficients_per_direction[fe];
161 for (
unsigned int j = 0; j < fe_collection[fe].dofs_per_cell; ++j)
162 fourier_transform_matrices[fe](k, j) =
163 integrate(fe_collection[fe],
165 k_vectors(k1, k2, k3),
175 template <
int dim,
int spacedim>
177 const std::vector<unsigned int> & n_coefficients_per_direction,
180 : n_coefficients_per_direction(n_coefficients_per_direction)
181 , fe_collection(&fe_collection)
182 , q_collection(q_collection)
183 , fourier_transform_matrices(fe_collection.size())
185 Assert(n_coefficients_per_direction.size() == fe_collection.
size() &&
186 n_coefficients_per_direction.size() == q_collection.
size(),
187 ExcMessage(
"All parameters are supposed to have the same size."));
189 const unsigned int max_n_coefficients_per_direction =
190 *std::max_element(n_coefficients_per_direction.cbegin(),
191 n_coefficients_per_direction.cend());
192 set_k_vectors(
k_vectors, max_n_coefficients_per_direction);
200 template <
int dim,
int spacedim>
202 const unsigned int n_coefficients_per_direction,
206 std::vector<unsigned
int>(fe_collection.size(),
207 n_coefficients_per_direction),
214 template <
int dim,
int spacedim>
229 template <
int dim,
int spacedim>
234 for (
unsigned int fe = 0; fe < fe_collection->
size(); ++fe)
236 ensure_existence(n_coefficients_per_direction,
249 template <
int dim,
int spacedim>
252 const unsigned int index)
const 254 return n_coefficients_per_direction[index];
259 template <
int dim,
int spacedim>
260 template <
typename Number>
263 const Vector<Number> & local_dof_values,
264 const unsigned int cell_active_fe_index,
267 for (
unsigned int d = 0;
d < dim; ++
d)
269 n_coefficients_per_direction[cell_active_fe_index]);
271 ensure_existence(n_coefficients_per_direction,
275 cell_active_fe_index,
282 n_coefficients_per_direction[cell_active_fe_index]));
289 Assert(local_dof_values.size() == matrix.
n(),
293 for (
unsigned int j = 0; j < local_dof_values.size(); j++)
302 #include "fe_series_fourier.inst" SmartPointer< const hp::FECollection< dim, spacedim > > fe_collection
#define AssertDimension(dim1, dim2)
inline ::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &x)
Contents is actually a matrix.
void calculate(const ::Vector< Number > &local_dof_values, const unsigned int cell_active_fe_index, Table< dim, CoefficientType > &fourier_coefficients)
Task< RT > new_task(const std::function< RT()> &function)
#define AssertIndexRange(index, range)
const Point< dim > & point(const unsigned int i) const
unsigned int size() const
Fourier(const std::vector< unsigned int > &n_coefficients_per_direction, const hp::FECollection< dim, spacedim > &fe_collection, const hp::QCollection< dim > &q_collection)
size_type n_elements() const
static ::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
unsigned int size() const
#define DEAL_II_NAMESPACE_CLOSE
void precalculate_all_transformation_matrices()
typename std::complex< double > CoefficientType
const std::vector< unsigned int > n_coefficients_per_direction
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< rank, dim, Number > sum(const SymmetricTensor< rank, dim, Number > &local, const MPI_Comm &mpi_communicator)
Table< dim, Tensor< 1, dim > > k_vectors
unsigned int size() const
unsigned int get_n_coefficients_per_direction(const unsigned int index) const
size_type size(const unsigned int i) const
virtual double shape_value(const unsigned int i, const Point< dim > &p) const
static constexpr double PI
std::vector< FullMatrix< CoefficientType > > fourier_transform_matrices
#define DEAL_II_NAMESPACE_OPEN
std::vector< CoefficientType > unrolled_coefficients
bool operator==(const Fourier< dim, spacedim > &fourier) const
const hp::QCollection< dim > q_collection
void fill(InputIterator entries, const bool C_style_indexing=true)
double weight(const unsigned int i) const
static ::ExceptionBase & ExcInternalError()