Reference documentation for deal.II version GIT relicensing-422-gb369f187d8 2024-04-17 18:10:02+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
29
32
34
35
36
38
39// Forward declarations
40#ifndef DOXYGEN
41namespace internal
42{
43 class MGTwoLevelTransferImplementation;
44}
45
47{
48 template <int dim, int spacedim>
49 class Base;
50}
51
52template <int dim, typename Number>
53class MGTransferMF;
54#endif
55
56
57namespace mg
58{
70 {
76 boost::signals2::signal<void(const bool before)> prolongation_cell_loop;
77
83 boost::signals2::signal<void(const bool before)> restriction_cell_loop;
84
92 boost::signals2::signal<void(const bool before)> prolongation;
93
101 boost::signals2::signal<void(const bool before)> restriction;
102 };
103} // namespace mg
104
109{
135
140 unsigned int
142 const unsigned int degree,
143 const PolynomialCoarseningSequenceType &p_sequence);
144
150 std::vector<unsigned int>
152 const unsigned int max_degree,
153 const PolynomialCoarseningSequenceType &p_sequence);
154
165 template <int dim, int spacedim>
166 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
168 const Triangulation<dim, spacedim> &tria);
169
186 template <int dim, int spacedim>
187 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
191 const bool preserve_fine_triangulation,
192 const bool repartition_fine_triangulation);
193
199 template <int dim, int spacedim>
200 std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
204 const bool repartition_fine_triangulation = false);
205
206} // namespace MGTransferGlobalCoarseningTools
207
208
209
217template <typename VectorType>
219{
220public:
221 static_assert(
222 std::is_same_v<
223 VectorType,
225 "This class is currently only implemented for vectors of "
226 "type LinearAlgebra::distributed::Vector.");
227
231 using Number = typename VectorType::value_type;
232
237
241 void
242 prolongate_and_add(VectorType &dst, const VectorType &src) const;
243
247 void
248 restrict_and_add(VectorType &dst, const VectorType &src) const;
249
257 virtual void
258 interpolate(VectorType &dst, const VectorType &src) const = 0;
259
264 virtual void
266 const std::shared_ptr<const Utilities::MPI::Partitioner>
268 const std::shared_ptr<const Utilities::MPI::Partitioner>
269 &partitioner_fine) = 0;
270
274 virtual std::size_t
276
277protected:
281 virtual void
284 const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
285
289 virtual void
292 const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
293
299 void
300 update_ghost_values(const VectorType &vec) const;
301
307 void
308 compress(VectorType &vec, const VectorOperation::values op) const;
309
315 void
316 zero_out_ghost_values(const VectorType &vec) const;
317
322 template <int dim, std::size_t width, typename IndexType>
323 void
325 const std::shared_ptr<const Utilities::MPI::Partitioner>
327 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine,
330 ConstraintInfo<dim, VectorizedArray<Number, width>, IndexType>
331 &constraint_info_coarse,
332 std::vector<unsigned int> &dof_indices_fine);
333
340
341public:
345 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_coarse;
346
350 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine;
351
352protected:
357
366
371
376 std::shared_ptr<const Utilities::MPI::Partitioner>
378
383 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine_embedded;
384
390
396};
397
398
399
405template <int dim, typename VectorType>
407{
408public:
409 static_assert(
410 std::is_same_v<
411 VectorType,
413 "This class is currently only implemented for vectors of "
414 "type LinearAlgebra::distributed::Vector.");
415
419 using Number = typename VectorType::value_type;
420
426
432 void
435 const DoFHandler<dim> &dof_handler_coarse,
436 const AffineConstraints<Number> &constraint_fine =
438 const AffineConstraints<Number> &constraint_coarse =
440 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
441 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
442
452 void
455 const DoFHandler<dim> &dof_handler_coarse,
456 const AffineConstraints<Number> &constraint_fine =
458 const AffineConstraints<Number> &constraint_coarse =
460 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
461 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
462
476 void
478 const DoFHandler<dim> &dof_handler_coarse,
479 const AffineConstraints<Number> &constraint_fine =
481 const AffineConstraints<Number> &constraint_coarse =
483 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
484 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
485
494 static bool
495 fast_polynomial_transfer_supported(const unsigned int fe_degree_fine,
496 const unsigned int fe_degree_coarse);
497
501 void
502 interpolate(VectorType &dst, const VectorType &src) const override;
503
508 void
510 const std::shared_ptr<const Utilities::MPI::Partitioner>
512 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
513 override;
514
518 std::size_t
519 memory_consumption() const override;
520
521protected:
522 void
524 const VectorType &src) const override;
525
526 void
528 const VectorType &src) const override;
529
530private:
599
603 std::vector<MGTransferScheme> schemes;
604
609 internal::MatrixFreeFunctions::
610 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
612
616 internal::MatrixFreeFunctions::
617 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
619
623 std::vector<Number> weights; // TODO: vectorize
624
630
634 unsigned int n_components;
635
640
644 unsigned int mg_level_fine;
645
647
648 friend class MGTransferMF<dim, Number>;
649};
650
651
652
656template <int dim, typename VectorType>
658{
659private:
660 static_assert(
661 std::is_same_v<
662 VectorType,
664 "This class is currently only implemented for vectors of "
665 "type LinearAlgebra::distributed::Vector.");
666
667 using Number = typename VectorType::value_type;
669
671
672public:
680 {
690 AdditionalData(const double tolerance = 1e-6,
691 const unsigned int rtree_level = 0,
692 const bool enforce_all_points_found = true)
696 {}
697
702 double tolerance;
703
709 unsigned int rtree_level;
710
719 };
720
725
730 void
732 const DoFHandler<dim> &dof_handler_coarse,
733 const Mapping<dim> &mapping_fine,
734 const Mapping<dim> &mapping_coarse,
735 const AffineConstraints<Number> &constraint_fine =
737 const AffineConstraints<Number> &constraint_coarse =
739
746 void
747 interpolate(VectorType &dst, const VectorType &src) const override;
748
753 void
755 const std::shared_ptr<const Utilities::MPI::Partitioner>
757 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
758 override;
759
763 std::size_t
764 memory_consumption() const override;
765
769 boost::signals2::connection
770 connect_prolongation_cell_loop(const std::function<void(const bool)> &slot);
771
775 boost::signals2::connection
776 connect_restriction_cell_loop(const std::function<void(const bool)> &slot);
777
781 boost::signals2::connection
782 connect_prolongation(const std::function<void(const bool)> &slot);
783
787 boost::signals2::connection
788 connect_restriction(const std::function<void(const bool)> &slot);
789
790protected:
795 void
797 const VectorType &src) const override;
798
802 void
804 const VectorType &src) const override;
805
806private:
810 template <int n_components>
811 void
813 const VectorType &src) const;
814
818 template <int n_components>
819 void
820 restrict_and_add_internal_comp(VectorType &dst, const VectorType &src) const;
821
826
830 unsigned int mg_level_fine;
831
837
841 std::shared_ptr<NonMatching::MappingInfo<dim, dim, Number>> mapping_info;
842
847 internal::MatrixFreeFunctions::
848 ConstraintInfo<dim, VectorizedArrayType, unsigned int>
850
854 std::unique_ptr<FiniteElement<dim>> fe_coarse;
855
860 std::vector<unsigned int> level_dof_indices_fine;
861
867 std::vector<unsigned int> level_dof_indices_fine_ptrs;
868
869 friend class MGTransferMF<dim, Number>;
870};
871
872
873
902template <int dim, typename Number>
904 LinearAlgebra::distributed::Vector<Number>>
905{
906public:
911
918
933 template <typename MGTwoLevelTransferObject>
935 const std::function<void(const unsigned int, VectorType &)>
937
941 template <typename MGTwoLevelTransferObject>
942 void
945
954 void
955 build(const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
957
962 void
963 build(const std::function<void(const unsigned int, VectorType &)>
965
980
986 void
988
1005 void
1006 build(const DoFHandler<dim> &dof_handler,
1007 const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1008 &external_partitioners = {});
1009
1019 void
1020 build(const DoFHandler<dim> &dof_handler,
1021 const std::function<void(const unsigned int, VectorType &)>
1023
1034 void
1035 prolongate(const unsigned int to_level,
1036 VectorType &dst,
1037 const VectorType &src) const override;
1038
1042 void
1043 prolongate_and_add(const unsigned int to_level,
1044 VectorType &dst,
1045 const VectorType &src) const override;
1046
1050 virtual void
1051 restrict_and_add(const unsigned int from_level,
1052 VectorType &dst,
1053 const VectorType &src) const override;
1054
1064 template <class InVector>
1065 void
1066 copy_to_mg(const DoFHandler<dim> &dof_handler,
1068 const InVector &src) const;
1069
1079 template <class OutVector>
1080 void
1081 copy_from_mg(const DoFHandler<dim> &dof_handler,
1082 OutVector &dst,
1083 const MGLevelObject<VectorType> &src) const;
1084
1103 template <class InVector>
1104 void
1107 const InVector &src) const;
1108
1117 template <class InVector>
1118 void
1119 interpolate_to_mg(MGLevelObject<VectorType> &dst, const InVector &src) const;
1120
1134 std::size_t
1136
1140 unsigned int
1141 min_level() const;
1142
1146 unsigned int
1147 max_level() const;
1148
1153 void
1155
1158private:
1164 void
1166 const DoFHandler<dim> &dof_handler,
1168
1172 std::pair<const DoFHandler<dim> *, unsigned int>
1174
1180 void
1182 const DoFHandler<dim> &dof_handler);
1183
1187 template <typename MGTwoLevelTransferObject>
1188 void
1191
1195 template <class InVector>
1196 void
1197 initialize_dof_vector(const unsigned int level,
1198 VectorType &vector,
1199 const InVector &vector_reference,
1200 const bool omit_zeroing_entries) const;
1201
1207 void
1208 assert_dof_handler(const DoFHandler<dim> &dof_handler_out) const;
1209
1216
1221
1225 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1227};
1228
1229
1230
1236template <int dim, typename Number>
1238 : public MGTransferBlockMatrixFreeBase<dim, Number, MGTransferMF<dim, Number>>
1239{
1240public:
1245
1252
1258 MGTransferBlockMF(const MGConstrainedDoFs &mg_constrained_dofs);
1259
1265 MGTransferBlockMF(const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1266
1272 void
1273 initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs);
1274
1280 void
1282 const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1283
1289 void
1290 build(const DoFHandler<dim> &dof_handler);
1291
1297 void
1298 build(const std::vector<const DoFHandler<dim> *> &dof_handler);
1299
1300protected:
1302 get_matrix_free_transfer(const unsigned int b) const override;
1303
1304private:
1308 std::vector<MGTransferMF<dim, Number>> transfer_operators_internal;
1309
1313 std::vector<SmartPointer<const MGTransferMF<dim, Number>>> transfer_operators;
1314};
1315
1316
1317
1318template <int dim, typename VectorType>
1321
1322template <int dim, typename VectorType>
1325
1326
1327
1328#ifndef DOXYGEN
1329
1330/* ----------------------- Inline functions --------------------------------- */
1331
1332
1333
1334template <int dim, typename Number>
1335template <typename MGTwoLevelTransferObject>
1338 const std::function<void(const unsigned int, VectorType &)>
1339 &initialize_dof_vector)
1340{
1341 this->transfer.clear();
1342 this->internal_transfer.clear();
1343
1344 this->initialize_transfer_references(transfer);
1345 this->build(initialize_dof_vector);
1346}
1347
1348
1349
1350template <int dim, typename Number>
1351template <typename MGTwoLevelTransferObject>
1352void
1355{
1356 this->initialize_transfer_references(transfer);
1357}
1358
1359
1360
1361template <int dim, typename Number>
1362template <typename MGTwoLevelTransferObject>
1363void
1366{
1367 const unsigned int min_level = transfer.min_level();
1368 const unsigned int max_level = transfer.max_level();
1369
1370 this->transfer.resize(min_level, max_level);
1371
1372 for (unsigned int l = min_level; l <= max_level; ++l)
1373 this->transfer[l] = &const_cast<MGTwoLevelTransferBase<VectorType> &>(
1374 static_cast<const MGTwoLevelTransferBase<VectorType> &>(
1375 Utilities::get_underlying_value(transfer[l])));
1376}
1377
1378
1379
1380template <int dim, typename Number>
1381template <class InVector>
1382void
1384 const unsigned int level,
1385 VectorType &vec,
1386 const InVector &vec_reference,
1387 const bool omit_zeroing_entries) const
1388{
1389 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1390
1391 if (external_partitioners.empty())
1392 {
1393 partitioner = vec_reference.get_partitioner();
1394 }
1395 else
1396 {
1397 Assert(transfer.min_level() <= level && level <= transfer.max_level(),
1399
1400 partitioner = external_partitioners[level - transfer.min_level()];
1401 }
1402
1403 // check if vectors are already correctly initialized
1404
1405 // yes: same partitioners are used
1406 if (vec.get_partitioner().get() == partitioner.get())
1407 {
1408 if (omit_zeroing_entries == false)
1409 vec = 0;
1410 return; // nothing to do
1411 }
1412
1413 // yes: vectors are compatible
1414 if (vec.size() == partitioner->size() &&
1415 vec.locally_owned_size() == partitioner->locally_owned_size())
1416 {
1417 if (omit_zeroing_entries == false)
1418 vec = 0;
1419 return; // nothing to do
1420 }
1421
1422 // no
1423 vec.reinit(partitioner, omit_zeroing_entries);
1424}
1425
1426
1427
1428template <int dim, typename Number>
1429template <class InVector>
1430void
1433 const InVector &src) const
1434{
1435 assert_dof_handler(dof_handler);
1436
1437 for (unsigned int level = dst.min_level(); level <= dst.max_level(); ++level)
1438 {
1439 const bool zero_out_values =
1440 (this->perform_plain_copy == false &&
1441 this->perform_renumbered_plain_copy == false) ||
1442 level != dst.max_level();
1443
1444 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1445 }
1446
1447 if (this->perform_plain_copy)
1448 {
1449 dst[dst.max_level()].copy_locally_owned_data_from(src);
1450 }
1451 else if (this->perform_renumbered_plain_copy)
1452 {
1453 auto &dst_level = dst[dst.max_level()];
1454
1455 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1456 dst_level.local_element(this->copy_indices.back()(1, i)) =
1457 src.local_element(i);
1458 }
1459 else
1460 {
1461 this->ghosted_global_vector = src;
1462 this->ghosted_global_vector.update_ghost_values();
1463
1464 for (unsigned int l = dst.max_level() + 1; l != dst.min_level();)
1465 {
1466 --l;
1467
1468 auto &dst_level = dst[l];
1469
1470 const auto copy_unknowns = [&](const auto &indices) {
1471 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1472 dst_level.local_element(indices(1, i)) =
1473 this->ghosted_global_vector.local_element(indices(0, i));
1474 };
1475
1476 copy_unknowns(this->copy_indices[l]);
1477 copy_unknowns(this->copy_indices_level_mine[l]);
1478
1479 dst_level.compress(VectorOperation::insert);
1480 }
1481 }
1482}
1483
1484
1485
1486template <int dim, typename Number>
1487template <class OutVector>
1488void
1490 const DoFHandler<dim> &dof_handler,
1491 OutVector &dst,
1492 const MGLevelObject<VectorType> &src) const
1493{
1494 assert_dof_handler(dof_handler);
1495
1496 if (this->perform_plain_copy)
1497 {
1498 dst.zero_out_ghost_values();
1499 dst.copy_locally_owned_data_from(src[src.max_level()]);
1500 }
1501 else if (this->perform_renumbered_plain_copy)
1502 {
1503 const auto &src_level = src[src.max_level()];
1504 dst.zero_out_ghost_values();
1505 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1506 dst.local_element(i) =
1507 src_level.local_element(this->copy_indices.back()(1, i));
1508 }
1509 else
1510 {
1511 dst = 0;
1512 for (unsigned int l = src.min_level(); l <= src.max_level(); ++l)
1513 {
1514 auto &ghosted_vector = this->ghosted_level_vector[l];
1515
1516 if (this->ghosted_level_vector[l].size() > 0)
1517 ghosted_vector = src[l];
1518
1519 const auto *const ghosted_vector_ptr =
1520 (this->ghosted_level_vector[l].size() > 0) ? &ghosted_vector :
1521 &src[l];
1522
1523 ghosted_vector_ptr->update_ghost_values();
1524
1525 const auto copy_unknowns = [&](const auto &indices) {
1526 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1527 dst.local_element(indices(0, i)) =
1528 ghosted_vector_ptr->local_element(indices(1, i));
1529 };
1530
1531 copy_unknowns(this->copy_indices[l]);
1532 copy_unknowns(this->copy_indices_global_mine[l]);
1533 }
1534 dst.compress(VectorOperation::insert);
1535 }
1536}
1537
1538
1539
1540template <int dim, typename Number>
1541template <class InVector>
1542void
1544 const InVector &src) const
1545{
1546 DoFHandler<dim> dof_handler_dummy;
1547
1548 this->interpolate_to_mg(dof_handler_dummy, dst, src);
1549}
1550
1551
1552
1553template <int dim, typename Number>
1554template <class InVector>
1555void
1558 const InVector &src) const
1559{
1560 assert_dof_handler(dof_handler);
1561
1562 const unsigned int min_level = transfer.min_level();
1563 const unsigned int max_level = transfer.max_level();
1564
1565 AssertDimension(min_level, dst.min_level());
1566 AssertDimension(max_level, dst.max_level());
1567
1568 for (unsigned int level = min_level; level <= max_level; ++level)
1569 {
1570 const bool zero_out_values = false;
1571 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1572 }
1573
1574 if (this->perform_plain_copy)
1575 {
1576 dst[max_level].copy_locally_owned_data_from(src);
1577
1578 for (unsigned int l = max_level; l > min_level; --l)
1579 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1580 }
1581 else if (this->perform_renumbered_plain_copy)
1582 {
1583 auto &dst_level = dst[max_level];
1584
1585 for (unsigned int i = 0; i < this->solution_copy_indices.back().n_cols();
1586 ++i)
1587 dst_level.local_element(this->solution_copy_indices.back()(1, i)) =
1588 src.local_element(i);
1589
1590 for (unsigned int l = max_level; l > min_level; --l)
1591 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1592 }
1593 else
1594 {
1595 this->solution_ghosted_global_vector = src;
1596 this->solution_ghosted_global_vector.update_ghost_values();
1597
1598 for (unsigned int l = max_level + 1; l != min_level;)
1599 {
1600 --l;
1601
1602 auto &dst_level = dst[l];
1603
1604 const auto copy_unknowns = [&](const auto &indices) {
1605 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1606 dst_level.local_element(indices(1, i)) =
1607 this->solution_ghosted_global_vector.local_element(
1608 indices(0, i));
1609 };
1610
1611 copy_unknowns(this->solution_copy_indices[l]);
1612 copy_unknowns(this->solution_copy_indices_level_mine[l]);
1613
1614 dst_level.compress(VectorOperation::insert);
1615
1616 if (l != min_level)
1617 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1618 }
1619 }
1620}
1621
1622#endif
1623
1625
1626#endif
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)
MGTransferBlockMF()=default
void build(const DoFHandler< dim > &dof_handler)
const MGTransferMF< dim, Number > & get_matrix_free_transfer(const unsigned int b) const override
std::vector< SmartPointer< const MGTransferMF< dim, Number > > > transfer_operators
void initialize_constraints(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
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 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_internal_transfer(const DoFHandler< dim > &dof_handler, const SmartPointer< 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)
MGLevelObject< SmartPointer< MGTwoLevelTransferBase< VectorType > > > transfer
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
virtual void 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
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 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)
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
void restrict_and_add(VectorType &dst, const VectorType &src) const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse_embedded
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
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
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 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
SmartPointer< const DoFHandler< dim > > dof_handler_fine
SmartPointer< const DoFHandler< dim > > dof_handler_fine
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
AlignedVector< VectorizedArrayType > weights_compressed
void 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
typename VectorType::value_type Number
void interpolate(VectorType &dst, const VectorType &src) const override
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType, types::global_dof_index > constraint_info_coarse
static bool fast_polynomial_transfer_supported(const unsigned int fe_degree_fine, const unsigned int fe_degree_coarse)
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)
void restrict_and_add_internal(VectorType &dst, const VectorType &src) const override
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:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
unsigned int level
Definition grid_out.cc:4626
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
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
spacedim const DoFHandler< dim, spacedim > const FullMatrix< double > & transfer
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
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