deal.II version GIT relicensing-2165-gc91f007519 2024-11-20 01:40: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
21
23
26
30
33
35
36
37
39
40// Forward declarations
41#ifndef DOXYGEN
42namespace internal
43{
44 class MGTwoLevelTransferImplementation;
45}
46
48{
49 template <int dim, int spacedim>
50 class Base;
51}
52
53template <int dim, typename Number>
54class MGTransferMF;
55#endif
56
57
63namespace mg
64{
76 {
82 boost::signals2::signal<void(const bool before)> prolongation_cell_loop;
83
89 boost::signals2::signal<void(const bool before)> restriction_cell_loop;
90
98 boost::signals2::signal<void(const bool before)> prolongation;
99
107 boost::signals2::signal<void(const bool before)> restriction;
108 };
109} // namespace mg
110
115{
141
146 unsigned int
148 const unsigned int degree,
149 const PolynomialCoarseningSequenceType &p_sequence);
150
156 std::vector<unsigned int>
158 const unsigned int max_degree,
159 const PolynomialCoarseningSequenceType &p_sequence);
160
171 template <int dim, int spacedim>
172 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
174 const Triangulation<dim, spacedim> &tria);
175
192 template <int dim, int spacedim>
193 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
197 const bool preserve_fine_triangulation,
198 const bool repartition_fine_triangulation);
199
205 template <int dim, int spacedim>
206 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
210 const bool repartition_fine_triangulation = false);
211
212} // namespace MGTransferGlobalCoarseningTools
213
214
215
223template <typename VectorType>
225{
226public:
227 static_assert(
228 std::is_same_v<
229 VectorType,
231 "This class is currently only implemented for vectors of "
232 "type LinearAlgebra::distributed::Vector.");
233
237 using Number = typename VectorType::value_type;
238
243
247 void
248 prolongate_and_add(VectorType &dst, const VectorType &src) const;
249
253 void
254 restrict_and_add(VectorType &dst, const VectorType &src) const;
255
263 virtual void
264 interpolate(VectorType &dst, const VectorType &src) const = 0;
265
271 virtual std::pair<bool, bool>
273 const std::shared_ptr<const Utilities::MPI::Partitioner>
275 const std::shared_ptr<const Utilities::MPI::Partitioner>
276 &partitioner_fine) = 0;
277
281 virtual std::size_t
283
284protected:
288 virtual void
291 const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
292
296 virtual void
299 const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
300
306 void
307 update_ghost_values(const VectorType &vec) const;
308
314 void
315 compress(VectorType &vec, const VectorOperation::values op) const;
316
322 void
323 zero_out_ghost_values(const VectorType &vec) const;
324
329 template <int dim, std::size_t width, typename IndexType>
330 std::pair<bool, bool>
332 const std::shared_ptr<const Utilities::MPI::Partitioner>
334 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine,
337 ConstraintInfo<dim, VectorizedArray<Number, width>, IndexType>
338 &constraint_info_coarse,
339 std::vector<unsigned int> &dof_indices_fine);
340
347
348public:
352 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_coarse;
353
357 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine;
358
359protected:
364
373
378
383 std::shared_ptr<const Utilities::MPI::Partitioner>
385
390 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine_embedded;
391
397
403};
404
405
406
432template <int dim, typename VectorType>
434{
435public:
436 static_assert(
437 std::is_same_v<
438 VectorType,
440 "This class is currently only implemented for vectors of "
441 "type LinearAlgebra::distributed::Vector.");
442
446 using Number = typename VectorType::value_type;
447
453
459 void
462 const DoFHandler<dim> &dof_handler_coarse,
463 const AffineConstraints<Number> &constraint_fine =
465 const AffineConstraints<Number> &constraint_coarse =
467 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
468 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
469
479 void
482 const DoFHandler<dim> &dof_handler_coarse,
483 const AffineConstraints<Number> &constraint_fine =
485 const AffineConstraints<Number> &constraint_coarse =
487 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
488 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
489
503 void
505 const DoFHandler<dim> &dof_handler_coarse,
506 const AffineConstraints<Number> &constraint_fine =
508 const AffineConstraints<Number> &constraint_coarse =
510 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
511 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
512
522 void
523 reinit(const MatrixFree<dim, Number> &matrix_free_fine,
524 const unsigned int dof_no_fine,
525 const MatrixFree<dim, Number> &matrix_free_coarse,
526 const unsigned int dof_no_coarse);
527
536 static bool
537 fast_polynomial_transfer_supported(const unsigned int fe_degree_fine,
538 const unsigned int fe_degree_coarse);
539
543 void
544 interpolate(VectorType &dst, const VectorType &src) const override;
545
550 std::pair<bool, bool>
552 const std::shared_ptr<const Utilities::MPI::Partitioner>
554 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
555 override;
556
560 std::size_t
561 memory_consumption() const override;
562
563protected:
564 void
566 const VectorType &src) const override;
567
568 void
570 const VectorType &src) const override;
571
572private:
632
636 std::vector<MGTransferScheme> schemes;
637
642 internal::MatrixFreeFunctions::
643 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
645
649 internal::MatrixFreeFunctions::
650 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
652
685
691 std::unique_ptr<MatrixFreeRelatedData> matrix_free_data;
692
697 std::vector<unsigned int> weights_start;
698
704
709 std::vector<unsigned char> weights_are_compressed;
710
714 unsigned int n_components;
715
720
724 unsigned int mg_level_fine;
725
727
728 friend class MGTransferMF<dim, Number>;
729};
730
731
732
736template <int dim, typename VectorType>
738{
739private:
740 static_assert(
741 std::is_same_v<
742 VectorType,
744 "This class is currently only implemented for vectors of "
745 "type LinearAlgebra::distributed::Vector.");
746
747 using Number = typename VectorType::value_type;
749
751
752public:
760 {
770 AdditionalData(const double tolerance = 1e-6,
771 const unsigned int rtree_level = 0,
772 const bool enforce_all_points_found = true)
776 {}
777
782 double tolerance;
783
789 unsigned int rtree_level;
790
799 };
800
805
810 void
812 const DoFHandler<dim> &dof_handler_coarse,
813 const Mapping<dim> &mapping_fine,
814 const Mapping<dim> &mapping_coarse,
815 const AffineConstraints<Number> &constraint_fine =
817 const AffineConstraints<Number> &constraint_coarse =
819
826 void
827 interpolate(VectorType &dst, const VectorType &src) const override;
828
833 std::pair<bool, bool>
835 const std::shared_ptr<const Utilities::MPI::Partitioner>
837 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
838 override;
839
843 std::size_t
844 memory_consumption() const override;
845
849 boost::signals2::connection
850 connect_prolongation_cell_loop(const std::function<void(const bool)> &slot);
851
855 boost::signals2::connection
856 connect_restriction_cell_loop(const std::function<void(const bool)> &slot);
857
861 boost::signals2::connection
862 connect_prolongation(const std::function<void(const bool)> &slot);
863
867 boost::signals2::connection
868 connect_restriction(const std::function<void(const bool)> &slot);
869
870protected:
875 void
877 const VectorType &src) const override;
878
882 void
884 const VectorType &src) const override;
885
886private:
890 template <int n_components>
891 void
893 const VectorType &src) const;
894
898 template <int n_components>
899 void
900 restrict_and_add_internal_comp(VectorType &dst, const VectorType &src) const;
901
906
910 unsigned int mg_level_fine;
911
917
921 mutable std::vector<Number> rpe_input_output;
922
926 mutable std::vector<Number> rpe_buffer;
927
931 std::shared_ptr<NonMatching::MappingInfo<dim, dim, Number>> mapping_info;
932
937 internal::MatrixFreeFunctions::
938 ConstraintInfo<dim, VectorizedArrayType, unsigned int>
940
944 std::unique_ptr<FiniteElement<dim>> fe_coarse;
945
950 std::vector<unsigned int> level_dof_indices_fine;
951
957 std::vector<unsigned int> level_dof_indices_fine_ptrs;
958
959 friend class MGTransferMF<dim, Number>;
960};
961
962
963
992template <int dim, typename Number>
994 LinearAlgebra::distributed::Vector<Number>>
995{
996public:
1001
1008
1023 template <typename MGTwoLevelTransferObject>
1025 const std::function<void(const unsigned int, VectorType &)>
1026 &initialize_dof_vector = {});
1027
1031 template <typename MGTwoLevelTransferObject>
1032 void
1035
1044 void
1045 build(const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1046 &external_partitioners = {});
1047
1052 void
1053 build(const std::function<void(const unsigned int, VectorType &)>
1055
1070
1076 void
1078
1095 void
1096 build(const DoFHandler<dim> &dof_handler,
1097 const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1098 &external_partitioners = {});
1099
1109 void
1110 build(const DoFHandler<dim> &dof_handler,
1111 const std::function<void(const unsigned int, VectorType &)>
1113
1124 void
1125 prolongate(const unsigned int to_level,
1126 VectorType &dst,
1127 const VectorType &src) const override;
1128
1132 void
1133 prolongate_and_add(const unsigned int to_level,
1134 VectorType &dst,
1135 const VectorType &src) const override;
1136
1140 virtual void
1141 restrict_and_add(const unsigned int from_level,
1142 VectorType &dst,
1143 const VectorType &src) const override;
1144
1154 template <class InVector>
1155 void
1156 copy_to_mg(const DoFHandler<dim> &dof_handler,
1158 const InVector &src) const;
1159
1169 template <class OutVector>
1170 void
1171 copy_from_mg(const DoFHandler<dim> &dof_handler,
1172 OutVector &dst,
1173 const MGLevelObject<VectorType> &src) const;
1174
1193 template <class InVector>
1194 void
1197 const InVector &src) const;
1198
1207 template <class InVector>
1208 void
1209 interpolate_to_mg(MGLevelObject<VectorType> &dst, const InVector &src) const;
1210
1224 std::size_t
1226
1230 unsigned int
1231 min_level() const;
1232
1236 unsigned int
1237 max_level() const;
1238
1243 void
1245
1248private:
1254 void
1256 const DoFHandler<dim> &dof_handler,
1258
1262 std::pair<const DoFHandler<dim> *, unsigned int>
1264
1270 void
1272 const DoFHandler<dim> &dof_handler);
1273
1277 template <typename MGTwoLevelTransferObject>
1278 void
1281
1285 template <class InVector>
1286 void
1287 initialize_dof_vector(const unsigned int level,
1288 VectorType &vector,
1289 const InVector &vector_reference,
1290 const bool omit_zeroing_entries) const;
1291
1297 void
1298 assert_dof_handler(const DoFHandler<dim> &dof_handler_out) const;
1299
1306
1311
1315 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1317};
1318
1319
1320
1326template <int dim, typename Number>
1328 : public MGTransferBlockMatrixFreeBase<dim, Number, MGTransferMF<dim, Number>>
1329{
1330public:
1335
1342
1348 MGTransferBlockMF(const MGConstrainedDoFs &mg_constrained_dofs);
1349
1355 MGTransferBlockMF(const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1356
1362 void
1363 initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs);
1364
1370 void
1372 const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1373
1379 void
1380 build(const DoFHandler<dim> &dof_handler);
1381
1387 void
1388 build(const std::vector<const DoFHandler<dim> *> &dof_handler);
1389
1390protected:
1392 get_matrix_free_transfer(const unsigned int b) const override;
1393
1394private:
1398 std::vector<MGTransferMF<dim, Number>> transfer_operators_internal;
1399
1403 std::vector<ObserverPointer<const MGTransferMF<dim, Number>>>
1405};
1406
1407
1408
1409template <int dim, typename VectorType>
1412
1413template <int dim, typename VectorType>
1416
1417
1420#ifndef DOXYGEN
1421
1422/* ----------------------- Inline functions --------------------------------- */
1423
1424
1425
1426template <int dim, typename Number>
1427template <typename MGTwoLevelTransferObject>
1430 const std::function<void(const unsigned int, VectorType &)>
1431 &initialize_dof_vector)
1432{
1433 this->transfer.clear();
1434 this->internal_transfer.clear();
1435
1436 this->initialize_transfer_references(transfer);
1437 this->build(initialize_dof_vector);
1438}
1439
1440
1441
1442template <int dim, typename Number>
1443template <typename MGTwoLevelTransferObject>
1444void
1447{
1448 this->initialize_transfer_references(transfer);
1449}
1450
1451
1452
1453template <int dim, typename Number>
1454template <typename MGTwoLevelTransferObject>
1455void
1458{
1459 const unsigned int min_level = transfer.min_level();
1460 const unsigned int max_level = transfer.max_level();
1461
1462 this->transfer.resize(min_level, max_level);
1463
1464 // Note that transfer[min_level] is empty and never used:
1465 for (unsigned int l = min_level + 1; l <= max_level; ++l)
1466 this->transfer[l] = &const_cast<MGTwoLevelTransferBase<VectorType> &>(
1467 static_cast<const MGTwoLevelTransferBase<VectorType> &>(
1468 Utilities::get_underlying_value(transfer[l])));
1469}
1470
1471
1472
1473template <int dim, typename Number>
1474template <class InVector>
1475void
1477 const unsigned int level,
1478 VectorType &vec,
1479 const InVector &vec_reference,
1480 const bool omit_zeroing_entries) const
1481{
1482 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1483
1484 if (external_partitioners.empty())
1485 {
1486 partitioner = vec_reference.get_partitioner();
1487 }
1488 else
1489 {
1490 Assert(transfer.min_level() <= level && level <= transfer.max_level(),
1492
1493 partitioner = external_partitioners[level - transfer.min_level()];
1494 }
1495
1496 // check if vectors are already correctly initialized
1497
1498 // yes: same partitioners are used
1499 if (vec.get_partitioner().get() == partitioner.get())
1500 {
1501 if (omit_zeroing_entries == false)
1502 vec = 0;
1503 return; // nothing to do
1504 }
1505
1506 // yes: vectors are compatible
1507 if (vec.size() == partitioner->size() &&
1508 vec.locally_owned_size() == partitioner->locally_owned_size())
1509 {
1510 if (omit_zeroing_entries == false)
1511 vec = 0;
1512 return; // nothing to do
1513 }
1514
1515 // no
1516 vec.reinit(partitioner, omit_zeroing_entries);
1517}
1518
1519
1520
1521template <int dim, typename Number>
1522template <class InVector>
1523void
1526 const InVector &src) const
1527{
1528 assert_dof_handler(dof_handler);
1529
1530 for (unsigned int level = dst.min_level(); level <= dst.max_level(); ++level)
1531 {
1532 const bool zero_out_values =
1533 (this->perform_plain_copy == false &&
1534 this->perform_renumbered_plain_copy == false) ||
1535 level != dst.max_level();
1536
1537 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1538 }
1539
1540 if (this->perform_plain_copy)
1541 {
1542 dst[dst.max_level()].copy_locally_owned_data_from(src);
1543 }
1544 else if (this->perform_renumbered_plain_copy)
1545 {
1546 auto &dst_level = dst[dst.max_level()];
1547
1548 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1549 dst_level.local_element(this->copy_indices.back()(1, i)) =
1550 src.local_element(i);
1551 }
1552 else
1553 {
1554 this->ghosted_global_vector = src;
1555 this->ghosted_global_vector.update_ghost_values();
1556
1557 for (unsigned int l = dst.max_level() + 1; l != dst.min_level();)
1558 {
1559 --l;
1560
1561 auto &dst_level = dst[l];
1562
1563 const auto copy_unknowns = [&](const auto &indices) {
1564 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1565 dst_level.local_element(indices(1, i)) =
1566 this->ghosted_global_vector.local_element(indices(0, i));
1567 };
1568
1569 copy_unknowns(this->copy_indices[l]);
1570 copy_unknowns(this->copy_indices_level_mine[l]);
1571
1572 dst_level.compress(VectorOperation::insert);
1573 }
1574 }
1575}
1576
1577
1578
1579template <int dim, typename Number>
1580template <class OutVector>
1581void
1583 const DoFHandler<dim> &dof_handler,
1584 OutVector &dst,
1585 const MGLevelObject<VectorType> &src) const
1586{
1587 assert_dof_handler(dof_handler);
1588
1589 if (this->perform_plain_copy)
1590 {
1591 dst.zero_out_ghost_values();
1592 dst.copy_locally_owned_data_from(src[src.max_level()]);
1593 }
1594 else if (this->perform_renumbered_plain_copy)
1595 {
1596 const auto &src_level = src[src.max_level()];
1597 dst.zero_out_ghost_values();
1598 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1599 dst.local_element(i) =
1600 src_level.local_element(this->copy_indices.back()(1, i));
1601 }
1602 else
1603 {
1604 dst = 0;
1605 for (unsigned int l = src.min_level(); l <= src.max_level(); ++l)
1606 {
1607 auto &ghosted_vector = this->ghosted_level_vector[l];
1608
1609 if (this->ghosted_level_vector[l].size() > 0)
1610 ghosted_vector = src[l];
1611
1612 const auto *const ghosted_vector_ptr =
1613 (this->ghosted_level_vector[l].size() > 0) ? &ghosted_vector :
1614 &src[l];
1615
1616 ghosted_vector_ptr->update_ghost_values();
1617
1618 const auto copy_unknowns = [&](const auto &indices) {
1619 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1620 dst.local_element(indices(0, i)) =
1621 ghosted_vector_ptr->local_element(indices(1, i));
1622 };
1623
1624 copy_unknowns(this->copy_indices[l]);
1625 copy_unknowns(this->copy_indices_global_mine[l]);
1626 }
1627 dst.compress(VectorOperation::insert);
1628 }
1629}
1630
1631
1632
1633template <int dim, typename Number>
1634template <class InVector>
1635void
1637 const InVector &src) const
1638{
1639 DoFHandler<dim> dof_handler_dummy;
1640
1641 this->interpolate_to_mg(dof_handler_dummy, dst, src);
1642}
1643
1644
1645
1646template <int dim, typename Number>
1647template <class InVector>
1648void
1651 const InVector &src) const
1652{
1653 assert_dof_handler(dof_handler);
1654
1655 const unsigned int min_level = transfer.min_level();
1656 const unsigned int max_level = transfer.max_level();
1657
1658 AssertDimension(min_level, dst.min_level());
1659 AssertDimension(max_level, dst.max_level());
1660
1661 for (unsigned int level = min_level; level <= max_level; ++level)
1662 {
1663 const bool zero_out_values = false;
1664 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1665 }
1666
1667 if (this->perform_plain_copy)
1668 {
1669 dst[max_level].copy_locally_owned_data_from(src);
1670
1671 for (unsigned int l = max_level; l > min_level; --l)
1672 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1673 }
1674 else if (this->perform_renumbered_plain_copy)
1675 {
1676 auto &dst_level = dst[max_level];
1677
1678 for (unsigned int i = 0; i < this->solution_copy_indices.back().n_cols();
1679 ++i)
1680 dst_level.local_element(this->solution_copy_indices.back()(1, i)) =
1681 src.local_element(i);
1682
1683 for (unsigned int l = max_level; l > min_level; --l)
1684 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1685 }
1686 else
1687 {
1688 this->solution_ghosted_global_vector = src;
1689 this->solution_ghosted_global_vector.update_ghost_values();
1690
1691 for (unsigned int l = max_level + 1; l != min_level;)
1692 {
1693 --l;
1694
1695 auto &dst_level = dst[l];
1696
1697 const auto copy_unknowns = [&](const auto &indices) {
1698 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1699 dst_level.local_element(indices(1, i)) =
1700 this->solution_ghosted_global_vector.local_element(
1701 indices(0, i));
1702 };
1703
1704 copy_unknowns(this->solution_copy_indices[l]);
1705 copy_unknowns(this->solution_copy_indices_level_mine[l]);
1706
1707 dst_level.compress(VectorOperation::insert);
1708
1709 if (l != min_level)
1710 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1711 }
1712 }
1713}
1714
1715#endif
1716
1718
1719#endif
ObserverPointer< const MGConstrainedDoFs > mg_constrained_dofs
std::function< void(const unsigned int, LinearAlgebra::distributed::Vector< Number > &)> 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 > > transfer_operators_internal
MGTransferBlockMF(const MGTransferMF< dim, Number > &transfer_operator)
std::vector< ObserverPointer< const MGTransferMF< dim, Number > > > transfer_operators
MGTransferBlockMF()=default
void build(const DoFHandler< dim > &dof_handler)
const MGTransferMF< dim, Number > & get_matrix_free_transfer(const unsigned int b) const override
void initialize_constraints(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
MGLevelObject< ObserverPointer< MGTwoLevelTransferBase< VectorType > > > transfer
std::pair< const DoFHandler< dim > *, unsigned int > get_dof_handler_fine() const
void copy_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
unsigned int min_level() const
void build(const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector)
void assert_dof_handler(const DoFHandler< dim > &dof_handler_out) const
void interpolate_to_mg(const DoFHandler< dim > &dof_handler, MGLevelObject< VectorType > &dst, const InVector &src) const
std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > external_partitioners
void prolongate_and_add(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
unsigned int max_level() const
MGTransferMF(const MGLevelObject< MGTwoLevelTransferObject > &transfer, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector={})
void build(const DoFHandler< dim > &dof_handler, const std::function< void(const unsigned int, VectorType &)> &initialize_dof_vector)
void initialize_internal_transfer(const DoFHandler< dim > &dof_handler, const ObserverPointer< const MGConstrainedDoFs > &mg_constrained_dofs)
void build(const DoFHandler< dim > &dof_handler, const std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > &external_partitioners={})
void build(const std::vector< std::shared_ptr< const Utilities::MPI::Partitioner > > &external_partitioners={})
void initialize_dof_vector(const unsigned int level, VectorType &vector, const InVector &vector_reference, const bool omit_zeroing_entries) const
void initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs)
void initialize_two_level_transfers(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
MGTransferMF(const MGConstrainedDoFs &mg_constrained_dofs)
MGLevelObject< MGTwoLevelTransfer< dim, VectorType > > internal_transfer
void fill_and_communicate_copy_indices_global_coarsening(const DoFHandler< dim > &dof_handler)
std::size_t memory_consumption() const
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const override
void initialize_transfer_references(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const override
void copy_from_mg(const DoFHandler< dim > &dof_handler, OutVector &dst, const MGLevelObject< VectorType > &src) const
void interpolate_to_mg(MGLevelObject< VectorType > &dst, const InVector &src) 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
LinearAlgebra::distributed::Vector< Number > vec_fine
void update_ghost_values(const VectorType &vec) const
LinearAlgebra::distributed::Vector< Number > vec_coarse
typename VectorType::value_type Number
virtual void restrict_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const =0
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
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
virtual void prolongate_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const =0
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:4626
#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