SubdomainOperator.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 
8 namespace LinearSolver::Schwarz {
9 
10 /*!
11  * \brief Abstract base class for the subdomain operator, i.e. the linear
12  * operator restricted to an element-centered Schwarz subdomain
13  *
14  * A subdomain operator must implement these member function templates
15  * - `operator()`: Applies the operator to the element-centered subdomain data.
16  * It must take these arguments, in this order:
17  * - `gsl::not_null<LinearSolver::Schwarz::ElementCenteredSubdomainData*>`:
18  * The data where the result of the operator applied to the operand should
19  * be written to
20  * - `LinearSolver::Schwarz::ElementCenteredSubdomainData`: The operand data
21  * to which the operator should be applied
22  * - `db::DataBox`: The element's DataBox. Can be used to retrieve any data on
23  * the subdomain geometry and to access and mutate persistent memory
24  * buffers.
25  *
26  * Since the subdomain operator has access to the element's DataBox, it can
27  * retrieve any background data, i.e. data that does not depend on the variables
28  * it operates on. Background data on overlap regions with other elements can be
29  * either initialized in advance if possible or communicated with the
30  * `LinearSolver::Schwarz::Actions::SendOverlapFields` and
31  * `LinearSolver::Schwarz::Actions::ReceiveOverlapFields` actions. Note that
32  * such communication should not be necessary between iterations of the Schwarz
33  * solve, but only between successive solves, because background data should not
34  * change during the solve. The Schwarz algorithm takes care of communicating
35  * all variable data that the subdomain operator operates on, whenever
36  * necessary. This variable data is passed to the operator as the `operand`
37  * argument (see above). It includes the data on the central element of the
38  * subdomain, as well as the data on overlap regions with neighbors. Since data
39  * on the entire subdomain is available, applying the subdomain operator
40  * requires _no_ communication between elements. This is the strength of the
41  * Schwarz algorithm: all subdomain solves are independent of each other (see
42  * `LinearSolver::Schwarz::Schwarz` for details).
43  *
44  * Here's an example of a subdomain operator that is the restriction of an
45  * explicit global matrix:
46  *
47  * \snippet Test_SchwarzAlgorithm.cpp subdomain_operator
48  */
49 template <size_t Dim>
51  public:
52  static constexpr size_t volume_dim = Dim;
53 
54  protected:
55  SubdomainOperator() = default;
56 };
57 
58 } // namespace LinearSolver::Schwarz
LinearSolver::Schwarz::SubdomainOperator
Abstract base class for the subdomain operator, i.e. the linear operator restricted to an element-cen...
Definition: SubdomainOperator.hpp:50
LinearSolver::Schwarz
Items related to the Schwarz linear solver.
Definition: CommunicateOverlapFields.hpp:37
cstddef