16#ifndef dealii_non_matching_mapping_info_h
17#define dealii_non_matching_mapping_info_h
45 template <
int dim,
int spacedim = dim>
58 return mapping->requires_update_flags(update_flags);
69 &internal_mapping_data,
73 internal_mapping_data->reinit(update_flags_mapping, quadrature);
75 cell_similarity = mapping->fill_fe_values(cell,
78 *internal_mapping_data,
91 &internal_mapping_data,
94 mapping_data.
initialize(quadrature.size(), update_flags_mapping);
96 internal_mapping_data->reinit(update_flags_mapping, quadrature);
98 mapping->fill_fe_immersed_surface_values(cell,
100 *internal_mapping_data,
111 const unsigned int face_no,
114 &internal_mapping_data,
125 *internal_mapping_data);
128 ReferenceCells::get_hypercube<dim>(),
131 cell->face_orientation(face_no),
132 cell->face_flip(face_no),
133 cell->face_rotation(face_no)),
136 mapping_q->fill_mapping_data_for_face_quadrature(
137 cell, face_no, quadrature, *internal_mapping_data, mapping_data);
141 auto internal_mapping_data =
142 mapping->get_face_data(update_flags_mapping,
145 mapping->fill_fe_face_values(cell,
148 *internal_mapping_data,
154 template <
int dim,
int spacedim = dim>
157 const double diameter,
161 const auto jac_0 = inverse_jacobians[0];
162 const double zero_tolerance_double =
163 1e4 / diameter * std::numeric_limits<double>::epsilon() * 1024.;
164 bool jacobian_constant =
true;
165 for (
unsigned int q = 1; q < inverse_jacobians.size(); ++q)
168 for (
unsigned int d = 0; d < dim; ++d)
169 for (
unsigned int e = 0; e < spacedim; ++e)
170 if (std::fabs(jac_0[d][e] - jac[d][e]) > zero_tolerance_double)
171 jacobian_constant =
false;
172 if (!jacobian_constant)
178 bool cell_cartesian = jacobian_constant && dim == spacedim;
179 for (
unsigned int d = 0; d < dim; ++d)
180 for (
unsigned int e = 0; e < dim; ++e)
182 if (std::fabs(jac_0[d][e]) > zero_tolerance_double)
184 cell_cartesian =
false;
190 return ::internal::MatrixFreeFunctions::GeometryType::cartesian;
191 else if (jacobian_constant)
192 return ::internal::MatrixFreeFunctions::GeometryType::affine;
194 return ::internal::MatrixFreeFunctions::GeometryType::general;
220 template <
int dim,
int spacedim = dim,
typename Number =
double>
228 Number>::vectorized_value_type;
324 template <
typename ContainerType>
327 const ContainerType &cell_iterator_range,
328 const std::vector<std::vector<
Point<dim>>> &unit_points_vector,
337 template <
typename ContainerType>
340 const ContainerType &cell_iterator_range,
348 template <
typename ContainerType>
351 const ContainerType &cell_iterator_range,
359 template <
typename ContainerType>
362 const ContainerType &cell_iterator_range,
370 template <
typename CellIteratorType>
372 reinit_faces(
const std::vector<std::pair<CellIteratorType, unsigned int>>
373 &face_iterator_range_interior,
409 const bool is_interior =
true)
const;
417 const bool is_interior =
true)
const;
461 template <
bool is_face>
483 const unsigned int geometry_index)
const;
519 template <
typename NumberType>
546 const bool is_face_centric =
false);
553 const unsigned int n_q_points,
562 const unsigned int n_q_points,
571 const unsigned int n_q_points,
574 const std::vector<double> &weights,
575 const unsigned int compressed_unit_point_index_offset,
576 const bool affine_cell,
577 const bool is_interior =
true);
588 template <
typename ContainerType,
typename QuadratureType>
591 const ContainerType &cell_iterator_range,
592 const std::vector<QuadratureType> &quadrature_vector,
593 const unsigned int n_unfiltered_cells,
639 std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase>
680 std::vector<::internal::MatrixFreeFunctions::GeometryType>
cell_type;
713 std::array<AlignedVector<DerivativeForm<1, dim, spacedim, Number>>, 2>
723 std::array<AlignedVector<DerivativeForm<1, spacedim, dim, Number>>, 2>
775 template <
int dim,
int spacedim,
typename Number>
778 const unsigned int offset,
779 const bool is_interior)
const
781 const auto &face_pair = face_number[offset];
782 return is_interior ? face_pair.first : face_pair.second;
788 template <
int dim,
int spacedim,
typename Number>
794 , update_flags(update_flags)
796 , additional_data(additional_data)
823 template <
int dim,
int spacedim,
typename Number>
827 n_q_points_unvectorized.
clear();
828 unit_points_index.clear();
829 data_index_offsets.clear();
830 compressed_data_index_offsets.clear();
836 template <
int dim,
int spacedim,
typename Number>
840 const std::vector<
Point<dim>> &unit_points_in)
847 template <
int dim,
int spacedim,
typename Number>
853 quadrature.initialize(unit_points_in);
854 reinit(cell, quadrature);
859 template <
int dim,
int spacedim,
typename Number>
865 n_q_points_unvectorized.resize(1);
866 n_q_points_unvectorized[0] = quadrature.
size();
868 const unsigned int n_q_points =
869 compute_n_q_points<VectorizedArrayType>(n_q_points_unvectorized[0]);
871 const unsigned int n_q_points_data =
872 compute_n_q_points<Number>(n_q_points_unvectorized[0]);
875 resize_unit_points(n_q_points);
876 resize_data_fields(n_q_points_data);
881 n_q_points_unvectorized[0],
888 update_flags_mapping,
892 internal_mapping_data,
896 if (!quadrature.
empty() &&
901 mapping_data.inverse_jacobians));
911 n_q_points_unvectorized[0],
918 unit_points_index.push_back(0);
919 data_index_offsets.push_back(0);
920 compressed_data_index_offsets.push_back(0);
922 state = State::single_cell;
927 template <
int dim,
int spacedim,
typename Number>
928 template <
typename ContainerType>
931 const ContainerType &cell_iterator_range,
932 const std::vector<std::vector<
Point<dim>>> &unit_points_vector,
933 const unsigned int n_unfiltered_cells)
935 const unsigned int n_cells = unit_points_vector.size();
937 std::distance(cell_iterator_range.begin(),
938 cell_iterator_range.end()));
940 std::vector<Quadrature<dim>> quadrature_vector(n_cells);
945 reinit_cells(cell_iterator_range, quadrature_vector, n_unfiltered_cells);
950 template <
int dim,
int spacedim,
typename Number>
951 template <
typename ContainerType,
typename QuadratureType>
954 const ContainerType &cell_iterator_range,
955 const std::vector<QuadratureType> &quadrature_vector,
956 const unsigned int n_unfiltered_cells,
959 const QuadratureType &quadrature,
964 do_cell_index_compression =
967 const unsigned int n_cells = quadrature_vector.size();
969 std::distance(cell_iterator_range.begin(),
970 cell_iterator_range.end()));
972 n_q_points_unvectorized.reserve(n_cells);
974 cell_type.reserve(n_cells);
976 if (additional_data.store_cells)
977 cell_level_and_indices.resize(n_cells);
980 unit_points_index.reserve(n_cells + 1);
981 unit_points_index.push_back(0);
982 data_index_offsets.reserve(n_cells + 1);
983 data_index_offsets.push_back(0);
984 for (
const auto &quadrature : quadrature_vector)
986 const unsigned int n_points = quadrature.size();
987 n_q_points_unvectorized.push_back(n_points);
989 const unsigned int n_q_points =
990 compute_n_q_points<VectorizedArrayType>(n_points);
991 unit_points_index.push_back(unit_points_index.back() + n_q_points);
993 const unsigned int n_q_points_data =
994 compute_n_q_points<Number>(n_points);
995 data_index_offsets.push_back(data_index_offsets.back() +
999 const unsigned int n_unit_points = unit_points_index.back();
1000 const unsigned int n_data_points = data_index_offsets.back();
1003 resize_unit_points(n_unit_points);
1004 resize_data_fields(n_data_points);
1006 if (do_cell_index_compression)
1007 cell_index_to_compressed_cell_index.resize(n_unfiltered_cells,
1011 unsigned int size_compressed_data = 0;
1013 for (
const auto &cell : cell_iterator_range)
1015 if (additional_data.store_cells)
1018 cell_level_and_indices[
cell_index] = {cell->level(), cell->index()};
1021 const auto &quadrature = quadrature_vector[
cell_index];
1022 const bool empty = quadrature.empty();
1025 const unsigned int n_q_points = compute_n_q_points<VectorizedArrayType>(
1027 store_unit_points(unit_points_index[
cell_index],
1030 quadrature.get_points());
1033 compute_mapping_data(cell, quadrature, mapping_data);
1036 const unsigned int n_q_points_data =
1037 compute_n_q_points<Number>(n_q_points_unvectorized[
cell_index]);
1043 cell_type.push_back(
1048 cell_type.push_back(
1054 const bool affine_cells =
1063 1e4 / cell->diameter() * std::numeric_limits<double>::epsilon() *
1068 const auto comparison_result =
1079 comparison_result ==
1082 compressed_data_index_offsets.push_back(
1083 compressed_data_index_offsets.back());
1087 const unsigned int n_compressed_data_last_cell =
1091 compute_n_q_points<Number>(
1094 compressed_data_index_offsets.push_back(
1095 compressed_data_index_offsets.back() +
1096 n_compressed_data_last_cell);
1100 compressed_data_index_offsets.push_back(0);
1103 mapping_data_previous_cell = mapping_data;
1105 store_mapping_data(data_index_offsets[
cell_index],
1109 quadrature.get_weights(),
1118 size_compressed_data = compressed_data_index_offsets.back() + 1;
1120 size_compressed_data =
1122 compressed_data_index_offsets.back() + n_q_points_data);
1124 if (do_cell_index_compression)
1125 cell_index_to_compressed_cell_index[cell->active_cell_index()] =
1133 jacobians[0].resize(size_compressed_data);
1134 jacobians[0].shrink_to_fit();
1138 inverse_jacobians[0].resize(size_compressed_data);
1139 inverse_jacobians[0].shrink_to_fit();
1142 state = State::cell_vector;
1147 template <
int dim,
int spacedim,
typename Number>
1148 template <
typename ContainerType>
1151 const ContainerType &cell_iterator_range,
1153 const unsigned int n_unfiltered_cells)
1155 auto compute_mapping_data_for_cells =
1163 update_flags_mapping,
1167 internal_mapping_data,
1171 do_reinit_cells<ContainerType, Quadrature<dim>>(
1172 cell_iterator_range,
1175 compute_mapping_data_for_cells);
1180 template <
int dim,
int spacedim,
typename Number>
1181 template <
typename ContainerType>
1184 const ContainerType &cell_iterator_range,
1186 const unsigned int n_unfiltered_cells)
1189 additional_data.use_global_weights ==
false,
1191 "There is no known use-case for AdditionalData::use_global_weights=true and reinit_surface()"));
1198 auto compute_mapping_data_for_surface =
1205 update_flags_mapping,
1208 internal_mapping_data,
1212 do_reinit_cells<ContainerType, ImmersedSurfaceQuadrature<dim>>(
1213 cell_iterator_range,
1216 compute_mapping_data_for_surface);
1221 template <
int dim,
int spacedim,
typename Number>
1222 template <
typename ContainerType>
1225 const ContainerType &cell_iterator_range,
1227 const unsigned int n_unfiltered_cells)
1233 do_cell_index_compression =
1236 const unsigned int n_cells = quadrature_vector.size();
1238 std::distance(cell_iterator_range.begin(),
1239 cell_iterator_range.end()));
1242 cell_index_offset.resize(n_cells);
1243 unsigned int n_faces = 0;
1245 for (
const auto &cell : cell_iterator_range)
1248 n_faces += cell->n_faces();
1252 n_q_points_unvectorized.reserve(n_faces);
1254 cell_type.reserve(n_faces);
1257 unit_points_index.resize(n_faces + 1);
1258 data_index_offsets.resize(n_faces + 1);
1260 unsigned int n_unit_points = 0;
1261 unsigned int n_data_points = 0;
1262 for (
const auto &cell : cell_iterator_range)
1264 for (
const auto &f : cell->face_indices())
1266 const unsigned int current_face_index =
1269 unit_points_index[current_face_index] = n_unit_points;
1270 data_index_offsets[current_face_index] = n_data_points;
1272 const unsigned int n_points =
1274 n_q_points_unvectorized.push_back(n_points);
1276 const unsigned int n_q_points =
1277 compute_n_q_points<VectorizedArrayType>(n_points);
1278 n_unit_points += n_q_points;
1280 const unsigned int n_q_points_data =
1281 compute_n_q_points<Number>(n_points);
1282 n_data_points += n_q_points_data;
1287 unit_points_index[n_faces] = n_unit_points;
1288 data_index_offsets[n_faces] = n_data_points;
1291 if (do_cell_index_compression)
1292 cell_index_to_compressed_cell_index.resize(n_unfiltered_cells,
1297 resize_unit_points_faces(n_unit_points);
1298 resize_data_fields(n_data_points);
1302 bool first_set =
false;
1303 unsigned int size_compressed_data = 0;
1305 for (
const auto &cell : cell_iterator_range)
1307 const auto &quadratures_on_faces = quadrature_vector[
cell_index];
1309 Assert(quadratures_on_faces.size() == cell->n_faces(),
1313 for (
const auto &f : cell->face_indices())
1315 const auto &quadrature_on_face = quadratures_on_faces[f];
1316 const bool empty = quadrature_on_face.empty();
1318 const unsigned int current_face_index =
1322 const unsigned int n_q_points =
1323 compute_n_q_points<VectorizedArrayType>(
1324 n_q_points_unvectorized[current_face_index]);
1325 store_unit_points_faces(unit_points_index[current_face_index],
1327 n_q_points_unvectorized[current_face_index],
1328 quadrature_on_face.get_points());
1332 update_flags_mapping,
1336 internal_mapping_data,
1344 cell->diameter(), mapping_data.inverse_jacobians));
1348 mapping_data_first = mapping_data;
1353 cell_type.push_back(
1356 if (current_face_index > 0)
1359 const bool affine_cells =
1360 cell_type[current_face_index] <=
1362 cell_type[current_face_index - 1] <=
1368 1e4 / cell->diameter() *
1369 std::numeric_limits<double>::epsilon() * 1024.);
1373 const auto comparison_result =
1374 (!affine_cells || mapping_data.inverse_jacobians.empty() ||
1378 mapping_data.inverse_jacobians[0],
1384 comparison_result ==
1387 compressed_data_index_offsets.push_back(
1388 compressed_data_index_offsets.back());
1390 else if (first_set &&
1391 (cell_type[current_face_index] <=
1394 mapping_data.inverse_jacobians[0],
1397 double>::ComparisonResult::equal))
1399 compressed_data_index_offsets.push_back(0);
1403 const unsigned int n_compressed_data_last_cell =
1404 cell_type[current_face_index - 1] <=
1407 compute_n_q_points<Number>(
1408 n_q_points_unvectorized[current_face_index - 1]);
1410 compressed_data_index_offsets.push_back(
1411 compressed_data_index_offsets.back() +
1412 n_compressed_data_last_cell);
1416 compressed_data_index_offsets.push_back(0);
1419 mapping_data_previous_cell = mapping_data;
1421 const unsigned int n_q_points_data = compute_n_q_points<Number>(
1422 n_q_points_unvectorized[current_face_index]);
1423 store_mapping_data(data_index_offsets[current_face_index],
1425 n_q_points_unvectorized[current_face_index],
1427 quadrature_on_face.get_weights(),
1428 data_index_offsets[current_face_index],
1429 cell_type[current_face_index] <=
1434 if (cell_type[current_face_index] <=
1436 size_compressed_data = compressed_data_index_offsets.back() + 1;
1438 size_compressed_data =
1440 compressed_data_index_offsets.back() +
1443 if (do_cell_index_compression)
1444 cell_index_to_compressed_cell_index[cell->active_cell_index()] =
1452 jacobians[0].resize(size_compressed_data);
1453 jacobians[0].shrink_to_fit();
1457 inverse_jacobians[0].resize(size_compressed_data);
1458 inverse_jacobians[0].shrink_to_fit();
1461 state = State::faces_on_cells_in_vector;
1466 template <
int dim,
int spacedim,
typename Number>
1467 template <
typename CellIteratorType>
1470 const std::vector<std::pair<CellIteratorType, unsigned int>>
1471 &face_iterator_range_interior,
1476 do_cell_index_compression =
false;
1481 const unsigned int n_faces = quadrature_vector.size();
1483 std::distance(face_iterator_range_interior.begin(),
1484 face_iterator_range_interior.end()));
1486 n_q_points_unvectorized.reserve(n_faces);
1488 cell_type.reserve(n_faces);
1489 face_number.reserve(n_faces);
1492 unit_points_index.reserve(n_faces + 1);
1493 unit_points_index.push_back(0);
1494 data_index_offsets.reserve(n_faces + 1);
1495 data_index_offsets.push_back(0);
1496 for (
const auto &quadrature : quadrature_vector)
1498 const unsigned int n_points = quadrature.size();
1499 n_q_points_unvectorized.push_back(n_points);
1501 const unsigned int n_q_points =
1502 compute_n_q_points<VectorizedArrayType>(n_points);
1503 unit_points_index.push_back(unit_points_index.back() + n_q_points);
1505 const unsigned int n_q_points_data =
1506 compute_n_q_points<Number>(n_points);
1507 data_index_offsets.push_back(data_index_offsets.back() +
1511 const unsigned int n_unit_points = unit_points_index.back();
1512 const unsigned int n_data_points = data_index_offsets.back();
1515 resize_unit_points_faces(n_unit_points);
1516 resize_data_fields(n_data_points,
true);
1518 std::array<MappingData, 2> mapping_data;
1519 std::array<MappingData, 2> mapping_data_previous_cell;
1520 std::array<MappingData, 2> mapping_data_first;
1521 bool first_set =
false;
1522 unsigned int size_compressed_data = 0;
1523 unsigned int face_index = 0;
1524 for (
const auto &cell_and_f : face_iterator_range_interior)
1526 const auto &quadrature_on_face = quadrature_vector[face_index];
1527 const bool empty = quadrature_on_face.empty();
1530 const auto &cell_m = cell_and_f.first;
1531 const auto f_m = cell_and_f.second;
1534 const auto &cell_p =
1535 cell_m->at_boundary(f_m) ? cell_m : cell_m->neighbor(f_m);
1537 cell_m->at_boundary(f_m) ? f_m : cell_m->neighbor_of_neighbor(f_m);
1539 face_number.emplace_back(f_m, f_p);
1542 cell_m->combined_face_orientation(f_m) ==
1544 cell_p->combined_face_orientation(f_p) ==
1547 "Non standard face orientation is currently not implemented."));
1550 const unsigned int n_q_points = compute_n_q_points<VectorizedArrayType>(
1551 n_q_points_unvectorized[face_index]);
1552 store_unit_points_faces(unit_points_index[face_index],
1554 n_q_points_unvectorized[face_index],
1555 quadrature_on_face.get_points());
1560 update_flags_mapping,
1564 internal_mapping_data,
1570 update_flags_mapping,
1574 internal_mapping_data,
1584 cell_m->diameter(), mapping_data[0].inverse_jacobians),
1586 cell_m->diameter(), mapping_data[1].inverse_jacobians)));
1592 mapping_data_first = mapping_data;
1597 cell_type.push_back(
1603 const bool affine_cells =
1604 cell_type[face_index] <=
1606 cell_type[face_index - 1] <=
1612 1e4 / cell_m->diameter() *
1613 std::numeric_limits<double>::epsilon() * 1024.);
1617 const auto comparison_result_m =
1618 (!affine_cells || mapping_data[0].inverse_jacobians.empty() ||
1619 mapping_data_previous_cell[0].inverse_jacobians.empty()) ?
1622 mapping_data[0].inverse_jacobians[0],
1623 mapping_data_previous_cell[0].inverse_jacobians[0]);
1625 const auto comparison_result_p =
1626 (!affine_cells || mapping_data[1].inverse_jacobians.empty() ||
1627 mapping_data_previous_cell[1].inverse_jacobians.empty()) ?
1630 mapping_data[1].inverse_jacobians[0],
1631 mapping_data_previous_cell[1].inverse_jacobians[0]);
1636 comparison_result_m ==
1638 comparison_result_p ==
1641 compressed_data_index_offsets.push_back(
1642 compressed_data_index_offsets.back());
1644 else if (first_set &&
1645 (cell_type[face_index] <=
1648 mapping_data[0].inverse_jacobians[0],
1649 mapping_data_first[0].inverse_jacobians[0]) ==
1651 double>::ComparisonResult::equal) &&
1653 mapping_data[1].inverse_jacobians[0],
1654 mapping_data_first[1].inverse_jacobians[0]) ==
1657 compressed_data_index_offsets.push_back(0);
1661 const unsigned int n_compressed_data_last_cell =
1662 cell_type[face_index - 1] <=
1665 compute_n_q_points<Number>(
1666 n_q_points_unvectorized[face_index - 1]);
1668 compressed_data_index_offsets.push_back(
1669 compressed_data_index_offsets.back() +
1670 n_compressed_data_last_cell);
1674 compressed_data_index_offsets.push_back(0);
1677 mapping_data_previous_cell = mapping_data;
1679 const unsigned int n_q_points_data =
1680 compute_n_q_points<Number>(n_q_points_unvectorized[face_index]);
1683 store_mapping_data(data_index_offsets[face_index],
1685 n_q_points_unvectorized[face_index],
1687 quadrature_on_face.get_weights(),
1688 data_index_offsets[face_index],
1689 cell_type[face_index] <=
1695 store_mapping_data(data_index_offsets[face_index],
1697 n_q_points_unvectorized[face_index],
1699 quadrature_on_face.get_weights(),
1700 data_index_offsets[face_index],
1701 cell_type[face_index] <=
1707 if (cell_type[face_index] <=
1709 size_compressed_data = compressed_data_index_offsets.back() + 1;
1711 size_compressed_data =
1713 compressed_data_index_offsets.back() + n_q_points_data);
1720 jacobians[0].resize(size_compressed_data);
1721 jacobians[0].shrink_to_fit();
1722 jacobians[1].resize(size_compressed_data);
1723 jacobians[1].shrink_to_fit();
1727 inverse_jacobians[0].resize(size_compressed_data);
1728 inverse_jacobians[0].shrink_to_fit();
1729 inverse_jacobians[1].resize(size_compressed_data);
1730 inverse_jacobians[1].shrink_to_fit();
1733 state = State::face_vector;
1738 template <
int dim,
int spacedim,
typename Number>
1742 return state == State::faces_on_cells_in_vector;
1747 template <
int dim,
int spacedim,
typename Number>
1750 const unsigned int geometry_index)
const
1752 return n_q_points_unvectorized[geometry_index];
1756 template <
int dim,
int spacedim,
typename Number>
1759 const unsigned int geometry_index)
const
1761 return cell_type[geometry_index];
1766 template <
int dim,
int spacedim,
typename Number>
1772 additional_data.store_cells,
1774 "Cells have been not stored. You can enable this by Additional::store_cells."));
1782 template <
int dim,
int spacedim,
typename Number>
1783 template <
typename NumberType>
1786 const unsigned int n_q_points_unvectorized)
1788 const unsigned int n_lanes =
1790 const unsigned int n_filled_lanes_last_batch =
1791 n_q_points_unvectorized % n_lanes;
1792 unsigned int n_q_points = n_q_points_unvectorized / n_lanes;
1793 if (n_filled_lanes_last_batch > 0)
1800 template <
int dim,
int spacedim,
typename Number>
1801 template <
bool is_face>
1805 const unsigned int face_number)
const
1810 const unsigned int compressed_cell_index =
1814 Assert(state == State::cell_vector,
1816 "This mapping info is not reinitialized for a cell vector!"));
1817 return compressed_cell_index;
1823 "cell_index has to be set if face_number is specified!"));
1824 Assert(state == State::faces_on_cells_in_vector ||
1825 state == State::face_vector,
1826 ExcMessage(
"This mapping info is not reinitialized for faces"
1827 " on cells in a vector!"));
1828 if (state == State::faces_on_cells_in_vector)
1829 return cell_index_offset[compressed_cell_index] + face_number;
1830 else if (state == State::face_vector)
1837 template <
int dim,
int spacedim,
typename Number>
1842 if (do_cell_index_compression)
1846 ExcMessage(
"Mapping info object was not initialized for this"
1847 " active cell index!"));
1848 return cell_index_to_compressed_cell_index[
cell_index];
1855 template <
int dim,
int spacedim,
typename Number>
1858 const unsigned int unit_points_index_offset,
1859 const unsigned int n_q_points,
1860 const unsigned int n_q_points_unvectorized,
1863 const unsigned int n_lanes =
1866 for (
unsigned int q = 0; q < n_q_points; ++q)
1868 const unsigned int offset = unit_points_index_offset + q;
1869 for (
unsigned int v = 0;
1870 v < n_lanes && q * n_lanes + v < n_q_points_unvectorized;
1872 for (
unsigned int d = 0; d < dim; ++d)
1874 unit_points[offset][d], v) = points[q * n_lanes + v][d];
1880 template <
int dim,
int spacedim,
typename Number>
1883 const unsigned int unit_points_index_offset,
1884 const unsigned int n_q_points,
1885 const unsigned int n_q_points_unvectorized,
1888 const unsigned int n_lanes =
1891 for (
unsigned int q = 0; q < n_q_points; ++q)
1893 const unsigned int offset = unit_points_index_offset + q;
1894 for (
unsigned int v = 0;
1895 v < n_lanes && q * n_lanes + v < n_q_points_unvectorized;
1897 for (
unsigned int d = 0; d < dim - 1; ++d)
1899 unit_points_faces[offset][d], v) = points[q * n_lanes + v][d];
1905 template <
int dim,
int spacedim,
typename Number>
1908 const unsigned int unit_points_index_offset,
1909 const unsigned int n_q_points,
1910 const unsigned int n_q_points_unvectorized,
1912 const std::vector<double> &weights,
1913 const unsigned int compressed_unit_point_index_offset,
1914 const bool affine_cell,
1915 const bool is_interior)
1917 const unsigned int n_lanes =
1920 for (
unsigned int q = 0; q < n_q_points; ++q)
1922 const unsigned int offset = unit_points_index_offset + q;
1923 const unsigned int compressed_offset =
1924 compressed_unit_point_index_offset + q;
1925 for (
unsigned int v = 0;
1926 v < n_lanes && q * n_lanes + v < n_q_points_unvectorized;
1929 if (q == 0 || !affine_cell)
1932 for (
unsigned int d = 0; d < dim; ++d)
1933 for (
unsigned int s = 0; s < spacedim; ++s)
1935 jacobians[is_interior ? 0 : 1][compressed_offset][d][s],
1936 v) = mapping_data.
jacobians[q * n_lanes + v][d][s];
1937 if (update_flags_mapping &
1939 for (
unsigned int d = 0; d < dim; ++d)
1940 for (
unsigned int s = 0; s < spacedim; ++s)
1942 inverse_jacobians[is_interior ? 0 : 1]
1943 [compressed_offset][d][s],
1952 if (additional_data.use_global_weights)
1955 JxW_values[offset], v) = weights[q * n_lanes + v];
1960 JxW_values[offset], v) =
1965 for (
unsigned int s = 0; s < spacedim; ++s)
1967 normal_vectors[offset][s], v) =
1969 if (update_flags_mapping &
1971 for (
unsigned int s = 0; s < spacedim; ++s)
1973 real_points[offset][s], v) =
1982 template <
int dim,
int spacedim,
typename Number>
1985 const unsigned int n_unit_point_batches)
1987 unit_points.resize(n_unit_point_batches);
1992 template <
int dim,
int spacedim,
typename Number>
1995 const unsigned int n_unit_point_batches)
1997 unit_points_faces.resize(n_unit_point_batches);
2002 template <
int dim,
int spacedim,
typename Number>
2005 const unsigned int n_data_point_batches,
2006 const bool is_face_centric)
2010 jacobians[0].resize(n_data_point_batches);
2011 if (is_face_centric)
2012 jacobians[1].resize(n_data_point_batches);
2016 inverse_jacobians[0].resize(n_data_point_batches);
2017 if (is_face_centric)
2018 inverse_jacobians[1].resize(n_data_point_batches);
2021 JxW_values.resize(n_data_point_batches);
2023 normal_vectors.resize(n_data_point_batches);
2025 real_points.resize(n_data_point_batches);
2030 template <
int dim,
int spacedim,
typename Number>
2035 const unsigned int offset)
const
2037 return unit_points.data() + offset;
2042 template <
int dim,
int spacedim,
typename Number>
2047 const unsigned int offset)
const
2049 return unit_points_faces.data() + offset;
2054 template <
int dim,
int spacedim,
typename Number>
2057 const unsigned int offset)
const
2059 return real_points.data() + offset;
2064 template <
int dim,
int spacedim,
typename Number>
2067 const unsigned int geometry_index)
const
2069 return unit_points_index[geometry_index];
2074 template <
int dim,
int spacedim,
typename Number>
2077 const unsigned int geometry_index)
const
2079 return data_index_offsets[geometry_index];
2083 template <
int dim,
int spacedim,
typename Number>
2086 const unsigned int geometry_index)
const
2088 return compressed_data_index_offsets[geometry_index];
2093 template <
int dim,
int spacedim,
typename Number>
2096 const bool is_interior)
const
2098 return jacobians[is_interior ? 0 : 1].data() + offset;
2103 template <
int dim,
int spacedim,
typename Number>
2106 const unsigned int offset,
2107 const bool is_interior)
const
2109 return inverse_jacobians[is_interior ? 0 : 1].data() + offset;
2114 template <
int dim,
int spacedim,
typename Number>
2117 const unsigned int offset)
const
2119 return normal_vectors.data() + offset;
2124 template <
int dim,
int spacedim,
typename Number>
2125 inline const Number *
2128 return JxW_values.data() + offset;
2133 template <
int dim,
int spacedim,
typename Number>
2142 template <
int dim,
int spacedim,
typename Number>
2146 return update_flags;
2151 template <
int dim,
int spacedim,
typename Number>
2155 return update_flags_mapping;
2160 template <
int dim,
int spacedim,
typename Number>
2167 memory += cell_type.capacity() *
2180 cell_index_to_compressed_cell_index);
2182 memory +=
sizeof(*this);
ArrayView< std::remove_reference_t< typename std::iterator_traits< Iterator >::reference >, MemorySpaceType > make_array_view(const Iterator begin, const Iterator end)
void initialize_face(const UpdateFlags update_flags, const Quadrature< dim > &quadrature, const unsigned int n_original_q_points)
Abstract base class for mapping classes.
const UpdateFlags update_flags
unsigned int compute_compressed_data_index_offset(const unsigned int geometry_index) const
const DerivativeForm< 1, spacedim, dim, Number > * get_inverse_jacobian(const unsigned int offset, const bool is_interior=true) const
AlignedVector< Point< dim, VectorizedArrayType > > unit_points
std::array< AlignedVector< DerivativeForm< 1, dim, spacedim, Number > >, 2 > jacobians
AlignedVector< Number > JxW_values
::internal::MatrixFreeFunctions::GeometryType get_cell_type(const unsigned int geometry_index) const
unsigned int get_face_number(const unsigned int offset, const bool is_interior) const
const Mapping< dim, spacedim > & get_mapping() const
void reinit_faces(const ContainerType &cell_iterator_range, const std::vector< std::vector< Quadrature< dim - 1 > > > &quadrature_vector, const unsigned int n_unfiltered_cells=numbers::invalid_unsigned_int)
std::array< AlignedVector< DerivativeForm< 1, spacedim, dim, Number > >, 2 > inverse_jacobians
const Point< dim, VectorizedArrayType > * get_unit_point(const unsigned int offset) const
unsigned int get_n_q_points_unvectorized(const unsigned int geometry_index) const
const ObserverPointer< const Mapping< dim, spacedim > > mapping
unsigned int compute_compressed_cell_index(const unsigned int cell_index) const
const Point< dim - 1, VectorizedArrayType > * get_unit_point_faces(const unsigned int offset) const
Quadrature< dim > quadrature
std::vector< unsigned int > cell_index_offset
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Quadrature< dim > &quadrature)
void store_mapping_data(const unsigned int unit_points_index_offset, const unsigned int n_q_points, const unsigned int n_q_points_unvectorized, const MappingData &mapping_data, const std::vector< double > &weights, const unsigned int compressed_unit_point_index_offset, const bool affine_cell, const bool is_interior=true)
AlignedVector< Tensor< 1, spacedim, Number > > normal_vectors
unsigned int compute_geometry_index_offset(const unsigned int cell_index, const unsigned int face_number) const
std::vector<::internal::MatrixFreeFunctions::GeometryType > cell_type
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ArrayView< const Point< dim > > &unit_points)
void reinit_cells(const ContainerType &cell_iterator_range, const std::vector< Quadrature< dim > > &quadrature_vector, const unsigned int n_unfiltered_cells=numbers::invalid_unsigned_int)
MappingInfo & operator=(const MappingInfo &)=delete
ObserverPointer< const Triangulation< dim, spacedim > > triangulation
std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > internal_mapping_data
void reinit_surface(const ContainerType &cell_iterator_range, const std::vector< ImmersedSurfaceQuadrature< dim > > &quadrature_vector, const unsigned int n_unfiltered_cells=numbers::invalid_unsigned_int)
void resize_unit_points_faces(const unsigned int n_unit_point_batches)
const Tensor< 1, spacedim, Number > * get_normal_vector(const unsigned int offset) const
void reinit(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const std::vector< Point< dim > > &unit_points)
const DerivativeForm< 1, dim, spacedim, Number > * get_jacobian(const unsigned int offset, const bool is_interior=true) const
typename ::internal::VectorizedArrayTrait< Number >::vectorized_value_type VectorizedArrayType
void reinit_cells(const ContainerType &cell_iterator_range, const std::vector< std::vector< Point< dim > > > &unit_points_vector, const unsigned int n_unfiltered_cells=numbers::invalid_unsigned_int)
void resize_data_fields(const unsigned int n_data_point_batches, const bool is_face_centric=false)
void resize_unit_points(const unsigned int n_unit_point_batches)
std::size_t memory_consumption() const
UpdateFlags get_update_flags() const
void store_unit_points_faces(const unsigned int unit_points_index_offset, const unsigned int n_q_points, const unsigned int n_q_points_unvectorized, const std::vector< Point< dim - 1 > > &points)
unsigned int compute_unit_point_index_offset(const unsigned int geometry_index) const
std::vector< unsigned int > cell_index_to_compressed_cell_index
AlignedVector< Point< spacedim, Number > > real_points
unsigned int compute_data_index_offset(const unsigned int geometry_index) const
@ faces_on_cells_in_vector
std::vector< std::pair< unsigned char, unsigned char > > face_number
MappingInfo(const Mapping< dim, spacedim > &mapping, const UpdateFlags update_flags, const AdditionalData additional_data=AdditionalData())
std::vector< unsigned int > unit_points_index
std::vector< std::pair< int, int > > cell_level_and_indices
std::vector< unsigned int > compressed_data_index_offsets
bool do_cell_index_compression
std::vector< unsigned int > data_index_offsets
bool is_face_state() const
std::vector< unsigned int > n_q_points_unvectorized
const Number * get_JxW(const unsigned int offset) const
const Point< spacedim, Number > * get_real_point(const unsigned int offset) const
void store_unit_points(const unsigned int unit_points_index_offset, const unsigned int n_q_points, const unsigned int n_q_points_unvectorized, const std::vector< Point< dim > > &points)
const AdditionalData additional_data
AlignedVector< Point< dim - 1, VectorizedArrayType > > unit_points_faces
unsigned int compute_n_q_points(const unsigned int n_q_points_unvectorized)
MappingInfo(const MappingInfo &)=delete
void reinit_faces(const std::vector< std::pair< CellIteratorType, unsigned int > > &face_iterator_range_interior, const std::vector< Quadrature< dim - 1 > > &quadrature_vector)
UpdateFlags update_flags_mapping
void do_reinit_cells(const ContainerType &cell_iterator_range, const std::vector< QuadratureType > &quadrature_vector, const unsigned int n_unfiltered_cells, const std::function< void(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const QuadratureType &quadrature, MappingData &mapping_data)> &compute_mapping_data)
UpdateFlags get_update_flags_mapping() const
Triangulation< dim, spacedim >::cell_iterator get_cell_iterator(const unsigned int cell_index) const
static void compute_mapping_data_for_immersed_surface_quadrature(const ObserverPointer< const Mapping< dim, spacedim > > &mapping, const UpdateFlags &update_flags_mapping, const typename Triangulation< dim, spacedim >::cell_iterator &cell, const ImmersedSurfaceQuadrature< dim > &quadrature, std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > &internal_mapping_data, MappingData &mapping_data)
static void compute_mapping_data_for_face_quadrature(const ObserverPointer< const Mapping< dim, spacedim > > &mapping, const UpdateFlags &update_flags_mapping, const typename Triangulation< dim, spacedim >::cell_iterator &cell, const unsigned int face_no, const Quadrature< dim - 1 > &quadrature, std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > &internal_mapping_data, MappingData &mapping_data)
static void compute_mapping_data_for_quadrature(const ObserverPointer< const Mapping< dim, spacedim > > &mapping, const UpdateFlags &update_flags_mapping, const typename Triangulation< dim, spacedim >::cell_iterator &cell, CellSimilarity::Similarity &cell_similarity, const Quadrature< dim > &quadrature, std::unique_ptr< typename Mapping< dim, spacedim >::InternalDataBase > &internal_mapping_data, MappingData &mapping_data)
static UpdateFlags required_update_flags(const ObserverPointer< const Mapping< dim, spacedim > > &mapping, const UpdateFlags &update_flags)
const std::vector< double > & get_weights() const
const std::vector< Point< dim > > & get_points() const
unsigned int size() const
static constexpr unsigned char default_combined_face_orientation()
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_covariant_transformation
Covariant transformation.
@ update_jacobians
Volume element.
@ update_inverse_jacobians
Volume element.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
@ update_default
No update.
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
::internal::MatrixFreeFunctions::GeometryType compute_geometry_type(const double diameter, const std::vector< DerivativeForm< 1, spacedim, dim, double > > &inverse_jacobians)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
ComparisonResult compare(const std::vector< T > &v1, const std::vector< T > &v2) const
AdditionalData(const bool use_global_weights=false, const bool store_cells=false)
static constexpr std::size_t width()
static value_type & get(value_type &value, unsigned int c)