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())
187 ExcMessage(
"All parameters are supposed to have the same size."));
189 const unsigned int max_n_coefficients_per_direction =
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,
241 fourier_transform_matrices);
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,
276 fourier_transform_matrices);
279 fourier_transform_matrices[cell_active_fe_index];
281 unrolled_coefficients.resize(Utilities::fixed_power<dim>(
282 n_coefficients_per_direction[cell_active_fe_index]));
283 std::fill(unrolled_coefficients.begin(),
284 unrolled_coefficients.end(),
292 for (
unsigned int i = 0; i < unrolled_coefficients.size(); i++)
293 for (
unsigned int j = 0; j < local_dof_values.size(); j++)
294 unrolled_coefficients[i] +=
matrix[i][j] * local_dof_values[j];
296 fourier_coefficients.
fill(unrolled_coefficients.begin());
302 #include "fe_series_fourier.inst"