]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Extend docu of MatrixFree::initialize_dof_vector() 13484/head
authorPeter Munch <peterrmuench@gmail.com>
Thu, 3 Mar 2022 08:11:12 +0000 (09:11 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Tue, 8 Mar 2022 12:14:54 +0000 (13:14 +0100)
include/deal.II/matrix_free/matrix_free.h

index 043d331fe20ff5aafec3b53eccda00abc199f627..c8d7e110ded4d0d7f1bc3888794ab4cdea67c800 100644 (file)
@@ -1522,14 +1522,30 @@ public:
   initialize_face_data_vector(AlignedVector<T> &vec) const;
 
   /**
-   * Initialize function for a general vector. The length of the vector is
-   * equal to the total number of degrees in the DoFHandler. Vector entries
-   * are initialized with zero. For vector-valued problems with several
-   * DoFHandlers underlying this class, the parameter @p vector_component
-   * defines which component is to be used.
+   * Initialize function for a general serial non-block vector.
+   * After a call to this function, the length of the vector is equal to the
+   * total number of degrees of freedom in the DoFHandler. Vector entries are
+   * initialized with zero.
    *
-   * For the vectors used with MatrixFree and in FEEvaluation, a vector needs
-   * to hold all
+   * If MatrixFree was set up with several DoFHandler objects, the parameter
+   * @p dof_handler_index defines which component is to be used.
+   *
+   * @note Serial vectors also include Trilinos and PETSc vectors; however
+   * in these cases, MatrixFree has to be used in a serial context, i.e., the
+   * size of the communicator has to be exactly one.
+   */
+  template <typename VectorType>
+  void
+  initialize_dof_vector(VectorType &       vec,
+                        const unsigned int dof_handler_index = 0) const;
+
+  /**
+   * Specialization of the method initialize_dof_vector() for the
+   * class LinearAlgebra::distributed::Vector@<Number@>.
+   * See the other function with the same name for the general descriptions.
+   *
+   * @note For the parallel vectors used with MatrixFree and in FEEvaluation, a
+   * vector needs to hold all
    * @ref GlossLocallyActiveDof "locally active DoFs"
    * and also some of the
    * @ref GlossLocallyRelevantDof "locally relevant DoFs".
@@ -1540,17 +1556,6 @@ public:
    * accessed in matrix-vector products and result in too much data sent
    * around which impacts the performance.
    */
-  template <typename VectorType>
-  void
-  initialize_dof_vector(VectorType &       vec,
-                        const unsigned int dof_handler_index = 0) const;
-
-  /**
-   * See the other function with the same name for descriptions.
-   *
-   * Since the vector is of class LinearAlgebra::distributed::Vector@<Number@>,
-   * the ghost entries are set accordingly.
-   */
   template <typename Number2>
   void
   initialize_dof_vector(LinearAlgebra::distributed::Vector<Number2> &vec,
@@ -2235,6 +2240,12 @@ MatrixFree<dim, Number, VectorizedArrayType>::initialize_dof_vector(
   VectorType &       vec,
   const unsigned int comp) const
 {
+  static_assert(IsBlockVector<VectorType>::value == false,
+                "This function is not supported for block vectors.");
+
+  Assert(task_info.n_procs == 1,
+         ExcMessage("This function can only be used in serial."));
+
   AssertIndexRange(comp, n_components());
   vec.reinit(dof_info[comp].vector_partitioner->size());
 }

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.