17 #ifndef dealii_matrix_free_h 18 #define dealii_matrix_free_h 20 #include <deal.II/base/aligned_vector.h> 21 #include <deal.II/base/exceptions.h> 22 #include <deal.II/base/quadrature.h> 23 #include <deal.II/base/template_constraints.h> 24 #include <deal.II/base/thread_local_storage.h> 25 #include <deal.II/base/vectorization.h> 27 #include <deal.II/dofs/dof_handler.h> 29 #include <deal.II/fe/fe.h> 30 #include <deal.II/fe/mapping.h> 31 #include <deal.II/fe/mapping_q1.h> 33 #include <deal.II/grid/grid_tools.h> 35 #include <deal.II/hp/dof_handler.h> 36 #include <deal.II/hp/q_collection.h> 38 #include <deal.II/lac/affine_constraints.h> 39 #include <deal.II/lac/block_vector_base.h> 40 #include <deal.II/lac/la_parallel_vector.h> 41 #include <deal.II/lac/vector_operation.h> 43 #include <deal.II/matrix_free/dof_info.h> 44 #include <deal.II/matrix_free/mapping_info.h> 45 #include <deal.II/matrix_free/shape_info.h> 46 #include <deal.II/matrix_free/task_info.h> 54 DEAL_II_NAMESPACE_OPEN
111 template <
int dim,
typename Number =
double>
184 none = internal::MatrixFreeFunctions::TaskInfo::none,
189 internal::MatrixFreeFunctions::TaskInfo::partition_partition,
194 internal::MatrixFreeFunctions::TaskInfo::partition_color,
199 color = internal::MatrixFreeFunctions::TaskInfo::color
490 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
493 const DoFHandlerType & dof_handler,
495 const QuadratureType & quad,
502 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
504 reinit(
const DoFHandlerType & dof_handler,
506 const QuadratureType & quad,
516 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
517 DEAL_II_DEPRECATED
void 519 const DoFHandlerType & dof_handler,
521 const IndexSet & locally_owned_dofs,
522 const QuadratureType & quad,
545 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
548 const std::vector<const DoFHandlerType *> & dof_handler,
550 const std::vector<QuadratureType> & quad,
557 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
559 reinit(
const std::vector<const DoFHandlerType *> & dof_handler,
561 const std::vector<QuadratureType> & quad,
571 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
572 DEAL_II_DEPRECATED
void 574 const std::vector<const DoFHandlerType *> & dof_handler,
576 const std::vector<IndexSet> & locally_owned_set,
577 const std::vector<QuadratureType> &quad,
587 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
590 const std::vector<const DoFHandlerType *> & dof_handler,
592 const QuadratureType & quad,
599 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
601 reinit(
const std::vector<const DoFHandlerType *> & dof_handler,
603 const QuadratureType & quad,
716 template <
typename OutVector,
typename InVector>
722 const std::pair<unsigned int, unsigned int> &)>
726 const bool zero_dst_vector =
false)
const;
769 template <
typename CLASS,
typename OutVector,
typename InVector>
775 const std::pair<unsigned int, unsigned int> &)
const,
776 const CLASS * owning_class,
779 const bool zero_dst_vector =
false)
const;
784 template <
typename CLASS,
typename OutVector,
typename InVector>
790 const std::pair<unsigned int, unsigned int> &),
791 CLASS * owning_class,
794 const bool zero_dst_vector =
false)
const;
871 template <
typename OutVector,
typename InVector>
876 const std::pair<unsigned int, unsigned int> &)>
881 const std::pair<unsigned int, unsigned int> &)>
886 const std::pair<unsigned int, unsigned int> &)>
887 & boundary_operation,
889 const InVector & src,
890 const bool zero_dst_vector =
false,
980 template <
typename CLASS,
typename OutVector,
typename InVector>
983 void (CLASS::*cell_operation)(
const MatrixFree &,
986 const std::pair<unsigned int, unsigned int> &)
988 void (CLASS::*face_operation)(
const MatrixFree &,
991 const std::pair<unsigned int, unsigned int> &)
993 void (CLASS::*boundary_operation)(
997 const std::pair<unsigned int, unsigned int> &)
const,
998 const CLASS * owning_class,
1000 const InVector & src,
1001 const bool zero_dst_vector =
false,
1010 template <
typename CLASS,
typename OutVector,
typename InVector>
1012 loop(
void (CLASS::*cell_operation)(
1016 const std::pair<unsigned int, unsigned int> &),
1017 void (CLASS::*face_operation)(
1021 const std::pair<unsigned int, unsigned int> &),
1022 void (CLASS::*boundary_operation)(
1026 const std::pair<unsigned int, unsigned int> &),
1027 CLASS * owning_class,
1029 const InVector & src,
1030 const bool zero_dst_vector =
false,
1043 std::pair<unsigned int, unsigned int>
1045 const unsigned int fe_degree,
1046 const unsigned int dof_handler_index = 0)
const;
1054 std::pair<unsigned int, unsigned int>
1056 const std::pair<unsigned int, unsigned int> &range,
1057 const unsigned int fe_index,
1058 const unsigned int dof_handler_index = 0)
const;
1086 template <
typename VectorType>
1089 const unsigned int dof_handler_index = 0)
const;
1111 template <
typename Number2>
1114 const unsigned int dof_handler_index = 0)
const;
1126 const std::shared_ptr<const Utilities::MPI::Partitioner> &
1139 get_ghost_set(
const unsigned int dof_handler_index = 0)
const;
1150 const std::vector<unsigned int> &
1164 renumber_dofs(std::vector<types::global_dof_index> &renumbering,
1165 const unsigned int dof_handler_index = 0);
1176 template <
int spacedim>
1277 std::array<types::boundary_id, VectorizedArray<Number>::n_array_elements>
1279 const unsigned int face_number)
const;
1300 const unsigned int vector_number,
1301 const unsigned int fe_component = 0)
const;
1316 const unsigned int vector_number,
1317 const unsigned int dof_handler_index = 0)
const;
1372 const unsigned int hp_active_fe_index = 0)
const;
1379 const unsigned int hp_active_fe_index = 0)
const;
1387 const unsigned int hp_active_fe_index = 0)
const;
1395 const unsigned int hp_active_fe_index = 0)
const;
1402 const unsigned int hp_active_fe_index = 0)
const;
1409 const unsigned int hp_active_fe_index = 0)
const;
1424 std::pair<unsigned int, unsigned int>
1452 template <
typename StreamType>
1461 print(std::ostream &out)
const;
1487 get_mapping_info()
const;
1493 get_dof_info(
const unsigned int dof_handler_index_component = 0)
const;
1520 get_shape_info(
const unsigned int dof_handler_index_component = 0,
1521 const unsigned int quad_index = 0,
1522 const unsigned int fe_base_element = 0,
1523 const unsigned int hp_active_fe_index = 0,
1524 const unsigned int hp_active_quad_index = 0)
const;
1582 template <
typename number2>
1588 const std::vector<IndexSet> & locally_owned_set,
1595 template <
typename number2>
1601 const std::vector<IndexSet> & locally_owned_set,
1611 template <
typename number2>
1615 const std::vector<IndexSet> & locally_owned_set,
1649 : active_dof_handler(usual)
1654 std::vector<SmartPointer<const DoFHandler<dim>>> dof_handler;
1655 std::vector<SmartPointer<const hp::DoFHandler<dim>>> hp_dof_handler;
1666 } active_dof_handler;
1667 unsigned int n_dof_handlers;
1680 std::vector<internal::MatrixFreeFunctions::DoFInfo>
dof_info;
1758 std::list<std::pair<bool, AlignedVector<VectorizedArray<Number>>>>>
1765 mutable std::list<std::pair<bool, AlignedVector<Number>>>
1777 template <
int dim,
typename Number>
1778 template <
typename VectorType>
1781 const unsigned int comp)
const 1784 vec.reinit(
dof_info[comp].vector_partitioner->size());
1789 template <
int dim,
typename Number>
1790 template <
typename Number2>
1794 const unsigned int comp)
const 1802 template <
int dim,
typename Number>
1803 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1807 return dof_info[comp].vector_partitioner;
1812 template <
int dim,
typename Number>
1813 inline const std::vector<unsigned int> &
1817 return dof_info[comp].constrained_dofs;
1822 template <
int dim,
typename Number>
1832 template <
int dim,
typename Number>
1838 return dof_handlers.dof_handler[dof_no]->get_fe().n_base_elements();
1843 template <
int dim,
typename Number>
1852 template <
int dim,
typename Number>
1861 template <
int dim,
typename Number>
1870 template <
int dim,
typename Number>
1879 template <
int dim,
typename Number>
1888 template <
int dim,
typename Number>
1898 template <
int dim,
typename Number>
1909 template <
int dim,
typename Number>
1921 template <
int dim,
typename Number>
1932 template <
int dim,
typename Number>
1946 template <
int dim,
typename Number>
1947 inline std::array<types::boundary_id, VectorizedArray<Number>::n_array_elements>
1949 const unsigned int macro_cell,
1950 const unsigned int face_number)
const 1956 std::array<types::boundary_id, VectorizedArray<Number>::n_array_elements>
1966 template <
int dim,
typename Number>
1975 template <
int dim,
typename Number>
1985 template <
int dim,
typename Number>
1994 template <
int dim,
typename Number>
1995 inline const Number *
2006 template <
int dim,
typename Number>
2007 inline const Number *
2018 template <
int dim,
typename Number>
2019 inline std::pair<unsigned int, unsigned int>
2021 const std::pair<unsigned int, unsigned int> &range,
2022 const unsigned int degree,
2023 const unsigned int dof_handler_component)
const 2025 if (
dof_info[dof_handler_component].cell_active_fe_index.empty())
2028 dof_info[dof_handler_component].fe_index_conversion.size(), 1);
2030 dof_info[dof_handler_component].fe_index_conversion[0].size(), 1);
2031 if (
dof_info[dof_handler_component].fe_index_conversion[0][0] == degree)
2034 return std::pair<unsigned int, unsigned int>(range.second,
2038 const unsigned int fe_index =
2039 dof_info[dof_handler_component].fe_index_from_degree(0, degree);
2040 if (fe_index >=
dof_info[dof_handler_component].max_fe_index)
2041 return std::pair<unsigned int, unsigned int>(range.second, range.second);
2045 dof_handler_component);
2050 template <
int dim,
typename Number>
2066 template <
int dim,
typename Number>
2069 const unsigned int cell_batch_number)
const 2076 template <
int dim,
typename Number>
2079 const unsigned int cell_batch_number)
const 2083 while (n_components > 1 &&
2086 n_components - 1] ==
2097 template <
int dim,
typename Number>
2100 const unsigned int face_batch_number)
const 2104 while (n_components > 1 &&
2105 face_info.
faces[face_batch_number].cells_interior[n_components - 1] ==
2114 template <
int dim,
typename Number>
2117 const unsigned int dof_handler_index,
2118 const unsigned int active_fe_index)
const 2120 return dof_info[dof_handler_index].dofs_per_cell[active_fe_index];
2125 template <
int dim,
typename Number>
2128 const unsigned int quad_index,
2129 const unsigned int active_fe_index)
const 2133 .descriptor[active_fe_index]
2139 template <
int dim,
typename Number>
2142 const unsigned int dof_handler_index,
2143 const unsigned int active_fe_index)
const 2145 return dof_info[dof_handler_index].dofs_per_face[active_fe_index];
2150 template <
int dim,
typename Number>
2153 const unsigned int quad_index,
2154 const unsigned int active_fe_index)
const 2158 .descriptor[active_fe_index]
2164 template <
int dim,
typename Number>
2167 const unsigned int dof_handler_index)
const 2169 return dof_info[dof_handler_index].vector_partitioner->locally_owned_range();
2174 template <
int dim,
typename Number>
2177 const unsigned int dof_handler_index)
const 2179 return dof_info[dof_handler_index].vector_partitioner->ghost_indices();
2184 template <
int dim,
typename Number>
2187 const unsigned int dof_handler_index,
2188 const unsigned int index_quad,
2189 const unsigned int index_fe,
2190 const unsigned int active_fe_index,
2191 const unsigned int active_quad_index)
const 2194 const unsigned int ind =
2195 dof_info[dof_handler_index].global_base_element_offset + index_fe;
2200 return shape_info(ind, index_quad, active_fe_index, active_quad_index);
2205 template <
int dim,
typename Number>
2216 template <
int dim,
typename Number>
2219 const unsigned int quad_index,
2220 const unsigned int active_fe_index)
const 2224 .descriptor[active_fe_index]
2230 template <
int dim,
typename Number>
2233 const unsigned int quad_index,
2234 const unsigned int active_fe_index)
const 2238 .descriptor[active_fe_index]
2244 template <
int dim,
typename Number>
2250 if (
dof_info[0].cell_active_fe_index.empty())
2253 return dof_info[0].cell_active_fe_index[macro_cell];
2258 template <
int dim,
typename Number>
2259 inline std::pair<unsigned int, unsigned int>
2263 if (
dof_info[0].cell_active_fe_index.empty())
2264 return std::make_pair(0U, 0U);
2266 std::pair<unsigned int, unsigned int> result;
2267 for (
unsigned int v = 0; v < VectorizedArray<Number>::n_array_elements &&
2271 result.first = std::max(
2274 .cell_active_fe_index[
face_info.
faces[macro_face].cells_interior[v]]);
2277 for (
unsigned int v = 0; v < VectorizedArray<Number>::n_array_elements &&
2281 result.second = std::max(
2284 .cell_active_fe_index[
face_info.
faces[macro_face].cells_exterior[v]]);
2292 template <
int dim,
typename Number>
2301 template <
int dim,
typename Number>
2310 template <
int dim,
typename Number>
2315 std::list<std::pair<bool, AlignedVector<VectorizedArray<Number>>>>;
2317 for (
typename list_type::iterator it = data.begin(); it != data.end(); ++it)
2318 if (it->first ==
false)
2325 return &data.front().second;
2330 template <
int dim,
typename Number>
2336 std::list<std::pair<bool, AlignedVector<VectorizedArray<Number>>>>;
2338 for (
typename list_type::iterator it = data.begin(); it != data.end(); ++it)
2339 if (&it->second == scratch)
2350 template <
int dim,
typename Number>
2358 if (it->first ==
false)
2370 template <
int dim,
typename Number>
2379 if (&it->second == scratch)
2394 namespace MatrixFreeImplementation
2396 template <
typename DoFHandlerType>
2397 inline std::vector<IndexSet>
2398 extract_locally_owned_index_sets(
2399 const std::vector<const DoFHandlerType *> &dofh,
2400 const unsigned int level)
2402 std::vector<IndexSet> locally_owned_set;
2403 locally_owned_set.reserve(dofh.size());
2404 for (
unsigned int j = 0; j < dofh.size(); j++)
2406 locally_owned_set.push_back(dofh[j]->locally_owned_dofs());
2409 return locally_owned_set;
2412 template <
int dim,
int spacedim>
2413 inline std::vector<IndexSet>
2414 extract_locally_owned_index_sets(
2415 const std::vector<const ::DoFHandler<dim, spacedim> *> &dofh,
2416 const unsigned int level)
2418 std::vector<IndexSet> locally_owned_set;
2419 locally_owned_set.reserve(dofh.size());
2420 for (
unsigned int j = 0; j < dofh.size(); j++)
2422 locally_owned_set.push_back(dofh[j]->locally_owned_dofs());
2424 locally_owned_set.push_back(dofh[j]->locally_owned_mg_dofs(level));
2425 return locally_owned_set;
2432 template <
int dim,
typename Number>
2433 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2436 const DoFHandlerType & dof_handler,
2438 const QuadratureType & quad,
2442 std::vector<const AffineConstraints<number2> *> constraints;
2443 std::vector<QuadratureType> quads;
2445 dof_handlers.push_back(&dof_handler);
2446 constraints.push_back(&constraints_in);
2447 quads.push_back(quad);
2449 std::vector<IndexSet> locally_owned_sets =
2450 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2453 std::vector<hp::QCollection<1>> quad_hp;
2454 quad_hp.emplace_back(quad);
2466 template <
int dim,
typename Number>
2467 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2471 const DoFHandlerType & dof_handler,
2473 const QuadratureType & quad,
2477 std::vector<const AffineConstraints<number2> *> constraints;
2479 dof_handlers.push_back(&dof_handler);
2480 constraints.push_back(&constraints_in);
2482 std::vector<IndexSet> locally_owned_sets =
2483 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2486 std::vector<hp::QCollection<1>> quad_hp;
2487 quad_hp.emplace_back(quad);
2499 template <
int dim,
typename Number>
2500 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2503 const std::vector<const DoFHandlerType *> & dof_handler,
2505 const std::vector<QuadratureType> & quad,
2508 std::vector<IndexSet> locally_owned_set =
2509 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2511 std::vector<hp::QCollection<1>> quad_hp;
2512 for (
unsigned int q = 0; q < quad.size(); ++q)
2513 quad_hp.emplace_back(quad[q]);
2524 template <
int dim,
typename Number>
2525 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2528 const std::vector<const DoFHandlerType *> & dof_handler,
2530 const QuadratureType & quad,
2533 std::vector<IndexSet> locally_owned_set =
2534 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2536 std::vector<hp::QCollection<1>> quad_hp;
2537 quad_hp.emplace_back(quad);
2548 template <
int dim,
typename Number>
2549 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2553 const std::vector<const DoFHandlerType *> & dof_handler,
2555 const QuadratureType & quad,
2558 std::vector<IndexSet> locally_owned_set =
2559 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2561 std::vector<hp::QCollection<1>> quad_hp;
2562 quad_hp.emplace_back(quad);
2573 template <
int dim,
typename Number>
2574 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2578 const std::vector<const DoFHandlerType *> & dof_handler,
2580 const std::vector<QuadratureType> & quad,
2583 std::vector<IndexSet> locally_owned_set =
2584 internal::MatrixFreeImplementation::extract_locally_owned_index_sets(
2586 std::vector<hp::QCollection<1>> quad_hp;
2587 for (
unsigned int q = 0; q < quad.size(); ++q)
2588 quad_hp.emplace_back(quad[q]);
2599 template <
int dim,
typename Number>
2600 template <
typename DoFHandlerType,
typename QuadratureType,
typename number2>
2604 const std::vector<const DoFHandlerType *> & dof_handler,
2606 const std::vector<IndexSet> & locally_owned_set,
2607 const std::vector<QuadratureType> & quad,
2611 std::vector<hp::QCollection<1>> quad_hp;
2612 for (
unsigned int q = 0; q < quad.size(); ++q)
2613 quad_hp.emplace_back(quad[q]);
2636 template <
int dim,
typename Number>
2637 struct VectorDataExchange
2642 static constexpr
unsigned int channel_shift = 103;
2645 const ::MatrixFree<dim, Number> &matrix_free,
2646 const typename ::MatrixFree<dim, Number>::DataAccessOnFaces
2649 : matrix_free(matrix_free)
2650 , vector_face_access(
2651 matrix_free.get_task_info().face_partition_data.empty() ?
2654 , ghosts_were_set(
false)
2655 # ifdef DEAL_II_WITH_MPI 2656 , tmp_data(n_components)
2657 , requests(n_components)
2661 if (this->vector_face_access !=
2663 for (
unsigned int c = 0; c < matrix_free.n_components(); ++c)
2665 matrix_free.get_dof_info(c).vector_partitioner_face_variants.size(),
2669 ~VectorDataExchange()
2671 # ifdef DEAL_II_WITH_MPI 2672 for (
unsigned int i = 0; i < tmp_data.size(); ++i)
2673 if (tmp_data[i] !=
nullptr)
2674 matrix_free.release_scratch_data_non_threadsafe(tmp_data[i]);
2680 const bool check_global_compatibility =
true)
const 2683 (void)check_global_compatibility;
2684 for (
unsigned int c = 0; c < matrix_free.n_components(); ++c)
2687 check_global_compatibility ?
2689 *matrix_free.get_dof_info(c).vector_partitioner) :
2692 *matrix_free.get_dof_info(c).vector_partitioner))
2697 return mf_component;
2701 get_partitioner(
const unsigned int mf_component)
const 2704 .vector_partitioner_face_variants.size(),
2706 if (vector_face_access ==
2708 return *matrix_free.get_dof_info(mf_component)
2709 .vector_partitioner_face_variants[0];
2710 else if (vector_face_access ==
2712 return *matrix_free.get_dof_info(mf_component)
2713 .vector_partitioner_face_variants[1];
2715 return *matrix_free.get_dof_info(mf_component)
2716 .vector_partitioner_face_variants[2];
2720 update_ghost_values_start(
2721 const unsigned int component_in_block_vector,
2724 (void)component_in_block_vector;
2727 ghosts_were_set =
true;
2728 if (vector_face_access ==
2735 # ifdef DEAL_II_WITH_MPI 2736 const unsigned int mf_component = find_vector_in_mf(vec);
2737 if (&get_partitioner(mf_component) ==
2738 matrix_free.get_dof_info(mf_component).vector_partitioner.get())
2746 get_partitioner(mf_component);
2750 tmp_data[component_in_block_vector] =
2751 matrix_free.acquire_scratch_data_non_threadsafe();
2752 tmp_data[component_in_block_vector]->resize_fast(
2757 component_in_block_vector + channel_shift,
2764 this->requests[component_in_block_vector]);
2770 update_ghost_values_finish(
2771 const unsigned int component_in_block_vector,
2774 (void)component_in_block_vector;
2775 if (vector_face_access ==
2781 # ifdef DEAL_II_WITH_MPI 2786 const unsigned int mf_component = find_vector_in_mf(vec);
2788 get_partitioner(mf_component);
2790 matrix_free.get_dof_info(mf_component).vector_partitioner.get())
2803 this->requests[component_in_block_vector]);
2805 matrix_free.release_scratch_data_non_threadsafe(
2806 tmp_data[component_in_block_vector]);
2807 tmp_data[component_in_block_vector] =
nullptr;
2813 compress_start(
const unsigned int component_in_block_vector,
2816 (void)component_in_block_vector;
2818 if (vector_face_access ==
2824 # ifdef DEAL_II_WITH_MPI 2826 const unsigned int mf_component = find_vector_in_mf(vec);
2828 get_partitioner(mf_component);
2830 matrix_free.get_dof_info(mf_component).vector_partitioner.get())
2839 tmp_data[component_in_block_vector] =
2840 matrix_free.acquire_scratch_data_non_threadsafe();
2841 tmp_data[component_in_block_vector]->resize_fast(
2847 component_in_block_vector + channel_shift,
2852 this->requests[component_in_block_vector]);
2858 compress_finish(
const unsigned int component_in_block_vector,
2861 (void)component_in_block_vector;
2862 if (vector_face_access ==
2868 # ifdef DEAL_II_WITH_MPI 2872 const unsigned int mf_component = find_vector_in_mf(vec);
2875 get_partitioner(mf_component);
2877 matrix_free.get_dof_info(mf_component).vector_partitioner.get())
2889 tmp_data[component_in_block_vector]->begin(),
2894 this->requests[component_in_block_vector]);
2896 matrix_free.release_scratch_data_non_threadsafe(
2897 tmp_data[component_in_block_vector]);
2898 tmp_data[component_in_block_vector] =
nullptr;
2907 if (ghosts_were_set ==
true)
2910 if (vector_face_access ==
2916 # ifdef DEAL_II_WITH_MPI 2919 const unsigned int mf_component = find_vector_in_mf(vec);
2921 get_partitioner(mf_component);
2923 matrix_free.get_dof_info(mf_component).vector_partitioner.get())
2927 for (std::vector<std::pair<unsigned int, unsigned int>>::
2928 const_iterator my_ghosts =
2933 for (
unsigned int j = my_ghosts->first; j < my_ghosts->second;
2946 zero_vector_region(
const unsigned int range_index,
2953 const unsigned int mf_component = find_vector_in_mf(vec,
false);
2955 matrix_free.get_dof_info(mf_component);
2963 for (
unsigned int id =
2968 const unsigned int start_pos =
2971 const unsigned int end_pos =
2974 chunk_size_zero_vector,
2977 std::memset(vec.
begin() + start_pos,
2979 (end_pos - start_pos) *
sizeof(Number));
2984 const ::MatrixFree<dim, Number> &matrix_free;
2985 const typename ::MatrixFree<dim, Number>::DataAccessOnFaces
2987 bool ghosts_were_set;
2988 # ifdef DEAL_II_WITH_MPI 2989 std::vector<AlignedVector<Number> *> tmp_data;
2990 std::vector<std::vector<MPI_Request>> requests;
2994 template <
typename VectorStruct>
2998 template <
typename VectorStruct>
3000 n_components_block(
const VectorStruct &vec,
3001 std::integral_constant<bool, true>)
3003 unsigned int components = 0;
3004 for (
unsigned int bl = 0; bl < vec.n_blocks(); ++bl)
3009 template <
typename VectorStruct>
3011 n_components_block(
const VectorStruct &, std::integral_constant<bool, false>)
3016 template <
typename VectorStruct>
3020 return n_components_block(
3024 template <
typename VectorStruct>
3028 unsigned int components = 0;
3029 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3030 components += n_components_block(
3036 template <
typename VectorStruct>
3040 unsigned int components = 0;
3041 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3042 components += n_components_block(
3048 template <
int dim,
typename VectorStruct,
typename Number>
3050 update_ghost_values_start_block(
const VectorStruct &vec,
3051 const unsigned int channel,
3052 std::integral_constant<bool, true>,
3053 VectorDataExchange<dim, Number> &exchanger);
3054 template <
int dim,
typename VectorStruct,
typename Number>
3056 reset_ghost_values_block(
const VectorStruct &vec,
3057 std::integral_constant<bool, true>,
3058 VectorDataExchange<dim, Number> &exchanger);
3059 template <
int dim,
typename VectorStruct,
typename Number>
3061 update_ghost_values_finish_block(
const VectorStruct &vec,
3062 const unsigned int channel,
3063 std::integral_constant<bool, true>,
3064 VectorDataExchange<dim, Number> &exchanger);
3065 template <
int dim,
typename VectorStruct,
typename Number>
3067 compress_start_block(
const VectorStruct &vec,
3068 const unsigned int channel,
3069 std::integral_constant<bool, true>,
3070 VectorDataExchange<dim, Number> &exchanger);
3071 template <
int dim,
typename VectorStruct,
typename Number>
3073 compress_finish_block(
const VectorStruct &vec,
3074 const unsigned int channel,
3075 std::integral_constant<bool, true>,
3076 VectorDataExchange<dim, Number> &exchanger);
3077 template <
int dim,
typename VectorStruct,
typename Number>
3079 zero_vector_region_block(
const unsigned int range_index,
3081 std::integral_constant<bool, true>,
3082 VectorDataExchange<dim, Number> &);
3084 template <
int dim,
typename VectorStruct,
typename Number>
3086 update_ghost_values_start_block(
const VectorStruct &,
3088 std::integral_constant<bool, false>,
3089 VectorDataExchange<dim, Number> &)
3091 template <
int dim,
typename VectorStruct,
typename Number>
3093 reset_ghost_values_block(
const VectorStruct &,
3094 std::integral_constant<bool, false>,
3095 VectorDataExchange<dim, Number> &)
3097 template <
int dim,
typename VectorStruct,
typename Number>
3099 update_ghost_values_finish_block(
const VectorStruct &,
3101 std::integral_constant<bool, false>,
3102 VectorDataExchange<dim, Number> &)
3104 template <
int dim,
typename VectorStruct,
typename Number>
3106 compress_start_block(
const VectorStruct &,
3108 std::integral_constant<bool, false>,
3109 VectorDataExchange<dim, Number> &)
3111 template <
int dim,
typename VectorStruct,
typename Number>
3113 compress_finish_block(
const VectorStruct &,
3115 std::integral_constant<bool, false>,
3116 VectorDataExchange<dim, Number> &)
3118 template <
int dim,
typename VectorStruct,
typename Number>
3120 zero_vector_region_block(
const unsigned int range_index,
3122 std::integral_constant<bool, false>,
3123 VectorDataExchange<dim, Number> &)
3134 template <
int dim,
typename VectorStruct,
typename Number>
3136 reset_ghost_values(
const VectorStruct & vec,
3137 VectorDataExchange<dim, Number> &exchanger)
3139 reset_ghost_values_block(
3147 template <
int dim,
typename Number,
typename Number2>
3150 VectorDataExchange<dim, Number2> &exchanger)
3152 exchanger.reset_ghost_values(vec);
3157 template <
int dim,
typename VectorStruct,
typename Number>
3159 reset_ghost_values(
const std::vector<VectorStruct> &vec,
3160 VectorDataExchange<dim, Number> &exchanger)
3163 if (exchanger.ghosts_were_set ==
true)
3166 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3167 reset_ghost_values(vec[comp], exchanger);
3172 template <
int dim,
typename VectorStruct,
typename Number>
3174 reset_ghost_values(
const std::vector<VectorStruct *> &vec,
3175 VectorDataExchange<dim, Number> & exchanger)
3178 if (exchanger.ghosts_were_set ==
true)
3181 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3182 reset_ghost_values(*vec[comp], exchanger);
3187 template <
int dim,
typename VectorStruct,
typename Number>
3189 reset_ghost_values_block(
const VectorStruct &vec,
3190 std::integral_constant<bool, true>,
3191 VectorDataExchange<dim, Number> &exchanger)
3194 if (exchanger.ghosts_were_set ==
true)
3197 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
3198 reset_ghost_values(vec.block(i), exchanger);
3207 template <
typename VectorStruct>
3208 constexpr
unsigned int 3209 get_communication_block_size(
const VectorStruct &)
3218 template <
typename Number>
3219 constexpr
unsigned int 3220 get_communication_block_size(
3224 Number>::communication_block_size;
3229 template <
int dim,
typename VectorStruct,
typename Number>
3231 update_ghost_values_start(
const VectorStruct & vec,
3232 VectorDataExchange<dim, Number> &exchanger,
3233 const unsigned int channel = 0)
3235 update_ghost_values_start_block(
3244 template <
int dim,
typename Number,
typename Number2>
3246 update_ghost_values_start(
3248 VectorDataExchange<dim, Number2> & exchanger,
3249 const unsigned int channel = 0)
3251 exchanger.update_ghost_values_start(channel, vec);
3256 template <
int dim,
typename VectorStruct,
typename Number>
3258 update_ghost_values_start(
const std::vector<VectorStruct> &vec,
3259 VectorDataExchange<dim, Number> &exchanger)
3261 unsigned int component_index = 0;
3262 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3264 update_ghost_values_start(vec[comp], exchanger, component_index);
3271 template <
int dim,
typename VectorStruct,
typename Number>
3273 update_ghost_values_start(
const std::vector<VectorStruct *> &vec,
3274 VectorDataExchange<dim, Number> & exchanger)
3276 unsigned int component_index = 0;
3277 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3279 update_ghost_values_start(*vec[comp], exchanger, component_index);
3286 template <
int dim,
typename VectorStruct,
typename Number>
3288 update_ghost_values_start_block(
const VectorStruct &vec,
3289 const unsigned int channel,
3290 std::integral_constant<bool, true>,
3291 VectorDataExchange<dim, Number> &exchanger)
3293 if (get_communication_block_size(vec) < vec.n_blocks())
3297 exchanger.ghosts_were_set = vec.has_ghost_elements();
3298 vec.update_ghost_values();
3302 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
3303 update_ghost_values_start(vec.block(i), exchanger, channel + i);
3309 template <
int dim,
typename VectorStruct,
typename Number>
3311 update_ghost_values_finish(
const VectorStruct & vec,
3312 VectorDataExchange<dim, Number> &exchanger,
3313 const unsigned int channel = 0)
3315 update_ghost_values_finish_block(
3324 template <
int dim,
typename Number,
typename Number2>
3326 update_ghost_values_finish(
3328 VectorDataExchange<dim, Number2> & exchanger,
3329 const unsigned int channel = 0)
3331 exchanger.update_ghost_values_finish(channel, vec);
3336 template <
int dim,
typename VectorStruct,
typename Number>
3338 update_ghost_values_finish(
const std::vector<VectorStruct> &vec,
3339 VectorDataExchange<dim, Number> &exchanger)
3341 unsigned int component_index = 0;
3342 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3344 update_ghost_values_finish(vec[comp], exchanger, component_index);
3351 template <
int dim,
typename VectorStruct,
typename Number>
3353 update_ghost_values_finish(
const std::vector<VectorStruct *> &vec,
3354 VectorDataExchange<dim, Number> & exchanger)
3356 unsigned int component_index = 0;
3357 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3359 update_ghost_values_finish(*vec[comp], exchanger, component_index);
3366 template <
int dim,
typename VectorStruct,
typename Number>
3368 update_ghost_values_finish_block(
const VectorStruct &vec,
3369 const unsigned int channel,
3370 std::integral_constant<bool, true>,
3371 VectorDataExchange<dim, Number> &exchanger)
3373 if (get_communication_block_size(vec) < vec.n_blocks())
3379 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
3380 update_ghost_values_finish(vec.block(i), exchanger, channel + i);
3385 template <
int dim,
typename VectorStruct,
typename Number>
3387 compress_start(VectorStruct & vec,
3388 VectorDataExchange<dim, Number> &exchanger,
3389 const unsigned int channel = 0)
3391 compress_start_block(
3400 template <
int dim,
typename Number,
typename Number2>
3403 VectorDataExchange<dim, Number2> & exchanger,
3404 const unsigned int channel = 0)
3406 exchanger.compress_start(channel, vec);
3411 template <
int dim,
typename VectorStruct,
typename Number>
3413 compress_start(std::vector<VectorStruct> & vec,
3414 VectorDataExchange<dim, Number> &exchanger)
3416 unsigned int component_index = 0;
3417 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3419 compress_start(vec[comp], exchanger, component_index);
3426 template <
int dim,
typename VectorStruct,
typename Number>
3428 compress_start(std::vector<VectorStruct *> & vec,
3429 VectorDataExchange<dim, Number> &exchanger)
3431 unsigned int component_index = 0;
3432 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3434 compress_start(*vec[comp], exchanger, component_index);
3441 template <
int dim,
typename VectorStruct,
typename Number>
3443 compress_start_block(VectorStruct & vec,
3444 const unsigned int channel,
3445 std::integral_constant<bool, true>,
3446 VectorDataExchange<dim, Number> &exchanger)
3448 if (get_communication_block_size(vec) < vec.n_blocks())
3451 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
3452 compress_start(vec.block(i), exchanger, channel + i);
3457 template <
int dim,
typename VectorStruct,
typename Number>
3459 compress_finish(VectorStruct & vec,
3460 VectorDataExchange<dim, Number> &exchanger,
3461 const unsigned int channel = 0)
3463 compress_finish_block(
3472 template <
int dim,
typename Number,
typename Number2>
3475 VectorDataExchange<dim, Number2> & exchanger,
3476 const unsigned int channel = 0)
3478 exchanger.compress_finish(channel, vec);
3483 template <
int dim,
typename VectorStruct,
typename Number>
3485 compress_finish(std::vector<VectorStruct> & vec,
3486 VectorDataExchange<dim, Number> &exchanger)
3488 unsigned int component_index = 0;
3489 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3491 compress_finish(vec[comp], exchanger, component_index);
3498 template <
int dim,
typename VectorStruct,
typename Number>
3500 compress_finish(std::vector<VectorStruct *> & vec,
3501 VectorDataExchange<dim, Number> &exchanger)
3503 unsigned int component_index = 0;
3504 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3506 compress_finish(*vec[comp], exchanger, component_index);
3513 template <
int dim,
typename VectorStruct,
typename Number>
3515 compress_finish_block(VectorStruct & vec,
3516 const unsigned int channel,
3517 std::integral_constant<bool, true>,
3518 VectorDataExchange<dim, Number> &exchanger)
3520 if (get_communication_block_size(vec) < vec.n_blocks())
3526 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
3527 compress_finish(vec.block(i), exchanger, channel + i);
3532 template <
int dim,
typename VectorStruct,
typename Number>
3534 zero_vector_region(
const unsigned int range_index,
3536 VectorDataExchange<dim, Number> &exchanger)
3538 zero_vector_region_block(
3547 template <
int dim,
typename Number,
typename Number2>
3549 zero_vector_region(
const unsigned int range_index,
3551 VectorDataExchange<dim, Number2> & exchanger)
3553 exchanger.zero_vector_region(range_index, vec);
3558 template <
int dim,
typename VectorStruct,
typename Number>
3560 zero_vector_region(
const unsigned int range_index,
3561 std::vector<VectorStruct> & vec,
3562 VectorDataExchange<dim, Number> &exchanger)
3564 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3565 zero_vector_region(range_index, vec[comp], exchanger);
3570 template <
int dim,
typename VectorStruct,
typename Number>
3572 zero_vector_region(
const unsigned int range_index,
3573 std::vector<VectorStruct *> & vec,
3574 VectorDataExchange<dim, Number> &exchanger)
3576 for (
unsigned int comp = 0; comp < vec.size(); comp++)
3577 zero_vector_region(range_index, *vec[comp], exchanger);
3582 template <
int dim,
typename VectorStruct,
typename Number>
3584 zero_vector_region_block(
const unsigned int range_index,
3586 std::integral_constant<bool, true>,
3587 VectorDataExchange<dim, Number> &exchanger)
3589 for (
unsigned int i = 0; i < vec.n_blocks(); ++i)
3590 zero_vector_region(range_index, vec.block(i), exchanger);
3595 namespace MatrixFreeFunctions
3599 template <
typename,
typename,
typename,
typename,
bool>
3600 struct InterfaceSelector
3604 template <
typename MF,
3608 struct InterfaceSelector<MF, InVector, OutVector, Container, true>
3610 using function_type = void (Container::*)(
3614 const std::pair<unsigned int, unsigned int> &)
const;
3618 template <
typename MF,
3622 struct InterfaceSelector<MF, InVector, OutVector, Container, false>
3624 using function_type =
3625 void (Container::*)(
const MF &,
3628 const std::pair<unsigned int, unsigned int> &);
3636 template <
typename MF,
3641 class MFWorker :
public MFWorkerInterface
3645 using function_type =
typename MatrixFreeFunctions::
3646 InterfaceSelector<MF, InVector, OutVector, Container, is_constant>::
3650 MFWorker(
const MF & matrix_free,
3651 const InVector & src,
3653 const bool zero_dst_vector_setting,
3654 const Container & container,
3655 function_type cell_function,
3656 function_type face_function,
3657 function_type boundary_function,
3658 const typename MF::DataAccessOnFaces src_vector_face_access =
3659 MF::DataAccessOnFaces::none,
3660 const typename MF::DataAccessOnFaces dst_vector_face_access =
3661 MF::DataAccessOnFaces::none)
3662 : matrix_free(matrix_free)
3663 , container(const_cast<Container &>(container))
3664 , cell_function(cell_function)
3665 , face_function(face_function)
3666 , boundary_function(boundary_function)
3669 , src_data_exchanger(matrix_free,
3670 src_vector_face_access,
3672 , dst_data_exchanger(matrix_free,
3673 dst_vector_face_access,
3676 , zero_dst_vector_setting(zero_dst_vector_setting &&
3677 !src_and_dst_are_same)
3682 cell(
const std::pair<unsigned int, unsigned int> &cell_range)
override 3684 if (cell_function !=
nullptr && cell_range.second > cell_range.first)
3686 cell_function)(matrix_free, this->dst, this->src, cell_range);
3692 face(
const std::pair<unsigned int, unsigned int> &face_range)
override 3694 if (face_function !=
nullptr && face_range.second > face_range.first)
3696 face_function)(matrix_free, this->dst, this->src, face_range);
3702 boundary(
const std::pair<unsigned int, unsigned int> &face_range)
override 3704 if (boundary_function !=
nullptr && face_range.second > face_range.first)
3706 boundary_function)(matrix_free, this->dst, this->src, face_range);
3716 vector_update_ghosts_start()
override 3718 if (!src_and_dst_are_same)
3719 internal::update_ghost_values_start(src, src_data_exchanger);
3724 vector_update_ghosts_finish()
override 3726 if (!src_and_dst_are_same)
3727 internal::update_ghost_values_finish(src, src_data_exchanger);
3732 vector_compress_start()
override 3734 internal::compress_start(dst, dst_data_exchanger);
3739 vector_compress_finish()
override 3741 internal::compress_finish(dst, dst_data_exchanger);
3742 if (!src_and_dst_are_same)
3743 internal::reset_ghost_values(src, src_data_exchanger);
3748 zero_dst_vector_range(
const unsigned int range_index)
override 3750 if (zero_dst_vector_setting)
3751 internal::zero_vector_region(range_index, dst, dst_data_exchanger);
3755 const MF & matrix_free;
3756 Container & container;
3757 function_type cell_function;
3758 function_type face_function;
3759 function_type boundary_function;
3761 const InVector &src;
3763 VectorDataExchange<MF::dimension, typename MF::value_type>
3765 VectorDataExchange<MF::dimension, typename MF::value_type>
3767 const bool src_and_dst_are_same;
3768 const bool zero_dst_vector_setting;
3777 template <
class MF,
typename InVector,
typename OutVector>
3778 struct MFClassWrapper
3780 using function_type =
3781 std::function<void(
const MF &,
3784 const std::pair<unsigned int, unsigned int> &)>;
3786 MFClassWrapper(
const function_type cell,
3787 const function_type face,
3788 const function_type boundary)
3791 , boundary(boundary)
3795 cell_integrator(
const MF & mf,
3797 const InVector & src,
3798 const std::pair<unsigned int, unsigned int> &range)
const 3801 cell(mf, dst, src, range);
3805 face_integrator(
const MF & mf,
3807 const InVector & src,
3808 const std::pair<unsigned int, unsigned int> &range)
const 3811 face(mf, dst, src, range);
3815 boundary_integrator(
3818 const InVector & src,
3819 const std::pair<unsigned int, unsigned int> &range)
const 3822 boundary(mf, dst, src, range);
3825 const function_type cell;
3826 const function_type face;
3827 const function_type boundary;
3834 template <
int dim,
typename Number>
3835 template <
typename OutVector,
typename InVector>
3841 const std::pair<unsigned int, unsigned int> &)>
3844 const InVector &src,
3845 const bool zero_dst_vector)
const 3848 internal::MFClassWrapper<MatrixFree<dim, Number>, InVector, OutVector>;
3849 Wrapper wrap(cell_operation,
nullptr,
nullptr);
3851 MFWorker<MatrixFree<dim, Number>, InVector, OutVector, Wrapper,
true>
3857 &Wrapper::cell_integrator,
3858 &Wrapper::face_integrator,
3859 &Wrapper::boundary_integrator);
3866 template <
int dim,
typename Number>
3867 template <
typename OutVector,
typename InVector>
3873 const std::pair<unsigned int, unsigned int> &)>
3878 const std::pair<unsigned int, unsigned int> &)>
3883 const std::pair<unsigned int, unsigned int> &)>
3884 & boundary_operation,
3886 const InVector & src,
3887 const bool zero_dst_vector,
3892 internal::MFClassWrapper<MatrixFree<dim, Number>, InVector, OutVector>;
3893 Wrapper wrap(cell_operation, face_operation, boundary_operation);
3895 MFWorker<MatrixFree<dim, Number>, InVector, OutVector, Wrapper,
true>
3901 &Wrapper::cell_integrator,
3902 &Wrapper::face_integrator,
3903 &Wrapper::boundary_integrator,
3904 src_vector_face_access,
3905 dst_vector_face_access);
3912 template <
int dim,
typename Number>
3913 template <
typename CLASS,
typename OutVector,
typename InVector>
3919 const std::pair<unsigned int, unsigned int> &)
3921 const CLASS * owning_class,
3923 const InVector &src,
3924 const bool zero_dst_vector)
const 3926 internal::MFWorker<MatrixFree<dim, Number>, InVector, OutVector, CLASS,
true>
3940 template <
int dim,
typename Number>
3941 template <
typename CLASS,
typename OutVector,
typename InVector>
3947 const std::pair<unsigned int, unsigned int> &)
3952 const std::pair<unsigned int, unsigned int> &)
3954 void (CLASS::*boundary_operation)(
3958 const std::pair<unsigned int, unsigned int> &)
const,
3959 const CLASS * owning_class,
3961 const InVector & src,
3962 const bool zero_dst_vector,
3966 internal::MFWorker<MatrixFree<dim, Number>, InVector, OutVector, CLASS,
true>
3975 src_vector_face_access,
3976 dst_vector_face_access);
3982 template <
int dim,
typename Number>
3983 template <
typename CLASS,
typename OutVector,
typename InVector>
3986 void (CLASS::*function_pointer)(
3990 const std::pair<unsigned int, unsigned int> &),
3991 CLASS * owning_class,
3993 const InVector &src,
3994 const bool zero_dst_vector)
const 3996 internal::MFWorker<MatrixFree<dim, Number>, InVector, OutVector, CLASS,
false>
4010 template <
int dim,
typename Number>
4011 template <
typename CLASS,
typename OutVector,
typename InVector>
4017 const std::pair<unsigned int, unsigned int> &),
4021 const std::pair<unsigned int, unsigned int> &),
4022 void (CLASS::*boundary_operation)(
4026 const std::pair<unsigned int, unsigned int> &),
4027 CLASS * owning_class,
4029 const InVector & src,
4030 const bool zero_dst_vector,
4034 internal::MFWorker<MatrixFree<dim, Number>, InVector, OutVector, CLASS,
false>
4043 src_vector_face_access,
4044 dst_vector_face_access);
4049 #endif // ifndef DOXYGEN 4053 DEAL_II_NAMESPACE_CLOSE
Transformed quadrature weights.
const internal::MatrixFreeFunctions::TaskInfo & get_size_info() const
UpdateFlags mapping_update_flags_inner_faces
void reinit(const size_type size, const bool omit_zeroing_entries=false)
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_partitioner() const
unsigned int get_n_q_points_face(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
unsigned int n_ghost_indices() const
internal::MatrixFreeFunctions::TaskInfo task_info
bool indices_are_initialized
unsigned int get_dofs_per_cell(const unsigned int dof_handler_index=0, const unsigned int hp_active_fe_index=0) const
static const unsigned int invalid_unsigned_int
UpdateFlags mapping_update_flags_boundary_faces
bool at_irregular_cell(const unsigned int macro_cell_number) const
std::vector< unsigned int > constraint_pool_row_index
void loop(const std::function< void(const MatrixFree< dim, Number > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &cell_operation, const std::function< void(const MatrixFree< dim, Number > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &face_operation, const std::function< void(const MatrixFree< dim, Number > &, 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
#define AssertDimension(dim1, dim2)
A class that provides a separate storage location on each thread that accesses the object...
static const unsigned int dimension
std::list< std::pair< bool, AlignedVector< Number > > > scratch_pad_non_threadsafe
unsigned int get_n_q_points(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
DoFHandler< dim >::cell_iterator get_cell_iterator(const unsigned int macro_cell_number, const unsigned int vector_number, const unsigned int fe_component=0) const
bool mapping_initialized() const
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_vector_partitioner(const unsigned int dof_handler_index=0) const
std::vector< std::pair< unsigned int, unsigned int > > cell_level_index
std::pair< unsigned int, unsigned int > get_face_category(const unsigned int macro_face) const
std::vector< Number > constraint_pool_data
AlignedVector< Number > * acquire_scratch_data_non_threadsafe() const
#define AssertIndexRange(index, range)
std::shared_ptr< const Utilities::MPI::Partitioner > vector_partitioner
std::vector< unsigned int > vector_zero_range_list_index
void copy_from(const MatrixFree< dim, Number > &matrix_free_base)
void import_from_ghosted_array_start(const VectorOperation::values vector_operation, const unsigned int communication_channel, const ArrayView< Number > &ghost_array, const ArrayView< Number > &temporary_storage, std::vector< MPI_Request > &requests) const
unsigned int n_constraint_pool_entries() const
void print_memory_consumption(StreamType &out) const
void make_connectivity_graph_faces(DynamicSparsityPattern &connectivity)
void export_to_ghosted_array_start(const unsigned int communication_channel, const ArrayView< const Number > &locally_owned_array, const ArrayView< Number > &temporary_storage, const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests) const
unsigned int n_active_entries_per_face_batch(const unsigned int face_batch_number) const
static::ExceptionBase & ExcNotInitialized()
const std::vector< unsigned int > & get_constrained_dofs(const unsigned int dof_handler_index=0) const
std::vector< unsigned int > cell_partition_data
#define AssertThrow(cond, exc)
const internal::MatrixFreeFunctions::DoFInfo & get_dof_info(const unsigned int dof_handler_index_component=0) const
const DoFHandler< dim > & get_dof_handler(const unsigned int dof_handler_index=0) const
const internal::MatrixFreeFunctions::ShapeInfo< VectorizedArray< Number > > & 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
static::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
const std::vector< std::pair< unsigned int, unsigned int > > & ghost_indices_within_larger_ghost_set() const
const internal::MatrixFreeFunctions::TaskInfo & get_task_info() const
hp::DoFHandler< dim >::active_cell_iterator get_hp_cell_iterator(const unsigned int macro_cell_number, const unsigned int vector_number, const unsigned int dof_handler_index=0) const
const internal::MatrixFreeFunctions::FaceToCellTopology< VectorizedArray< Number >::n_array_elements > & get_face_info(const unsigned int face_batch_number) const
void compress_start(const unsigned int communication_channel=0,::VectorOperation::values operation=VectorOperation::add)
bool mapping_is_initialized
~MatrixFree() override=default
unsigned int n_macro_cells() const
void import_from_ghosted_array_finish(const VectorOperation::values vector_operation, const ArrayView< const Number > &temporary_storage, const ArrayView< Number > &locally_owned_storage, const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests) const
typename ActiveSelector::active_cell_iterator active_cell_iterator
void initialize_dof_handlers(const std::vector< const DoFHandler< dim > * > &dof_handlers, const AdditionalData &additional_data)
static::ExceptionBase & ExcMessage(std::string arg1)
void renumber_dofs(std::vector< types::global_dof_index > &renumbering, const unsigned int dof_handler_index=0)
void loop(MFWorkerInterface &worker) const
virtual size_type size() const override
size_type size(const unsigned int i) const
#define Assert(cond, exc)
static bool is_supported(const FiniteElement< dim, spacedim > &fe)
unsigned int n_components() const
void update_ghost_values_start(const unsigned int communication_channel=0) const
bool indices_initialized() const
const types::boundary_id invalid_boundary_id
bool cell_vectorization_categories_strict
std::vector< unsigned int > boundary_partition_data
void release_scratch_data(const AlignedVector< VectorizedArray< Number >> *memory) const
void release_scratch_data_non_threadsafe(const AlignedVector< Number > *memory) const
bool has_ghost_elements() const
unsigned int n_components_filled(const unsigned int cell_batch_number) const
const Quadrature< dim > & get_quadrature(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
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 level_mg_handler=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)
TasksParallelScheme tasks_parallel_scheme
const Quadrature< dim-1 > & get_face_quadrature(const unsigned int quad_index=0, const unsigned int hp_active_fe_index=0) const
bool hold_all_faces_to_owned_cells
std::array< types::boundary_id, VectorizedArray< Number >::n_array_elements > get_faces_by_cells_boundary_id(const unsigned int macro_cell, const unsigned int face_number) const
unsigned int n_inner_face_batches() const
unsigned int n_active_cells
unsigned int n_import_indices() const
bool partitioners_are_compatible(const Utilities::MPI::Partitioner &part) const
std::vector< FaceToCellTopology< vectorization_width > > faces
unsigned int n_boundary_face_batches() const
internal::MatrixFreeFunctions::FaceInfo< VectorizedArray< Number >::n_array_elements > face_info
Table< 4, internal::MatrixFreeFunctions::ShapeInfo< VectorizedArray< Number > > > shape_info
unsigned int n_cell_batches() const
types::boundary_id get_boundary_id(const unsigned int macro_face) const
void export_to_ghosted_array_finish(const ArrayView< Number > &ghost_array, std::vector< MPI_Request > &requests) const
const Number * constraint_pool_end(const unsigned int pool_index) const
std::size_t memory_consumption() const
std::vector< unsigned int > face_partition_data
void reinit(const Mapping< dim > &mapping, const DoFHandlerType &dof_handler, const AffineConstraints< number2 > &constraint, const QuadratureType &quad, const AdditionalData additional_data=AdditionalData())
unsigned int n_base_elements(const unsigned int dof_handler_index) const
unsigned int tasks_block_size
::Table< 3, types::boundary_id > cell_and_face_boundary_id
void compress_finish(::VectorOperation::values operation)
unsigned int n_physical_cells() const
unsigned int get_dofs_per_face(const unsigned int fe_component=0, const unsigned int hp_active_fe_index=0) const
internal::MatrixFreeFunctions::MappingInfo< dim, Number > mapping_info
unsigned int cell_level_index_end_local
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
unsigned int level_mg_handler
Shape function gradients.
const IndexSet & get_locally_owned_set(const unsigned int dof_handler_index=0) const
void internal_reinit(const Mapping< dim > &mapping, const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< number2 > * > &constraint, const std::vector< IndexSet > &locally_owned_set, const std::vector< hp::QCollection< 1 >> &quad, const AdditionalData &additional_data)
unsigned int get_cell_category(const unsigned int macro_cell) const
unsigned int n_ghost_cell_batches() const
UpdateFlags mapping_update_flags
void update_ghost_values_finish() const
static::ExceptionBase & ExcNotImplemented()
Threads::ThreadLocalStorage< std::list< std::pair< bool, AlignedVector< VectorizedArray< Number > > > > > scratch_pad
std::vector< unsigned int > vector_zero_range_list
const Number * constraint_pool_begin(const unsigned int pool_index) const
std::vector< internal::MatrixFreeFunctions::DoFInfo > dof_info
AlignedVector< VectorizedArray< Number > > * acquire_scratch_data() const
static const unsigned int chunk_size_zero_vector
const IndexSet & get_ghost_set(const unsigned int dof_handler_index=0) const
void cell_loop(const std::function< void(const MatrixFree< dim, Number > &, OutVector &, const InVector &, const std::pair< unsigned int, unsigned int > &)> &cell_operation, OutVector &dst, const InVector &src, const bool zero_dst_vector=false) const
void print(std::ostream &out) const
bool overlap_communication_computation
unsigned int n_ghost_inner_face_batches() const
UpdateFlags mapping_update_flags_faces_by_cells
unsigned int local_size() const
unsigned int n_active_entries_per_cell_batch(const unsigned int cell_batch_number) const
static bool equal(const T *p1, const T *p2)
void zero_out_ghosts() const
std::vector< unsigned int > cell_vectorization_category
void initialize_dof_vector(VectorType &vec, const unsigned int dof_handler_index=0) const
static::ExceptionBase & ExcInternalError()
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