Debian Codegraph @

include/deal.II/dofs/dof_faces.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2006 - 2023 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 #ifndef dealii_dof_faces_h
16 #define dealii_dof_faces_h
17
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/base/exceptions.h>
22
23 #include <deal.II/dofs/dof_objects.h>
24
25 #include <vector>
26
27 DEAL_II_NAMESPACE_OPEN
28
29 namespace internal
30 {
31 /**
32 * A namespace for internal data structures of the DoFHandler group of
33 * classes.
34 *
35 * @ingroup dofs
36 */
37 namespace DoFHandlerImplementation
38 {
39 /**
40 *
41 * <h4>DoFFaces</h4>
42 *
43 * These classes are similar to the DoFLevel classes. We here store
44 * information that is associated with faces, rather than cells, as this
45 * information is independent of the hierarchical structure of cells,
46 * which are organized in levels. In 2d we store information on degrees of
47 * freedom located on lines whereas in 3d we store information on degrees
48 * of freedom located on quads and lines. In 1d we do nothing, as the
49 * faces of lines are vertices which are treated separately.
50 *
51 * Apart from the DoFObjects object containing the data to store (degree
52 * of freedom indices) we do not store any data or provide any
53 * functionality. However, we do implement a function to determine an
54 * estimate of the memory consumption of the contained DoFObjects
55 * object(s).
56 *
57 * The data contained isn't usually directly accessed. Rather, except for
58 * some access from the DoFHandler class, access is usually through the
59 * DoFAccessor::set_dof_index() and DoFAccessor::dof_index() functions or
60 * similar functions of derived classes that in turn access the member
61 * variables using the DoFHandler::get_dof_index() and corresponding
62 * setter functions. Knowledge of the actual data format is therefore
63 * encapsulated to the present hierarchy of classes as well as the
64 * DoFHandler class.
65 */
66 template <int dim>
67 class DoFFaces
68 {
69 public:
70 /**
71 * Constructor. This constructor is deleted to prevent the use of this
72 * template, as only the specializations should be used
73 */
74 DoFFaces() = delete;
75 };
76
77 /**
78 * Store the indices of degrees of freedom on faces in 1d. As these would
79 * be vertices, which are treated separately, don't do anything.
80 */
81 template <>
82 class DoFFaces<1>
83 {
84 public:
85 /**
86 * Determine an estimate for the memory consumption (in bytes) of this
87 * object.
88 */
89 std::size_t
90 memory_consumption() const;
91
92 /**
93 * Read or write the data of this object to or from a stream for the
94 * purpose of serialization using the [BOOST serialization
95 * library](https://www.boost.org/doc/libs/1_74_0/libs/serialization/doc/index.html).
96 *
97 */
98 template <class Archive>
99 void
100 serialize(Archive &ar, const unsigned int version);
101 };
102
103 /**
104 * Store the indices of degrees of freedom on faces in 2d, which are
105 * lines.
106 */
107 template <>
108 class DoFFaces<2>
109 {
110 public:
111 /**
112 * The object containing the data of DoFs on lines.
113 */
114 internal::DoFHandlerImplementation::DoFObjects<1> lines;
115
116 /**
117 * Determine an estimate for the memory consumption (in bytes) of this
118 * object.
119 */
120 std::size_t
121 memory_consumption() const;
122
123 /**
124 * Read or write the data of this object to or from a stream for the
125 * purpose of serialization using the [BOOST serialization
126 * library](https://www.boost.org/doc/libs/1_74_0/libs/serialization/doc/index.html).
127 */
128 template <class Archive>
129 void
130 serialize(Archive &ar, const unsigned int version);
131 };
132
133 /**
134 * Store the indices of degrees of freedom on faces in 3d, which are
135 * quads, additionally also on lines.
136 */
137 template <>
138 class DoFFaces<3>
139 {
140 public:
141 /**
142 * The object containing the data of DoFs on lines.
143 */
144 internal::DoFHandlerImplementation::DoFObjects<1> lines;
145
146 /**
147 * The object containing the data of DoFs on quads.
148 */
149 internal::DoFHandlerImplementation::DoFObjects<2> quads;
150
151 /**
152 * Determine an estimate for the memory consumption (in bytes) of this
153 * object.
154 */
155 std::size_t
156 memory_consumption() const;
157
158 /**
159 * Read or write the data of this object to or from a stream for the
160 * purpose of serialization using the [BOOST serialization
161 * library](https://www.boost.org/doc/libs/1_74_0/libs/serialization/doc/index.html).
162 */
163 template <class Archive>
164 void
165 serialize(Archive &ar, const unsigned int version);
166 };
167
168
169
170 template <class Archive>
171 void
172 DoFFaces<1>::serialize(Archive &, const unsigned int)
173 {}
174
175
176 template <class Archive>
177 void
178 DoFFaces<2>::serialize(Archive &ar, const unsigned int)
179 {
180 ar &lines;
181 }
182
183
184 template <class Archive>
185 void
186 DoFFaces<3>::serialize(Archive &ar, const unsigned int)
187 {
188 ar &lines &quads;
189 }
190
191 } // namespace DoFHandlerImplementation
192 } // namespace internal
193
194 DEAL_II_NAMESPACE_CLOSE
195
196 #endif