17#ifndef dealii_matrix_free_h
18#define dealii_matrix_free_h
114 typename Number = double,
119 std::is_same<Number, typename VectorizedArrayType::value_type>::value,
120 "Type of Number and of VectorizedArrayType do not match.");
574 template <
typename QuadratureType,
typename number2,
typename MappingType>
579 const QuadratureType & quad,
588 template <
typename QuadratureType,
typename number2>
592 const QuadratureType & quad,
616 template <
typename QuadratureType,
typename number2,
typename MappingType>
621 const std::vector<QuadratureType> & quad,
629 template <
typename QuadratureType,
631 typename DoFHandlerType,
632 typename MappingType>
635 const std::vector<const DoFHandlerType *> & dof_handler,
637 const std::vector<QuadratureType> & quad,
646 template <
typename QuadratureType,
typename number2>
650 const std::vector<QuadratureType> & quad,
658 template <
typename QuadratureType,
typename number2,
typename DoFHandlerType>
660 reinit(
const std::vector<const DoFHandlerType *> & dof_handler,
662 const std::vector<QuadratureType> & quad,
672 template <
typename QuadratureType,
typename number2,
typename MappingType>
677 const QuadratureType & quad,
685 template <
typename QuadratureType,
687 typename DoFHandlerType,
688 typename MappingType>
691 const std::vector<const DoFHandlerType *> & dof_handler,
693 const QuadratureType & quad,
702 template <
typename QuadratureType,
typename number2>
706 const QuadratureType & quad,
714 template <
typename QuadratureType,
typename number2,
typename DoFHandlerType>
716 reinit(
const std::vector<const DoFHandlerType *> & dof_handler,
718 const QuadratureType & quad,
875 template <
typename OutVector,
typename InVector>
881 const std::pair<unsigned int, unsigned int> &)> &cell_operation,
883 const InVector & src,
884 const bool zero_dst_vector =
false)
const;
932 template <
typename CLASS,
typename OutVector,
typename InVector>
938 const std::pair<unsigned int, unsigned int> &)
const,
939 const CLASS * owning_class,
942 const bool zero_dst_vector =
false)
const;
947 template <
typename CLASS,
typename OutVector,
typename InVector>
953 const std::pair<unsigned int, unsigned int> &),
954 CLASS * owning_class,
957 const bool zero_dst_vector =
false)
const;
1043 template <
typename CLASS,
typename OutVector,
typename InVector>
1049 const std::pair<unsigned int, unsigned int> &)
const,
1050 const CLASS * owning_class,
1052 const InVector &src,
1053 const std::function<
void(
const unsigned int,
const unsigned int)>
1054 &operation_before_loop,
1055 const std::function<
void(
const unsigned int,
const unsigned int)>
1056 & operation_after_loop,
1057 const unsigned int dof_handler_index_pre_post = 0)
const;
1062 template <
typename CLASS,
typename OutVector,
typename InVector>
1068 const std::pair<unsigned int, unsigned int> &),
1069 CLASS * owning_class,
1071 const InVector &src,
1072 const std::function<
void(
const unsigned int,
const unsigned int)>
1073 &operation_before_loop,
1074 const std::function<
void(
const unsigned int,
const unsigned int)>
1075 & operation_after_loop,
1076 const unsigned int dof_handler_index_pre_post = 0)
const;
1082 template <
typename OutVector,
typename InVector>
1088 const std::pair<unsigned int, unsigned int> &)> &cell_operation,
1090 const InVector & src,
1091 const std::function<
void(
const unsigned int,
const unsigned int)>
1092 &operation_before_loop,
1093 const std::function<
void(
const unsigned int,
const unsigned int)>
1094 & operation_after_loop,
1095 const unsigned int dof_handler_index_pre_post = 0)
const;
1172 template <
typename OutVector,
typename InVector>
1178 const std::pair<unsigned int, unsigned int> &)> &cell_operation,
1179 const std::function<
1183 const std::pair<unsigned int, unsigned int> &)> &face_operation,
1184 const std::function<
void(
1188 const std::pair<unsigned int, unsigned int> &)> &boundary_operation,
1190 const InVector & src,
1191 const bool zero_dst_vector =
false,
1282 template <
typename CLASS,
typename OutVector,
typename InVector>
1285 void (CLASS::*cell_operation)(
const MatrixFree &,
1288 const std::pair<unsigned int, unsigned int> &)
1290 void (CLASS::*face_operation)(
const MatrixFree &,
1293 const std::pair<unsigned int, unsigned int> &)
1295 void (CLASS::*boundary_operation)(
1299 const std::pair<unsigned int, unsigned int> &)
const,
1300 const CLASS * owning_class,
1302 const InVector & src,
1303 const bool zero_dst_vector =
false,
1312 template <
typename CLASS,
typename OutVector,
typename InVector>
1314 loop(
void (CLASS::*cell_operation)(
1318 const std::pair<unsigned int, unsigned int> &),
1319 void (CLASS::*face_operation)(
1323 const std::pair<unsigned int, unsigned int> &),
1324 void (CLASS::*boundary_operation)(
1328 const std::pair<unsigned int, unsigned int> &),
1329 CLASS * owning_class,
1331 const InVector & src,
1332 const bool zero_dst_vector =
false,
1402 template <
typename CLASS,
typename OutVector,
typename InVector>
1408 const std::pair<unsigned int, unsigned int> &)
const,
1409 const CLASS * owning_class,
1411 const InVector & src,
1412 const bool zero_dst_vector =
false,
1419 template <
typename CLASS,
typename OutVector,
typename InVector>
1425 const std::pair<unsigned int, unsigned int> &),
1426 CLASS * owning_class,
1428 const InVector & src,
1429 const bool zero_dst_vector =
false,
1436 template <
typename OutVector,
typename InVector>
1442 const std::pair<unsigned int, unsigned int> &)>
1445 const InVector & src,
1446 const bool zero_dst_vector =
false,
1457 std::pair<unsigned int, unsigned int>
1459 const unsigned int fe_degree,
1460 const unsigned int dof_handler_index = 0)
const;
1468 std::pair<unsigned int, unsigned int>
1470 const std::pair<unsigned int, unsigned int> &range,
1471 const unsigned int fe_index,
1472 const unsigned int dof_handler_index = 0)
const;
1485 const std::pair<unsigned int, unsigned int> range)
const;
1492 const bool is_interior_face =
true)
const;
1520 template <
typename VectorType>
1523 const unsigned int dof_handler_index = 0)
const;
1545 template <
typename Number2>
1548 const unsigned int dof_handler_index = 0)
const;
1560 const std::shared_ptr<const Utilities::MPI::Partitioner> &
1584 const std::vector<unsigned int> &
1599 const unsigned int dof_handler_index = 0);
1610 template <
int spacedim>
1707 const unsigned int face_number)
const;
1726 template <
typename DoFHandlerType>
1744 const unsigned int lane_index,
1745 const unsigned int dof_handler_index = 0)
const;
1754 const unsigned int lane_index)
const;
1768 std::pair<typename DoFHandler<dim>::cell_iterator,
unsigned int>
1770 const unsigned int lane_index,
1771 const bool interior =
true,
1772 const unsigned int fe_component = 0)
const;
1781 const unsigned int lane_index,
1782 const unsigned int dof_handler_index = 0)
const;
1834 const unsigned int hp_active_fe_index = 0)
const;
1841 const unsigned int hp_active_fe_index = 0)
const;
1849 const unsigned int hp_active_fe_index = 0)
const;
1857 const unsigned int hp_active_fe_index = 0)
const;
1864 const unsigned int hp_active_fe_index = 0)
const;
1871 const unsigned int hp_active_fe_index = 0)
const;
1886 std::pair<unsigned int, unsigned int>
1920 template <
typename StreamType>
1948 const internal::MatrixFreeFunctions::
1949 MappingInfo<dim, Number, VectorizedArrayType> &
1984 const unsigned int quad_index = 0,
1985 const unsigned int fe_base_element = 0,
1986 const unsigned int hp_active_fe_index = 0,
1987 const unsigned int hp_active_quad_index = 0)
const;
1993 VectorizedArrayType::size()> &
2053 template <
typename number2,
int q_dim>
2059 const std::vector<IndexSet> & locally_owned_set,
2069 template <
typename number2>
2073 const std::vector<IndexSet> & locally_owned_set,
2093 std::vector<internal::MatrixFreeFunctions::DoFInfo>
dof_info;
2171 std::list<std::pair<bool, AlignedVector<VectorizedArrayType>>>>
2178 mutable std::list<std::pair<bool, AlignedVector<Number>>>
2195template <
int dim,
typename Number,
typename VectorizedArrayType>
2196template <
typename VectorType>
2200 const unsigned int comp)
const
2203 vec.reinit(
dof_info[comp].vector_partitioner->size());
2208template <
int dim,
typename Number,
typename VectorizedArrayType>
2209template <
typename Number2>
2213 const unsigned int comp)
const
2221template <
int dim,
typename Number,
typename VectorizedArrayType>
2222inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
2224 const unsigned int comp)
const
2227 return dof_info[comp].vector_partitioner;
2232template <
int dim,
typename Number,
typename VectorizedArrayType>
2233inline const std::vector<unsigned int> &
2235 const unsigned int comp)
const
2238 return dof_info[comp].constrained_dofs;
2243template <
int dim,
typename Number,
typename VectorizedArrayType>
2253template <
int dim,
typename Number,
typename VectorizedArrayType>
2256 const unsigned int dof_no)
const
2260 return dof_handlers[dof_no]->get_fe().n_base_elements();
2265template <
int dim,
typename Number,
typename VectorizedArrayType>
2274template <
int dim,
typename Number,
typename VectorizedArrayType>
2283template <
int dim,
typename Number,
typename VectorizedArrayType>
2292template <
int dim,
typename Number,
typename VectorizedArrayType>
2301template <
int dim,
typename Number,
typename VectorizedArrayType>
2311template <
int dim,
typename Number,
typename VectorizedArrayType>
2322template <
int dim,
typename Number,
typename VectorizedArrayType>
2334template <
int dim,
typename Number,
typename VectorizedArrayType>
2345template <
int dim,
typename Number,
typename VectorizedArrayType>
2348 const unsigned int macro_face)
const
2360template <
int dim,
typename Number,
typename VectorizedArrayType>
2363 const unsigned int cell_batch_index,
2364 const unsigned int face_number)
const
2372 for (
unsigned int v = 0;
2382template <
int dim,
typename Number,
typename VectorizedArrayType>
2383inline const internal::MatrixFreeFunctions::
2384 MappingInfo<dim, Number, VectorizedArrayType> &
2392template <
int dim,
typename Number,
typename VectorizedArrayType>
2395 const unsigned int dof_index)
const
2403template <
int dim,
typename Number,
typename VectorizedArrayType>
2412template <
int dim,
typename Number,
typename VectorizedArrayType>
2413inline const Number *
2415 const unsigned int row)
const
2425template <
int dim,
typename Number,
typename VectorizedArrayType>
2426inline const Number *
2428 const unsigned int row)
const
2438template <
int dim,
typename Number,
typename VectorizedArrayType>
2439inline std::pair<unsigned int, unsigned int>
2441 const std::pair<unsigned int, unsigned int> &range,
2442 const unsigned int degree,
2443 const unsigned int dof_handler_component)
const
2445 if (
dof_info[dof_handler_component].cell_active_fe_index.empty())
2448 dof_info[dof_handler_component].fe_index_conversion.size(), 1);
2450 dof_info[dof_handler_component].fe_index_conversion[0].size(), 1);
2451 if (
dof_info[dof_handler_component].fe_index_conversion[0][0] == degree)
2454 return {range.second, range.second};
2457 const unsigned int fe_index =
2458 dof_info[dof_handler_component].fe_index_from_degree(0, degree);
2459 if (fe_index >=
dof_info[dof_handler_component].max_fe_index)
2460 return {range.second, range.second};
2464 dof_handler_component);
2469template <
int dim,
typename Number,
typename VectorizedArrayType>
2472 const unsigned int cell_batch_index)
const
2475 return VectorizedArrayType::size() > 1 &&
2478 VectorizedArrayType::size() -
2484template <
int dim,
typename Number,
typename VectorizedArrayType>
2492template <
int dim,
typename Number,
typename VectorizedArrayType>
2495 const std::pair<unsigned int, unsigned int> range)
const
2497 const auto &fe_indices =
dof_info[0].cell_active_fe_index;
2499 if (fe_indices.empty() ==
true)
2502 const auto index = fe_indices[range.first];
2504 for (
unsigned int i = range.first; i < range.second; ++i)
2512template <
int dim,
typename Number,
typename VectorizedArrayType>
2515 const std::pair<unsigned int, unsigned int> range,
2516 const bool is_interior_face)
const
2518 const auto &fe_indices =
dof_info[0].cell_active_fe_index;
2520 if (fe_indices.empty() ==
true)
2523 if (is_interior_face)
2525 const unsigned int index =
2527 VectorizedArrayType::size()];
2529 for (
unsigned int i = range.first; i < range.second; ++i)
2532 VectorizedArrayType::size()]);
2538 const unsigned int index =
2540 VectorizedArrayType::size()];
2542 for (
unsigned int i = range.first; i < range.second; ++i)
2545 VectorizedArrayType::size()]);
2553template <
int dim,
typename Number,
typename VectorizedArrayType>
2556 const unsigned int cell_batch_index)
const
2563template <
int dim,
typename Number,
typename VectorizedArrayType>
2566 const unsigned int cell_batch_index)
const
2569 unsigned int n_lanes = VectorizedArrayType::size();
2570 while (n_lanes > 1 &&
2582template <
int dim,
typename Number,
typename VectorizedArrayType>
2585 const unsigned int face_batch_index)
const
2588 unsigned int n_lanes = VectorizedArrayType::size();
2589 while (n_lanes > 1 &&
2599template <
int dim,
typename Number,
typename VectorizedArrayType>
2602 const unsigned int dof_handler_index,
2603 const unsigned int active_fe_index)
const
2605 return dof_info[dof_handler_index].dofs_per_cell[active_fe_index];
2610template <
int dim,
typename Number,
typename VectorizedArrayType>
2613 const unsigned int quad_index,
2614 const unsigned int active_fe_index)
const
2618 .descriptor[active_fe_index]
2624template <
int dim,
typename Number,
typename VectorizedArrayType>
2627 const unsigned int dof_handler_index,
2628 const unsigned int active_fe_index)
const
2630 return dof_info[dof_handler_index].dofs_per_face[active_fe_index];
2635template <
int dim,
typename Number,
typename VectorizedArrayType>
2638 const unsigned int quad_index,
2639 const unsigned int active_fe_index)
const
2643 .descriptor[active_fe_index]
2649template <
int dim,
typename Number,
typename VectorizedArrayType>
2652 const unsigned int dof_handler_index)
const
2654 return dof_info[dof_handler_index].vector_partitioner->locally_owned_range();
2659template <
int dim,
typename Number,
typename VectorizedArrayType>
2662 const unsigned int dof_handler_index)
const
2664 return dof_info[dof_handler_index].vector_partitioner->ghost_indices();
2669template <
int dim,
typename Number,
typename VectorizedArrayType>
2672 const unsigned int dof_handler_index,
2673 const unsigned int index_quad,
2674 const unsigned int index_fe,
2675 const unsigned int active_fe_index,
2676 const unsigned int active_quad_index)
const
2679 const unsigned int ind =
2680 dof_info[dof_handler_index].global_base_element_offset + index_fe;
2685 return shape_info(ind, index_quad, active_fe_index, active_quad_index);
2690template <
int dim,
typename Number,
typename VectorizedArrayType>
2692 VectorizedArrayType::size()> &
2694 const unsigned int macro_face)
const
2702template <
int dim,
typename Number,
typename VectorizedArrayType>
2712template <
int dim,
typename Number,
typename VectorizedArrayType>
2715 const unsigned int quad_index,
2716 const unsigned int active_fe_index)
const
2720 .descriptor[active_fe_index]
2726template <
int dim,
typename Number,
typename VectorizedArrayType>
2729 const unsigned int quad_index,
2730 const unsigned int active_fe_index)
const
2734 .descriptor[active_fe_index]
2740template <
int dim,
typename Number,
typename VectorizedArrayType>
2743 const unsigned int cell_batch_index)
const
2747 if (
dof_info[0].cell_active_fe_index.empty())
2750 return dof_info[0].cell_active_fe_index[cell_batch_index];
2755template <
int dim,
typename Number,
typename VectorizedArrayType>
2756inline std::pair<unsigned int, unsigned int>
2758 const unsigned int macro_face)
const
2761 if (
dof_info[0].cell_active_fe_index.empty())
2762 return std::make_pair(0
U, 0
U);
2764 std::pair<unsigned int, unsigned int> result;
2765 for (
unsigned int v = 0; v < VectorizedArrayType::size() &&
2772 .cell_active_fe_index[
face_info.
faces[macro_face].cells_interior[v]]);
2775 for (
unsigned int v = 0; v < VectorizedArrayType::size() &&
2782 .cell_active_fe_index[
face_info.
faces[macro_face].cells_exterior[v]]);
2790template <
int dim,
typename Number,
typename VectorizedArrayType>
2799template <
int dim,
typename Number,
typename VectorizedArrayType>
2807template <
int dim,
typename Number,
typename VectorizedArrayType>
2816template <
int dim,
typename Number,
typename VectorizedArrayType>
2821 std::list<std::pair<bool, AlignedVector<VectorizedArrayType>>>;
2823 for (
typename list_type::iterator it = data.begin(); it != data.end(); ++it)
2824 if (it->first ==
false)
2830 return &data.front().second;
2835template <
int dim,
typename Number,
typename VectorizedArrayType>
2841 std::list<std::pair<bool, AlignedVector<VectorizedArrayType>>>;
2843 for (
typename list_type::iterator it = data.begin(); it != data.end(); ++it)
2844 if (&it->second == scratch)
2855template <
int dim,
typename Number,
typename VectorizedArrayType>
2864 if (it->first ==
false)
2876template <
int dim,
typename Number,
typename VectorizedArrayType>
2886 if (&it->second == scratch)
2901 namespace MatrixFreeImplementation
2903 template <
int dim,
int spacedim>
2904 inline std::vector<IndexSet>
2905 extract_locally_owned_index_sets(
2906 const std::vector<const ::DoFHandler<dim, spacedim> *> &dofh,
2907 const unsigned int level)
2909 std::vector<IndexSet> locally_owned_set;
2910 locally_owned_set.reserve(dofh.size());
2911 for (
unsigned int j = 0; j < dofh.size(); j++)
2913 locally_owned_set.push_back(dofh[j]->locally_owned_dofs());
2915 locally_owned_set.push_back(dofh[j]->locally_owned_mg_dofs(
level));
2916 return locally_owned_set;
2923template <
int dim,
typename Number,
typename VectorizedArrayType>
2924template <
typename QuadratureType,
typename number2>
2929 const QuadratureType & quad,
2933 std::vector<const DoFHandler<dim, dim> *>
dof_handlers;
2934 std::vector<const AffineConstraints<number2> *> constraints;
2935 std::vector<QuadratureType> quads;
2938 constraints.push_back(&constraints_in);
2939 quads.push_back(quad);
2941 std::vector<IndexSet> locally_owned_sets =
2942 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2945 std::vector<hp::QCollection<dim>> quad_hp;
2946 quad_hp.emplace_back(quad);
2959template <
int dim,
typename Number,
typename VectorizedArrayType>
2960template <
typename QuadratureType,
typename number2,
typename MappingType>
2963 const MappingType & mapping,
2966 const QuadratureType & quad,
2970 std::vector<const DoFHandler<dim, dim> *>
dof_handlers;
2971 std::vector<const AffineConstraints<number2> *> constraints;
2974 constraints.push_back(&constraints_in);
2976 std::vector<IndexSet> locally_owned_sets =
2977 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2980 std::vector<hp::QCollection<dim>> quad_hp;
2981 quad_hp.emplace_back(quad);
2993template <
int dim,
typename Number,
typename VectorizedArrayType>
2994template <
typename QuadratureType,
typename number2>
2999 const std::vector<QuadratureType> & quad,
3003 std::vector<IndexSet> locally_owned_set =
3004 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
3005 dof_handler, additional_data.
mg_level);
3006 std::vector<hp::QCollection<dim>> quad_hp;
3007 for (
unsigned int q = 0; q < quad.size(); ++q)
3008 quad_hp.emplace_back(quad[q]);
3021template <
int dim,
typename Number,
typename VectorizedArrayType>
3022template <
typename QuadratureType,
3024 typename DoFHandlerType,
3025 typename MappingType>
3028 const MappingType & mapping,
3029 const std::vector<const DoFHandlerType *> & dof_handler,
3031 const std::vector<QuadratureType> & quad,
3032 const AdditionalData & additional_data)
3034 static_assert(dim == DoFHandlerType::dimension,
3035 "Dimension dim not equal to DoFHandlerType::dimension.");
3039 for (
const auto dh : dof_handler)
3047template <
int dim,
typename Number,
typename VectorizedArrayType>
3048template <
typename QuadratureType,
typename number2>
3053 const QuadratureType & quad,
3057 std::vector<IndexSet> locally_owned_set =
3058 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
3059 dof_handler, additional_data.
mg_level);
3060 std::vector<hp::QCollection<dim>> quad_hp;
3061 quad_hp.emplace_back(quad);
3074template <
int dim,
typename Number,
typename VectorizedArrayType>
3075template <
typename QuadratureType,
typename number2,
typename DoFHandlerType>
3078 const std::vector<const DoFHandlerType *> & dof_handler,
3080 const std::vector<QuadratureType> & quad,
3081 const AdditionalData & additional_data)
3083 static_assert(dim == DoFHandlerType::dimension,
3084 "Dimension dim not equal to DoFHandlerType::dimension.");
3088 for (
const auto dh : dof_handler)
3091 this->
reinit(dof_handlers, constraint, quad, additional_data);
3096template <
int dim,
typename Number,
typename VectorizedArrayType>
3097template <
typename QuadratureType,
typename number2,
typename MappingType>
3100 const MappingType & mapping,
3103 const QuadratureType & quad,
3107 std::vector<IndexSet> locally_owned_set =
3108 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
3109 dof_handler, additional_data.
mg_level);
3110 std::vector<hp::QCollection<dim>> quad_hp;
3111 quad_hp.emplace_back(quad);
3123template <
int dim,
typename Number,
typename VectorizedArrayType>
3124template <
typename QuadratureType,
typename number2,
typename MappingType>
3127 const MappingType & mapping,
3130 const std::vector<QuadratureType> & quad,
3134 std::vector<IndexSet> locally_owned_set =
3135 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
3136 dof_handler, additional_data.
mg_level);
3137 std::vector<hp::QCollection<dim>> quad_hp;
3138 for (
unsigned int q = 0; q < quad.size(); ++q)
3139 quad_hp.emplace_back(quad[q]);
3151template <
int dim,
typename Number,
typename VectorizedArrayType>
3152template <
typename QuadratureType,
3154 typename DoFHandlerType,
3155 typename MappingType>
3158 const MappingType & mapping,
3159 const std::vector<const DoFHandlerType *> & dof_handler,
3161 const QuadratureType & quad,
3162 const AdditionalData & additional_data)
3164 static_assert(dim == DoFHandlerType::dimension,
3165 "Dimension dim not equal to DoFHandlerType::dimension.");
3169 for (
const auto dh : dof_handler)
3177template <
int dim,
typename Number,
typename VectorizedArrayType>
3178template <
typename QuadratureType,
typename number2,
typename DoFHandlerType>
3181 const std::vector<const DoFHandlerType *> & dof_handler,
3183 const QuadratureType & quad,
3184 const AdditionalData & additional_data)
3186 static_assert(dim == DoFHandlerType::dimension,
3187 "Dimension dim not equal to DoFHandlerType::dimension.");
3191 for (
const auto dh : dof_handler)
3194 this->
reinit(dof_handlers, constraint, quad, additional_data);
3214 template <
int dim,
typename Number,
typename VectorizedArrayType>
3215 struct VectorDataExchange
3222 static constexpr unsigned int channel_shift = 20;
3231 const ::MatrixFree<dim, Number, VectorizedArrayType> &matrix_free,
3232 const typename ::MatrixFree<dim, Number, VectorizedArrayType>::
3233 DataAccessOnFaces vector_face_access,
3234 const unsigned int n_components)
3235 : matrix_free(matrix_free)
3236 , vector_face_access(
3237 matrix_free.get_task_info().face_partition_data.empty() ?
3238 ::
MatrixFree<dim, Number, VectorizedArrayType>::
3239 DataAccessOnFaces::unspecified :
3241 , ghosts_were_set(false)
3242# ifdef DEAL_II_WITH_MPI
3243 , tmp_data(n_components)
3244 , requests(n_components)
3248 if (this->vector_face_access !=
3250 DataAccessOnFaces::unspecified)
3251 for (
unsigned int c = 0; c < matrix_free.n_components(); ++c)
3253 matrix_free.get_dof_info(c).vector_exchanger_face_variants.size(),
3262 ~VectorDataExchange()
3264# ifdef DEAL_II_WITH_MPI
3265 for (
unsigned int i = 0; i < tmp_data.size(); ++i)
3266 if (tmp_data[i] !=
nullptr)
3267 matrix_free.release_scratch_data_non_threadsafe(tmp_data[i]);
3277 template <
typename VectorType>
3279 find_vector_in_mf(
const VectorType &vec,
3280 const bool check_global_compatibility =
true)
const
3283 for (
unsigned int c = 0; c < matrix_free.n_components(); ++c)
3284 if (vec.get_partitioner().get() ==
3285 matrix_free.get_dof_info(c).vector_partitioner.get())
3289 for (
unsigned int c = 0; c < matrix_free.n_components(); ++c)
3290 if (check_global_compatibility ?
3291 vec.get_partitioner()->is_globally_compatible(
3292 *matrix_free.get_dof_info(c).vector_partitioner) :
3293 vec.get_partitioner()->is_compatible(
3294 *matrix_free.get_dof_info(c).vector_partitioner))
3310 get_partitioner(
const unsigned int mf_component)
const
3313 .vector_exchanger_face_variants.size(),
3315 if (vector_face_access ==
3318 return *matrix_free.get_dof_info(mf_component)
3319 .vector_exchanger_face_variants[0];
3320 else if (vector_face_access ==
3323 return *matrix_free.get_dof_info(mf_component)
3324 .vector_exchanger_face_variants[1];
3325 else if (vector_face_access ==
3328 return *matrix_free.get_dof_info(mf_component)
3329 .vector_exchanger_face_variants[2];
3330 else if (vector_face_access ==
3332 DataAccessOnFaces::values_all_faces)
3333 return *matrix_free.get_dof_info(mf_component)
3334 .vector_exchanger_face_variants[3];
3335 else if (vector_face_access ==
3337 DataAccessOnFaces::gradients_all_faces)
3338 return *matrix_free.get_dof_info(mf_component)
3339 .vector_exchanger_face_variants[4];
3341 return *matrix_free.get_dof_info(mf_component).vector_exchanger.get();
3349 template <
typename VectorType,
3350 typename std::enable_if<is_serial_or_dummy<VectorType>::value,
3351 VectorType>::type * =
nullptr>
3353 update_ghost_values_start(
const unsigned int ,
3354 const VectorType & )
3362 template <
typename VectorType,
3363 typename std::enable_if<
3364 !has_update_ghost_values_start<VectorType>::value &&
3365 !is_serial_or_dummy<VectorType>::value,
3366 VectorType>::type * =
nullptr>
3368 update_ghost_values_start(
const unsigned int component_in_block_vector,
3369 const VectorType & vec)
3371 (void)component_in_block_vector;
3372 bool ghosts_set = vec.has_ghost_elements();
3374 ghosts_were_set =
true;
3376 vec.update_ghost_values();
3386 template <
typename VectorType,
3387 typename std::enable_if<
3388 has_update_ghost_values_start<VectorType>::value &&
3389 !has_exchange_on_subset<VectorType>::value,
3390 VectorType>::type * =
nullptr>
3392 update_ghost_values_start(
const unsigned int component_in_block_vector,
3393 const VectorType & vec)
3395 (void)component_in_block_vector;
3396 bool ghosts_set = vec.has_ghost_elements();
3398 ghosts_were_set =
true;
3400 vec.update_ghost_values_start(component_in_block_vector + channel_shift);
3411 template <
typename VectorType,
3412 typename std::enable_if<
3413 has_update_ghost_values_start<VectorType>::value &&
3414 has_exchange_on_subset<VectorType>::value,
3415 VectorType>::type * =
nullptr>
3417 update_ghost_values_start(
const unsigned int component_in_block_vector,
3418 const VectorType & vec)
3421 std::is_same<Number, typename VectorType::value_type>::value,
3422 "Type mismatch between VectorType and VectorDataExchange");
3423 (void)component_in_block_vector;
3424 bool ghosts_set = vec.has_ghost_elements();
3426 ghosts_were_set =
true;
3428 if (vec.size() != 0)
3430# ifdef DEAL_II_WITH_MPI
3431 const unsigned int mf_component = find_vector_in_mf(vec);
3433 const auto &part = get_partitioner(mf_component);
3435 if (part.n_ghost_indices() == 0 && part.n_import_indices() == 0 &&
3436 part.n_import_sm_procs() == 0)
3439 tmp_data[component_in_block_vector] =
3440 matrix_free.acquire_scratch_data_non_threadsafe();
3441 tmp_data[component_in_block_vector]->resize_fast(
3442 part.n_import_indices());
3445 part.export_to_ghosted_array_start(
3446 component_in_block_vector * 2 + channel_shift,
3448 vec.shared_vector_data(),
3450 part.locally_owned_size(),
3451 matrix_free.get_dof_info(mf_component)
3452 .vector_partitioner->n_ghost_indices()),
3454 part.n_import_indices()),
3455 this->requests[component_in_block_vector]);
3467 typename VectorType,
3468 typename std::enable_if<!has_update_ghost_values_start<VectorType>::value,
3469 VectorType>::type * =
nullptr>
3471 update_ghost_values_finish(
const unsigned int ,
3472 const VectorType & )
3482 template <
typename VectorType,
3483 typename std::enable_if<
3484 has_update_ghost_values_start<VectorType>::value &&
3485 !has_exchange_on_subset<VectorType>::value,
3486 VectorType>::type * =
nullptr>
3488 update_ghost_values_finish(
const unsigned int component_in_block_vector,
3489 const VectorType & vec)
3491 (void)component_in_block_vector;
3492 vec.update_ghost_values_finish();
3503 template <
typename VectorType,
3504 typename std::enable_if<
3505 has_update_ghost_values_start<VectorType>::value &&
3506 has_exchange_on_subset<VectorType>::value,
3507 VectorType>::type * =
nullptr>
3509 update_ghost_values_finish(
const unsigned int component_in_block_vector,
3510 const VectorType & vec)
3513 std::is_same<Number, typename VectorType::value_type>::value,
3514 "Type mismatch between VectorType and VectorDataExchange");
3515 (void)component_in_block_vector;
3517 if (vec.size() != 0)
3519# ifdef DEAL_II_WITH_MPI
3523 const unsigned int mf_component = find_vector_in_mf(vec);
3525 const auto &part = get_partitioner(mf_component);
3527 if (part.n_ghost_indices() != 0 || part.n_import_indices() != 0 ||
3528 part.n_import_sm_procs() != 0)
3530 part.export_to_ghosted_array_finish(
3532 vec.shared_vector_data(),
3534 part.locally_owned_size(),
3535 matrix_free.get_dof_info(mf_component)
3536 .vector_partitioner->n_ghost_indices()),
3537 this->requests[component_in_block_vector]);
3539 matrix_free.release_scratch_data_non_threadsafe(
3540 tmp_data[component_in_block_vector]);
3541 tmp_data[component_in_block_vector] =
nullptr;
3547 vec.set_ghost_state(
true);
3555 template <
typename VectorType,
3556 typename std::enable_if<is_serial_or_dummy<VectorType>::value,
3557 VectorType>::type * =
nullptr>
3559 compress_start(
const unsigned int ,
3569 template <
typename VectorType,
3570 typename std::enable_if<!has_compress_start<VectorType>::value &&
3571 !is_serial_or_dummy<VectorType>::value,
3572 VectorType>::type * =
nullptr>
3574 compress_start(
const unsigned int component_in_block_vector,
3577 (void)component_in_block_vector;
3590 typename VectorType,
3591 typename std::enable_if<has_compress_start<VectorType>::value &&
3592 !has_exchange_on_subset<VectorType>::value,
3593 VectorType>::type * =
nullptr>
3595 compress_start(
const unsigned int component_in_block_vector,
3598 (void)component_in_block_vector;
3600 vec.compress_start(component_in_block_vector + channel_shift);
3612 typename VectorType,
3613 typename std::enable_if<has_compress_start<VectorType>::value &&
3614 has_exchange_on_subset<VectorType>::value,
3615 VectorType>::type * =
nullptr>
3617 compress_start(
const unsigned int component_in_block_vector,
3621 std::is_same<Number, typename VectorType::value_type>::value,
3622 "Type mismatch between VectorType and VectorDataExchange");
3623 (void)component_in_block_vector;
3626 if (vec.size() != 0)
3628# ifdef DEAL_II_WITH_MPI
3629 const unsigned int mf_component = find_vector_in_mf(vec);
3631 const auto &part = get_partitioner(mf_component);
3633 if (part.n_ghost_indices() == 0 && part.n_import_indices() == 0 &&
3634 part.n_import_sm_procs() == 0)
3637 tmp_data[component_in_block_vector] =
3638 matrix_free.acquire_scratch_data_non_threadsafe();
3639 tmp_data[component_in_block_vector]->resize_fast(
3640 part.n_import_indices());
3643 part.import_from_ghosted_array_start(
3645 component_in_block_vector * 2 + channel_shift,
3647 vec.shared_vector_data(),
3649 matrix_free.get_dof_info(mf_component)
3650 .vector_partitioner->n_ghost_indices()),
3652 part.n_import_indices()),
3653 this->requests[component_in_block_vector]);
3664 template <
typename VectorType,
3665 typename std::enable_if<!has_compress_start<VectorType>::value,
3666 VectorType>::type * =
nullptr>
3668 compress_finish(
const unsigned int ,
3680 typename VectorType,
3681 typename std::enable_if<has_compress_start<VectorType>::value &&
3682 !has_exchange_on_subset<VectorType>::value,
3683 VectorType>::type * =
nullptr>
3685 compress_finish(
const unsigned int component_in_block_vector,
3688 (void)component_in_block_vector;
3701 typename VectorType,
3702 typename std::enable_if<has_compress_start<VectorType>::value &&
3703 has_exchange_on_subset<VectorType>::value,
3704 VectorType>::type * =
nullptr>
3706 compress_finish(
const unsigned int component_in_block_vector,
3710 std::is_same<Number, typename VectorType::value_type>::value,
3711 "Type mismatch between VectorType and VectorDataExchange");
3712 (void)component_in_block_vector;
3713 if (vec.size() != 0)
3715# ifdef DEAL_II_WITH_MPI
3719 const unsigned int mf_component = find_vector_in_mf(vec);
3721 const auto &part = get_partitioner(mf_component);
3723 if (part.n_ghost_indices() != 0 || part.n_import_indices() != 0 ||
3724 part.n_import_sm_procs() != 0)
3726 part.import_from_ghosted_array_finish(
3729 vec.shared_vector_data(),
3731 matrix_free.get_dof_info(mf_component)
3732 .vector_partitioner->n_ghost_indices()),
3734 tmp_data[component_in_block_vector]->begin(),
3735 part.n_import_indices()),
3736 this->requests[component_in_block_vector]);
3738 matrix_free.release_scratch_data_non_threadsafe(
3739 tmp_data[component_in_block_vector]);
3740 tmp_data[component_in_block_vector] =
nullptr;
3744 MPI_Barrier(matrix_free.get_task_info().communicator_sm);
3754 template <
typename VectorType,
3755 typename std::enable_if<is_serial_or_dummy<VectorType>::value,
3756 VectorType>::type * =
nullptr>
3758 reset_ghost_values(
const VectorType & )
const
3768 typename VectorType,
3769 typename std::enable_if<!has_exchange_on_subset<VectorType>::value &&
3770 !is_serial_or_dummy<VectorType>::value,
3771 VectorType>::type * =
nullptr>
3773 reset_ghost_values(
const VectorType &vec)
const
3775 if (ghosts_were_set ==
true)
3778 vec.zero_out_ghost_values();
3788 template <
typename VectorType,
3789 typename std::enable_if<has_exchange_on_subset<VectorType>::value,
3790 VectorType>::type * =
nullptr>
3792 reset_ghost_values(
const VectorType &vec)
const
3795 std::is_same<Number, typename VectorType::value_type>::value,
3796 "Type mismatch between VectorType and VectorDataExchange");
3797 if (ghosts_were_set ==
true)
3800 if (vec.size() != 0)
3802# ifdef DEAL_II_WITH_MPI
3805 const unsigned int mf_component = find_vector_in_mf(vec);
3807 const auto &part = get_partitioner(mf_component);
3809 if (part.n_ghost_indices() > 0)
3814 part.locally_owned_size(),
3815 matrix_free.get_dof_info(mf_component)
3816 .vector_partitioner->n_ghost_indices()));
3822 vec.set_ghost_state(
false);
3832 template <
typename VectorType,
3833 typename std::enable_if<has_exchange_on_subset<VectorType>::value,
3834 VectorType>::type * =
nullptr>
3836 zero_vector_region(
const unsigned int range_index, VectorType &vec)
const
3839 std::is_same<Number, typename VectorType::value_type>::value,
3840 "Type mismatch between VectorType and VectorDataExchange");
3845 const unsigned int mf_component = find_vector_in_mf(vec,
false);
3847 matrix_free.get_dof_info(mf_component);
3855 for (
unsigned int id =
3875 typename VectorType,
3876 typename std::enable_if<!has_exchange_on_subset<VectorType>::value,
3877 VectorType>::type * =
nullptr,
3878 typename VectorType::value_type * =
nullptr>
3880 zero_vector_region(
const unsigned int range_index, VectorType &vec)
const
3883 vec =
typename VectorType::value_type();
3893 zero_vector_region(
const unsigned int, ...)
const
3897 "which provide VectorType::value_type"));
3902 const ::MatrixFree<dim, Number, VectorizedArrayType> &matrix_free;
3903 const typename ::MatrixFree<dim, Number, VectorizedArrayType>::
3904 DataAccessOnFaces vector_face_access;
3905 bool ghosts_were_set;
3906# ifdef DEAL_II_WITH_MPI
3907 std::vector<AlignedVector<Number> *> tmp_data;
3908 std::vector<std::vector<MPI_Request>> requests;
3912 template <
typename VectorStruct>
3914 n_components(
const VectorStruct &vec);
3916 template <
typename VectorStruct>
3918 n_components_block(
const VectorStruct &vec,
3919 std::integral_constant<bool, true>)
3921 unsigned int components = 0;
3922 for (
unsigned int bl = 0; bl < vec.n_blocks(); ++bl)
3923 components += n_components(vec.block(bl));
3927 template <
typename VectorStruct>
3929 n_components_block(
const VectorStruct &, std::integral_constant<bool, false>)
3934 template <
typename VectorStruct>
3936 n_components(
const VectorStruct &vec)
3938 return n_components_block(
3942 template <
typename VectorStruct>
3944 n_components(
const std::vector<VectorStruct> &vec)
3946 unsigned int components = 0;
3947 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3948 components += n_components_block(
3954 template <
typename VectorStruct>
3956 n_components(
const std::vector<VectorStruct *> &vec)
3958 unsigned int components = 0;
3959 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3960 components += n_components_block(
3974 typename VectorStruct,
3975 typename std::enable_if<!has_communication_block_size<VectorStruct>::value,
3976 VectorStruct>::type * =
nullptr>
3977 constexpr unsigned int
3978 get_communication_block_size(
const VectorStruct &)
3986 typename VectorStruct,
3987 typename std::enable_if<has_communication_block_size<VectorStruct>::value,
3988 VectorStruct>::type * =
nullptr>
3989 constexpr unsigned int
3990 get_communication_block_size(
const VectorStruct &)
3992 return VectorStruct::communication_block_size;
4007 typename VectorStruct,
4009 typename VectorizedArrayType,
4010 typename std::enable_if<IsBlockVector<VectorStruct>::value,
4011 VectorStruct>::type * =
nullptr>
4013 update_ghost_values_start(
4014 const VectorStruct & vec,
4015 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4016 const unsigned int channel = 0)
4018 if (get_communication_block_size(vec) < vec.n_blocks())
4022 exchanger.ghosts_were_set = vec.has_ghost_elements();
4023 vec.update_ghost_values();
4027 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
4028 update_ghost_values_start(vec.block(i), exchanger, channel + i);
4036 typename VectorStruct,
4038 typename VectorizedArrayType,
4039 typename std::enable_if<!IsBlockVector<VectorStruct>::value,
4040 VectorStruct>::type * =
nullptr>
4042 update_ghost_values_start(
4043 const VectorStruct & vec,
4044 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4045 const unsigned int channel = 0)
4047 exchanger.update_ghost_values_start(channel, vec);
4054 typename VectorStruct,
4056 typename VectorizedArrayType>
4058 update_ghost_values_start(
4059 const std::vector<VectorStruct> & vec,
4060 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4062 unsigned int component_index = 0;
4063 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4065 update_ghost_values_start(vec[comp], exchanger, component_index);
4066 component_index += n_components(vec[comp]);
4074 typename VectorStruct,
4076 typename VectorizedArrayType>
4078 update_ghost_values_start(
4079 const std::vector<VectorStruct *> & vec,
4080 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4082 unsigned int component_index = 0;
4083 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4085 update_ghost_values_start(*vec[comp], exchanger, component_index);
4086 component_index += n_components(*vec[comp]);
4098 typename VectorStruct,
4100 typename VectorizedArrayType,
4101 typename std::enable_if<IsBlockVector<VectorStruct>::value,
4102 VectorStruct>::type * =
nullptr>
4104 update_ghost_values_finish(
4105 const VectorStruct & vec,
4106 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4107 const unsigned int channel = 0)
4109 if (get_communication_block_size(vec) < vec.n_blocks())
4115 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
4116 update_ghost_values_finish(vec.block(i), exchanger, channel + i);
4123 typename VectorStruct,
4125 typename VectorizedArrayType,
4126 typename std::enable_if<!IsBlockVector<VectorStruct>::value,
4127 VectorStruct>::type * =
nullptr>
4129 update_ghost_values_finish(
4130 const VectorStruct & vec,
4131 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4132 const unsigned int channel = 0)
4134 exchanger.update_ghost_values_finish(channel, vec);
4141 typename VectorStruct,
4143 typename VectorizedArrayType>
4145 update_ghost_values_finish(
4146 const std::vector<VectorStruct> & vec,
4147 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4149 unsigned int component_index = 0;
4150 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4152 update_ghost_values_finish(vec[comp], exchanger, component_index);
4153 component_index += n_components(vec[comp]);
4161 typename VectorStruct,
4163 typename VectorizedArrayType>
4165 update_ghost_values_finish(
4166 const std::vector<VectorStruct *> & vec,
4167 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4169 unsigned int component_index = 0;
4170 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4172 update_ghost_values_finish(*vec[comp], exchanger, component_index);
4173 component_index += n_components(*vec[comp]);
4185 typename VectorStruct,
4187 typename VectorizedArrayType,
4188 typename std::enable_if<IsBlockVector<VectorStruct>::value,
4189 VectorStruct>::type * =
nullptr>
4193 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4194 const unsigned int channel = 0)
4196 if (get_communication_block_size(vec) < vec.n_blocks())
4199 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
4200 compress_start(vec.block(i), exchanger, channel + i);
4207 typename VectorStruct,
4209 typename VectorizedArrayType,
4210 typename std::enable_if<!IsBlockVector<VectorStruct>::value,
4211 VectorStruct>::type * =
nullptr>
4215 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4216 const unsigned int channel = 0)
4218 exchanger.compress_start(channel, vec);
4225 typename VectorStruct,
4227 typename VectorizedArrayType>
4230 std::vector<VectorStruct> & vec,
4231 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4233 unsigned int component_index = 0;
4234 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4236 compress_start(vec[comp], exchanger, component_index);
4237 component_index += n_components(vec[comp]);
4245 typename VectorStruct,
4247 typename VectorizedArrayType>
4250 std::vector<VectorStruct *> & vec,
4251 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4253 unsigned int component_index = 0;
4254 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4256 compress_start(*vec[comp], exchanger, component_index);
4257 component_index += n_components(*vec[comp]);
4269 typename VectorStruct,
4271 typename VectorizedArrayType,
4272 typename std::enable_if<IsBlockVector<VectorStruct>::value,
4273 VectorStruct>::type * =
nullptr>
4277 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4278 const unsigned int channel = 0)
4280 if (get_communication_block_size(vec) < vec.n_blocks())
4286 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
4287 compress_finish(vec.block(i), exchanger, channel + i);
4294 typename VectorStruct,
4296 typename VectorizedArrayType,
4297 typename std::enable_if<!IsBlockVector<VectorStruct>::value,
4298 VectorStruct>::type * =
nullptr>
4302 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger,
4303 const unsigned int channel = 0)
4305 exchanger.compress_finish(channel, vec);
4312 typename VectorStruct,
4314 typename VectorizedArrayType>
4317 std::vector<VectorStruct> & vec,
4318 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4320 unsigned int component_index = 0;
4321 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4323 compress_finish(vec[comp], exchanger, component_index);
4324 component_index += n_components(vec[comp]);
4332 typename VectorStruct,
4334 typename VectorizedArrayType>
4337 std::vector<VectorStruct *> & vec,
4338 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4340 unsigned int component_index = 0;
4341 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4343 compress_finish(*vec[comp], exchanger, component_index);
4344 component_index += n_components(*vec[comp]);
4360 typename VectorStruct,
4362 typename VectorizedArrayType,
4363 typename std::enable_if<IsBlockVector<VectorStruct>::value,
4364 VectorStruct>::type * =
nullptr>
4367 const VectorStruct & vec,
4368 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4371 if (exchanger.ghosts_were_set ==
true)
4374 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
4375 reset_ghost_values(vec.block(i), exchanger);
4382 typename VectorStruct,
4384 typename VectorizedArrayType,
4385 typename std::enable_if<!IsBlockVector<VectorStruct>::value,
4386 VectorStruct>::type * =
nullptr>
4389 const VectorStruct & vec,
4390 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4392 exchanger.reset_ghost_values(vec);
4399 typename VectorStruct,
4401 typename VectorizedArrayType>
4404 const std::vector<VectorStruct> & vec,
4405 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4408 if (exchanger.ghosts_were_set ==
true)
4411 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4412 reset_ghost_values(vec[comp], exchanger);
4419 typename VectorStruct,
4421 typename VectorizedArrayType>
4424 const std::vector<VectorStruct *> & vec,
4425 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4428 if (exchanger.ghosts_were_set ==
true)
4431 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4432 reset_ghost_values(*vec[comp], exchanger);
4443 typename VectorStruct,
4445 typename VectorizedArrayType,
4446 typename std::enable_if<IsBlockVector<VectorStruct>::value,
4447 VectorStruct>::type * =
nullptr>
4450 const unsigned int range_index,
4452 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4454 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
4455 exchanger.zero_vector_region(range_index, vec.block(i));
4462 typename VectorStruct,
4464 typename VectorizedArrayType,
4465 typename std::enable_if<!IsBlockVector<VectorStruct>::value,
4466 VectorStruct>::type * =
nullptr>
4469 const unsigned int range_index,
4471 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4473 exchanger.zero_vector_region(range_index, vec);
4480 typename VectorStruct,
4482 typename VectorizedArrayType>
4485 const unsigned int range_index,
4486 std::vector<VectorStruct> & vec,
4487 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4489 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4490 zero_vector_region(range_index, vec[comp], exchanger);
4497 typename VectorStruct,
4499 typename VectorizedArrayType>
4502 const unsigned int range_index,
4503 std::vector<VectorStruct *> & vec,
4504 VectorDataExchange<dim, Number, VectorizedArrayType> &exchanger)
4506 for (
unsigned int comp = 0; comp < vec.size(); comp++)
4507 zero_vector_region(range_index, *vec[comp], exchanger);
4512 namespace MatrixFreeFunctions
4516 template <
typename,
typename,
typename,
typename,
bool>
4517 struct InterfaceSelector
4521 template <
typename MF,
4525 struct InterfaceSelector<MF, InVector, OutVector, Container, true>
4527 using function_type = void (Container::*)(
4531 const std::pair<unsigned int, unsigned int> &)
const;
4535 template <
typename MF,
4539 struct InterfaceSelector<MF, InVector, OutVector, Container, false>
4541 using function_type =
4542 void (Container::*)(
const MF &,
4545 const std::pair<unsigned int, unsigned int> &);
4553 template <
typename MF,
4558 class MFWorker :
public MFWorkerInterface
4562 using function_type =
typename MatrixFreeFunctions::
4563 InterfaceSelector<MF, InVector, OutVector, Container, is_constant>::
4567 MFWorker(
const MF & matrix_free,
4568 const InVector & src,
4570 const bool zero_dst_vector_setting,
4571 const Container & container,
4572 function_type cell_function,
4573 function_type face_function,
4574 function_type boundary_function,
4575 const typename MF::DataAccessOnFaces src_vector_face_access =
4577 const typename MF::DataAccessOnFaces dst_vector_face_access =
4579 const std::function<
void(
const unsigned int,
const unsigned int)>
4580 &operation_before_loop = {},
4581 const std::function<void(
const unsigned int,
const unsigned int)>
4582 & operation_after_loop = {},
4583 const unsigned int dof_handler_index_pre_post = 0)
4584 : matrix_free(matrix_free)
4585 , container(
const_cast<Container &
>(container))
4586 , cell_function(cell_function)
4587 , face_function(face_function)
4588 , boundary_function(boundary_function)
4591 , src_data_exchanger(matrix_free,
4592 src_vector_face_access,
4594 , dst_data_exchanger(matrix_free,
4595 dst_vector_face_access,
4598 , zero_dst_vector_setting(zero_dst_vector_setting &&
4599 !src_and_dst_are_same)
4600 , operation_before_loop(operation_before_loop)
4601 , operation_after_loop(operation_after_loop)
4602 , dof_handler_index_pre_post(dof_handler_index_pre_post)
4607 cell(
const std::pair<unsigned int, unsigned int> &cell_range)
override
4609 if (cell_function !=
nullptr && cell_range.second > cell_range.first)
4610 for (
unsigned int i = 0; i < matrix_free.n_active_fe_indices(); ++i)
4612 const auto cell_subrange =
4613 matrix_free.create_cell_subrange_hp_by_index(cell_range, i);
4615 if (cell_subrange.second <= cell_subrange.first)
4619 cell_function)(matrix_free, this->dst, this->src, cell_subrange);
4624 cell(
const unsigned int range_index)
override
4626 process_range(cell_function,
4627 matrix_free.get_task_info().cell_partition_data_hp_ptr,
4628 matrix_free.get_task_info().cell_partition_data_hp,
4633 face(
const unsigned int range_index)
override
4635 process_range(face_function,
4636 matrix_free.get_task_info().face_partition_data_hp_ptr,
4637 matrix_free.get_task_info().face_partition_data_hp,
4642 boundary(
const unsigned int range_index)
override
4644 process_range(boundary_function,
4645 matrix_free.get_task_info().boundary_partition_data_hp_ptr,
4646 matrix_free.get_task_info().boundary_partition_data_hp,
4652 process_range(
const function_type & fu,
4653 const std::vector<unsigned int> &ptr,
4654 const std::vector<unsigned int> &data,
4655 const unsigned int range_index)
4660 for (
unsigned int i = ptr[range_index]; i < ptr[range_index + 1]; ++i)
4661 (container.*fu)(matrix_free,
4664 std::make_pair(data[2 * i], data[2 * i + 1]));
4675 vector_update_ghosts_start()
override
4677 if (!src_and_dst_are_same)
4678 internal::update_ghost_values_start(src, src_data_exchanger);
4683 vector_update_ghosts_finish()
override
4685 if (!src_and_dst_are_same)
4686 internal::update_ghost_values_finish(src, src_data_exchanger);
4691 vector_compress_start()
override
4693 internal::compress_start(dst, dst_data_exchanger);
4698 vector_compress_finish()
override
4700 internal::compress_finish(dst, dst_data_exchanger);
4701 if (!src_and_dst_are_same)
4702 internal::reset_ghost_values(src, src_data_exchanger);
4707 zero_dst_vector_range(
const unsigned int range_index)
override
4709 if (zero_dst_vector_setting)
4710 internal::zero_vector_region(range_index, dst, dst_data_exchanger);
4714 cell_loop_pre_range(
const unsigned int range_index)
override
4716 if (operation_before_loop)
4719 matrix_free.get_dof_info(dof_handler_index_pre_post);
4726 operation_before_loop,
4733 for (
unsigned int id =
4744 cell_loop_post_range(
const unsigned int range_index)
override
4746 if (operation_after_loop)
4749 matrix_free.get_dof_info(dof_handler_index_pre_post);
4756 operation_after_loop,
4763 for (
unsigned int id =
4774 const MF & matrix_free;
4775 Container & container;
4776 function_type cell_function;
4777 function_type face_function;
4778 function_type boundary_function;
4780 const InVector &src;
4782 VectorDataExchange<MF::dimension,
4783 typename MF::value_type,
4784 typename MF::vectorized_value_type>
4786 VectorDataExchange<MF::dimension,
4787 typename MF::value_type,
4788 typename MF::vectorized_value_type>
4790 const bool src_and_dst_are_same;
4791 const bool zero_dst_vector_setting;
4792 const std::function<void(
const unsigned int,
const unsigned int)>
4793 operation_before_loop;
4794 const std::function<void(
const unsigned int,
const unsigned int)>
4795 operation_after_loop;
4796 const unsigned int dof_handler_index_pre_post;
4805 template <
class MF,
typename InVector,
typename OutVector>
4806 struct MFClassWrapper
4808 using function_type =
4809 std::function<void(
const MF &,
4812 const std::pair<unsigned int, unsigned int> &)>;
4814 MFClassWrapper(
const function_type cell,
4815 const function_type face,
4816 const function_type boundary)
4819 , boundary(boundary)
4823 cell_integrator(
const MF & mf,
4825 const InVector & src,
4826 const std::pair<unsigned int, unsigned int> &range)
const
4829 cell(mf, dst, src, range);
4833 face_integrator(
const MF & mf,
4835 const InVector & src,
4836 const std::pair<unsigned int, unsigned int> &range)
const
4839 face(mf, dst, src, range);
4843 boundary_integrator(
4846 const InVector & src,
4847 const std::pair<unsigned int, unsigned int> &range)
const
4850 boundary(mf, dst, src, range);
4853 const function_type cell;
4854 const function_type face;
4855 const function_type boundary;
4862template <
int dim,
typename Number,
typename VectorizedArrayType>
4863template <
typename OutVector,
typename InVector>
4869 const std::pair<unsigned int, unsigned int> &)>
4872 const InVector &src,
4873 const bool zero_dst_vector)
const
4876 internal::MFClassWrapper<MatrixFree<dim, Number, VectorizedArrayType>,
4879 Wrapper wrap(cell_operation,
nullptr,
nullptr);
4880 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
4890 &Wrapper::cell_integrator,
4891 &Wrapper::face_integrator,
4892 &Wrapper::boundary_integrator);
4899template <
int dim,
typename Number,
typename VectorizedArrayType>
4900template <
typename OutVector,
typename InVector>
4906 const std::pair<unsigned int, unsigned int> &)>
4909 const InVector &src,
4910 const std::function<
void(
const unsigned int,
const unsigned int)>
4911 &operation_before_loop,
4912 const std::function<
void(
const unsigned int,
const unsigned int)>
4913 & operation_after_loop,
4914 const unsigned int dof_handler_index_pre_post)
const
4917 internal::MFClassWrapper<MatrixFree<dim, Number, VectorizedArrayType>,
4920 Wrapper wrap(cell_operation,
nullptr,
nullptr);
4921 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
4931 &Wrapper::cell_integrator,
4932 &Wrapper::face_integrator,
4933 &Wrapper::boundary_integrator,
4936 operation_before_loop,
4937 operation_after_loop,
4938 dof_handler_index_pre_post);
4945template <
int dim,
typename Number,
typename VectorizedArrayType>
4946template <
typename OutVector,
typename InVector>
4952 const std::pair<unsigned int, unsigned int> &)>
4957 const std::pair<unsigned int, unsigned int> &)>
4962 const std::pair<unsigned int, unsigned int> &)>
4963 & boundary_operation,
4965 const InVector & src,
4966 const bool zero_dst_vector,
4967 const DataAccessOnFaces dst_vector_face_access,
4968 const DataAccessOnFaces src_vector_face_access)
const
4971 internal::MFClassWrapper<MatrixFree<dim, Number, VectorizedArrayType>,
4974 Wrapper wrap(cell_operation, face_operation, boundary_operation);
4975 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
4985 &Wrapper::cell_integrator,
4986 &Wrapper::face_integrator,
4987 &Wrapper::boundary_integrator,
4988 src_vector_face_access,
4989 dst_vector_face_access);
4996template <
int dim,
typename Number,
typename VectorizedArrayType>
4997template <
typename CLASS,
typename OutVector,
typename InVector>
5000 void (CLASS::*function_pointer)(
5004 const std::pair<unsigned int, unsigned int> &)
const,
5005 const CLASS * owning_class,
5007 const InVector &src,
5008 const bool zero_dst_vector)
const
5010 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5028template <
int dim,
typename Number,
typename VectorizedArrayType>
5029template <
typename CLASS,
typename OutVector,
typename InVector>
5032 void (CLASS::*function_pointer)(
5036 const std::pair<unsigned int, unsigned int> &)
const,
5037 const CLASS * owning_class,
5039 const InVector &src,
5040 const std::function<
void(
const unsigned int,
const unsigned int)>
5041 &operation_before_loop,
5042 const std::function<
void(
const unsigned int,
const unsigned int)>
5043 & operation_after_loop,
5044 const unsigned int dof_handler_index_pre_post)
const
5046 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5061 operation_before_loop,
5062 operation_after_loop,
5063 dof_handler_index_pre_post);
5069template <
int dim,
typename Number,
typename VectorizedArrayType>
5070template <
typename CLASS,
typename OutVector,
typename InVector>
5073 void (CLASS::*cell_operation)(
5077 const std::pair<unsigned int, unsigned int> &)
const,
5078 void (CLASS::*face_operation)(
5082 const std::pair<unsigned int, unsigned int> &)
const,
5083 void (CLASS::*boundary_operation)(
5087 const std::pair<unsigned int, unsigned int> &)
const,
5088 const CLASS * owning_class,
5090 const InVector & src,
5091 const bool zero_dst_vector,
5092 const DataAccessOnFaces dst_vector_face_access,
5093 const DataAccessOnFaces src_vector_face_access)
const
5095 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5108 src_vector_face_access,
5109 dst_vector_face_access);
5115template <
int dim,
typename Number,
typename VectorizedArrayType>
5116template <
typename CLASS,
typename OutVector,
typename InVector>
5119 void (CLASS::*function_pointer)(
5123 const std::pair<unsigned int, unsigned int> &),
5124 CLASS * owning_class,
5126 const InVector &src,
5127 const bool zero_dst_vector)
const
5129 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5147template <
int dim,
typename Number,
typename VectorizedArrayType>
5148template <
typename CLASS,
typename OutVector,
typename InVector>
5151 void (CLASS::*function_pointer)(
5155 const std::pair<unsigned int, unsigned int> &),
5156 CLASS * owning_class,
5158 const InVector &src,
5159 const std::function<
void(
const unsigned int,
const unsigned int)>
5160 &operation_before_loop,
5161 const std::function<
void(
const unsigned int,
const unsigned int)>
5162 & operation_after_loop,
5163 const unsigned int dof_handler_index_pre_post)
const
5165 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5180 operation_before_loop,
5181 operation_after_loop,
5182 dof_handler_index_pre_post);
5188template <
int dim,
typename Number,
typename VectorizedArrayType>
5189template <
typename CLASS,
typename OutVector,
typename InVector>
5192 void (CLASS::*cell_operation)(
5196 const std::pair<unsigned int, unsigned int> &),
5197 void (CLASS::*face_operation)(
5201 const std::pair<unsigned int, unsigned int> &),
5202 void (CLASS::*boundary_operation)(
5206 const std::pair<unsigned int, unsigned int> &),
5207 CLASS * owning_class,
5209 const InVector & src,
5210 const bool zero_dst_vector,
5211 const DataAccessOnFaces dst_vector_face_access,
5212 const DataAccessOnFaces src_vector_face_access)
const
5214 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5227 src_vector_face_access,
5228 dst_vector_face_access);
5234template <
int dim,
typename Number,
typename VectorizedArrayType>
5235template <
typename CLASS,
typename OutVector,
typename InVector>
5238 void (CLASS::*function_pointer)(
5242 const std::pair<unsigned int, unsigned int> &)
const,
5243 const CLASS * owning_class,
5245 const InVector & src,
5246 const bool zero_dst_vector,
5247 const DataAccessOnFaces src_vector_face_access)
const
5249 auto src_vector_face_access_temp = src_vector_face_access;
5255 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5268 src_vector_face_access_temp,
5275template <
int dim,
typename Number,
typename VectorizedArrayType>
5276template <
typename CLASS,
typename OutVector,
typename InVector>
5279 void (CLASS::*function_pointer)(
5283 const std::pair<unsigned int, unsigned int> &),
5284 CLASS * owning_class,
5286 const InVector & src,
5287 const bool zero_dst_vector,
5288 const DataAccessOnFaces src_vector_face_access)
const
5290 auto src_vector_face_access_temp = src_vector_face_access;
5296 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5309 src_vector_face_access_temp,
5316template <
int dim,
typename Number,
typename VectorizedArrayType>
5317template <
typename OutVector,
typename InVector>
5323 const std::pair<unsigned int, unsigned int> &)>
5326 const InVector & src,
5327 const bool zero_dst_vector,
5328 const DataAccessOnFaces src_vector_face_access)
const
5330 auto src_vector_face_access_temp = src_vector_face_access;
5337 internal::MFClassWrapper<MatrixFree<dim, Number, VectorizedArrayType>,
5340 Wrapper wrap(cell_operation,
nullptr,
nullptr);
5342 internal::MFWorker<MatrixFree<dim, Number, VectorizedArrayType>,
5352 &Wrapper::cell_integrator,
5353 &Wrapper::face_integrator,
5354 &Wrapper::boundary_integrator,
5355 src_vector_face_access_temp,
Abstract base class for mapping classes.
unsigned int n_active_fe_indices() const
std::pair< typename DoFHandler< dim >::cell_iterator, unsigned int > get_face_iterator(const unsigned int face_batch_index, const unsigned int lane_index, const bool interior=true, const unsigned int fe_component=0) const
void loop_cell_centric(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &), CLASS *owning_class, OutVector &dst, const InVector &src, const bool zero_dst_vector=false, const DataAccessOnFaces src_vector_face_access=DataAccessOnFaces::unspecified) const
internal::MatrixFreeFunctions::MappingInfo< dim, Number, VectorizedArrayType > mapping_info
unsigned int get_cell_active_fe_index(const std::pair< unsigned int, unsigned int > range) const
const internal::MatrixFreeFunctions::TaskInfo & get_task_info() const
DoFHandler< dim >::active_cell_iterator get_hp_cell_iterator(const unsigned int cell_batch_index, const unsigned int lane_index, const unsigned int dof_handler_index=0) const
unsigned int n_ghost_cell_batches() const
void loop(const std::function< void(const MatrixFree< dim, Number, VectorizedArrayType > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &cell_operation, const std::function< void(const MatrixFree< dim, Number, VectorizedArrayType > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &face_operation, const std::function< void(const MatrixFree< dim, Number, VectorizedArrayType > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &boundary_operation, OutVector &dst, const InVector &src, const bool zero_dst_vector=false, const DataAccessOnFaces dst_vector_face_access=DataAccessOnFaces::unspecified, const DataAccessOnFaces src_vector_face_access=DataAccessOnFaces::unspecified) const
const internal::MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > & get_shape_info(const unsigned int dof_handler_index_component=0, const unsigned int quad_index=0, const unsigned int fe_base_element=0, const unsigned int hp_active_fe_index=0, const unsigned int hp_active_quad_index=0) const
void initialize_dof_handlers(const std::vector< const DoFHandler< dim, dim > * > &dof_handlers, const AdditionalData &additional_data)
Table< 4, internal::MatrixFreeFunctions::ShapeInfo< VectorizedArrayType > > shape_info
void print(std::ostream &out) const
void update_mapping(const std::shared_ptr< hp::MappingCollection< dim > > &mapping)
const Table< 3, unsigned int > & get_cell_and_face_to_plain_faces() const
void reinit(const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const QuadratureType &quad, const AdditionalData &additional_data=AdditionalData())
unsigned int n_inner_face_batches() const
unsigned int n_active_entries_per_cell_batch(const unsigned int cell_batch_index) const
void update_mapping(const Mapping< dim > &mapping)
const Quadrature< dim > & get_quadrature(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
const internal::MatrixFreeFunctions::FaceToCellTopology< VectorizedArrayType::size()> & get_face_info(const unsigned int face_batch_index) const
unsigned int get_mg_level() const
unsigned int n_components_filled(const unsigned int cell_batch_number) const
void print_memory_consumption(StreamType &out) const
void reinit(const std::vector< const DoFHandlerType * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< QuadratureType > &quad, const AdditionalData &additional_data=AdditionalData())
bool mapping_initialized() const
void cell_loop(const std::function< void(const MatrixFree< dim, Number, VectorizedArrayType > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &cell_operation, OutVector &dst, const InVector &src, const std::function< void(const unsigned int, const unsigned int)> &operation_before_loop, const std::function< void(const unsigned int, const unsigned int)> &operation_after_loop, const unsigned int dof_handler_index_pre_post=0) const
void internal_reinit(const std::shared_ptr< hp::MappingCollection< dim > > &mapping, const std::vector< const DoFHandler< dim, dim > * > &dof_handlers, const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< IndexSet > &locally_owned_set, const std::vector< hp::QCollection< q_dim > > &quad, const AdditionalData &additional_data)
unsigned int get_n_q_points_face(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info(const unsigned int dof_handler_index_component=0) const
AlignedVector< VectorizedArrayType > * acquire_scratch_data() const
bool at_irregular_cell(const unsigned int cell_batch_index) const
~MatrixFree() override=default
const DoFHandlerType & get_dof_handler(const unsigned int dof_handler_index=0) const
void copy_from(const MatrixFree< dim, Number, VectorizedArrayType > &matrix_free_base)
unsigned int get_dofs_per_cell(const unsigned int dof_handler_index=0, const unsigned int hp_active_fe_index=0) const
unsigned int n_constraint_pool_entries() const
void cell_loop(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &), CLASS *owning_class, OutVector &dst, const InVector &src, const std::function< void(const unsigned int, const unsigned int)> &operation_before_loop, const std::function< void(const unsigned int, const unsigned int)> &operation_after_loop, const unsigned int dof_handler_index_pre_post=0) const
const Number * constraint_pool_begin(const unsigned int pool_index) const
AlignedVector< Number > * acquire_scratch_data_non_threadsafe() const
const IndexSet & get_locally_owned_set(const unsigned int dof_handler_index=0) const
unsigned int get_dofs_per_face(const unsigned int dof_handler_index=0, const unsigned int hp_active_fe_index=0) const
internal::MatrixFreeFunctions::TaskInfo task_info
const DoFHandler< dim > & get_dof_handler(const unsigned int dof_handler_index=0) const
void release_scratch_data(const AlignedVector< VectorizedArrayType > *memory) const
void loop(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &) const, void(CLASS::*face_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &) const, void(CLASS::*boundary_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &) const, const CLASS *owning_class, OutVector &dst, const InVector &src, const bool zero_dst_vector=false, const DataAccessOnFaces dst_vector_face_access=DataAccessOnFaces::unspecified, const DataAccessOnFaces src_vector_face_access=DataAccessOnFaces::unspecified) const
std::pair< unsigned int, unsigned int > get_face_category(const unsigned int macro_face) const
bool mapping_is_initialized
void loop_cell_centric(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &) const, const CLASS *owning_class, OutVector &dst, const InVector &src, const bool zero_dst_vector=false, const DataAccessOnFaces src_vector_face_access=DataAccessOnFaces::unspecified) const
void initialize_dof_vector(LinearAlgebra::distributed::Vector< Number2 > &vec, const unsigned int dof_handler_index=0) const
DoFHandler< dim >::cell_iterator get_cell_iterator(const unsigned int cell_batch_index, const unsigned int lane_index, const unsigned int dof_handler_index=0) const
MatrixFree(const MatrixFree< dim, Number, VectorizedArrayType > &other)
std::pair< unsigned int, unsigned int > create_cell_subrange_hp(const std::pair< unsigned int, unsigned int > &range, const unsigned int fe_degree, const unsigned int dof_handler_index=0) const
std::pair< unsigned int, unsigned int > create_cell_subrange_hp_by_index(const std::pair< unsigned int, unsigned int > &range, const unsigned int fe_index, const unsigned int dof_handler_index=0) const
void cell_loop(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &) const, const CLASS *owning_class, OutVector &dst, const InVector &src, const std::function< void(const unsigned int, const unsigned int)> &operation_before_loop, const std::function< void(const unsigned int, const unsigned int)> &operation_after_loop, const unsigned int dof_handler_index_pre_post=0) const
std::vector< std::pair< unsigned int, unsigned int > > cell_level_index
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_vector_partitioner(const unsigned int dof_handler_index=0) const
const internal::MatrixFreeFunctions::MappingInfo< dim, Number, VectorizedArrayType > & get_mapping_info() const
void reinit(const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< QuadratureType > &quad, const AdditionalData &additional_data=AdditionalData())
std::vector< Number > constraint_pool_data
VectorizedArrayType vectorized_value_type
unsigned int n_cell_batches() const
const IndexSet & get_ghost_set(const unsigned int dof_handler_index=0) const
std::pair< int, int > get_cell_level_and_index(const unsigned int cell_batch_index, const unsigned int lane_index) const
bool indices_initialized() const
const Quadrature< dim - 1 > & get_face_quadrature(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
types::boundary_id get_boundary_id(const unsigned int macro_face) const
unsigned int get_cell_category(const unsigned int cell_batch_index) const
void reinit(const MappingType &mapping, const std::vector< const DoFHandlerType * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const QuadratureType &quad, const AdditionalData &additional_data=AdditionalData())
Threads::ThreadLocalStorage< std::list< std::pair< bool, AlignedVector< VectorizedArrayType > > > > scratch_pad
std::size_t memory_consumption() const
unsigned int n_boundary_face_batches() const
void cell_loop(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &) const, const CLASS *owning_class, OutVector &dst, const InVector &src, const bool zero_dst_vector=false) const
std::list< std::pair< bool, AlignedVector< Number > > > scratch_pad_non_threadsafe
const Number * constraint_pool_end(const unsigned int pool_index) const
void loop_cell_centric(const std::function< void(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &cell_operation, OutVector &dst, const InVector &src, const bool zero_dst_vector=false, const DataAccessOnFaces src_vector_face_access=DataAccessOnFaces::unspecified) const
std::vector< SmartPointer< const DoFHandler< dim > > > dof_handlers
void reinit(const std::vector< const DoFHandlerType * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const QuadratureType &quad, const AdditionalData &additional_data=AdditionalData())
void initialize_indices(const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< IndexSet > &locally_owned_set, const AdditionalData &additional_data)
unsigned int n_components() const
unsigned int n_physical_cells() const
void initialize_dof_vector(VectorType &vec, const unsigned int dof_handler_index=0) const
unsigned int get_n_q_points(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
void reinit(const MappingType &mapping, const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const QuadratureType &quad, const AdditionalData &additional_data=AdditionalData())
void cell_loop(const std::function< void(const MatrixFree< dim, Number, VectorizedArrayType > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &cell_operation, OutVector &dst, const InVector &src, const bool zero_dst_vector=false) const
unsigned int n_macro_cells() const
void reinit(const MappingType &mapping, const std::vector< const DoFHandlerType * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< QuadratureType > &quad, const AdditionalData &additional_data=AdditionalData())
void cell_loop(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &), CLASS *owning_class, OutVector &dst, const InVector &src, const bool zero_dst_vector=false) const
std::vector< internal::MatrixFreeFunctions::DoFInfo > dof_info
unsigned int n_ghost_inner_face_batches() const
void release_scratch_data_non_threadsafe(const AlignedVector< Number > *memory) const
void renumber_dofs(std::vector< types::global_dof_index > &renumbering, const unsigned int dof_handler_index=0)
unsigned int get_face_active_fe_index(const std::pair< unsigned int, unsigned int > range, const bool is_interior_face=true) const
unsigned int n_active_entries_per_face_batch(const unsigned int face_batch_index) const
bool indices_are_initialized
internal::MatrixFreeFunctions::FaceInfo< VectorizedArrayType::size()> face_info
void reinit(const MappingType &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< number2 > &constraint, const QuadratureType &quad, const AdditionalData &additional_data=AdditionalData())
void loop(void(CLASS::*cell_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &), void(CLASS::*face_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &), void(CLASS::*boundary_operation)(const MatrixFree &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &), CLASS *owning_class, OutVector &dst, const InVector &src, const bool zero_dst_vector=false, const DataAccessOnFaces dst_vector_face_access=DataAccessOnFaces::unspecified, const DataAccessOnFaces src_vector_face_access=DataAccessOnFaces::unspecified) const
void reinit(const MappingType &mapping, const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< QuadratureType > &quad, const AdditionalData &additional_data=AdditionalData())
std::array< types::boundary_id, VectorizedArrayType::size()> get_faces_by_cells_boundary_id(const unsigned int cell_batch_index, const unsigned int face_number) const
std::vector< unsigned int > constraint_pool_row_index
const std::vector< unsigned int > & get_constrained_dofs(const unsigned int dof_handler_index=0) const
void reinit(const DoFHandler< dim > &dof_handler, const AffineConstraints< number2 > &constraint, const QuadratureType &quad, const AdditionalData &additional_data=AdditionalData())
unsigned int cell_level_index_end_local
unsigned int n_base_elements(const unsigned int dof_handler_index) const
static const unsigned int dimension
static bool is_supported(const FiniteElement< dim, spacedim > &fe)
A class that provides a separate storage location on each thread that accesses the object.
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
#define DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
@ update_JxW_values
Transformed quadrature weights.
@ update_gradients
Shape function gradients.
@ update_default
No update.
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::cell_iterator cell_iterator
typename ActiveSelector::active_cell_iterator active_cell_iterator
void reinit(const size_type size, const bool omit_zeroing_entries=false)
VectorType::value_type * begin(VectorType &V)
unsigned int minimum_parallel_grain_size
const types::boundary_id invalid_boundary_id
static const unsigned int invalid_unsigned_int
void apply_to_subranges(const tbb::blocked_range< RangeType > &range, const Function &f)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
TasksParallelScheme tasks_parallel_scheme
bool hold_all_faces_to_owned_cells
UpdateFlags mapping_update_flags_inner_faces
AdditionalData(const TasksParallelScheme tasks_parallel_scheme=partition_partition, const unsigned int tasks_block_size=0, const UpdateFlags mapping_update_flags=update_gradients|update_JxW_values, const UpdateFlags mapping_update_flags_boundary_faces=update_default, const UpdateFlags mapping_update_flags_inner_faces=update_default, const UpdateFlags mapping_update_flags_faces_by_cells=update_default, const unsigned int mg_level=numbers::invalid_unsigned_int, const bool store_plain_indices=true, const bool initialize_indices=true, const bool initialize_mapping=true, const bool overlap_communication_computation=true, const bool hold_all_faces_to_owned_cells=false, const bool cell_vectorization_categories_strict=false)
std::vector< unsigned int > cell_vectorization_category
AdditionalData & operator=(const AdditionalData &other)
unsigned int & level_mg_handler
bool cell_vectorization_categories_strict
UpdateFlags mapping_update_flags_boundary_faces
UpdateFlags mapping_update_flags
UpdateFlags mapping_update_flags_faces_by_cells
AdditionalData(const AdditionalData &other)
unsigned int tasks_block_size
bool overlap_communication_computation
static bool equal(const T *p1, const T *p2)
std::vector< unsigned int > cell_loop_pre_list_index
std::vector< unsigned int > cell_loop_post_list_index
std::vector< std::pair< unsigned int, unsigned int > > vector_zero_range_list
std::shared_ptr< const Utilities::MPI::Partitioner > vector_partitioner
std::vector< std::pair< unsigned int, unsigned int > > cell_loop_pre_list
std::vector< unsigned int > vector_zero_range_list_index
std::vector< std::pair< unsigned int, unsigned int > > cell_loop_post_list
::Table< 3, unsigned int > cell_and_face_to_plain_faces
std::vector< FaceToCellTopology< vectorization_width > > faces
::Table< 3, types::boundary_id > cell_and_face_boundary_id
std::vector< unsigned int > boundary_partition_data
void loop(MFWorkerInterface &worker) const
unsigned int n_active_cells
std::vector< unsigned int > cell_partition_data
std::vector< unsigned int > face_partition_data