From 73d2a534e41ca669e78fcf5f653d350498650524 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 4 Oct 2023 20:47:34 -0600 Subject: [PATCH] Add an example to the documentation. --- include/deal.II/base/index_set.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index be095d3858..12e5c5f3e7 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -371,6 +371,9 @@ public: * begin. This corresponds to the notion of a view: The * interval [begin, end) is a window through which we see * the set represented by the current object. + * + * A more general function of the same name, taking a mask instead + * of just an interval to define the view, is below. */ IndexSet get_view(const size_type begin, const size_type end) const; @@ -395,6 +398,30 @@ public: * within the mask. This corresponds to the notion of a view: * The mask is a window through which we see the set represented by the * current object. + * + * A typical case where this function is useful is as follows. Say, + * you have a block linear system in which you have blocks + * corresponding to variables $(u,p,T,c)$ (which you can think of as + * velocity, pressure, temperature, and chemical composition -- or + * whatever other kind of problem you are currently considering in + * your own work). We solve this in parallel, so every MPI process + * has its own `locally_owned_dofs` index set that describes which + * among all $N_\text{dofs}$ degrees of freedom this process + * owns. Let's assume we have developed a linear solver or + * preconditioner that first solves the coupled $u$-$T$ system, and + * once that is done, solves the $p$-$c$ system. In this case, it is + * often useful to set up block vectors with only two components + * corresponding to the $u$ and $T$ components, and later for only + * the $p$-$c$ components of the solution. The question is which of + * the components of these 2-block vectors are locally owned? The + * answer is that we need to get a view of the `locally_owned_dofs` + * index set in which we apply a mask that corresponds to the + * variables we're currently interested in. For the $u$-$T$ system, + * we need a mask (corresponding to an index set of size + * $N_\text{dofs}$ that contains all indices of $u$ degrees of + * freedom as well as all indices of $T$ degrees of freedom. The + * resulting view is an index set of size $N_u+N_T$ that contains + * the indices of the locally owned $u$ and $T$ degrees of freedom. */ IndexSet get_view(const IndexSet &mask) const; -- 2.39.5