]> https://gitweb.dealii.org/ - dealii.git/commitdiff
review
authorMarco Feder <marco.feder@sissa.it>
Thu, 27 Apr 2023 12:50:33 +0000 (14:50 +0200)
committerMarco Feder <marco.feder@sissa.it>
Thu, 27 Apr 2023 12:50:33 +0000 (14:50 +0200)
include/deal.II/multigrid/mg_transfer_global_coarsening.h
include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h

index d83ca0bafd16400f1a3ef1373611b57593c08291..7fe96f979bce85f1241207a08207fd6bb14d02ea 100644 (file)
@@ -153,7 +153,9 @@ namespace MGTransferGlobalCoarseningTools
 } // namespace MGTransferGlobalCoarseningTools
 
 
-
+/**
+ * Abstract base class for transfer operators between two multigrid levels.
+ */
 template <typename VectorType>
 class MGTwoLevelTransferBase : public Subscriptor
 {
@@ -198,7 +200,13 @@ public:
 };
 
 
-
+/**
+ * Base class for transfer operators between two multigrid levels.
+ * Specialization for LinearAlgebra::distributed::Vector. The implementation of
+ * restriction and prolongation between levels is delegated to derived classes,
+ * which implement prolongate_and_add_internal() and restrict_and_add_internal()
+ * accordingly.
+ */
 template <typename Number>
 class MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>
   : public Subscriptor
@@ -220,9 +228,7 @@ public:
 
   /**
    * Perform interpolation of a solution vector from the fine level to the
-   * coarse level. This function is different from restriction, where a
-   * weighted residual is transferred to a coarser level (transposition of
-   * prolongation matrix).
+   * coarse level.
    */
   virtual void
   interpolate(VectorType &dst, const VectorType &src) const = 0;
@@ -246,7 +252,7 @@ public:
 
 protected:
   /**
-   * Perform prolongation.
+   * Perform prolongation on vectors with correct ghosting.
    */
   virtual void
   prolongate_and_add_internal(
@@ -254,21 +260,36 @@ protected:
     const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
 
   /**
-   * Perform restriction.
+   * Perform restriction on vectors with correct ghosting.
    */
   virtual void
   restrict_and_add_internal(
     LinearAlgebra::distributed::Vector<Number> &      dst,
     const LinearAlgebra::distributed::Vector<Number> &src) const = 0;
 
+  /**
+   * A wrapper around update_ghost_values() optimized in case the
+   * present vector has the same parallel layout of one of the external
+   * partitioners.
+   */
   void
   update_ghost_values(
     const LinearAlgebra::distributed::Vector<Number> &vec) const;
 
+  /**
+   * A wrapper around compress() optimized in case the
+   * present vector has the same parallel layout of one of the external
+   * partitioners.
+   */
   void
   compress(LinearAlgebra::distributed::Vector<Number> &vec,
            const VectorOperation::values               op) const;
 
+  /**
+   * A wrapper around zero_out_ghost_values() optimized in case the
+   * present vector has the same parallel layout of one of the external
+   * partitioners.
+   */
   void
   zero_out_ghost_values(
     const LinearAlgebra::distributed::Vector<Number> &vec) const;
@@ -277,13 +298,14 @@ protected:
    * Enable inplace vector operations if external and internal vectors
    * are compatible.
    */
-  template <typename ConstraintInfo>
+  template <int dim, std::size_t width>
   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,
-    ConstraintInfo &                                          constraint_info);
+    internal::MatrixFreeFunctions::
+      ConstraintInfo<dim, VectorizedArray<Number, width>> &constraint_info);
 
   /**
    * Flag if the finite elements on the fine cells are continuous. If yes,
@@ -373,9 +395,7 @@ public:
 
   /**
    * Perform interpolation of a solution vector from the fine level to the
-   * coarse level. This function is different from restriction, where a
-   * weighted residual is transferred to a coarser level (transposition of
-   * prolongation matrix).
+   * coarse level.
    */
   void
   interpolate(VectorType &dst, const VectorType &src) const override;
@@ -484,9 +504,7 @@ public:
 
   /**
    * Perform interpolation of a solution vector from the fine level to the
-   * coarse level. This function is different from restriction, where a
-   * weighted residual is transferred to a coarser level (transposition of
-   * prolongation matrix).
+   * coarse level.
    */
   void
   interpolate(
index dd8f5648ce6256eaf412b5ca499d57e4e70065fc..1a53fe6e8f841cdf672c46cee88082d636a15973 100644 (file)
@@ -3113,15 +3113,16 @@ namespace internal
 } // namespace internal
 
 template <typename Number>
-template <typename ConstraintInfo>
+template <int dim, std::size_t width>
 void
 MGTwoLevelTransferBase<LinearAlgebra::distributed::Vector<Number>>::
   internal_enable_inplace_operations_if_possible(
     const std::shared_ptr<const Utilities::MPI::Partitioner>
       &external_partitioner_coarse,
     const std::shared_ptr<const Utilities::MPI::Partitioner>
-      &             external_partitioner_fine,
-    ConstraintInfo &constraint_info)
+      &external_partitioner_fine,
+    internal::MatrixFreeFunctions::
+      ConstraintInfo<dim, VectorizedArray<Number, width>> &constraint_info)
 {
   if (this->partitioner_coarse->is_globally_compatible(
         *external_partitioner_coarse))

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.