Reference documentation for deal.II version 9.2.0
\(\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 - 2020 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
32 template <int dim, int spacedim>
33 class DoFHandler;
34 namespace hp
35 {
36  template <int dim, int spacedim>
37  class DoFHandler;
38 }
39 #endif
40 
41 
99 class BlockInfo : public Subscriptor
100 {
101 public:
115  template <int dim, int spacedim>
116  void
118  bool levels_only = false,
119  bool active_only = false);
120 
126  template <int dim, int spacedim>
127  void
129  bool levels_only = false,
130  bool active_only = false);
131 
136  template <int dim, int spacedim>
137  void
139 
145  template <int dim, int spacedim>
146  void
148 
152  const BlockIndices &
153  global() const;
154 
158  const BlockIndices &
159  local() const;
160 
164  const BlockIndices &
165  level(unsigned int level) const;
166 
177  renumber(const unsigned int i) const;
178 
182  unsigned int
183  n_base_elements() const;
184 
188  unsigned int
189  base_element(const unsigned int i) const;
190 
194  template <class OS>
195  void
196  print(OS &stream) const;
197 
202  std::size_t
203  memory_consumption() const;
204 
209  template <class Archive>
210  void
211  serialize(Archive &ar, const unsigned int /*version*/);
212 
213 private:
221  std::vector<BlockIndices> levels;
222 
227 
231  std::vector<unsigned int> base_elements;
232 
237  std::vector<types::global_dof_index> local_renumbering;
238 };
239 
240 
241 
242 //----------------------------------------------------------------------//
243 
244 inline const BlockIndices &
246 {
247  return bi_global;
248 }
249 
250 
251 inline const BlockIndices &
253 {
254  return bi_local;
255 }
256 
257 
258 inline const BlockIndices &
259 BlockInfo::level(const unsigned int l) const
260 {
261  AssertIndexRange(l, levels.size());
262  return levels[l];
263 }
264 
265 
267 BlockInfo::renumber(const unsigned int i) const
268 {
269  AssertIndexRange(i, static_cast<unsigned int>(local_renumbering.size()));
270  return local_renumbering[i];
271 }
272 
273 
274 inline unsigned int
275 BlockInfo::base_element(const unsigned int i) const
276 {
277  AssertIndexRange(i, base_elements.size());
278 
279  return base_elements[i];
280 }
281 
282 
283 inline unsigned int
285 {
286  return base_elements.size();
287 }
288 
289 
290 
291 template <class OS>
292 inline void
293 BlockInfo::print(OS &os) const
294 {
295  os << "global dofs " << std::setw(5) << global().total_size() << " blocks";
296  for (unsigned int i = 0; i < global().size(); ++i)
297  os << ' ' << std::setw(5) << global().block_size(i);
298  os << std::endl;
299 
300  if (local().size() == 0)
301  {
302  os << "local dofs not initialized" << std::endl;
303  }
304  else
305  {
306  os << "local dofs " << std::setw(5) << local().total_size()
307  << " blocks";
308  for (unsigned int i = 0; i < local().size(); ++i)
309  os << ' ' << std::setw(5) << local().block_size(i);
310  os << std::endl;
311  }
312 
313  for (unsigned int l = 0; l < levels.size(); ++l)
314  {
315  os << "level " << std::setw(2) << l << " dofs " << std::setw(5)
316  << level(l).total_size() << " blocks";
317  for (unsigned int i = 0; i < level(l).size(); ++i)
318  os << ' ' << std::setw(5) << level(l).block_size(i);
319  os << std::endl;
320  }
321 }
322 
323 
324 inline std::size_t
326 {
331 }
332 
333 
334 template <class Archive>
335 void
336 BlockInfo::serialize(Archive &ar, const unsigned int /*version*/)
337 {
338  ar &bi_global;
339  ar &levels;
340  ar &bi_local;
341  ar &base_elements;
342  ar &local_renumbering;
343 }
344 
345 
347 
348 #endif
BlockInfo::level
const BlockIndices & level(unsigned int level) const
Definition: block_info.h:259
BlockInfo::initialize_local
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:73
BlockIndices::size
unsigned int size() const
Definition: block_indices.h:356
BlockInfo::bi_local
BlockIndices bi_local
The block structure of the cell systems.
Definition: block_info.h:226
BlockInfo::memory_consumption
std::size_t memory_consumption() const
Definition: block_info.h:325
BlockInfo::global
const BlockIndices & global() const
Definition: block_info.h:245
memory_consumption.h
AssertIndexRange
#define AssertIndexRange(index, range)
Definition: exceptions.h:1649
block_indices.h
BlockIndices::block_size
size_type block_size(const unsigned int i) const
Definition: block_indices.h:374
BlockInfo::n_base_elements
unsigned int n_base_elements() const
Definition: block_info.h:284
hp::DoFHandler
Definition: dof_handler.h:203
DoFHandler
Definition: dof_handler.h:205
BlockInfo::serialize
void serialize(Archive &ar, const unsigned int)
Definition: block_info.h:336
BlockIndices::total_size
size_type total_size() const
Definition: block_indices.h:364
Subscriptor
Definition: subscriptor.h:62
BlockInfo::local
const BlockIndices & local() const
Definition: block_info.h:252
BlockInfo::levels
std::vector< BlockIndices > levels
The multilevel block structure.
Definition: block_info.h:221
BlockInfo::initialize
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
BlockInfo::renumber
types::global_dof_index renumber(const unsigned int i) const
Definition: block_info.h:267
BlockInfo::local_renumbering
std::vector< types::global_dof_index > local_renumbering
Definition: block_info.h:237
subscriptor.h
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
MemoryConsumption::memory_consumption
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Definition: memory_consumption.h:268
Physics::Elasticity::Kinematics::l
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
BlockInfo::base_element
unsigned int base_element(const unsigned int i) const
Definition: block_info.h:275
unsigned int
BlockInfo::print
void print(OS &stream) const
Definition: block_info.h:293
BlockInfo::base_elements
std::vector< unsigned int > base_elements
Definition: block_info.h:231
hp
Definition: hp.h:117
config.h
BlockInfo
A small class collecting the different BlockIndices involved in global, multilevel and local computat...
Definition: block_info.h:99
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
BlockInfo::bi_global
BlockIndices bi_global
The block structure of the global system.
Definition: block_info.h:217
BlockIndices
Definition: block_indices.h:60