Debian Codegraph @

include/deal.II/meshworker/local_integrator.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2012 - 2025 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15
16 #ifndef dealii_mesh_worker_local_integrator_h
17 #define dealii_mesh_worker_local_integrator_h
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/base/enable_observer_pointer.h>
22 #include <deal.II/base/exceptions.h>
23
24 #include <functional>
25 #include <string>
26 #include <vector>
27
28 DEAL_II_NAMESPACE_OPEN
29
30 namespace MeshWorker
31 {
32 // Forward declarations
33 #ifndef DOXYGEN
34 template <int dim, int spacedim, typename number>
35 class DoFInfo;
36 template <int dim, int spacedim>
37 class IntegrationInfo;
38 #endif
39
40 /**
41 * A local integrator object, which can be used to simplify the call of
42 * loop(). Instead of providing the three local integration functions
43 * separately, we bundle them as virtual functions in this class.
44 *
45 * Additionally, since we cannot have a virtual null function, we provide
46 * flags, which allow us to indicate, whether we want to integrate on
47 * boundary and interior faces. These flags are true by default, but can be
48 * modified by applications to speed up the loop.
49 *
50 * If a function is not overloaded in a derived class, but its usage flag is
51 * true, the function will cause an exception ExcPureFunction.
52 *
53 * @deprecated This class is deprecated. It used to be the basis for
54 * integration via the MeshWorker::integration_loop() function, but the
55 * same functionality is available via MeshWorker::loop().
56 *
57 * @ingroup MeshWorker
58 */
59 template <int dim, int spacedim = dim, typename number = double>
60 class DEAL_II_DEPRECATED LocalIntegrator : public EnableObserverPointer
61 {
62 public:
63 /**
64 * The constructor setting default values, namely all integration flags to
65 * true.
66 */
67 LocalIntegrator();
68
69 /**
70 * The constructor setting integration flags to specified values.
71 */
72 LocalIntegrator(bool use_cell, bool use_boundary, bool use_face);
73
74 /**
75 * The empty virtual destructor.
76 */
77 virtual ~LocalIntegrator() override = default;
78
79 /**
80 * Virtual function for integrating on cells. Throws exception
81 * PureFunctionCalled if not overloaded by a derived class.
82 */
83 virtual void
84 cell(DoFInfo<dim, spacedim, number> &dinfo,
85 IntegrationInfo<dim, spacedim> &info) const;
86 /**
87 * Virtual function for integrating on boundary faces. Throws exception
88 * PureFunctionCalled if not overloaded by a derived class.
89 */
90 virtual void
91 boundary(DoFInfo<dim, spacedim, number> &dinfo,
92 IntegrationInfo<dim, spacedim> &info) const;
93 /**
94 * Virtual function for integrating on interior faces. Throws exception
95 * PureFunctionCalled if not overloaded by a derived class.
96 */
97 virtual void
98 face(DoFInfo<dim, spacedim, number> &dinfo1,
99 DoFInfo<dim, spacedim, number> &dinfo2,
100 IntegrationInfo<dim, spacedim> &info1,
101 IntegrationInfo<dim, spacedim> &info2) const;
102
103 /**
104 * The flag indicating whether the cell integrator cell() is to be used in
105 * the loop. Defaults to <tt>true</tt>.
106 */
107 bool use_cell;
108
109 /**
110 * The flag indicating whether the boundary integrator boundary() is to be
111 * used in the loop. Defaults to <tt>true</tt>.
112 */
113 bool use_boundary;
114
115 /**
116 * The flag indicating whether the interior face integrator face() is to
117 * be used in the loop. Defaults to <tt>true</tt>.
118 */
119 bool use_face;
120
121 /**
122 * The names of the input vectors. If this vector is nonempty, it can be
123 * used by application programs to automatically select and verify the
124 * input vectors used for integration.
125 *
126 * @note This variable is currently not used by the library, but it is
127 * provided to help develop application programs.
128 *
129 * @deprecated Because the library itself does not use this field, it is
130 * better placed in derived classes.
131 */
132 DEAL_II_DEPRECATED
133 std::vector<std::string> input_vector_names;
134
135 /**
136 * The names of the results produced. If this vector is nonempty, it can
137 * be used by application programs to automatically assign names to output
138 * values and/or verify the names of vectors.
139 *
140 * @note This variable is currently not used by the library, but it is
141 * provided to help develop application programs.
142 *
143 * @deprecated Because the library itself does not use this field, it is
144 * better placed in derived classes.
145 */
146 DEAL_II_DEPRECATED
147 std::vector<std::string> output_names;
148
149 /**
150 * This error is thrown if one of the virtual functions cell(),
151 * boundary(), or face() is called without being overloaded in a derived
152 * class. Consider setting #use_cell, #use_boundary, and #use_face to
153 * false, respectively.
154 *
155 * @ingroup Exceptions
156 */
157 DeclException0(ExcPureFunction);
158 };
159 } // namespace MeshWorker
160
161
162
163 DEAL_II_NAMESPACE_CLOSE
164
165 #endif