17#ifndef dealii_matrix_free_fe_evaluation_data_h
18#define dealii_matrix_free_fe_evaluation_data_h
50 <<
"You are requesting information from an FEEvaluation/FEFaceEvaluation "
51 <<
"object for which this kind of information has not been computed. What "
52 <<
"information these objects compute is determined by the update_* flags you "
53 <<
"pass to MatrixFree::reinit() via MatrixFree::AdditionalData. Here, "
54 <<
"the operation you are attempting requires the <" <<
arg1
55 <<
"> flag to be set, but it was apparently not specified "
56 <<
"upon initialization.");
62 int n_q_points_1d = fe_degree + 1,
64 typename Number = double,
77 namespace MatrixFreeFunctions
79 template <
int,
typename>
80 class MappingDataOnTheFly;
113template <
int dim,
typename Number,
bool is_face>
118 MappingInfoStorage<(
is_face ? dim - 1 : dim), dim, Number>;
165 const unsigned int n_components);
396 const std::vector<unsigned int> &
494 const std::array<unsigned int, n_lanes> &
508 const std::array<unsigned int, n_lanes> &
537 const std::array<unsigned int, n_lanes> &
577 template <
typename T>
587 template <
typename T>
599 template <
typename T>
611 template <
typename T>
648 const std::shared_ptr<
999 template <
int,
int,
typename,
bool,
typename>
1002 template <
int,
int,
int,
int,
typename,
typename>
1023template <
int dim,
typename Number,
bool is_face>
1035template <
int dim,
typename Number,
bool is_face>
1086template <
int dim,
typename Number,
bool is_face>
1088 const std::shared_ptr<
1126 .jacobian_gradients_non_inverse[0]
1134template <
int dim,
typename Number,
bool is_face>
1146 dof_info =
other.dof_info;
1147 mapping_data =
other.mapping_data;
1148 descriptor =
other.descriptor;
1151 normal_vectors =
nullptr;
1152 normal_x_jacobian =
nullptr;
1153 jacobian_gradients =
nullptr;
1154 jacobian_gradients_non_inverse =
nullptr;
1156 quadrature_weights =
other.quadrature_weights;
1159 is_reinitialized =
false;
1160 dof_values_initialized =
false;
1161 values_quad_initialized =
false;
1162 gradients_quad_initialized =
false;
1163 hessians_quad_initialized =
false;
1164 values_quad_submitted =
false;
1165 gradients_quad_submitted =
false;
1169 interior_face =
other.is_interior_face();
1172 (is_interior_face() ?
1175 internal::MatrixFreeFunctions::DoFInfo::dof_access_cell;
1176 face_numbers[0] = 0;
1177 face_orientations[0] = 0;
1180 divergence_is_requested =
false;
1187template <
int dim,
typename Number,
bool is_face>
1196 Utilities::fixed_power<dim>(
data->data.front().fe_degree + 1);
1197 const unsigned int dofs_per_component =
data->dofs_per_component_on_cell;
1202 2 * n_quadrature_points;
1204 n_components * dofs_per_component +
1205 (n_components * ((dim * (dim + 1)) / 2 + 2 * dim + 2) *
1206 n_quadrature_points);
1210 scratch_data_array->clear();
1211 scratch_data_array->resize(allocated_size,
1212 Number(numbers::signaling_nan<ScalarNumber>()));
1214 scratch_data_array->resize_fast(allocated_size);
1220 values_dofs = scratch_data_array->begin();
1221 values_quad = scratch_data_array->begin() + n_components * dofs_per_component;
1222 values_from_gradients_quad =
1223 scratch_data_array->begin() +
1224 n_components * (dofs_per_component + n_quadrature_points);
1226 scratch_data_array->begin() +
1227 n_components * (dofs_per_component + 2 * n_quadrature_points);
1228 gradients_from_hessians_quad =
1229 scratch_data_array->begin() +
1230 n_components * (dofs_per_component + (dim + 2) * n_quadrature_points);
1232 scratch_data_array->begin() +
1233 n_components * (dofs_per_component + (2 * dim + 2) * n_quadrature_points);
1238template <
int dim,
typename Number,
bool is_face>
1244 ExcMessage(
"Faces can only be set if the is_face template parameter "
1248 subface_index = is_interior_face() ==
true ?
1257 face_orientations[0] = (is_interior_face() == (face.
face_orientation >= 8)) ?
1261 if (is_interior_face())
1269template <
int dim,
typename Number,
bool is_face>
1272 const unsigned int q_point)
const
1275 Assert(normal_vectors !=
nullptr,
1277 "update_normal_vectors"));
1279 return normal_vectors[0];
1281 return normal_vectors[
q_point];
1287template <
int dim,
typename Number,
bool is_face>
1290 const unsigned int q_point)
const
1292 return normal_vector(
q_point);
1297template <
int dim,
typename Number,
bool is_face>
1302 Assert(J_value !=
nullptr,
1304 "update_values|update_gradients"));
1308 return J_value[0] * quadrature_weights[
q_point];
1316template <
int dim,
typename Number,
bool is_face>
1319 const unsigned int q)
const
1322 Assert(this->quadrature_points !=
nullptr,
1324 "update_quadrature_points"));
1337 for (
unsigned int d = 0;
d < dim; ++
d)
1338 point[d] +=
jac[d][d] *
static_cast<typename Number::value_type
>(
1339 this->descriptor->quadrature.point(
q)[d]);
1341 for (
unsigned int d = 0;
d < dim; ++
d)
1342 for (
unsigned int e = 0;
e < dim; ++
e)
1343 point[d] +=
jac[d][e] *
static_cast<typename Number::value_type
>(
1344 this->descriptor->quadrature.point(
q)[e]);
1353template <
int dim,
typename Number,
bool is_face>
1356 const unsigned int q_point)
const
1359 Assert(jacobian !=
nullptr,
1361 "update_gradients"));
1370template <
int dim,
typename Number,
bool is_face>
1371inline const Number *
1379template <
int dim,
typename Number,
bool is_face>
1384 dof_values_initialized =
true;
1391template <
int dim,
typename Number,
bool is_face>
1392inline const Number *
1403template <
int dim,
typename Number,
bool is_face>
1408 values_quad_initialized =
true;
1409 values_quad_submitted =
true;
1416template <
int dim,
typename Number,
bool is_face>
1417inline const Number *
1421 Assert(gradients_quad_initialized || gradients_quad_submitted,
1424 return gradients_quad;
1429template <
int dim,
typename Number,
bool is_face>
1434 gradients_quad_submitted =
true;
1435 gradients_quad_initialized =
true;
1437 return gradients_quad;
1442template <
int dim,
typename Number,
bool is_face>
1443inline const Number *
1449 return hessians_quad;
1454template <
int dim,
typename Number,
bool is_face>
1459 hessians_quad_initialized =
true;
1461 return hessians_quad;
1466template <
int dim,
typename Number,
bool is_face>
1472 if (dof_info ==
nullptr)
1477 return mapping_data->data_index_offsets[cell];
1483template <
int dim,
typename Number,
bool is_face>
1495template <
int dim,
typename Number,
bool is_face>
1505template <
int dim,
typename Number,
bool is_face>
1509 Assert(dof_info !=
nullptr,
1511 "FEEvaluation was not initialized with a MatrixFree object!"));
1517template <
int dim,
typename Number,
bool is_face>
1518inline const std::vector<unsigned int> &
1521 return data->lexicographic_numbering;
1526template <
int dim,
typename Number,
bool is_face>
1535template <
int dim,
typename Number,
bool is_face>
1539 if (
is_face && dof_access_index ==
1548template <
int dim,
typename Number,
bool is_face>
1552 return active_fe_index;
1557template <
int dim,
typename Number,
bool is_face>
1561 return active_quad_index;
1566template <
int dim,
typename Number,
bool is_face>
1570 return first_selected_component;
1575template <
int dim,
typename Number,
bool is_face>
1579 return scratch_data;
1584template <
int dim,
typename Number,
bool is_face>
1592 is_interior_face() ==
false),
1593 ExcMessage(
"All face numbers can only be queried for ECL at exterior "
1594 "faces. Use get_face_no() in other cases."));
1596 return face_numbers[v];
1601template <
int dim,
typename Number,
bool is_face>
1605 return subface_index;
1610template <
int dim,
typename Number,
bool is_face>
1613 const unsigned int v)
const
1619 is_interior_face() ==
false),
1620 ExcMessage(
"All face numbers can only be queried for ECL at exterior "
1621 "faces. Use get_face_no() in other cases."));
1623 return face_orientations[v];
1628template <
int dim,
typename Number,
bool is_face>
1632 return dof_access_index;
1637template <
int dim,
typename Number,
bool is_face>
1641 return interior_face;
1646template <
int dim,
typename Number,
bool is_face>
1650 return {0U, n_quadrature_points};
1657 template <std::size_t N,
1667 for (
unsigned int i = 0; i < N; ++i)
1671 fu(out[i], array[indices[i] / N][indices[i] % N]);
1675 template <std::
size_t N,
typename VectorOfArrayType,
typename ArrayType>
1688 for (
unsigned int i = 0; i < N; ++i)
1689 out[i] = array[indices[
index] / N][indices[
index] % N];
1695template <
int dim,
typename Number,
bool is_face>
1696template <
typename T>
1702 internal::set_valid_element_to_array(this->get_cell_ids(), array, out);
1703 internal::process_cell_or_face_data(this->get_cell_ids(),
1706 [](
auto &local,
const auto &global) {
1714template <
int dim,
typename Number,
bool is_face>
1715template <
typename T>
1720 internal::process_cell_or_face_data(this->get_cell_ids(),
1723 [](
const auto &local,
auto &global) {
1730template <
int dim,
typename Number,
bool is_face>
1731template <
typename T>
1737 internal::set_valid_element_to_array(this->get_cell_ids(), array, out);
1738 internal::process_cell_or_face_data(this->get_face_ids(),
1741 [](
auto &local,
const auto &global) {
1749template <
int dim,
typename Number,
bool is_face>
1750template <
typename T>
1755 internal::process_cell_or_face_data(this->get_face_ids(),
1758 [](
const auto &local,
auto &global) {
value_type * data() const noexcept
void reinit(value_type *starting_element, const std::size_t n_elements)
AlignedVector< VectorizedArrayType > * scratch_data_array
const unsigned int quad_no
bool hessians_quad_submitted
internal::MatrixFreeFunctions::GeometryType get_cell_type() const
const Tensor< 2, dim, Number > * jacobian
const MappingInfoStorageType::QuadratureDescriptor * descriptor
Number * begin_gradients()
Number * begin_hessians()
const unsigned int n_quadrature_points
const MappingInfoStorageType * mapping_data
internal::MatrixFreeFunctions::DoFInfo::DoFAccessIndex dof_access_index
std::uint8_t get_face_no(const unsigned int v=0) const
ArrayView< Number > scratch_data
internal::MatrixFreeFunctions::DoFInfo::DoFAccessIndex get_dof_access_index() const
const Point< dim, Number > * quadrature_points
unsigned int subface_index
const Tensor< 1, dim *(dim+1)/2, Tensor< 1, dim, Number > > * jacobian_gradients_non_inverse
bool values_quad_submitted
FEEvaluationData(const FEEvaluationData &other)=default
const ShapeInfoType & get_shape_info() const
void set_face_data(AlignedVector< T > &array, const T &value) const
void reinit_face(const internal::MatrixFreeFunctions::FaceToCellTopology< n_lanes > &face)
Number JxW(const unsigned int q_point) const
const std::array< unsigned int, n_lanes > & get_face_ids() const
unsigned int get_first_selected_component() const
const unsigned int n_fe_components
const ShapeInfoType * data
T read_face_data(const AlignedVector< T > &array) const
Number * gradients_from_hessians_quad
std::shared_ptr< internal::MatrixFreeFunctions::MappingDataOnTheFly< dim, Number > > mapped_geometry
internal::MatrixFreeFunctions::DoFInfo DoFInfo
unsigned int get_active_quadrature_index() const
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info() const
const std::array< unsigned int, n_lanes > & get_cell_ids() const
unsigned int get_mapping_data_index_offset() const
bool gradients_quad_initialized
void set_data_pointers(AlignedVector< Number > *scratch_data, const unsigned int n_components)
Tensor< 2, dim, Number > inverse_jacobian(const unsigned int q_point) const
std::array< std::uint8_t, n_lanes > face_numbers
const unsigned int active_fe_index
static constexpr unsigned int n_lanes
const Tensor< 1, dim, Number > * normal_vectors
internal::MatrixFreeFunctions::GeometryType cell_type
const Number * begin_gradients() const
const std::array< unsigned int, n_lanes > & get_cell_or_face_ids() const
Tensor< 1, dim, Number > normal_vector(const unsigned int q_point) const
std::array< unsigned int, n_lanes > cell_ids
unsigned int get_current_cell_index() const
unsigned int get_subface_index() const
bool divergence_is_requested
Number shape_info_number_type
Tensor< 1, dim, Number > get_normal_vector(const unsigned int q_point) const
const unsigned int active_quad_index
unsigned int get_active_fe_index() const
Number * values_from_gradients_quad
void set_cell_data(AlignedVector< T > &array, const T &value) const
bool gradients_quad_submitted
unsigned int get_quadrature_index() const
std::array< std::uint8_t, n_lanes > face_orientations
const ScalarNumber * quadrature_weights
const Tensor< 1, dim *(dim+1)/2, Tensor< 1, dim, Number > > * jacobian_gradients
const Tensor< 1, dim, Number > * normal_x_jacobian
bool is_interior_face() const
std_cxx20::ranges::iota_view< unsigned int, unsigned int > quadrature_point_indices() const
const std::vector< unsigned int > & get_internal_dof_numbering() const
FEEvaluationData & operator=(const FEEvaluationData &other)
virtual ~FEEvaluationData()=default
ArrayView< Number > get_scratch_data() const
T read_cell_data(const AlignedVector< T > &array) const
Number * begin_dof_values()
static constexpr unsigned int dimension
internal::MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > ShapeInfoType
FEEvaluationData(const std::shared_ptr< internal::MatrixFreeFunctions::MappingDataOnTheFly< dim, Number > > &mapping_data, const unsigned int n_fe_components, const unsigned int first_selected_component)
bool values_quad_initialized
FEEvaluationData(const ShapeInfoType &shape_info, const bool is_interior_face=true)
Point< dim, Number > quadrature_point(const unsigned int q) const
const Number * begin_values() const
bool dof_values_initialized
typename internal::VectorizedArrayTrait< Number >::value_type ScalarNumber
std::array< unsigned int, n_lanes > face_ids
FEEvaluationData(const InitializationData &initialization_data, const bool is_interior_face, const unsigned int quad_no, const unsigned int first_selected_component)
const Number * begin_dof_values() const
std::uint8_t get_face_orientation(const unsigned int v=0) const
const Number * begin_hessians() const
bool hessians_quad_initialized
unsigned int get_cell_or_face_batch_id() const
const unsigned int first_selected_component
const unsigned int n_q_points
static constexpr unsigned int n_components
#define DEAL_II_ALWAYS_INLINE
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DeclException0(Exception0)
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcAccessToUninitializedField()
static ::ExceptionBase & ExcNotInitialized()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcMatrixFreeAccessToUninitializedMappingField(std::string arg1)
static ::ExceptionBase & ExcMessage(std::string arg1)
@ general
No special properties.
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
void quadrature_points(const Triangulation< dim, spacedim > &triangulation, const Quadrature< dim > &quadrature, const std::vector< std::vector< BoundingBox< spacedim > > > &global_bounding_boxes, ParticleHandler< dim, spacedim > &particle_handler, const Mapping< dim, spacedim > &mapping=(ReferenceCells::get_hypercube< dim >() .template get_default_linear_mapping< dim, spacedim >()), const std::vector< std::vector< double > > &properties={})
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
VectorType::value_type * begin(VectorType &V)
static const unsigned int invalid_unsigned_int
boost::integer_range< IncrementableType > iota_view
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
const MappingInfoStorageType * mapping_data
unsigned int active_quad_index
const MappingInfoStorageType::QuadratureDescriptor * descriptor
const ShapeInfoType * shape_info
unsigned int active_fe_index
@ dof_access_face_exterior
@ dof_access_face_interior
unsigned char subface_index
unsigned char interior_face_no
std::array< unsigned int, vectorization_width > cells_interior
types::boundary_id exterior_face_no
std::array< unsigned int, vectorization_width > cells_exterior
unsigned char face_orientation
static constexpr std::size_t width()