deal.II version GIT relicensing-2287-g6548a49e0a 2024-12-20 18:30:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mg_transfer_global_coarsening.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2020 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_mg_transfer_global_coarsening_h
16#define dealii_mg_transfer_global_coarsening_h
17
22
24
27
31
34
36
37
38
40
41// Forward declarations
42#ifndef DOXYGEN
43namespace internal
44{
45 class MGTwoLevelTransferImplementation;
46}
47
49{
50 template <int dim, int spacedim>
51 class Base;
52}
53
54template <int dim,
55 typename Number,
57class MGTransferMF;
58#endif
59
60
66namespace mg
67{
79 {
85 boost::signals2::signal<void(const bool before)> prolongation_cell_loop;
86
92 boost::signals2::signal<void(const bool before)> restriction_cell_loop;
93
101 boost::signals2::signal<void(const bool before)> prolongation;
102
110 boost::signals2::signal<void(const bool before)> restriction;
111 };
112} // namespace mg
113
118{
144
149 unsigned int
151 const unsigned int degree,
152 const PolynomialCoarseningSequenceType &p_sequence);
153
159 std::vector<unsigned int>
161 const unsigned int max_degree,
162 const PolynomialCoarseningSequenceType &p_sequence);
163
174 template <int dim, int spacedim>
175 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
177 const Triangulation<dim, spacedim> &tria);
178
195 template <int dim, int spacedim>
196 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
200 const bool preserve_fine_triangulation,
201 const bool repartition_fine_triangulation);
202
208 template <int dim, int spacedim>
209 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
213 const bool repartition_fine_triangulation = false);
214
215} // namespace MGTransferGlobalCoarseningTools
216
217
218
226template <typename VectorType>
228{
229public:
230 static_assert(
231 std::is_same_v<
232 VectorType,
233 LinearAlgebra::distributed::Vector<typename VectorType::value_type,
235 std::is_same_v<
236 VectorType,
237 LinearAlgebra::distributed::Vector<typename VectorType::value_type,
239 "This class is currently only implemented for vectors of "
240 "type LinearAlgebra::distributed::Vector.");
241
245 using Number = typename VectorType::value_type;
246
251
255 void
256 prolongate_and_add(VectorType &dst, const VectorType &src) const;
257
261 void
262 restrict_and_add(VectorType &dst, const VectorType &src) const;
263
271 virtual void
272 interpolate(VectorType &dst, const VectorType &src) const = 0;
273
279 virtual std::pair<bool, bool>
281 const std::shared_ptr<const Utilities::MPI::Partitioner>
283 const std::shared_ptr<const Utilities::MPI::Partitioner>
284 &partitioner_fine) = 0;
285
289 virtual std::size_t
291
292protected:
296 virtual void
297 prolongate_and_add_internal(VectorType &dst, const VectorType &src) const = 0;
298
302 virtual void
303 restrict_and_add_internal(VectorType &dst, const VectorType &src) const = 0;
304
310 void
311 update_ghost_values(const VectorType &vec) const;
312
318 void
319 compress(VectorType &vec, const VectorOperation::values op) const;
320
326 void
327 zero_out_ghost_values(const VectorType &vec) const;
328
333 template <int dim, std::size_t width, typename IndexType>
334 std::pair<bool, bool>
336 const std::shared_ptr<const Utilities::MPI::Partitioner>
338 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine,
341 ConstraintInfo<dim, VectorizedArray<Number, width>, IndexType>
342 &constraint_info_coarse,
343 std::vector<unsigned int> &dof_indices_fine);
344
351
352public:
356 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_coarse;
357
361 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine;
362
363protected:
367 mutable VectorType vec_coarse;
368
376 mutable VectorType vec_fine;
377
382
387 std::shared_ptr<const Utilities::MPI::Partitioner>
389
394 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine_embedded;
395
401
407};
408
409
410
436template <int dim, typename VectorType>
438{
439public:
440 static_assert(
441 std::is_same_v<
442 VectorType,
443 LinearAlgebra::distributed::Vector<typename VectorType::value_type,
445 std::is_same_v<
446 VectorType,
447 LinearAlgebra::distributed::Vector<typename VectorType::value_type,
449 "This class is currently only implemented for vectors of "
450 "type LinearAlgebra::distributed::Vector.");
451
455 using Number = typename VectorType::value_type;
456
462
468 void
471 const DoFHandler<dim> &dof_handler_coarse,
472 const AffineConstraints<Number> &constraint_fine =
474 const AffineConstraints<Number> &constraint_coarse =
476 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
477 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
478
488 void
491 const DoFHandler<dim> &dof_handler_coarse,
492 const AffineConstraints<Number> &constraint_fine =
494 const AffineConstraints<Number> &constraint_coarse =
496 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
497 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
498
512 void
514 const DoFHandler<dim> &dof_handler_coarse,
515 const AffineConstraints<Number> &constraint_fine =
517 const AffineConstraints<Number> &constraint_coarse =
519 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
520 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
521
531 void
532 reinit(const MatrixFree<dim, Number> &matrix_free_fine,
533 const unsigned int dof_no_fine,
534 const MatrixFree<dim, Number> &matrix_free_coarse,
535 const unsigned int dof_no_coarse);
536
545 static bool
546 fast_polynomial_transfer_supported(const unsigned int fe_degree_fine,
547 const unsigned int fe_degree_coarse);
548
552 void
553 interpolate(VectorType &dst, const VectorType &src) const override;
554
559 std::pair<bool, bool>
561 const std::shared_ptr<const Utilities::MPI::Partitioner>
563 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
564 override;
565
569 std::size_t
570 memory_consumption() const override;
571
572protected:
573 void
575 const VectorType &src) const override;
576
577 void
579 const VectorType &src) const override;
580
581private:
641
645 std::vector<MGTransferScheme> schemes;
646
651 internal::MatrixFreeFunctions::
652 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
654
658 internal::MatrixFreeFunctions::
659 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
661
694
700 std::unique_ptr<MatrixFreeRelatedData> matrix_free_data;
701
706 std::vector<unsigned int> weights_start;
707
713
718 std::vector<unsigned char> weights_are_compressed;
719
723 unsigned int n_components;
724
729
733 unsigned int mg_level_fine;
734
736
737 friend class MGTransferMF<dim, Number, typename VectorType::memory_space>;
738};
739
740
741
745template <int dim, typename VectorType>
747{
748private:
749 static_assert(
750 std::is_same_v<
751 VectorType,
753 "This class is currently only implemented for vectors of "
754 "type LinearAlgebra::distributed::Vector.");
755
756 using Number = typename VectorType::value_type;
758
760
761public:
769 {
779 AdditionalData(const double tolerance = 1e-6,
780 const unsigned int rtree_level = 0,
781 const bool enforce_all_points_found = true)
782 : tolerance(tolerance)
783 , rtree_level(rtree_level)
784 , enforce_all_points_found(enforce_all_points_found)
785 {}
786
791 double tolerance;
792
798 unsigned int rtree_level;
799
808 };
809
814
819 void
820 reinit(const DoFHandler<dim> &dof_handler_fine,
821 const DoFHandler<dim> &dof_handler_coarse,
822 const Mapping<dim> &mapping_fine,
823 const Mapping<dim> &mapping_coarse,
824 const AffineConstraints<Number> &constraint_fine =
826 const AffineConstraints<Number> &constraint_coarse =
828
835 void
836 interpolate(VectorType &dst, const VectorType &src) const override;
837
842 std::pair<bool, bool>
844 const std::shared_ptr<const Utilities::MPI::Partitioner>
845 &partitioner_coarse,
846 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
847 override;
848
852 std::size_t
853 memory_consumption() const override;
854
858 boost::signals2::connection
859 connect_prolongation_cell_loop(const std::function<void(const bool)> &slot);
860
864 boost::signals2::connection
865 connect_restriction_cell_loop(const std::function<void(const bool)> &slot);
866
870 boost::signals2::connection
871 connect_prolongation(const std::function<void(const bool)> &slot);
872
876 boost::signals2::connection
877 connect_restriction(const std::function<void(const bool)> &slot);
878
879protected:
884 void
886 const VectorType &src) const override;
887
891 void
893 const VectorType &src) const override;
894
895private:
899 template <int n_components>
900 void
902 const VectorType &src) const;
903
907 template <int n_components>
908 void
909 restrict_and_add_internal_comp(VectorType &dst, const VectorType &src) const;
910
915
919 unsigned int mg_level_fine;
920
926
930 mutable std::vector<Number> rpe_input_output;
931
935 mutable std::vector<Number> rpe_buffer;
936
940 std::shared_ptr<NonMatching::MappingInfo<dim, dim, Number>> mapping_info;
941
946 internal::MatrixFreeFunctions::
947 ConstraintInfo<dim, VectorizedArrayType, unsigned int>
949
953 std::unique_ptr<FiniteElement<dim>> fe_coarse;
954
959 std::vector<unsigned int> level_dof_indices_fine;
960
966 std::vector<unsigned int> level_dof_indices_fine_ptrs;
967
968 friend class MGTransferMF<dim, Number, typename VectorType::memory_space>;
969};
970
971
972
1001template <int dim, typename Number, typename MemorySpace>
1003 LinearAlgebra::distributed::Vector<Number, MemorySpace>>
1004{
1005public:
1010
1017
1032 template <typename MGTwoLevelTransferObject>
1034 const std::function<void(const unsigned int, VectorType &)>
1035 &initialize_dof_vector = {});
1036
1040 template <typename MGTwoLevelTransferObject>
1041 void
1044
1053 void
1054 build(const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1055 &external_partitioners = {});
1056
1061 void
1062 build(const std::function<void(const unsigned int, VectorType &)>
1063 &initialize_dof_vector);
1064
1078 MGTransferMF(const MGConstrainedDoFs &mg_constrained_dofs);
1079
1085 void
1086 initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs);
1087
1104 void
1105 build(const DoFHandler<dim> &dof_handler,
1106 const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1107 &external_partitioners = {});
1108
1118 void
1119 build(const DoFHandler<dim> &dof_handler,
1120 const std::function<void(const unsigned int, VectorType &)>
1121 &initialize_dof_vector);
1122
1133 void
1134 prolongate(const unsigned int to_level,
1135 VectorType &dst,
1136 const VectorType &src) const override;
1137
1141 void
1142 prolongate_and_add(const unsigned int to_level,
1143 VectorType &dst,
1144 const VectorType &src) const override;
1145
1149 virtual void
1150 restrict_and_add(const unsigned int from_level,
1151 VectorType &dst,
1152 const VectorType &src) const override;
1153
1163 template <class InVector>
1164 void
1165 copy_to_mg(const DoFHandler<dim> &dof_handler,
1167 const InVector &src) const;
1168
1178 template <class OutVector>
1179 void
1180 copy_from_mg(const DoFHandler<dim> &dof_handler,
1181 OutVector &dst,
1182 const MGLevelObject<VectorType> &src) const;
1183
1202 template <class InVector>
1203 void
1206 const InVector &src) const;
1207
1216 template <class InVector>
1217 void
1218 interpolate_to_mg(MGLevelObject<VectorType> &dst, const InVector &src) const;
1219
1233 std::size_t
1235
1239 unsigned int
1240 min_level() const;
1241
1245 unsigned int
1246 max_level() const;
1247
1252 void
1254
1257private:
1263 void
1265 const DoFHandler<dim> &dof_handler,
1266 const ObserverPointer<const MGConstrainedDoFs> &mg_constrained_dofs);
1267
1271 std::pair<const DoFHandler<dim> *, unsigned int>
1273
1279 void
1281 const DoFHandler<dim> &dof_handler);
1282
1286 template <typename MGTwoLevelTransferObject>
1287 void
1290
1294 template <class InVector>
1295 void
1296 initialize_dof_vector(const unsigned int level,
1297 VectorType &vector,
1298 const InVector &vector_reference,
1299 const bool omit_zeroing_entries) const;
1300
1306 void
1307 assert_dof_handler(const DoFHandler<dim> &dof_handler_out) const;
1308
1315
1320
1324 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1326};
1327
1328
1329
1335template <int dim, typename Number>
1338 dim,
1339 Number,
1340 MGTransferMF<dim, Number, ::MemorySpace::Host>>
1341{
1342public:
1347 &transfer_operator);
1348
1355
1361 MGTransferBlockMF(const MGConstrainedDoFs &mg_constrained_dofs);
1362
1368 MGTransferBlockMF(const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1369
1375 void
1376 initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs);
1377
1383 void
1385 const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1386
1392 void
1393 build(const DoFHandler<dim> &dof_handler);
1394
1400 void
1401 build(const std::vector<const DoFHandler<dim> *> &dof_handler);
1402
1403protected:
1405 get_matrix_free_transfer(const unsigned int b) const override;
1406
1407private:
1411 std::vector<MGTransferMF<dim, Number, ::MemorySpace::Host>>
1413
1417 std::vector<ObserverPointer<
1420};
1421
1422
1423
1424template <int dim, typename VectorType>
1426 typename VectorType::value_type,
1428
1429template <int dim, typename VectorType>
1432
1433
1436#ifndef DOXYGEN
1437
1438/* ----------------------- Inline functions --------------------------------- */
1439
1440
1441
1442template <int dim, typename Number, typename MemorySpace>
1443template <typename MGTwoLevelTransferObject>
1446 const std::function<void(const unsigned int, VectorType &)>
1447 &initialize_dof_vector)
1448{
1449 this->transfer.clear();
1450 this->internal_transfer.clear();
1451
1452 this->initialize_transfer_references(transfer);
1453 this->build(initialize_dof_vector);
1454}
1455
1456
1457
1458template <int dim, typename Number, typename MemorySpace>
1459template <typename MGTwoLevelTransferObject>
1460void
1463{
1464 this->initialize_transfer_references(transfer);
1465}
1466
1467
1468
1469template <int dim, typename Number, typename MemorySpace>
1470template <typename MGTwoLevelTransferObject>
1471void
1474{
1475 const unsigned int min_level = transfer.min_level();
1476 const unsigned int max_level = transfer.max_level();
1477
1478 this->transfer.resize(min_level, max_level);
1479
1480 // Note that transfer[min_level] is empty and never used:
1481 for (unsigned int l = min_level + 1; l <= max_level; ++l)
1482 this->transfer[l] = &const_cast<MGTwoLevelTransferBase<VectorType> &>(
1483 static_cast<const MGTwoLevelTransferBase<VectorType> &>(
1484 Utilities::get_underlying_value(transfer[l])));
1485}
1486
1487
1488
1489template <int dim, typename Number, typename MemorySpace>
1490template <class InVector>
1491void
1493 const unsigned int level,
1494 VectorType &vec,
1495 const InVector &vec_reference,
1496 const bool omit_zeroing_entries) const
1497{
1498 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1499
1500 if (external_partitioners.empty())
1501 {
1502 partitioner = vec_reference.get_partitioner();
1503 }
1504 else
1505 {
1506 Assert(transfer.min_level() <= level && level <= transfer.max_level(),
1508
1509 partitioner = external_partitioners[level - transfer.min_level()];
1510 }
1511
1512 // check if vectors are already correctly initialized
1513
1514 // yes: same partitioners are used
1515 if (vec.get_partitioner().get() == partitioner.get())
1516 {
1517 if (omit_zeroing_entries == false)
1518 vec = 0;
1519 return; // nothing to do
1520 }
1521
1522 // yes: vectors are compatible
1523 if (vec.size() == partitioner->size() &&
1524 vec.locally_owned_size() == partitioner->locally_owned_size())
1525 {
1526 if (omit_zeroing_entries == false)
1527 vec = 0;
1528 return; // nothing to do
1529 }
1530
1531 // no
1532 vec.reinit(partitioner, omit_zeroing_entries);
1533}
1534
1535
1536
1537template <int dim, typename Number, typename MemorySpace>
1538template <class InVector>
1539void
1541 const DoFHandler<dim> &dof_handler,
1543 const InVector &src) const
1544{
1545 assert_dof_handler(dof_handler);
1546
1547 for (unsigned int level = dst.min_level(); level <= dst.max_level(); ++level)
1548 {
1549 const bool zero_out_values =
1550 (this->perform_plain_copy == false &&
1551 this->perform_renumbered_plain_copy == false) ||
1552 level != dst.max_level();
1553
1554 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1555 }
1556
1557 if (this->perform_plain_copy)
1558 {
1559 dst[dst.max_level()].copy_locally_owned_data_from(src);
1560 }
1561 else if (this->perform_renumbered_plain_copy)
1562 {
1563 auto &dst_level = dst[dst.max_level()];
1564
1565 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1566 dst_level.local_element(this->copy_indices.back()(1, i)) =
1567 src.local_element(i);
1568 }
1569 else
1570 {
1571 this->ghosted_global_vector = src;
1572 this->ghosted_global_vector.update_ghost_values();
1573
1574 for (unsigned int l = dst.max_level() + 1; l != dst.min_level();)
1575 {
1576 --l;
1577
1578 auto &dst_level = dst[l];
1579
1580 const auto copy_unknowns = [&](const auto &indices) {
1581 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1582 dst_level.local_element(indices(1, i)) =
1583 this->ghosted_global_vector.local_element(indices(0, i));
1584 };
1585
1586 copy_unknowns(this->copy_indices[l]);
1587 copy_unknowns(this->copy_indices_level_mine[l]);
1588
1589 dst_level.compress(VectorOperation::insert);
1590 }
1591 }
1592}
1593
1594
1595
1596template <int dim, typename Number, typename MemorySpace>
1597template <class OutVector>
1598void
1600 const DoFHandler<dim> &dof_handler,
1601 OutVector &dst,
1602 const MGLevelObject<VectorType> &src) const
1603{
1604 assert_dof_handler(dof_handler);
1605
1606 if (this->perform_plain_copy)
1607 {
1608 dst.zero_out_ghost_values();
1609 dst.copy_locally_owned_data_from(src[src.max_level()]);
1610 }
1611 else if (this->perform_renumbered_plain_copy)
1612 {
1613 const auto &src_level = src[src.max_level()];
1614 dst.zero_out_ghost_values();
1615 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1616 dst.local_element(i) =
1617 src_level.local_element(this->copy_indices.back()(1, i));
1618 }
1619 else
1620 {
1621 dst = 0;
1622 for (unsigned int l = src.min_level(); l <= src.max_level(); ++l)
1623 {
1624 auto &ghosted_vector = this->ghosted_level_vector[l];
1625
1626 if (this->ghosted_level_vector[l].size() > 0)
1627 ghosted_vector = src[l];
1628
1629 const auto *const ghosted_vector_ptr =
1630 (this->ghosted_level_vector[l].size() > 0) ? &ghosted_vector :
1631 &src[l];
1632
1633 ghosted_vector_ptr->update_ghost_values();
1634
1635 const auto copy_unknowns = [&](const auto &indices) {
1636 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1637 dst.local_element(indices(0, i)) =
1638 ghosted_vector_ptr->local_element(indices(1, i));
1639 };
1640
1641 copy_unknowns(this->copy_indices[l]);
1642 copy_unknowns(this->copy_indices_global_mine[l]);
1643 }
1644 dst.compress(VectorOperation::insert);
1645 }
1646}
1647
1648
1649
1650template <int dim, typename Number, typename MemorySpace>
1651template <class InVector>
1652void
1655 const InVector &src) const
1656{
1657 DoFHandler<dim> dof_handler_dummy;
1658
1659 this->interpolate_to_mg(dof_handler_dummy, dst, src);
1660}
1661
1662
1663
1664template <int dim, typename Number, typename MemorySpace>
1665template <class InVector>
1666void
1668 const DoFHandler<dim> &dof_handler,
1670 const InVector &src) const
1671{
1672 assert_dof_handler(dof_handler);
1673
1674 const unsigned int min_level = transfer.min_level();
1675 const unsigned int max_level = transfer.max_level();
1676
1677 AssertDimension(min_level, dst.min_level());
1678 AssertDimension(max_level, dst.max_level());
1679
1680 for (unsigned int level = min_level; level <= max_level; ++level)
1681 {
1682 const bool zero_out_values = false;
1683 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1684 }
1685
1686 if (this->perform_plain_copy)
1687 {
1688 dst[max_level].copy_locally_owned_data_from(src);
1689
1690 for (unsigned int l = max_level; l > min_level; --l)
1691 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1692 }
1693 else if (this->perform_renumbered_plain_copy)
1694 {
1695 auto &dst_level = dst[max_level];
1696
1697 for (unsigned int i = 0; i < this->solution_copy_indices.back().n_cols();
1698 ++i)
1699 dst_level.local_element(this->solution_copy_indices.back()(1, i)) =
1700 src.local_element(i);
1701
1702 for (unsigned int l = max_level; l > min_level; --l)
1703 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1704 }
1705 else
1706 {
1707 this->solution_ghosted_global_vector = src;
1708 this->solution_ghosted_global_vector.update_ghost_values();
1709
1710 for (unsigned int l = max_level + 1; l != min_level;)
1711 {
1712 --l;
1713
1714 auto &dst_level = dst[l];
1715
1716 const auto copy_unknowns = [&](const auto &indices) {
1717 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1718 dst_level.local_element(indices(1, i)) =
1719 this->solution_ghosted_global_vector.local_element(
1720 indices(0, i));
1721 };
1722
1723 copy_unknowns(this->solution_copy_indices[l]);
1724 copy_unknowns(this->solution_copy_indices_level_mine[l]);
1725
1726 dst_level.compress(VectorOperation::insert);
1727
1728 if (l != min_level)
1729 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1730 }
1731 }
1732}
1733
1734#endif
1735
1737
1738#endif
std::function< void(const unsigned int, LinearAlgebra::distributed::Vector< Number, MemorySpace > &)> initialize_dof_vector
void resize(const unsigned int new_minlevel, const unsigned int new_maxlevel, Args &&...args)
unsigned int max_level() const
unsigned int min_level() const
void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs)
MGTransferBlockMF(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
MGTransferBlockMF(const MGConstrainedDoFs &mg_constrained_dofs)
void build(const std::vector< const DoFHandler< dim > * > &dof_handler)
std::vector< MGTransferMF< dim, Number, ::MemorySpace::Host > > transfer_operators_internal
const MGTransferMF< dim, Number, ::MemorySpace::Host > & get_matrix_free_transfer(const unsigned int b) const override
MGTransferBlockMF()=default
void build(const DoFHandler< dim > &dof_handler)
MGTransferBlockMF(const MGTransferMF< dim, Number, ::MemorySpace::Host > &transfer_operator)
void initialize_constraints(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
std::vector< ObserverPointer< const MGTransferMF< dim, Number, ::MemorySpace::Host > > > transfer_operators
void initialize_two_level_transfers(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs)
void build(const DoFHandler< dim > &dof_handler, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector)
void interpolate_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
void build(const DoFHandler< dim > &dof_handler, const std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > &external_partitioners={})
std::size_t memory_consumption() const
void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
void assert_dof_handler(const DoFHandler< dim > &dof_handler_out) const
unsigned int max_level() const
unsigned int min_level() const
void initialize_internal_transfer(const DoFHandler< dim > &dof_handler, const ObserverPointer< const MGConstrainedDoFs > &mg_constrained_dofs)
void initialize_dof_vector(const unsigned int level, VectorType &vector, const InVector &vector_reference, const bool omit_zeroing_entries) const
void initialize_transfer_references(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
MGTransferMF(const MGLevelObject< MGTwoLevelTransferObject > &transfer, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector={})
std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > external_partitioners
void interpolate_to_mg(MGLevelObject< VectorType > &dst, const InVector &src) const
MGLevelObject< MGTwoLevelTransfer< dim, VectorType > > internal_transfer
void copy_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
void build(const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector)
void prolongate_and_add(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
MGTransferMF(const MGConstrainedDoFs &mg_constrained_dofs)
void copy_from_mg(const DoFHandler< dim > &dof_handler, OutVector &dst, const MGLevelObject< VectorType > &src) const
void fill_and_communicate_copy_indices_global_coarsening(const DoFHandler< dim > &dof_handler)
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const override
void build(const std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > &external_partitioners={})
MGLevelObject< ObserverPointer< MGTwoLevelTransferBase< VectorType > > > transfer
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const
AlignedVector< Number > buffer_coarse_embedded
void zero_out_ghost_values(const VectorType &vec) const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine_embedded
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse
virtual std::size_t memory_consumption() const =0
AlignedVector< Number > buffer_fine_embedded
void prolongate_and_add(VectorType &dst, const VectorType &src) const
void update_ghost_values(const VectorType &vec) const
virtual void restrict_and_add_internal(VectorType &dst, const VectorType &src) const =0
typename VectorType::value_type Number
virtual std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine)=0
void restrict_and_add(VectorType &dst, const VectorType &src) const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse_embedded
virtual void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const =0
std::pair< bool, bool > internal_enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine, bool &vec_fine_needs_ghost_update, internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArray< Number, width >, IndexType > &constraint_info_coarse, std::vector< unsigned int > &dof_indices_fine)
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine
virtual void interpolate(VectorType &dst, const VectorType &src) const =0
void compress(VectorType &vec, const VectorOperation::values op) const
std::shared_ptr< NonMatching::MappingInfo< dim, dim, Number > > mapping_info
boost::signals2::connection connect_restriction(const std::function< void(const bool)> &slot)
void reinit(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const Mapping< dim > &mapping_fine, const Mapping< dim > &mapping_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >())
std::unique_ptr< FiniteElement< dim > > fe_coarse
ObserverPointer< const DoFHandler< dim > > dof_handler_fine
void restrict_and_add_internal_comp(VectorType &dst, const VectorType &src) const
boost::signals2::connection connect_prolongation_cell_loop(const std::function< void(const bool)> &slot)
std::size_t memory_consumption() const override
std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine) override
Utilities::MPI::RemotePointEvaluation< dim > rpe
void restrict_and_add_internal(VectorType &dst, const VectorType &src) const override
std::vector< unsigned int > level_dof_indices_fine_ptrs
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, unsigned int > constraint_info
boost::signals2::connection connect_prolongation(const std::function< void(const bool)> &slot)
boost::signals2::connection connect_restriction_cell_loop(const std::function< void(const bool)> &slot)
void prolongate_and_add_internal_comp(VectorType &dst, const VectorType &src) const
MGTwoLevelTransferNonNested(const AdditionalData &data=AdditionalData())
void interpolate(VectorType &dst, const VectorType &src) const override
std::vector< unsigned int > level_dof_indices_fine
typename VectorType::value_type Number
void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const override
void reinit_geometric_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, types::global_dof_index > constraint_info_fine
friend class internal::MGTwoLevelTransferImplementation
std::vector< MGTransferScheme > schemes
ObserverPointer< const DoFHandler< dim > > dof_handler_fine
typename VectorType::value_type Number
std::vector< unsigned char > weights_are_compressed
void interpolate(VectorType &dst, const VectorType &src) const override
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, types::global_dof_index > constraint_info_coarse
std::unique_ptr< MatrixFreeRelatedData > matrix_free_data
static bool fast_polynomial_transfer_supported(const unsigned int fe_degree_fine, const unsigned int fe_degree_coarse)
AlignedVector< VectorizedArrayType > weights
void reinit_polynomial_transfer(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
std::pair< bool, bool > enable_inplace_operations_if_possible(const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_coarse, const std::shared_ptr< const Utilities::MPI::Partitioner > &partitioner_fine) override
void restrict_and_add_internal(VectorType &dst, const VectorType &src) const override
std::vector< unsigned int > weights_start
void reinit(const MatrixFree< dim, Number > &matrix_free_fine, const unsigned int dof_no_fine, const MatrixFree< dim, Number > &matrix_free_coarse, const unsigned int dof_no_coarse)
void reinit(const DoFHandler< dim > &dof_handler_fine, const DoFHandler< dim > &dof_handler_coarse, const AffineConstraints< Number > &constraint_fine=AffineConstraints< Number >(), const AffineConstraints< Number > &constraint_coarse=AffineConstraints< Number >(), const unsigned int mg_level_fine=numbers::invalid_unsigned_int, const unsigned int mg_level_coarse=numbers::invalid_unsigned_int)
std::size_t memory_consumption() const override
void prolongate_and_add_internal(VectorType &dst, const VectorType &src) const override
Abstract base class for mapping classes.
Definition mapping.h:318
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
unsigned int level
Definition grid_out.cc:4632
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
std::vector< index_type > data
Definition mpi.cc:735
std::size_t size
Definition mpi.cc:734
void interpolate(const DoFHandler< dim, spacedim > &dof1, const InVector &u1, const DoFHandler< dim, spacedim > &dof2, OutVector &u2)
std::vector< std::shared_ptr< const Triangulation< dim, spacedim > > > create_geometric_coarsening_sequence(const Triangulation< dim, spacedim > &tria)
unsigned int create_next_polynomial_coarsening_degree(const unsigned int degree, const PolynomialCoarseningSequenceType &p_sequence)
std::vector< unsigned int > create_polynomial_coarsening_sequence(const unsigned int max_degree, const PolynomialCoarseningSequenceType &p_sequence)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
T & get_underlying_value(T &p)
Definition utilities.h:1639
Definition mg.h:81
static const unsigned int invalid_unsigned_int
Definition types.h:220
STL namespace.
AdditionalData(const double tolerance=1e-6, const unsigned int rtree_level=0, const bool enforce_all_points_found=true)
internal::MatrixFreeFunctions::ShapeInfo< double > shape_info_coarse
std::vector< std::array< unsigned int, VectorizedArrayType::size()> > cell_list_fine_to_coarse
ObserverPointer< const MatrixFree< dim, Number > > matrix_free_fine
ObserverPointer< const MatrixFree< dim, Number > > matrix_free_coarse
boost::signals2::signal< void(const bool before)> prolongation_cell_loop
boost::signals2::signal< void(const bool before)> restriction
boost::signals2::signal< void(const bool before)> restriction_cell_loop
boost::signals2::signal< void(const bool before)> prolongation