Reference documentation for deal.II version 9.5.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\}}\)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType > Class Template Referenceabstract

#include <deal.II/matrix_free/operators.h>

Inheritance diagram for MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >:
[legend]

Public Types

using value_type = typename VectorType::value_type
 
using size_type = typename VectorType::size_type
 

Public Member Functions

 Base ()
 
virtual ~Base () override=default
 
virtual void clear ()
 
void initialize (std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > > data, const std::vector< unsigned int > &selected_row_blocks=std::vector< unsigned int >(), const std::vector< unsigned int > &selected_column_blocks=std::vector< unsigned int >())
 
void initialize (std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > > data, const MGConstrainedDoFs &mg_constrained_dofs, const unsigned int level, const std::vector< unsigned int > &selected_row_blocks=std::vector< unsigned int >())
 
void initialize (std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > > data_, const std::vector< MGConstrainedDoFs > &mg_constrained_dofs, const unsigned int level, const std::vector< unsigned int > &selected_row_blocks=std::vector< unsigned int >())
 
size_type m () const
 
size_type n () const
 
void vmult_interface_down (VectorType &dst, const VectorType &src) const
 
void vmult_interface_up (VectorType &dst, const VectorType &src) const
 
void vmult (VectorType &dst, const VectorType &src) const
 
void Tvmult (VectorType &dst, const VectorType &src) const
 
void vmult_add (VectorType &dst, const VectorType &src) const
 
void Tvmult_add (VectorType &dst, const VectorType &src) const
 
value_type el (const unsigned int row, const unsigned int col) const
 
virtual std::size_t memory_consumption () const
 
void initialize_dof_vector (VectorType &vec) const
 
virtual void compute_diagonal ()=0
 
std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > > get_matrix_free () const
 
const std::shared_ptr< DiagonalMatrix< VectorType > > & get_matrix_diagonal_inverse () const
 
const std::shared_ptr< DiagonalMatrix< VectorType > > & get_matrix_diagonal () const
 
void precondition_Jacobi (VectorType &dst, const VectorType &src, const value_type omega) const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
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)
 

Protected Member Functions

void preprocess_constraints (VectorType &dst, const VectorType &src) const
 
void postprocess_constraints (VectorType &dst, const VectorType &src) const
 
void set_constrained_entries_to_one (VectorType &dst) const
 
virtual void apply_add (VectorType &dst, const VectorType &src) const =0
 
virtual void Tapply_add (VectorType &dst, const VectorType &src) const
 

Protected Attributes

std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > > data
 
std::shared_ptr< DiagonalMatrix< VectorType > > diagonal_entries
 
std::shared_ptr< DiagonalMatrix< VectorType > > inverse_diagonal_entries
 
std::vector< unsigned intselected_rows
 
std::vector< unsigned intselected_columns
 

Private Types

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

Private Member Functions

void mult_add (VectorType &dst, const VectorType &src, const bool transpose) const
 
void adjust_ghost_range_if_necessary (const VectorType &vec, const bool is_row) const
 
void check_no_subscribers () const noexcept
 

Private Attributes

std::vector< std::vector< unsigned int > > edge_constrained_indices
 
std::vector< std::vector< std::pair< value_type, value_type > > > edge_constrained_values
 
bool have_interface_matrices
 
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

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
class MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >

Abstract base class for matrix-free operators which can be used both at the finest mesh or at a certain level in geometric multigrid.

A derived class has to implement apply_add() method as well as compute_diagonal() to initialize the protected member inverse_diagonal_entries and/or diagonal_entries. In case of a non-symmetric operator, Tapply_add() should be additionally implemented.

Currently, the only supported vectors are LinearAlgebra::distributed::Vector and LinearAlgebra::distributed::BlockVector.

Selective use of blocks in MatrixFree

MatrixFree allows to use several DoFHandler/AffineConstraints combinations by passing a std::vector with pointers to the respective objects into the MatrixFree::reinit function. This class supports to select only some of the blocks in the underlying MatrixFree object by optional integer lists that specify the chosen blocks.

One application of constructing a matrix-free operator only on selected blocks would be the setting of the step-32 tutorial program: This problem has three blocks, one for the velocity, one for the pressure, and one for temperature. The time lag scheme used for temporal evolution splits the temperature equation away from the Stokes system in velocity and pressure. However, there are cross terms like the velocity that enters the temperature advection-diffusion equation or the temperature that enters the right hand side of the velocity. In order to be sure that MatrixFree uses the same integer indexing to the different blocks, one needs to put all the three blocks into the same MatrixFree object. However, when solving a linear system the operators involved either address the first two in the Stokes solver, or the last one for the temperature solver. In the former case, a BlockVector of two components would be selected with a vector selecting the blocks {0, 1} in MatrixFree, whereas in the latter, a non-block vector selecting the block {2} would be used.

A second application of selection is in problems with a Newton-type iteration or problems with inhomogeneous boundary conditions. In such a case, one has to deal with two different sets of constraints: One set of constraints applies to the solution vector which might include hanging node constraints or periodicity constraints but no constraints on inhomogeneous Dirichlet boundaries. Before the nonlinear iteration, the boundary values are set to the expected value in the vector, representing the initial guess. In each iteration of the Newton method, a linear system subject to zero Dirichlet boundary conditions is solved that is then added to the initial guess. This setup can be realized by using a vector of two pointers pointing to the same DoFHandler object and a vector of two pointers to the two AffineConstraints objects. If the first AffineConstraints object is the one including the zero Dirichlet constraints, one would give a std::vector<unsigned int>(1, 0) to the initialize() function, i.e., a vector of length 1 that selects exactly the first AffineConstraints object with index 0.

For systems of PDEs where the different blocks of MatrixFree are associated with different physical components of the equations, adding another block with a different AffineConstraints argument solely for the purpose of boundary conditions might lead to cumbersome index handling. Instead, one could set up a second MatrixFree instance with the different AffineConstraints object but the same interpretation of blocks, and use that for interpolating inhomogeneous boundary conditions (see also the discussion in the results section of the step-37 tutorial program):

matrix_free_inhomogeneous.reinit(dof_handler, constraints_no_dirichlet,
quadrature, additional_data);
operator_inhomogeneous.initialize(matrix_free_inhomogeneous,
selected_blocks);
matrix_free_inhomogeneous.initialize_dof_vector(inhomogeneity);
constraints_with_dirichlet.distribute(inhomogeneity);
operator_inhomogeneous.vmult(system_rhs, inhomogeneity);
system_rhs *= -1.;
// proceed with other terms from right hand side...

Definition at line 188 of file operators.h.

Member Typedef Documentation

◆ value_type

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
using MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::value_type = typename VectorType::value_type

Number alias.

Definition at line 194 of file operators.h.

◆ size_type

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
using MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::size_type = typename VectorType::size_type

size_type needed for preconditioner classes.

Definition at line 199 of file operators.h.

◆ map_value_type

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

The data type used in counter_map.

Definition at line 230 of file subscriptor.h.

◆ map_iterator

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

The iterator type used in counter_map.

Definition at line 235 of file subscriptor.h.

Constructor & Destructor Documentation

◆ Base()

template<int dim, typename VectorType , typename VectorizedArrayType >
MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::Base

Default constructor.

Definition at line 1218 of file operators.h.

◆ ~Base()

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
virtual MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::~Base ( )
overridevirtualdefault

Virtual destructor.

Member Function Documentation

◆ clear()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::clear
virtual

Release all memory and return to a state just like after having called the default constructor.

Reimplemented in MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >.

Definition at line 1255 of file operators.h.

◆ initialize() [1/3]

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::initialize ( std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > >  data,
const std::vector< unsigned int > &  selected_row_blocks = std::vector<unsigned int>(),
const std::vector< unsigned int > &  selected_column_blocks = std::vector<unsigned int>() 
)

Initialize operator on fine scale.

The optional selection vector allows to choose only some components from the underlying MatrixFree object, e.g. just a single one. The entry selected_row_blocks[i] in the vector chooses the DoFHandler and AffineConstraints object that was given as the selected_row_blocks[i]-th argument to the MatrixFree::reinit() call. Different arguments for rows and columns also make it possible to select non-diagonal blocks or rectangular blocks. If the row vector is empty, all components are selected, otherwise its size must be smaller or equal to MatrixFree::n_components() and all indices need to be unique and within the range of 0 and MatrixFree::n_components(). If the column selection vector is empty, it is taken the same as the row selection, defining a diagonal block.

Definition at line 1305 of file operators.h.

◆ initialize() [2/3]

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::initialize ( std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > >  data,
const MGConstrainedDoFs mg_constrained_dofs,
const unsigned int  level,
const std::vector< unsigned int > &  selected_row_blocks = std::vector<unsigned int>() 
)

Initialize operator on a level level for a single FiniteElement.

The optional selection vector allows to choose only some components from the underlying MatrixFree object, e.g. just a single one. The entry selected_row_blocks[i] in the vector chooses the DoFHandler and AffineConstraints object that was given as the selected_row_blocks[i]-th argument to the MatrixFree::reinit() call. Since a multigrid operator is always associated to inverting a matrix and thus represents a diagonal block, the same vector for rows and columns is used as opposed to the non-level initialization function. If empty, all components are selected.

Definition at line 1358 of file operators.h.

◆ initialize() [3/3]

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::initialize ( std::shared_ptr< const MatrixFree< dim, value_type, VectorizedArrayType > >  data_,
const std::vector< MGConstrainedDoFs > &  mg_constrained_dofs,
const unsigned int  level,
const std::vector< unsigned int > &  selected_row_blocks = std::vector<unsigned int>() 
)

Initialize operator on a level level for multiple FiniteElement objects.

The optional selection vector allows to choose only some components from the underlying MatrixFree object, e.g. just a single one. The entry selected_row_blocks[i] in the vector chooses the DoFHandler and AffineConstraints object that was given as the selected_row_blocks[i]-th argument to the MatrixFree::reinit() call. Since a multigrid operator is always associated to inverting a matrix and thus represents a diagonal block, the same vector for rows and columns is used as opposed to the non-level initialization function. If empty, all components are selected.

Definition at line 1374 of file operators.h.

◆ m()

template<int dim, typename VectorType , typename VectorizedArrayType >
Base< dim, VectorType, VectorizedArrayType >::size_type MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::m

Return the dimension of the codomain (or range) space.

Definition at line 1227 of file operators.h.

◆ n()

template<int dim, typename VectorType , typename VectorizedArrayType >
Base< dim, VectorType, VectorizedArrayType >::size_type MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::n

Return the dimension of the domain space.

Definition at line 1241 of file operators.h.

◆ vmult_interface_down()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::vmult_interface_down ( VectorType &  dst,
const VectorType &  src 
) const

vmult operator for interface.

Definition at line 1624 of file operators.h.

◆ vmult_interface_up()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::vmult_interface_up ( VectorType &  dst,
const VectorType &  src 
) const

vmult operator for interface.

Definition at line 1678 of file operators.h.

◆ vmult()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::vmult ( VectorType &  dst,
const VectorType &  src 
) const

Matrix-vector multiplication.

Definition at line 1463 of file operators.h.

◆ Tvmult()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::Tvmult ( VectorType &  dst,
const VectorType &  src 
) const

Transpose matrix-vector multiplication.

Definition at line 1719 of file operators.h.

◆ vmult_add()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::vmult_add ( VectorType &  dst,
const VectorType &  src 
) const

Adding Matrix-vector multiplication.

Definition at line 1476 of file operators.h.

◆ Tvmult_add()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::Tvmult_add ( VectorType &  dst,
const VectorType &  src 
) const

Adding transpose matrix-vector multiplication.

Definition at line 1487 of file operators.h.

◆ el()

template<int dim, typename VectorType , typename VectorizedArrayType >
Base< dim, VectorType, VectorizedArrayType >::value_type MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::el ( const unsigned int  row,
const unsigned int  col 
) const

Return the value of the matrix entry (row,col). In matrix-free context this function is valid only for row==col when diagonal is initialized.

Definition at line 1265 of file operators.h.

◆ memory_consumption()

template<int dim, typename VectorType , typename VectorizedArrayType >
std::size_t MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::memory_consumption
virtual

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

Definition at line 1733 of file operators.h.

◆ initialize_dof_vector()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::initialize_dof_vector ( VectorType &  vec) const

A wrapper for initialize_dof_vector() of MatrixFree object.

Definition at line 1280 of file operators.h.

◆ compute_diagonal()

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
virtual void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::compute_diagonal ( )
pure virtual

Compute diagonal of this operator.

A derived class needs to implement this function and resize and fill the protected member inverse_diagonal_entries and/or diagonal_entries accordingly.

Note
Since the diagonal is frequently used as a smoother or preconditioner, entries corresponding to constrained DoFs are set to 1 (instead of the correct value of 0) so that the diagonal matrix is invertible.

Implemented in MatrixFreeOperators::MassOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >, and MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >.

◆ get_matrix_free()

template<int dim, typename VectorType , typename VectorizedArrayType >
std::shared_ptr< const MatrixFree< dim, typename Base< dim, VectorType, VectorizedArrayType >::value_type, VectorizedArrayType > > MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::get_matrix_free

Get read access to the MatrixFree object stored with this operator.

Definition at line 1747 of file operators.h.

◆ get_matrix_diagonal_inverse()

template<int dim, typename VectorType , typename VectorizedArrayType >
const std::shared_ptr< DiagonalMatrix< VectorType > > & MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::get_matrix_diagonal_inverse

Get read access to the inverse diagonal of this operator.

Definition at line 1756 of file operators.h.

◆ get_matrix_diagonal()

template<int dim, typename VectorType , typename VectorizedArrayType >
const std::shared_ptr< DiagonalMatrix< VectorType > > & MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::get_matrix_diagonal

Get read access to the diagonal of this operator.

Definition at line 1769 of file operators.h.

◆ precondition_Jacobi()

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::precondition_Jacobi ( VectorType &  dst,
const VectorType &  src,
const value_type  omega 
) const

Apply the Jacobi preconditioner, which multiplies every element of the src vector by the inverse of the respective diagonal element and multiplies the result with the relaxation factor omega.

Definition at line 1791 of file operators.h.

◆ preprocess_constraints()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::preprocess_constraints ( VectorType &  dst,
const VectorType &  src 
) const
protected

Perform necessary operations related to constraints before calling apply_add() or Tapply_add() inside mult_add().

Definition at line 1540 of file operators.h.

◆ postprocess_constraints()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::postprocess_constraints ( VectorType &  dst,
const VectorType &  src 
) const
protected

Perform necessary operations related to constraints after calling apply_add() or Tapply_add() inside mult_add().

Definition at line 1590 of file operators.h.

◆ set_constrained_entries_to_one()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::set_constrained_entries_to_one ( VectorType &  dst) const
protected

Set constrained entries (both from hanging nodes and edge constraints) of dst to one.

Definition at line 1444 of file operators.h.

◆ apply_add()

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
virtual void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::apply_add ( VectorType &  dst,
const VectorType &  src 
) const
protectedpure virtual

◆ Tapply_add()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::Tapply_add ( VectorType &  dst,
const VectorType &  src 
) const
protectedvirtual

Apply transpose operator to src and add result in dst.

Default implementation is to call apply_add().

Definition at line 1780 of file operators.h.

◆ mult_add()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::mult_add ( VectorType &  dst,
const VectorType &  src,
const bool  transpose 
) const
private

Function which implements vmult_add (transpose = false) and Tvmult_add (transpose = true).

Definition at line 1570 of file operators.h.

◆ adjust_ghost_range_if_necessary()

template<int dim, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::adjust_ghost_range_if_necessary ( const VectorType &  vec,
const bool  is_row 
) const
private

Adjust the ghost range of the vectors to the storage requirements of the underlying MatrixFree class. This is used inside the mult_add() as well as vmult_interface_up() and vmult_interface_down() methods in order to ensure that the cell loops will be able to access the ghost indices with the correct local indices.

Definition at line 1498 of file operators.h.

◆ subscribe()

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

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

Definition at line 136 of file subscriptor.cc.

◆ unsubscribe()

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

Unsubscribes a user from the object.

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

Definition at line 156 of file subscriptor.cc.

◆ n_subscriptions()

unsigned int Subscriptor::n_subscriptions ( ) const
inlineinherited

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
inlineinherited

List the subscribers to the input stream.

Definition at line 317 of file subscriptor.h.

◆ list_subscribers() [2/2]

void Subscriptor::list_subscribers ( ) const
inherited

List the subscribers to deallog.

Definition at line 204 of file subscriptor.cc.

◆ serialize()

template<class Archive >
void Subscriptor::serialize ( Archive &  ar,
const unsigned int  version 
)
inlineinherited

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

This function does not actually serialize any of the member variables of this class. The reason is that what this class stores is only who subscribes to this object, but who does so at the time of storing the contents of this object does not necessarily have anything to do with who subscribes to the object when it is restored. Consequently, we do not want to overwrite the subscribers at the time of restoring, and then there is no reason to write the subscribers out in the first place.

Definition at line 309 of file subscriptor.h.

◆ check_no_subscribers()

void Subscriptor::check_no_subscribers ( ) const
privatenoexceptinherited

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.

Note
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 53 of file subscriptor.cc.

Member Data Documentation

◆ data

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::shared_ptr<const MatrixFree<dim, value_type, VectorizedArrayType> > MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::data
protected

MatrixFree object to be used with this operator.

Definition at line 436 of file operators.h.

◆ diagonal_entries

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::shared_ptr<DiagonalMatrix<VectorType> > MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::diagonal_entries
protected

A shared pointer to a diagonal matrix that stores the diagonal elements as a vector.

Definition at line 442 of file operators.h.

◆ inverse_diagonal_entries

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::shared_ptr<DiagonalMatrix<VectorType> > MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::inverse_diagonal_entries
protected

A shared pointer to a diagonal matrix that stores the inverse of diagonal elements as a vector.

Definition at line 448 of file operators.h.

◆ selected_rows

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::vector<unsigned int> MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::selected_rows
protected

A vector which defines the selection of sub-components of MatrixFree for the rows of the matrix representation.

Definition at line 454 of file operators.h.

◆ selected_columns

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::vector<unsigned int> MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::selected_columns
protected

A vector which defines the selection of sub-components of MatrixFree for the columns of the matrix representation.

Definition at line 460 of file operators.h.

◆ edge_constrained_indices

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::vector<std::vector<unsigned int> > MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::edge_constrained_indices
private

Indices of DoFs on edge in case the operator is used in GMG context.

Definition at line 466 of file operators.h.

◆ edge_constrained_values

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::vector<std::vector<std::pair<value_type, value_type> > > MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::edge_constrained_values
mutableprivate

Auxiliary vector.

Definition at line 472 of file operators.h.

◆ have_interface_matrices

template<int dim, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
bool MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::have_interface_matrices
private

A flag which determines whether or not this operator has interface matrices in GMG context.

Definition at line 478 of file operators.h.

◆ counter

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

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 219 of file subscriptor.h.

◆ counter_map

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

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

Definition at line 225 of file subscriptor.h.

◆ validity_pointers

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

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

Definition at line 241 of file subscriptor.h.

◆ object_info

const std::type_info* Subscriptor::object_info
mutableprivateinherited

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 249 of file subscriptor.h.

◆ mutex

std::mutex Subscriptor::mutex
staticprivateinherited

A mutex used to ensure data consistency when printing out the list of subscribers.

Definition at line 271 of file subscriptor.h.


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