Reference documentation for deal.II version 9.3.3
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
block_info.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2009 - 2021 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_block_info_h
17#define dealii_block_info_h
18
19#include <deal.II/base/config.h>
20
23
25
26#include <iomanip>
27
29
30// Forward declarations
31#ifndef DOXYGEN
32template <int dim, int spacedim>
33class DoFHandler;
34#endif
35
36
93class BlockInfo : public Subscriptor
94{
95public:
109 template <int dim, int spacedim>
110 void
112 bool levels_only = false,
113 bool active_only = false);
114
119 template <int dim, int spacedim>
120 void
122
126 const BlockIndices &
127 global() const;
128
132 const BlockIndices &
133 local() const;
134
138 const BlockIndices &
139 level(unsigned int level) const;
140
151 renumber(const unsigned int i) const;
152
156 unsigned int
157 n_base_elements() const;
158
162 unsigned int
163 base_element(const unsigned int i) const;
164
168 template <class OS>
169 void
170 print(OS &stream) const;
171
176 std::size_t
177 memory_consumption() const;
178
184 template <class Archive>
185 void
186 serialize(Archive &ar, const unsigned int /*version*/);
187
188private:
196 std::vector<BlockIndices> levels;
197
202
206 std::vector<unsigned int> base_elements;
207
212 std::vector<types::global_dof_index> local_renumbering;
213};
214
215
216
217//----------------------------------------------------------------------//
218
219inline const BlockIndices &
221{
222 return bi_global;
223}
224
225
226inline const BlockIndices &
228{
229 return bi_local;
230}
231
232
233inline const BlockIndices &
234BlockInfo::level(const unsigned int l) const
235{
236 AssertIndexRange(l, levels.size());
237 return levels[l];
238}
239
240
242BlockInfo::renumber(const unsigned int i) const
243{
244 AssertIndexRange(i, static_cast<unsigned int>(local_renumbering.size()));
245 return local_renumbering[i];
246}
247
248
249inline unsigned int
250BlockInfo::base_element(const unsigned int i) const
251{
253
254 return base_elements[i];
255}
256
257
258inline unsigned int
260{
261 return base_elements.size();
262}
263
264
265
266template <class OS>
267inline void
268BlockInfo::print(OS &os) const
269{
270 os << "global dofs " << std::setw(5) << global().total_size() << " blocks";
271 for (unsigned int i = 0; i < global().size(); ++i)
272 os << ' ' << std::setw(5) << global().block_size(i);
273 os << std::endl;
274
275 if (local().size() == 0)
276 {
277 os << "local dofs not initialized" << std::endl;
278 }
279 else
280 {
281 os << "local dofs " << std::setw(5) << local().total_size()
282 << " blocks";
283 for (unsigned int i = 0; i < local().size(); ++i)
284 os << ' ' << std::setw(5) << local().block_size(i);
285 os << std::endl;
286 }
287
288 for (unsigned int l = 0; l < levels.size(); ++l)
289 {
290 os << "level " << std::setw(2) << l << " dofs " << std::setw(5)
291 << level(l).total_size() << " blocks";
292 for (unsigned int i = 0; i < level(l).size(); ++i)
293 os << ' ' << std::setw(5) << level(l).block_size(i);
294 os << std::endl;
295 }
296}
297
298
299inline std::size_t
301{
306}
307
308
309template <class Archive>
310void
311BlockInfo::serialize(Archive &ar, const unsigned int /*version*/)
312{
313 ar &bi_global;
314 ar &levels;
315 ar &bi_local;
316 ar &base_elements;
318}
319
320
322
323#endif
size_type block_size(const unsigned int i) const
size_type total_size() const
unsigned int size() const
A small class collecting the different BlockIndices involved in global, multilevel and local computat...
Definition: block_info.h:94
unsigned int base_element(const unsigned int i) const
Definition: block_info.h:250
std::vector< types::global_dof_index > local_renumbering
Definition: block_info.h:212
std::vector< BlockIndices > levels
The multilevel block structure.
Definition: block_info.h:196
unsigned int n_base_elements() const
Definition: block_info.h:259
void serialize(Archive &ar, const unsigned int)
Definition: block_info.h:311
BlockIndices bi_global
The block structure of the global system.
Definition: block_info.h:192
std::size_t memory_consumption() const
Definition: block_info.h:300
BlockIndices bi_local
The block structure of the cell systems.
Definition: block_info.h:201
types::global_dof_index renumber(const unsigned int i) const
Definition: block_info.h:242
std::vector< unsigned int > base_elements
Definition: block_info.h:206
const BlockIndices & level(unsigned int level) const
Definition: block_info.h:234
const BlockIndices & global() const
Definition: block_info.h:220
const BlockIndices & local() const
Definition: block_info.h:227
void print(OS &stream) const
Definition: block_info.h:268
void initialize_local(const DoFHandler< dim, spacedim > &)
Initialize block structure on cells and compute renumbering between cell dofs and block cell dofs.
Definition: block_info.cc:62
void initialize(const DoFHandler< dim, spacedim > &, bool levels_only=false, bool active_only=false)
Fill the object with values describing block structure of the DoFHandler.
Definition: block_info.cc:30
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
#define AssertIndexRange(index, range)
Definition: exceptions.h:1690
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)