Reference documentation for deal.II version GIT relicensing-1062-gc06da148b8 2024-07-15 19:20: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
265 virtual std::pair<bool, bool>
267 const std::shared_ptr<const Utilities::MPI::Partitioner>
269 const std::shared_ptr<const Utilities::MPI::Partitioner>
270 &partitioner_fine) = 0;
271
275 virtual std::size_t
277
278protected:
282 virtual void
285 const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
286
290 virtual void
293 const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
294
300 void
301 update_ghost_values(const VectorType &vec) const;
302
308 void
309 compress(VectorType &vec, const VectorOperation::values op) const;
310
316 void
317 zero_out_ghost_values(const VectorType &vec) const;
318
323 template <int dim, std::size_t width, typename IndexType>
324 std::pair<bool, bool>
326 const std::shared_ptr<const Utilities::MPI::Partitioner>
328 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine,
331 ConstraintInfo<dim, VectorizedArray<Number, width>, IndexType>
332 &constraint_info_coarse,
333 std::vector<unsigned int> &dof_indices_fine);
334
341
342public:
346 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_coarse;
347
351 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine;
352
353protected:
358
367
372
377 std::shared_ptr<const Utilities::MPI::Partitioner>
379
384 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine_embedded;
385
391
397};
398
399
400
406template <int dim, typename VectorType>
408{
409public:
410 static_assert(
411 std::is_same_v<
412 VectorType,
414 "This class is currently only implemented for vectors of "
415 "type LinearAlgebra::distributed::Vector.");
416
420 using Number = typename VectorType::value_type;
421
427
433 void
436 const DoFHandler<dim> &dof_handler_coarse,
437 const AffineConstraints<Number> &constraint_fine =
439 const AffineConstraints<Number> &constraint_coarse =
441 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
442 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
443
453 void
456 const DoFHandler<dim> &dof_handler_coarse,
457 const AffineConstraints<Number> &constraint_fine =
459 const AffineConstraints<Number> &constraint_coarse =
461 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
462 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
463
477 void
479 const DoFHandler<dim> &dof_handler_coarse,
480 const AffineConstraints<Number> &constraint_fine =
482 const AffineConstraints<Number> &constraint_coarse =
484 const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
485 const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
486
495 static bool
496 fast_polynomial_transfer_supported(const unsigned int fe_degree_fine,
497 const unsigned int fe_degree_coarse);
498
502 void
503 interpolate(VectorType &dst, const VectorType &src) const override;
504
509 std::pair<bool, bool>
511 const std::shared_ptr<const Utilities::MPI::Partitioner>
513 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
514 override;
515
519 std::size_t
520 memory_consumption() const override;
521
522protected:
523 void
525 const VectorType &src) const override;
526
527 void
529 const VectorType &src) const override;
530
531private:
600
604 std::vector<MGTransferScheme> schemes;
605
610 internal::MatrixFreeFunctions::
611 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
613
617 internal::MatrixFreeFunctions::
618 ConstraintInfo<dim, VectorizedArrayType, types::global_dof_index>
620
624 std::vector<Number> weights; // TODO: vectorize
625
631
635 unsigned int n_components;
636
641
645 unsigned int mg_level_fine;
646
648
649 friend class MGTransferMF<dim, Number>;
650};
651
652
653
657template <int dim, typename VectorType>
659{
660private:
661 static_assert(
662 std::is_same_v<
663 VectorType,
665 "This class is currently only implemented for vectors of "
666 "type LinearAlgebra::distributed::Vector.");
667
668 using Number = typename VectorType::value_type;
670
672
673public:
681 {
691 AdditionalData(const double tolerance = 1e-6,
692 const unsigned int rtree_level = 0,
693 const bool enforce_all_points_found = true)
697 {}
698
703 double tolerance;
704
710 unsigned int rtree_level;
711
720 };
721
726
731 void
733 const DoFHandler<dim> &dof_handler_coarse,
734 const Mapping<dim> &mapping_fine,
735 const Mapping<dim> &mapping_coarse,
736 const AffineConstraints<Number> &constraint_fine =
738 const AffineConstraints<Number> &constraint_coarse =
740
747 void
748 interpolate(VectorType &dst, const VectorType &src) const override;
749
754 std::pair<bool, bool>
756 const std::shared_ptr<const Utilities::MPI::Partitioner>
758 const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
759 override;
760
764 std::size_t
765 memory_consumption() const override;
766
770 boost::signals2::connection
771 connect_prolongation_cell_loop(const std::function<void(const bool)> &slot);
772
776 boost::signals2::connection
777 connect_restriction_cell_loop(const std::function<void(const bool)> &slot);
778
782 boost::signals2::connection
783 connect_prolongation(const std::function<void(const bool)> &slot);
784
788 boost::signals2::connection
789 connect_restriction(const std::function<void(const bool)> &slot);
790
791protected:
796 void
798 const VectorType &src) const override;
799
803 void
805 const VectorType &src) const override;
806
807private:
811 template <int n_components>
812 void
814 const VectorType &src) const;
815
819 template <int n_components>
820 void
821 restrict_and_add_internal_comp(VectorType &dst, const VectorType &src) const;
822
827
831 unsigned int mg_level_fine;
832
838
842 mutable std::vector<Number> rpe_input_output;
843
847 mutable std::vector<Number> rpe_buffer;
848
852 std::shared_ptr<NonMatching::MappingInfo<dim, dim, Number>> mapping_info;
853
858 internal::MatrixFreeFunctions::
859 ConstraintInfo<dim, VectorizedArrayType, unsigned int>
861
865 std::unique_ptr<FiniteElement<dim>> fe_coarse;
866
871 std::vector<unsigned int> level_dof_indices_fine;
872
878 std::vector<unsigned int> level_dof_indices_fine_ptrs;
879
880 friend class MGTransferMF<dim, Number>;
881};
882
883
884
913template <int dim, typename Number>
915 LinearAlgebra::distributed::Vector<Number>>
916{
917public:
922
929
944 template <typename MGTwoLevelTransferObject>
946 const std::function<void(const unsigned int, VectorType &)>
948
952 template <typename MGTwoLevelTransferObject>
953 void
956
965 void
966 build(const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
968
973 void
974 build(const std::function<void(const unsigned int, VectorType &)>
976
991
997 void
999
1016 void
1017 build(const DoFHandler<dim> &dof_handler,
1018 const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1019 &external_partitioners = {});
1020
1030 void
1031 build(const DoFHandler<dim> &dof_handler,
1032 const std::function<void(const unsigned int, VectorType &)>
1034
1045 void
1046 prolongate(const unsigned int to_level,
1047 VectorType &dst,
1048 const VectorType &src) const override;
1049
1053 void
1054 prolongate_and_add(const unsigned int to_level,
1055 VectorType &dst,
1056 const VectorType &src) const override;
1057
1061 virtual void
1062 restrict_and_add(const unsigned int from_level,
1063 VectorType &dst,
1064 const VectorType &src) const override;
1065
1075 template <class InVector>
1076 void
1077 copy_to_mg(const DoFHandler<dim> &dof_handler,
1079 const InVector &src) const;
1080
1090 template <class OutVector>
1091 void
1092 copy_from_mg(const DoFHandler<dim> &dof_handler,
1093 OutVector &dst,
1094 const MGLevelObject<VectorType> &src) const;
1095
1114 template <class InVector>
1115 void
1118 const InVector &src) const;
1119
1128 template <class InVector>
1129 void
1130 interpolate_to_mg(MGLevelObject<VectorType> &dst, const InVector &src) const;
1131
1145 std::size_t
1147
1151 unsigned int
1152 min_level() const;
1153
1157 unsigned int
1158 max_level() const;
1159
1164 void
1166
1169private:
1175 void
1177 const DoFHandler<dim> &dof_handler,
1179
1183 std::pair<const DoFHandler<dim> *, unsigned int>
1185
1191 void
1193 const DoFHandler<dim> &dof_handler);
1194
1198 template <typename MGTwoLevelTransferObject>
1199 void
1202
1206 template <class InVector>
1207 void
1208 initialize_dof_vector(const unsigned int level,
1209 VectorType &vector,
1210 const InVector &vector_reference,
1211 const bool omit_zeroing_entries) const;
1212
1218 void
1219 assert_dof_handler(const DoFHandler<dim> &dof_handler_out) const;
1220
1227
1232
1236 std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1238};
1239
1240
1241
1247template <int dim, typename Number>
1249 : public MGTransferBlockMatrixFreeBase<dim, Number, MGTransferMF<dim, Number>>
1250{
1251public:
1256
1263
1269 MGTransferBlockMF(const MGConstrainedDoFs &mg_constrained_dofs);
1270
1276 MGTransferBlockMF(const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1277
1283 void
1284 initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs);
1285
1291 void
1293 const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1294
1300 void
1301 build(const DoFHandler<dim> &dof_handler);
1302
1308 void
1309 build(const std::vector<const DoFHandler<dim> *> &dof_handler);
1310
1311protected:
1313 get_matrix_free_transfer(const unsigned int b) const override;
1314
1315private:
1319 std::vector<MGTransferMF<dim, Number>> transfer_operators_internal;
1320
1324 std::vector<SmartPointer<const MGTransferMF<dim, Number>>> transfer_operators;
1325};
1326
1327
1328
1329template <int dim, typename VectorType>
1332
1333template <int dim, typename VectorType>
1336
1337
1338
1339#ifndef DOXYGEN
1340
1341/* ----------------------- Inline functions --------------------------------- */
1342
1343
1344
1345template <int dim, typename Number>
1346template <typename MGTwoLevelTransferObject>
1349 const std::function<void(const unsigned int, VectorType &)>
1350 &initialize_dof_vector)
1351{
1352 this->transfer.clear();
1353 this->internal_transfer.clear();
1354
1355 this->initialize_transfer_references(transfer);
1356 this->build(initialize_dof_vector);
1357}
1358
1359
1360
1361template <int dim, typename Number>
1362template <typename MGTwoLevelTransferObject>
1363void
1366{
1367 this->initialize_transfer_references(transfer);
1368}
1369
1370
1371
1372template <int dim, typename Number>
1373template <typename MGTwoLevelTransferObject>
1374void
1377{
1378 const unsigned int min_level = transfer.min_level();
1379 const unsigned int max_level = transfer.max_level();
1380
1381 this->transfer.resize(min_level, max_level);
1382
1383 for (unsigned int l = min_level; l <= max_level; ++l)
1384 this->transfer[l] = &const_cast<MGTwoLevelTransferBase<VectorType> &>(
1385 static_cast<const MGTwoLevelTransferBase<VectorType> &>(
1386 Utilities::get_underlying_value(transfer[l])));
1387}
1388
1389
1390
1391template <int dim, typename Number>
1392template <class InVector>
1393void
1395 const unsigned int level,
1396 VectorType &vec,
1397 const InVector &vec_reference,
1398 const bool omit_zeroing_entries) const
1399{
1400 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1401
1402 if (external_partitioners.empty())
1403 {
1404 partitioner = vec_reference.get_partitioner();
1405 }
1406 else
1407 {
1408 Assert(transfer.min_level() <= level && level <= transfer.max_level(),
1410
1411 partitioner = external_partitioners[level - transfer.min_level()];
1412 }
1413
1414 // check if vectors are already correctly initialized
1415
1416 // yes: same partitioners are used
1417 if (vec.get_partitioner().get() == partitioner.get())
1418 {
1419 if (omit_zeroing_entries == false)
1420 vec = 0;
1421 return; // nothing to do
1422 }
1423
1424 // yes: vectors are compatible
1425 if (vec.size() == partitioner->size() &&
1426 vec.locally_owned_size() == partitioner->locally_owned_size())
1427 {
1428 if (omit_zeroing_entries == false)
1429 vec = 0;
1430 return; // nothing to do
1431 }
1432
1433 // no
1434 vec.reinit(partitioner, omit_zeroing_entries);
1435}
1436
1437
1438
1439template <int dim, typename Number>
1440template <class InVector>
1441void
1444 const InVector &src) const
1445{
1446 assert_dof_handler(dof_handler);
1447
1448 for (unsigned int level = dst.min_level(); level <= dst.max_level(); ++level)
1449 {
1450 const bool zero_out_values =
1451 (this->perform_plain_copy == false &&
1452 this->perform_renumbered_plain_copy == false) ||
1453 level != dst.max_level();
1454
1455 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1456 }
1457
1458 if (this->perform_plain_copy)
1459 {
1460 dst[dst.max_level()].copy_locally_owned_data_from(src);
1461 }
1462 else if (this->perform_renumbered_plain_copy)
1463 {
1464 auto &dst_level = dst[dst.max_level()];
1465
1466 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1467 dst_level.local_element(this->copy_indices.back()(1, i)) =
1468 src.local_element(i);
1469 }
1470 else
1471 {
1472 this->ghosted_global_vector = src;
1473 this->ghosted_global_vector.update_ghost_values();
1474
1475 for (unsigned int l = dst.max_level() + 1; l != dst.min_level();)
1476 {
1477 --l;
1478
1479 auto &dst_level = dst[l];
1480
1481 const auto copy_unknowns = [&](const auto &indices) {
1482 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1483 dst_level.local_element(indices(1, i)) =
1484 this->ghosted_global_vector.local_element(indices(0, i));
1485 };
1486
1487 copy_unknowns(this->copy_indices[l]);
1488 copy_unknowns(this->copy_indices_level_mine[l]);
1489
1490 dst_level.compress(VectorOperation::insert);
1491 }
1492 }
1493}
1494
1495
1496
1497template <int dim, typename Number>
1498template <class OutVector>
1499void
1501 const DoFHandler<dim> &dof_handler,
1502 OutVector &dst,
1503 const MGLevelObject<VectorType> &src) const
1504{
1505 assert_dof_handler(dof_handler);
1506
1507 if (this->perform_plain_copy)
1508 {
1509 dst.zero_out_ghost_values();
1510 dst.copy_locally_owned_data_from(src[src.max_level()]);
1511 }
1512 else if (this->perform_renumbered_plain_copy)
1513 {
1514 const auto &src_level = src[src.max_level()];
1515 dst.zero_out_ghost_values();
1516 for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1517 dst.local_element(i) =
1518 src_level.local_element(this->copy_indices.back()(1, i));
1519 }
1520 else
1521 {
1522 dst = 0;
1523 for (unsigned int l = src.min_level(); l <= src.max_level(); ++l)
1524 {
1525 auto &ghosted_vector = this->ghosted_level_vector[l];
1526
1527 if (this->ghosted_level_vector[l].size() > 0)
1528 ghosted_vector = src[l];
1529
1530 const auto *const ghosted_vector_ptr =
1531 (this->ghosted_level_vector[l].size() > 0) ? &ghosted_vector :
1532 &src[l];
1533
1534 ghosted_vector_ptr->update_ghost_values();
1535
1536 const auto copy_unknowns = [&](const auto &indices) {
1537 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1538 dst.local_element(indices(0, i)) =
1539 ghosted_vector_ptr->local_element(indices(1, i));
1540 };
1541
1542 copy_unknowns(this->copy_indices[l]);
1543 copy_unknowns(this->copy_indices_global_mine[l]);
1544 }
1545 dst.compress(VectorOperation::insert);
1546 }
1547}
1548
1549
1550
1551template <int dim, typename Number>
1552template <class InVector>
1553void
1555 const InVector &src) const
1556{
1557 DoFHandler<dim> dof_handler_dummy;
1558
1559 this->interpolate_to_mg(dof_handler_dummy, dst, src);
1560}
1561
1562
1563
1564template <int dim, typename Number>
1565template <class InVector>
1566void
1569 const InVector &src) const
1570{
1571 assert_dof_handler(dof_handler);
1572
1573 const unsigned int min_level = transfer.min_level();
1574 const unsigned int max_level = transfer.max_level();
1575
1576 AssertDimension(min_level, dst.min_level());
1577 AssertDimension(max_level, dst.max_level());
1578
1579 for (unsigned int level = min_level; level <= max_level; ++level)
1580 {
1581 const bool zero_out_values = false;
1582 this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1583 }
1584
1585 if (this->perform_plain_copy)
1586 {
1587 dst[max_level].copy_locally_owned_data_from(src);
1588
1589 for (unsigned int l = max_level; l > min_level; --l)
1590 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1591 }
1592 else if (this->perform_renumbered_plain_copy)
1593 {
1594 auto &dst_level = dst[max_level];
1595
1596 for (unsigned int i = 0; i < this->solution_copy_indices.back().n_cols();
1597 ++i)
1598 dst_level.local_element(this->solution_copy_indices.back()(1, i)) =
1599 src.local_element(i);
1600
1601 for (unsigned int l = max_level; l > min_level; --l)
1602 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1603 }
1604 else
1605 {
1606 this->solution_ghosted_global_vector = src;
1607 this->solution_ghosted_global_vector.update_ghost_values();
1608
1609 for (unsigned int l = max_level + 1; l != min_level;)
1610 {
1611 --l;
1612
1613 auto &dst_level = dst[l];
1614
1615 const auto copy_unknowns = [&](const auto &indices) {
1616 for (unsigned int i = 0; i < indices.n_cols(); ++i)
1617 dst_level.local_element(indices(1, i)) =
1618 this->solution_ghosted_global_vector.local_element(
1619 indices(0, i));
1620 };
1621
1622 copy_unknowns(this->solution_copy_indices[l]);
1623 copy_unknowns(this->solution_copy_indices_level_mine[l]);
1624
1625 dst_level.compress(VectorOperation::insert);
1626
1627 if (l != min_level)
1628 this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1629 }
1630 }
1631}
1632
1633#endif
1634
1636
1637#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
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
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
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
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)
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
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
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