Reference documentation for deal.II version GIT 7b2de2f2f9 2023-09-24 11:00: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\}}\)
mg_transfer_global_coarsening.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2020 - 2023 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_mg_transfer_global_coarsening_h
17 #define dealii_mg_transfer_global_coarsening_h
18 
22 
24 
27 
30 
33 
35 
36 
37 
39 
40 // Forward declarations
41 #ifndef DOXYGEN
42 namespace internal
43 {
44  class MGTwoLevelTransferImplementation;
45 }
46 
48 {
49  template <int dim, int spacedim>
50  class Base;
51 }
52 #endif
53 
54 
55 
60 {
69  {
74  bisect,
84  go_to_one
85  };
86 
91  unsigned int
93  const unsigned int degree,
94  const PolynomialCoarseningSequenceType &p_sequence);
95 
101  std::vector<unsigned int>
103  const unsigned int max_degree,
104  const PolynomialCoarseningSequenceType &p_sequence);
105 
116  template <int dim, int spacedim>
117  std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
120 
137  template <int dim, int spacedim>
138  std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
142  const bool preserve_fine_triangulation,
143  const bool repartition_fine_triangulation);
144 
150  template <int dim, int spacedim>
151  std::vector<std::shared_ptr<const Triangulation<dim, spacedim>>>
155  const bool repartition_fine_triangulation = false);
156 
157 } // namespace MGTransferGlobalCoarseningTools
158 
159 
163 template <typename VectorType>
165 {
166 public:
170  virtual void
171  prolongate_and_add(VectorType &dst, const VectorType &src) const = 0;
172 
176  virtual void
177  restrict_and_add(VectorType &dst, const VectorType &src) const = 0;
178 
185  virtual void
186  interpolate(VectorType &dst, const VectorType &src) const = 0;
187 
192  virtual void
194  const std::shared_ptr<const Utilities::MPI::Partitioner>
195  &partitioner_coarse,
196  const std::shared_ptr<const Utilities::MPI::Partitioner>
197  &partitioner_fine) = 0;
198 
202  virtual std::size_t
203  memory_consumption() const = 0;
204 };
205 
206 
214 template <typename Number>
216  : public Subscriptor
217 {
218 public:
220 
224  void
225  prolongate_and_add(VectorType &dst, const VectorType &src) const;
226 
230  void
231  restrict_and_add(VectorType &dst, const VectorType &src) const;
232 
237  virtual void
238  interpolate(VectorType &dst, const VectorType &src) const = 0;
239 
244  virtual void
246  const std::shared_ptr<const Utilities::MPI::Partitioner>
247  &partitioner_coarse,
248  const std::shared_ptr<const Utilities::MPI::Partitioner>
249  &partitioner_fine) = 0;
250 
254  virtual std::size_t
255  memory_consumption() const = 0;
256 
257 protected:
261  virtual void
264  const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
265 
269  virtual void
272  const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
273 
279  void
282 
288  void
290  const VectorOperation::values op) const;
291 
297  void
300 
305  template <int dim, std::size_t width>
306  void
308  const std::shared_ptr<const Utilities::MPI::Partitioner>
309  &partitioner_coarse,
310  const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine,
312  dim,
313  VectorizedArray<Number, width>> &constraint_info_coarse,
314  std::vector<unsigned int> &dof_indices_fine);
315 
322 
323 public:
327  std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_coarse;
328 
332  std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine;
333 
334 protected:
343 
348 
353  std::shared_ptr<const Utilities::MPI::Partitioner>
355 
360  std::shared_ptr<const Utilities::MPI::Partitioner> partitioner_fine_embedded;
361 
367 
373 };
374 
375 
376 
382 template <int dim, typename VectorType>
383 class MGTwoLevelTransfer : public MGTwoLevelTransferBase<VectorType>
384 {
385 public:
389  void
390  prolongate_and_add(VectorType &dst, const VectorType &src) const override;
391 
395  void
396  restrict_and_add(VectorType &dst, const VectorType &src) const override;
397 
402  void
403  interpolate(VectorType &dst, const VectorType &src) const override;
404 
409  void
411  const std::shared_ptr<const Utilities::MPI::Partitioner>
412  &partitioner_coarse,
413  const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
414  override;
415 
419  std::size_t
420  memory_consumption() const override;
421 };
422 
423 
424 
431 template <int dim, typename Number>
433  : public MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>
434 {
436 
437 public:
443  void
445  const DoFHandler<dim> &dof_handler_fine,
446  const DoFHandler<dim> &dof_handler_coarse,
447  const AffineConstraints<Number> &constraint_fine =
449  const AffineConstraints<Number> &constraint_coarse =
451  const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
452  const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
453 
463  void
465  const DoFHandler<dim> &dof_handler_fine,
466  const DoFHandler<dim> &dof_handler_coarse,
467  const AffineConstraints<Number> &constraint_fine =
469  const AffineConstraints<Number> &constraint_coarse =
471  const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
472  const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
473 
487  void
488  reinit(const DoFHandler<dim> &dof_handler_fine,
489  const DoFHandler<dim> &dof_handler_coarse,
490  const AffineConstraints<Number> &constraint_fine =
492  const AffineConstraints<Number> &constraint_coarse =
494  const unsigned int mg_level_fine = numbers::invalid_unsigned_int,
495  const unsigned int mg_level_coarse = numbers::invalid_unsigned_int);
496 
505  static bool
506  fast_polynomial_transfer_supported(const unsigned int fe_degree_fine,
507  const unsigned int fe_degree_coarse);
508 
513  void
516  const LinearAlgebra::distributed::Vector<Number> &src) const override;
517 
522  void
524  const std::shared_ptr<const Utilities::MPI::Partitioner>
525  &partitioner_coarse,
526  const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
527  override;
528 
532  std::size_t
533  memory_consumption() const override;
534 
535 protected:
536  void
539  const LinearAlgebra::distributed::Vector<Number> &src) const override;
540 
541  void
544  const LinearAlgebra::distributed::Vector<Number> &src) const override;
545 
546 private:
554  struct MGTransferScheme
555  {
559  unsigned int n_coarse_cells;
560 
568 
575  unsigned int n_dofs_per_cell_fine;
576 
580  unsigned int degree_coarse;
581 
587  unsigned int degree_fine;
588 
593 
598 
603 
608 
615  };
616 
620  std::vector<MGTransferScheme> schemes;
621 
628 
634 
638  std::vector<Number> weights; // TODO: vectorize
639 
645 
649  unsigned int n_components;
650 
651  friend class internal::MGTwoLevelTransferImplementation;
652 };
653 
654 
655 
660 template <int dim, typename VectorType>
662 {
663 public:
667  void
668  prolongate_and_add(VectorType &dst, const VectorType &src) const override;
669 
673  void
674  restrict_and_add(VectorType &dst, const VectorType &src) const override;
675 
682  void
683  interpolate(VectorType &dst, const VectorType &src) const override;
684 
688  std::size_t
689  memory_consumption() const override;
690 };
691 
692 
693 
700 template <int dim, typename Number>
703  : public MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>
704 {
705 private:
707 
708 public:
715  struct AdditionalData
716  {
726  AdditionalData(const double tolerance = 1e-6,
727  const unsigned int rtree_level = 0,
728  const bool enforce_all_points_found = true)
729  : tolerance(tolerance)
730  , rtree_level(rtree_level)
731  , enforce_all_points_found(enforce_all_points_found)
732  {}
733 
738  double tolerance;
739 
745  unsigned int rtree_level;
746 
755  };
756 
757  MGTwoLevelTransferNonNested(const AdditionalData &data = AdditionalData());
758 
763  void
764  reinit(const DoFHandler<dim> &dof_handler_fine,
765  const DoFHandler<dim> &dof_handler_coarse,
766  const Mapping<dim> &mapping_fine,
767  const Mapping<dim> &mapping_coarse,
768  const AffineConstraints<Number> &constraint_fine =
770  const AffineConstraints<Number> &constraint_coarse =
772 
779  void
782  const LinearAlgebra::distributed::Vector<Number> &src) const override;
783 
788  void
790  const std::shared_ptr<const Utilities::MPI::Partitioner>
791  &partitioner_coarse,
792  const std::shared_ptr<const Utilities::MPI::Partitioner> &partitioner_fine)
793  override;
794 
798  std::size_t
799  memory_consumption() const override;
800 
801 protected:
802  AdditionalData additional_data;
806  void
809  const LinearAlgebra::distributed::Vector<Number> &src) const override;
810 
814  void
817  const LinearAlgebra::distributed::Vector<Number> &src) const override;
818 
819 private:
823  template <int n_components>
824  void
828 
832  template <int n_components>
833  void
837 
843 
847  std::shared_ptr<NonMatching::MappingInfo<dim, dim, Number>> mapping_info;
848 
855 
859  std::unique_ptr<FiniteElement<dim>> fe_coarse;
860 
865  std::vector<unsigned int> level_dof_indices_fine;
866 
872  std::vector<unsigned int> level_dof_indices_fine_ptrs;
873 };
874 
875 
876 
905 template <int dim, typename Number>
907  LinearAlgebra::distributed::Vector<Number>>
908 {
909 public:
914 
920  MGTransferMF() = default;
921 
936  template <typename MGTwoLevelTransferObject>
938  const std::function<void(const unsigned int, VectorType &)>
939  &initialize_dof_vector = {});
940 
944  template <typename MGTwoLevelTransferObject>
945  void
948 
957  void
958  build(const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
959  &external_partitioners = {});
960 
965  void
966  build(const std::function<void(const unsigned int, VectorType &)>
968 
983 
989  void
991 
997  void
998  build(const DoFHandler<dim> &dof_handler,
999  const std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1000  &external_partitioners = {});
1001 
1008  void
1009  build(const DoFHandler<dim> &dof_handler,
1010  const std::function<void(const unsigned int, VectorType &)>
1012 
1023  void
1024  prolongate(const unsigned int to_level,
1025  VectorType &dst,
1026  const VectorType &src) const override;
1027 
1031  void
1032  prolongate_and_add(const unsigned int to_level,
1033  VectorType &dst,
1034  const VectorType &src) const override;
1035 
1039  virtual void
1040  restrict_and_add(const unsigned int from_level,
1041  VectorType &dst,
1042  const VectorType &src) const override;
1043 
1050  template <class InVector>
1051  void
1052  copy_to_mg(const DoFHandler<dim> &dof_handler,
1054  const InVector &src) const;
1055 
1062  template <class OutVector>
1063  void
1064  copy_from_mg(const DoFHandler<dim> &dof_handler,
1065  OutVector &dst,
1066  const MGLevelObject<VectorType> &src) const;
1067 
1080  template <class InVector>
1081  void
1082  interpolate_to_mg(MGLevelObject<VectorType> &dst, const InVector &src) const;
1083 
1090  template <class InVector>
1091  void
1094  const InVector &src) const;
1095 
1109  std::size_t
1111 
1115  unsigned int
1116  min_level() const;
1117 
1121  unsigned int
1122  max_level() const;
1123 
1128  void
1130 
1133 private:
1139  void
1141  const DoFHandler<dim> &dof_handler,
1143 
1147  template <typename MGTwoLevelTransferObject>
1148  void
1151 
1155  template <class InVector>
1156  void
1157  initialize_dof_vector(const unsigned int level,
1158  VectorType &vector,
1159  const InVector &vector_reference,
1160  const bool omit_zeroing_entries) const;
1161 
1168 
1173 
1177  std::vector<std::shared_ptr<const Utilities::MPI::Partitioner>>
1179 };
1180 
1181 
1182 
1188 template <int dim, typename Number>
1190  : public MGTransferBlockMatrixFreeBase<dim, Number, MGTransferMF<dim, Number>>
1191 {
1192 public:
1197 
1203  MGTransferBlockMF() = default;
1204 
1210  MGTransferBlockMF(const MGConstrainedDoFs &mg_constrained_dofs);
1211 
1217  MGTransferBlockMF(const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1218 
1224  void
1225  initialize_constraints(const MGConstrainedDoFs &mg_constrained_dofs);
1226 
1232  void
1234  const std::vector<MGConstrainedDoFs> &mg_constrained_dofs);
1235 
1241  void
1242  build(const DoFHandler<dim> &dof_handler);
1243 
1249  void
1250  build(const std::vector<const DoFHandler<dim> *> &dof_handler);
1251 
1252 protected:
1254  get_matrix_free_transfer(const unsigned int b) const override;
1255 
1256 private:
1260  std::vector<MGTransferMF<dim, Number>> transfer_operators_internal;
1261 
1265  std::vector<SmartPointer<const MGTransferMF<dim, Number>>> transfer_operators;
1266 };
1267 
1268 
1269 
1270 template <int dim, typename VectorType>
1273 
1274 template <int dim, typename VectorType>
1277 
1278 
1279 
1280 #ifndef DOXYGEN
1281 
1282 /* ----------------------- Inline functions --------------------------------- */
1283 
1284 
1285 
1286 template <int dim, typename Number>
1287 template <typename MGTwoLevelTransferObject>
1290  const std::function<void(const unsigned int, VectorType &)>
1291  &initialize_dof_vector)
1292 {
1293  this->intitialize_transfer_references(transfer);
1294  this->build(initialize_dof_vector);
1295 }
1296 
1297 
1298 
1299 template <int dim, typename Number>
1300 template <typename MGTwoLevelTransferObject>
1301 void
1304 {
1305  this->intitialize_transfer_references(transfer);
1306 }
1307 
1308 
1309 
1310 template <int dim, typename Number>
1311 template <typename MGTwoLevelTransferObject>
1312 void
1315 {
1316  const unsigned int min_level = transfer.min_level();
1317  const unsigned int max_level = transfer.max_level();
1318 
1319  this->transfer.resize(min_level, max_level);
1320 
1321  for (unsigned int l = min_level; l <= max_level; ++l)
1322  this->transfer[l] = &const_cast<MGTwoLevelTransferBase<VectorType> &>(
1323  static_cast<const MGTwoLevelTransferBase<VectorType> &>(
1324  Utilities::get_underlying_value(transfer[l])));
1325 }
1326 
1327 
1328 
1329 template <int dim, typename Number>
1330 template <class InVector>
1331 void
1333  const unsigned int level,
1334  VectorType &vec,
1335  const InVector &vec_reference,
1336  const bool omit_zeroing_entries) const
1337 {
1338  std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1339 
1340  if (external_partitioners.empty())
1341  {
1342  partitioner = vec_reference.get_partitioner();
1343  }
1344  else
1345  {
1346  Assert(transfer.min_level() <= level && level <= transfer.max_level(),
1347  ExcInternalError());
1348 
1349  partitioner = external_partitioners[level - transfer.min_level()];
1350  }
1351 
1352  // check if vectors are already correctly initialized
1353 
1354  // yes: same partitioners are used
1355  if (vec.get_partitioner().get() == partitioner.get())
1356  {
1357  if (omit_zeroing_entries == false)
1358  vec = 0;
1359  return; // nothing to do
1360  }
1361 
1362  // yes: vectors are compatible
1363  if (vec.size() == partitioner->size() &&
1364  vec.locally_owned_size() == partitioner->locally_owned_size())
1365  {
1366  if (omit_zeroing_entries == false)
1367  vec = 0;
1368  return; // nothing to do
1369  }
1370 
1371  // no
1372  vec.reinit(partitioner, omit_zeroing_entries);
1373 }
1374 
1375 
1376 
1377 template <int dim, typename Number>
1378 template <class InVector>
1379 void
1382  const InVector &src) const
1383 {
1384  (void)dof_handler;
1385 
1386  for (unsigned int level = dst.min_level(); level <= dst.max_level(); ++level)
1387  {
1388  const bool zero_out_values =
1389  (this->perform_plain_copy == false &&
1390  this->perform_renumbered_plain_copy == false) ||
1391  level != dst.max_level();
1392 
1393  this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1394  }
1395 
1396  if (this->perform_plain_copy)
1397  {
1398  dst[dst.max_level()].copy_locally_owned_data_from(src);
1399  }
1400  else if (this->perform_renumbered_plain_copy)
1401  {
1402  auto &dst_level = dst[dst.max_level()];
1403 
1404  for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1405  dst_level.local_element(this->copy_indices.back()(1, i)) =
1406  src.local_element(i);
1407  }
1408  else
1409  {
1410  this->ghosted_global_vector = src;
1411  this->ghosted_global_vector.update_ghost_values();
1412 
1413  for (unsigned int l = dst.max_level() + 1; l != dst.min_level();)
1414  {
1415  --l;
1416 
1417  auto &dst_level = dst[l];
1418 
1419  const auto copy_unknowns = [&](const auto &indices) {
1420  for (unsigned int i = 0; i < indices.n_cols(); ++i)
1421  dst_level.local_element(indices(1, i)) =
1422  this->ghosted_global_vector.local_element(indices(0, i));
1423  };
1424 
1425  copy_unknowns(this->copy_indices[l]);
1426  copy_unknowns(this->copy_indices_level_mine[l]);
1427 
1428  dst_level.compress(VectorOperation::insert);
1429  }
1430  }
1431 }
1432 
1433 
1434 
1435 template <int dim, typename Number>
1436 template <class OutVector>
1437 void
1439  const DoFHandler<dim> &dof_handler,
1440  OutVector &dst,
1441  const MGLevelObject<VectorType> &src) const
1442 {
1443  (void)dof_handler;
1444 
1445  if (this->perform_plain_copy)
1446  {
1447  dst.zero_out_ghost_values();
1448  dst.copy_locally_owned_data_from(src[src.max_level()]);
1449  }
1450  else if (this->perform_renumbered_plain_copy)
1451  {
1452  const auto &src_level = src[src.max_level()];
1453  dst.zero_out_ghost_values();
1454  for (unsigned int i = 0; i < this->copy_indices.back().n_cols(); ++i)
1455  dst.local_element(i) =
1456  src_level.local_element(this->copy_indices.back()(1, i));
1457  }
1458  else
1459  {
1460  dst = 0;
1461  for (unsigned int l = src.min_level(); l <= src.max_level(); ++l)
1462  {
1463  auto &ghosted_vector = this->ghosted_level_vector[l];
1464 
1465  if (this->ghosted_level_vector[l].size() > 0)
1466  ghosted_vector = src[l];
1467 
1468  const auto *const ghosted_vector_ptr =
1469  (this->ghosted_level_vector[l].size() > 0) ? &ghosted_vector :
1470  &src[l];
1471 
1472  ghosted_vector_ptr->update_ghost_values();
1473 
1474  const auto copy_unknowns = [&](const auto &indices) {
1475  for (unsigned int i = 0; i < indices.n_cols(); ++i)
1476  dst.local_element(indices(0, i)) =
1477  ghosted_vector_ptr->local_element(indices(1, i));
1478  };
1479 
1480  copy_unknowns(this->copy_indices[l]);
1481  copy_unknowns(this->copy_indices_global_mine[l]);
1482  }
1483  dst.compress(VectorOperation::insert);
1484  }
1485 }
1486 
1487 
1488 
1489 template <int dim, typename Number>
1490 template <class InVector>
1491 void
1493  const InVector &src) const
1494 {
1495  const unsigned int min_level = transfer.min_level();
1496  const unsigned int max_level = transfer.max_level();
1497 
1498  AssertDimension(min_level, dst.min_level());
1499  AssertDimension(max_level, dst.max_level());
1500 
1501  for (unsigned int level = min_level; level <= max_level; ++level)
1502  {
1503  const bool zero_out_values = false;
1504  this->initialize_dof_vector(level, dst[level], src, !zero_out_values);
1505  }
1506 
1507  if (this->perform_plain_copy)
1508  {
1509  dst[max_level].copy_locally_owned_data_from(src);
1510 
1511  for (unsigned int l = max_level; l > min_level; --l)
1512  this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1513  }
1514  else if (this->perform_renumbered_plain_copy)
1515  {
1516  auto &dst_level = dst[max_level];
1517 
1518  for (unsigned int i = 0; i < this->solution_copy_indices.back().n_cols();
1519  ++i)
1520  dst_level.local_element(this->solution_copy_indices.back()(1, i)) =
1521  src.local_element(i);
1522 
1523  for (unsigned int l = max_level; l > min_level; --l)
1524  this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1525  }
1526  else
1527  {
1528  this->solution_ghosted_global_vector = src;
1529  this->solution_ghosted_global_vector.update_ghost_values();
1530 
1531  for (unsigned int l = max_level + 1; l != min_level;)
1532  {
1533  --l;
1534 
1535  auto &dst_level = dst[l];
1536 
1537  const auto copy_unknowns = [&](const auto &indices) {
1538  for (unsigned int i = 0; i < indices.n_cols(); ++i)
1539  dst_level.local_element(indices(1, i)) =
1540  this->solution_ghosted_global_vector.local_element(
1541  indices(0, i));
1542  };
1543 
1544  copy_unknowns(this->solution_copy_indices[l]);
1545  copy_unknowns(this->solution_copy_indices_level_mine[l]);
1546 
1547  dst_level.compress(VectorOperation::insert);
1548 
1549  if (l != min_level)
1550  this->transfer[l]->interpolate(dst[l - 1], dst[l]);
1551  }
1552  }
1553 }
1554 
1555 
1556 
1557 template <int dim, typename Number>
1558 template <class InVector>
1559 void
1562  const InVector &src) const
1563 {
1564  (void)dof_handler;
1565 
1566  this->interpolate_to_mg(dst, src);
1567 }
1568 
1569 #endif
1570 
1572 
1573 #endif
std::function< void(const unsigned int, LinearAlgebra::distributed::Vector< Number > &)> initialize_dof_vector
Definition: mg_transfer.h:604
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)
const MGTransferMF< dim, Number > & get_matrix_free_transfer(const unsigned int b) const override
MGTransferBlockMF()=default
void build(const DoFHandler< dim > &dof_handler)
std::vector< SmartPointer< const MGTransferMF< dim, Number > > > transfer_operators
void initialize_constraints(const std::vector< MGConstrainedDoFs > &mg_constrained_dofs)
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 intitialize_internal_transfer(const DoFHandler< dim > &dof_handler, const SmartPointer< 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 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
void intitialize_transfer_references(const MGLevelObject< MGTwoLevelTransferObject > &transfer)
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 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)
MGTransferMF(const MGConstrainedDoFs &mg_constrained_dofs)
MGTransferMF()=default
MGLevelObject< MGTwoLevelTransfer< dim, VectorType > > internal_transfer
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 intitialize_two_level_transfers(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
void prolongate_and_add(VectorType &dst, const VectorType &src) const
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_fine_embedded
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
void compress(LinearAlgebra::distributed::Vector< Number > &vec, const VectorOperation::values op) const
void zero_out_ghost_values(const LinearAlgebra::distributed::Vector< Number > &vec) const
virtual void restrict_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const =0
virtual void interpolate(VectorType &dst, const VectorType &src) const =0
void update_ghost_values(const LinearAlgebra::distributed::Vector< Number > &vec) const
virtual void prolongate_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const =0
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner_coarse_embedded
void restrict_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, internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArray< Number, width >> &constraint_info_coarse, std::vector< unsigned int > &dof_indices_fine)
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
virtual std::size_t memory_consumption() const =0
virtual void restrict_and_add(VectorType &dst, const VectorType &src) const =0
virtual void interpolate(VectorType &dst, const VectorType &src) const =0
virtual void prolongate_and_add(VectorType &dst, const VectorType &src) const =0
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
std::shared_ptr< NonMatching::MappingInfo< dim, dim, Number > > mapping_info
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType > constraint_info
void prolongate_and_add_internal_comp(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const
void prolongate_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const override
void interpolate(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const override
void restrict_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const override
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 >())
void restrict_and_add_internal_comp(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const
void prolongate_and_add(VectorType &dst, const VectorType &src) const override
std::size_t memory_consumption() const override
void restrict_and_add(VectorType &dst, const VectorType &src) const override
void interpolate(VectorType &dst, const VectorType &src) const override
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType > constraint_info_fine
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
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 interpolate(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const override
static bool fast_polynomial_transfer_supported(const unsigned int fe_degree_fine, const unsigned int fe_degree_coarse)
void prolongate_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &src) const override
internal::MatrixFreeFunctions::ConstraintInfo< dim, VectorizedArrayType > constraint_info_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)
void restrict_and_add_internal(LinearAlgebra::distributed::Vector< Number > &dst, const LinearAlgebra::distributed::Vector< Number > &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)
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
void interpolate(VectorType &dst, const VectorType &src) const override
void restrict_and_add(VectorType &dst, const VectorType &src) const override
void prolongate_and_add(VectorType &dst, const VectorType &src) const override
std::size_t memory_consumption() const override
Abstract base class for mapping classes.
Definition: mapping.h:317
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
unsigned int level
Definition: grid_out.cc:4617
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
Definition: exceptions.h:1616
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1789
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)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
T & get_underlying_value(T &p)
Definition: utilities.h:1601
static const unsigned int invalid_unsigned_int
Definition: types.h:213
AdditionalData(const double tolerance=1e-6, const unsigned int rtree_level=0, const bool enforce_all_points_found=true)
const ::Triangulation< dim, spacedim > & tria