16#ifndef HYPERDEAL_NDIM_FEEVALUATION_FACE
17#define HYPERDEAL_NDIM_FEEVALUATION_FACE
19#include <hyper.deal/base/config.h>
21#include <deal.II/matrix_free/fe_evaluation.h>
23#include <hyper.deal/matrix_free/fe_evaluation_base.h>
24#include <hyper.deal/matrix_free/read_write_operation.h>
25#include <hyper.deal/matrix_free/vector_access_internal.h>
40 typename VectorizedArrayType>
49 static const unsigned int DIM = dim_x + dim_v;
50 static const unsigned int DIM_ = DIM;
51 static const unsigned int N_Q_POINTS =
52 dealii::Utilities::pow(n_points, DIM - 1);
54 static const unsigned int N_Q_POINTS_1_CELL =
55 dealii::Utilities::pow(n_points, dim_x - 0);
56 static const unsigned int N_Q_POINTS_2_CELL =
57 dealii::Utilities::pow(n_points, dim_v - 0);
59 static const unsigned int N_Q_POINTS_1_FACE =
60 dealii::Utilities::pow(n_points, dim_x - 1);
61 static const unsigned int N_Q_POINTS_2_FACE =
62 dealii::Utilities::pow(n_points, dim_v - 1);
71 static const unsigned int n_vectors = PARENT::n_vectors;
72 static const unsigned int n_vectors_v = PARENT::n_vectors_v;
75 static const unsigned int dim = dim_x + dim_v;
76 static const unsigned int static_dofs_per_cell = dealii::Utilities::pow(degree + 1, dim);
77 static const unsigned int static_dofs_per_cell_x = dealii::Utilities::pow(degree + 1, dim_x);
78 static const unsigned int static_dofs_per_cell_v = dealii::Utilities::pow(degree + 1, dim_v);
79 static const unsigned int static_dofs_per_face = dealii::Utilities::pow(degree + 1, dim_x + dim_v - 1);
111 const bool is_minus_face,
112 const unsigned int dof_no_x,
113 const unsigned int dof_no_v,
114 const unsigned int quad_no_x,
115 const unsigned int quad_no_v)
117 , is_minus_face(is_minus_face)
120 , phi_face_x(this->
matrix_free_x, is_minus_face, dof_no_x, quad_no_x)
121 , phi_face_v(this->
matrix_free_v, is_minus_face, dof_no_v, quad_no_v)
125 &phi_x.get_shape_info().
data[0].shape_gradients_collocation_eo;
138 this->type = face_index.
type;
139 this->is_ecl =
false;
141 if (this->type == SpaceType::X)
143 phi_face_x.reinit(this->macro_cell_x);
144 phi_v.reinit(this->macro_cell_v);
148 phi_x.reinit(this->macro_cell_x);
149 phi_face_v.reinit(this->macro_cell_v);
152 if (this->type == SpaceType::X)
154 this->n_filled_lanes =
160 this->n_filled_lanes =
166 if (type == SpaceType::X)
168 const dealii::internal::MatrixFreeFunctions::FaceToCellTopology<
171 this->face_no = this->is_minus_face ? faces.interior_face_no :
172 faces.exterior_face_no;
176 const dealii::internal::MatrixFreeFunctions::FaceToCellTopology<
177 n_vectors_v> &faces =
179 this->face_no = this->is_minus_face ? faces.interior_face_no :
180 faces.exterior_face_no;
181 this->face_no += dim_x * 2;
196 this->type = (face >= 2 * dim_x) ? SpaceType::V : SpaceType::X;
200 if (this->type == SpaceType::X)
202 phi_face_x.reinit(this->macro_cell_x, face);
203 phi_v.reinit(this->macro_cell_v);
207 phi_x.reinit(this->macro_cell_x);
208 phi_face_v.reinit(this->macro_cell_v, face - 2 * dim_x);
213 this->n_filled_lanes =
220 this->face_no = face;
231 const dealii::LinearAlgebra::distributed::Vector<Number> &src)
243 const dealii::LinearAlgebra::distributed::Vector<Number> &src,
244 VectorizedArrayType *
data)
const
249 const unsigned int face_orientation =
251 ((this->is_minus_face ==
253 .face_orientations[0][this->macro] >= 8)) ?
261 this->matrix_free.get_face_info(),
262 this->matrix_free.get_shape_info())
263 .template process_face<dim_x, dim_v, degree>(
264 internal::MatrixFreeFunctions::
265 VectorReader<Number, VectorizedArrayType>(),
266 src.shared_vector_data(),
268 (is_ecl ==
false || this->is_minus_face) ?
270 this->matrix_free.get_face_info().no_faces[3].data() +
271 (2 * dim * this->macro + this->face_no) * n_vectors,
272 (is_ecl ==
false || this->is_minus_face) ?
274 this->matrix_free.get_face_info().face_orientations[3].data() +
275 (2 * dim * this->macro + this->face_no) * n_vectors,
276 this->type == SpaceType::X ? 0 : 8,
278 is_ecl ? 2 : !is_minus_face,
279 (is_ecl ==
false || this->is_minus_face) ?
281 2 * dim * this->macro + this->face_no,
282 !is_minus_face + (is_ecl ? 2 : 0));
286 AssertThrow(
false, dealii::StandardExceptions::ExcNotImplemented());
296 read_dof_values_from_buffer(
const VectorizedArrayType *src)
299 .face_to_cell_index_nodal[this->face_no];
301 for (
unsigned int i = 0; i < static_dofs_per_face; ++i)
302 this->
data[i] = src[index_array[i]];
314 .face_to_cell_index_nodal[this->face_no];
316 for (
unsigned int i = 0; i < static_dofs_per_face; ++i)
317 dst[index_array[i]] += this->
data[i];
326 dealii::LinearAlgebra::distributed::Vector<Number> &dst)
const
328 Assert(is_ecl ==
false, dealii::StandardExceptions::ExcNotImplemented());
333 const unsigned int face_orientation =
335 ((this->is_minus_face ==
337 .face_orientations[0][this->macro] >= 8)) ?
345 this->matrix_free.get_face_info(),
346 this->matrix_free.get_shape_info())
347 .template process_face<dim_x, dim_v, degree>(
348 internal::MatrixFreeFunctions::
349 VectorDistributorLocalToGlobal<Number, VectorizedArrayType>(),
350 dst.shared_vector_data(),
354 this->type == SpaceType::X ? 0 : 8,
362 AssertThrow(
false, dealii::StandardExceptions::ExcNotImplemented());
374 return n_filled_lanes;
381 template <SpaceType stype>
382 inline DEAL_II_ALWAYS_INLINE
385 const VectorizedArrayType &value,
386 const unsigned int q,
387 const unsigned int qx,
388 const unsigned int qv)
const
390 Assert(stype == this->type, dealii::ExcMessage(
"Types do not match!"));
393 if (stype == SpaceType::X)
394 data_ptr[q] = -value * phi_face_x.JxW(qx) *
395 phi_v.JxW(qv)[n_vectors_v == 1 ? 0 : this->lane_y];
396 else if (stype == SpaceType::V)
397 data_ptr[q] = -value * phi_x.JxW(qx) *
398 phi_face_v.JxW(qv)[n_vectors_v == 1 ? 0 : this->lane_y];
406 template <SpaceType stype>
407 inline DEAL_II_ALWAYS_INLINE
410 VectorizedArrayType *__restrict data_ptr_2,
411 const VectorizedArrayType &value,
412 const unsigned int q,
413 const unsigned int q1,
414 const unsigned int q2)
const
416 Assert(stype == this->type, dealii::ExcMessage(
"Types do not match!"));
420 (stype == SpaceType::X) ?
421 (value * phi_face_x.JxW(q1) *
422 phi_v.JxW(q2)[n_vectors_v == 1 ? 0 : this->lane_y]) :
423 (value * phi_x.JxW(q1) *
424 phi_face_v.JxW(q2)[n_vectors_v == 1 ? 0 : this->lane_y]);
425 data_ptr_1[q] = -temp;
426 data_ptr_2[q] = +temp;
434 inline DEAL_II_ALWAYS_INLINE
435 dealii::Tensor<1, dim_x, VectorizedArrayType>
440 return phi_face_x.get_normal_vector(qx);
448 inline DEAL_II_ALWAYS_INLINE
449 dealii::Tensor<1, dim_v, VectorizedArrayType>
458 dealii::Tensor<1, dim_v, VectorizedArrayType> result;
459 const auto temp = phi_face_v.get_normal_vector(qv);
460 for (
auto i = 0u; i < dim_v; i++)
461 result[i] = temp[i][0];
472 inline dealii::Point<DIM, VectorizedArrayType>
475 dealii::Point<DIM, VectorizedArrayType> temp;
477 if (type == SpaceType::X)
480 this->phi_face_x.quadrature_point(q % N_Q_POINTS_1_FACE);
481 for (
int i = 0; i < dim_x; i++)
483 const auto t2 = this->phi_v.quadrature_point(q / N_Q_POINTS_1_FACE);
484 for (
int i = 0; i < dim_v; i++)
485 temp[i + dim_x] = t2[i][n_vectors_v == 1 ? 0 : this->lane_y];
489 const auto t1 = this->phi_x.quadrature_point(q % N_Q_POINTS_1_CELL);
490 for (
int i = 0; i < dim_x; i++)
493 this->phi_face_v.quadrature_point(q / N_Q_POINTS_1_CELL);
494 for (
int i = 0; i < dim_v; i++)
495 temp[i + dim_x] = t2[i][n_vectors_v == 1 ? 0 : this->lane_y];
505 template <SpaceType stype>
506 inline dealii::Point<dim, VectorizedArrayType>
509 Assert(stype == this->type, dealii::ExcMessage(
"Types do not match!"));
511 dealii::Point<dim, VectorizedArrayType> temp;
513 if (stype == SpaceType::X)
515 const auto t1 = this->phi_face_x.quadrature_point(qx);
516 for (
int i = 0; i < dim_x; i++)
518 const auto t2 = this->phi_v.quadrature_point(qv);
519 for (
int i = 0; i < dim_v; i++)
520 temp[i + dim_x] = t2[i][n_vectors_v == 1 ? 0 : this->lane_y];
524 const auto t1 = this->phi_x.quadrature_point(qx);
525 for (
int i = 0; i < dim_x; i++)
527 const auto t2 = this->phi_face_v.quadrature_point(qv);
528 for (
int i = 0; i < dim_v; i++)
529 temp[i + dim_x] = t2[i][n_vectors_v == 1 ? 0 : this->lane_y];
539 const bool is_minus_face;
544 unsigned int n_filled_lanes;
559 unsigned int face_no;
562 dealii::FEEvaluation<dim_x, degree, n_points, 1, Number, typename PARENT::VectorizedArrayTypeX> phi_x;
563 dealii::FEEvaluation<dim_v, degree, n_points, 1, Number, typename PARENT::VectorizedArrayTypeV> phi_v;
565 dealii::FEFaceEvaluation<dim_x, degree, n_points, 1, Number, typename PARENT::VectorizedArrayTypeX> phi_face_x;
566 dealii::FEFaceEvaluation<dim_v, degree, n_points, 1, Number, typename PARENT::VectorizedArrayTypeV> phi_face_v;
Definition fe_evaluation_base.h:35
virtual void reinit(typename MatrixFree< dim_x, dim_v, Number, VectorizedArrayType >::ID cell_index)
Definition fe_evaluation_base.h:168
const dealii::AlignedVector< Number > * shape_values
Definition fe_evaluation_base.h:122
dealii::AlignedVector< VectorizedArrayType > data
Definition fe_evaluation_base.h:93
const MF & matrix_free
Definition fe_evaluation_base.h:98
const dealii::MatrixFree< dim_v, Number, VectorizedArrayTypeV > & matrix_free_v
Definition fe_evaluation_base.h:110
const dealii::MatrixFree< dim_x, Number, VectorizedArrayTypeX > & matrix_free_x
Definition fe_evaluation_base.h:104
const dealii::AlignedVector< Number > * shape_gradients
Definition fe_evaluation_base.h:127
Definition fe_evaluation_face.h:47
void reinit(typename MatrixFree< dim_x, dim_v, Number, VectorizedArrayType >::ID cell_index, unsigned int face)
Definition fe_evaluation_face.h:191
void read_dof_values(const dealii::LinearAlgebra::distributed::Vector< Number > &src, VectorizedArrayType *data) const
Definition fe_evaluation_face.h:242
DEAL_II_ALWAYS_INLINE void submit_value(VectorizedArrayType *__restrict data_ptr, const VectorizedArrayType &value, const unsigned int q, const unsigned int qx, const unsigned int qv) const
Definition fe_evaluation_face.h:384
unsigned int n_vectorization_lanes_filled() const
Definition fe_evaluation_face.h:372
FEFaceEvaluation(const MatrixFree< dim_x, dim_v, Number, VectorizedArrayType > &matrix_free, const bool is_minus_face, const unsigned int dof_no_x, const unsigned int dof_no_v, const unsigned int quad_no_x, const unsigned int quad_no_v)
Definition fe_evaluation_face.h:109
void read_dof_values(const dealii::LinearAlgebra::distributed::Vector< Number > &src)
Definition fe_evaluation_face.h:230
dealii::Point< DIM, VectorizedArrayType > get_quadrature_point(const unsigned int q) const
Definition fe_evaluation_face.h:473
dealii::Point< dim, VectorizedArrayType > get_quadrature_point(const unsigned int qx, const unsigned int qv) const
Definition fe_evaluation_face.h:507
void distribute_local_to_global(dealii::LinearAlgebra::distributed::Vector< Number > &dst) const
Definition fe_evaluation_face.h:325
DEAL_II_ALWAYS_INLINE void submit_value(VectorizedArrayType *__restrict data_ptr_1, VectorizedArrayType *__restrict data_ptr_2, const VectorizedArrayType &value, const unsigned int q, const unsigned int q1, const unsigned int q2) const
Definition fe_evaluation_face.h:409
void reinit(typename MatrixFree< dim_x, dim_v, Number, VectorizedArrayType >::ID face_index) override
Definition fe_evaluation_face.h:134
DEAL_II_ALWAYS_INLINE dealii::Tensor< 1, dim_v, VectorizedArrayType > get_normal_vector_v(const unsigned int qv) const
Definition fe_evaluation_face.h:450
void distribute_to_buffer(VectorizedArrayType *dst) const
Definition fe_evaluation_face.h:311
DEAL_II_ALWAYS_INLINE dealii::Tensor< 1, dim_x, VectorizedArrayType > get_normal_vector_x(const unsigned int qx) const
Definition fe_evaluation_face.h:436
Definition matrix_free.h:40
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info() const
Definition matrix_free.templates.h:1872
bool are_ghost_faces_supported() const
Definition matrix_free.templates.h:1835
const internal::MatrixFreeFunctions::FaceInfo & get_face_info() const
Definition matrix_free.templates.h:1881
const internal::MatrixFreeFunctions::ShapeInfo< Number > & get_shape_info() const
Definition matrix_free.templates.h:1890
Definition read_write_operation.h:37
const SpaceType type
Definition id.h:69
std::array< std::vector< unsigned int >, 4 > face_orientations
Definition face_info.h:37