Reference documentation for deal.II version GIT relicensing-1182-g1782d71672 2024-07-22 00:00:02+00:00
\(\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\}}\)
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
BlockInfo Class Reference

A small class collecting the different BlockIndices involved in global, multilevel and local computations. More...

#include <deal.II/dofs/block_info.h>

Inheritance diagram for BlockInfo:
Inheritance graph

Public Member Functions

template<int dim, int spacedim>
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.
template<int dim, int spacedim>
void initialize_local (const DoFHandler< dim, spacedim > &)
 Initialize block structure on cells and compute renumbering between cell dofs and block cell dofs.
const BlockIndicesglobal () const
const BlockIndiceslocal () const
const BlockIndiceslevel (unsigned int level) const
types::global_dof_index renumber (const unsigned int i) const
unsigned int n_base_elements () const
unsigned int base_element (const unsigned int i) const
template<class OS >
void print (OS &stream) const
std::size_t memory_consumption () const
template<class Archive >
void serialize (Archive &ar, const unsigned int)
Subscriptor functionality

Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class.

void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const
unsigned int n_subscriptions () const
template<typename StreamType >
void list_subscribers (StreamType &stream) const
void list_subscribers () const

Static Public Member Functions

static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)
static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)

Private Types

using map_value_type = decltype(counter_map)::value_type
using map_iterator = decltype(counter_map)::iterator

Private Member Functions

void check_no_subscribers () const noexcept

Private Attributes

BlockIndices bi_global
 The block structure of the global system.
std::vector< BlockIndiceslevels
 The multilevel block structure.
BlockIndices bi_local
 The block structure of the cell systems.
std::vector< unsigned intbase_elements
std::vector< types::global_dof_indexlocal_renumbering
std::atomic< unsigned intcounter
std::map< std::string, unsigned intcounter_map
std::vector< std::atomic< bool > * > validity_pointers
const std::type_info * object_info

Static Private Attributes

static std::mutex mutex

Detailed Description

A small class collecting the different BlockIndices involved in global, multilevel and local computations.

Once a DoFHandler has been initialized with an FESystem, a data object of type BlockInfo (accessed by DoFHandler::block_info() ) is filled, which reflects the block structure of the degrees of freedom.

BlockInfo consists of several BlockIndices objects. The member global() reflects the block structure of the system on the active cell level, usually referred to as the global system. As soon as DoFHandler::distribute_dofs() has been called, the function BlockIndices::block_size() in global() will return the correct sizes of each block. After DoFRenumbering::block_wise(), BlockIndices::block_start() will return the start index for each of the blocks.

When a DoFHandler with levels is used, the same structure is automatically generated for each level. The level blocks can be accessed through level().

Finally, there are local() BlockIndices, which describe the block structure on a single cell. This is used for instance by MeshWorker::Assembler::MatrixLocalBlocksToGlobalBlocks. The local indices are not filled automatically, since they change the behavior of the MeshWorker::Assembler classes relying on BlockInfo. They must be initialized by hand through initialize_local().


The most common usage for this object is initializing vectors as in the following code:

BlockVector<double> solution(dof_handler.block_info().global());
for (unsigned int i = 0; i < triangulation.n_levels(); ++i)
void block_wise(DoFHandler< dim, spacedim > &dof_handler)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation

In this example, solution obtains the block structure needed to represent a finite element function on the DoFHandler. Similarly, all levels of mg_vector will have the block structure needed on that level.

Extend the functions local() and renumber() to allow for hp-capablilites.

Definition at line 94 of file block_info.h.

Member Typedef Documentation

◆ map_value_type

using Subscriptor::map_value_type = decltype(counter_map)::value_type

The data type used in counter_map.

Definition at line 229 of file subscriptor.h.

◆ map_iterator

using Subscriptor::map_iterator = decltype(counter_map)::iterator

The iterator type used in counter_map.

Definition at line 234 of file subscriptor.h.

Member Function Documentation

◆ initialize()

template<int dim, int spacedim>
void BlockInfo::initialize ( const DoFHandler< dim, spacedim > &  dof,
bool  levels_only = false,
bool  active_only = false 

Fill the object with values describing block structure of the DoFHandler.

By default, this function will attempt to initialize whatever is possible. If active dofs have been assigned int the DoFHandler argument, they BlockIndices for those will be generated. The same for level dofs.

This default behavior can be overridden by the two parameters, which can switch off active dofs or level dofs.

This function will also clear the local() indices.

Definition at line 29 of file

◆ initialize_local()

template<int dim, int spacedim>
void BlockInfo::initialize_local ( const DoFHandler< dim, spacedim > &  dof)

Initialize block structure on cells and compute renumbering between cell dofs and block cell dofs.

Definition at line 61 of file

◆ global()

const BlockIndices & BlockInfo::global ( ) const

Access the BlockIndices structure of the global system.

Definition at line 221 of file block_info.h.

◆ local()

const BlockIndices & BlockInfo::local ( ) const

Access BlockIndices for the local system on a cell.

Definition at line 228 of file block_info.h.

◆ level()

const BlockIndices & BlockInfo::level ( unsigned int  level) const

Access the BlockIndices structure of a level in the multilevel hierarchy.

Definition at line 235 of file block_info.h.

◆ renumber()

types::global_dof_index BlockInfo::renumber ( const unsigned int  i) const

Return the index after local renumbering.

The input of this function is an index between zero and the number of dofs per cell, numbered in local block ordering, that is first all indices of the first system block, then all of the second block and so forth. The function then outputs the index in the standard local numbering of DoFAccessor.

Definition at line 243 of file block_info.h.

◆ n_base_elements()

unsigned int BlockInfo::n_base_elements ( ) const

The number of base elements.

Definition at line 260 of file block_info.h.

◆ base_element()

unsigned int BlockInfo::base_element ( const unsigned int  i) const

Return the base element of this index.

Definition at line 251 of file block_info.h.

◆ print()

template<class OS >
void BlockInfo::print ( OS stream) const

Write a summary of the block structure to the stream.

Definition at line 269 of file block_info.h.

◆ memory_consumption()

std::size_t BlockInfo::memory_consumption ( ) const

Determine an estimate for the memory consumption (in bytes) of this object.

Definition at line 301 of file block_info.h.

◆ serialize()

template<class Archive >
void BlockInfo::serialize ( Archive ar,
const unsigned int   

Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.

Definition at line 312 of file block_info.h.

◆ subscribe()

void Subscriptor::subscribe ( std::atomic< bool > *const  validity,
const std::string &  identifier = "" 
) const

Subscribes a user of the object by storing the pointer validity. The subscriber may be identified by text supplied as identifier.

Definition at line 135 of file

◆ unsubscribe()

void Subscriptor::unsubscribe ( std::atomic< bool > *const  validity,
const std::string &  identifier = "" 
) const

Unsubscribes a user from the object.

The identifier and the validity pointer must be the same as the one supplied to subscribe().

Definition at line 155 of file

◆ n_subscriptions()

unsigned int Subscriptor::n_subscriptions ( ) const

Return the present number of subscriptions to this object. This allows to use this class for reference counted lifetime determination where the last one to unsubscribe also deletes the object.

Definition at line 300 of file subscriptor.h.

◆ list_subscribers() [1/2]

template<typename StreamType >
void Subscriptor::list_subscribers ( StreamType stream) const

List the subscribers to the input stream.

Definition at line 317 of file subscriptor.h.

◆ list_subscribers() [2/2]

void Subscriptor::list_subscribers ( ) const

List the subscribers to deallog.

Definition at line 203 of file

◆ check_no_subscribers()

void Subscriptor::check_no_subscribers ( ) const

Check that there are no objects subscribing to this object. If this check passes then it is safe to destroy the current object. It this check fails then this function will either abort or print an error message to deallog (by using the AssertNothrow mechanism), but will not throw an exception.

Since this function is just a consistency check it does nothing in release mode.
If this function is called when there is an uncaught exception then, rather than aborting, this function prints an error message to the standard error stream and returns.

Definition at line 52 of file

Member Data Documentation

◆ bi_global

BlockIndices BlockInfo::bi_global

The block structure of the global system.

Definition at line 193 of file block_info.h.

◆ levels

std::vector<BlockIndices> BlockInfo::levels

The multilevel block structure.

Definition at line 197 of file block_info.h.

◆ bi_local

BlockIndices BlockInfo::bi_local

The block structure of the cell systems.

Definition at line 202 of file block_info.h.

◆ base_elements

std::vector<unsigned int> BlockInfo::base_elements

The base element associated with each block.

Definition at line 207 of file block_info.h.

◆ local_renumbering

std::vector<types::global_dof_index> BlockInfo::local_renumbering

A vector containing the renumbering from the standard order of degrees of freedom on a cell to a component wise ordering. Filled by initialize().

Definition at line 213 of file block_info.h.

◆ counter

std::atomic<unsigned int> Subscriptor::counter

Store the number of objects which subscribed to this object. Initially, this number is zero, and upon destruction it shall be zero again (i.e. all objects which subscribed should have unsubscribed again).

The creator (and owner) of an object is counted in the map below if HE manages to supply identification.

We use the mutable keyword in order to allow subscription to constant objects also.

This counter may be read from and written to concurrently in multithreaded code: hence we use the std::atomic class template.

Definition at line 218 of file subscriptor.h.

◆ counter_map

std::map<std::string, unsigned int> Subscriptor::counter_map

In this map, we count subscriptions for each different identification string supplied to subscribe().

Definition at line 224 of file subscriptor.h.

◆ validity_pointers

std::vector<std::atomic<bool> *> Subscriptor::validity_pointers

In this vector, we store pointers to the validity bool in the SmartPointer objects that subscribe to this class.

Definition at line 240 of file subscriptor.h.

◆ object_info

const std::type_info* Subscriptor::object_info

Pointer to the typeinfo object of this object, from which we can later deduce the class name. Since this information on the derived class is neither available in the destructor, nor in the constructor, we obtain it in between and store it here.

Definition at line 248 of file subscriptor.h.

◆ mutex

std::mutex Subscriptor::mutex

A mutex used to ensure data consistency when accessing the mutable members of this class. This lock is used in the subscribe() and unsubscribe() functions, as well as in list_subscribers().

Definition at line 271 of file subscriptor.h.

The documentation for this class was generated from the following files: