deal.II version GIT relicensing-2306-ga6fff1538f 2024-12-29 17:30:00+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\}}\)
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::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType > Class Template Reference

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

Inheritance diagram for MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >:
Inheritance graph
[legend]

Public Types

using value_type = typename Base< dim, VectorType, VectorizedArrayType >::value_type
 
using size_type = typename Base< dim, VectorType, VectorizedArrayType >::size_type
 

Public Member Functions

 LaplaceOperator ()
 
virtual void compute_diagonal () override
 
void set_coefficient (const std::shared_ptr< Table< 2, VectorizedArrayType > > &scalar_coefficient)
 
virtual void clear () override
 
std::shared_ptr< Table< 2, VectorizedArrayType > > get_coefficient ()
 
template<int n_components_compute>
void do_operation_on_cell (FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_compute, typename Base< dim, VectorType, VectorizedArrayType >::value_type, VectorizedArrayType > &phi, const unsigned int cell) const
 
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
 
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)
 
Querying the observer pointers an object has.
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 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

virtual void apply_add (VectorType &dst, const VectorType &src) const override
 
void local_apply_cell (const MatrixFree< dim, value_type, VectorizedArrayType > &data, VectorType &dst, const VectorType &src, const std::pair< unsigned int, unsigned int > &cell_range) const
 
void local_diagonal_cell (const MatrixFree< dim, value_type, VectorizedArrayType > &data, VectorType &dst, const VectorType &, const std::pair< unsigned int, unsigned int > &cell_range) const
 
template<int n_components_compute>
void do_operation_on_cell (FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_compute, value_type, VectorizedArrayType > &phi, const unsigned int cell) const
 
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
 
EnableObserverPointer functionality

Classes derived from EnableObserverPointer provide a facility to subscribe to this object. This is mostly used by the ObserverPointer 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
 
void check_no_subscribers () const noexcept
 

Private Attributes

std::shared_ptr< Table< 2, VectorizedArrayType > > scalar_coefficient
 
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, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
class MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >

This class implements the operation of the action of a Laplace matrix, namely \( L_{ij} = \int_\Omega c(\mathbf x) \mathbf \nabla N_i(\mathbf x) \cdot \mathbf \nabla N_j(\mathbf x)\,d \mathbf x\), where \(c(\mathbf x)\) is the scalar heterogeneity coefficient.

Note that this class only supports the non-blocked vector variant of the Base operator because only a single FEEvaluation object is used in the apply function.

Definition at line 869 of file operators.h.

Member Typedef Documentation

◆ value_type

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
using MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::value_type = typename Base<dim, VectorType, VectorizedArrayType>::value_type

Number alias.

Definition at line 875 of file operators.h.

◆ size_type

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
using MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::size_type = typename Base<dim, VectorType, VectorizedArrayType>::size_type

size_type needed for preconditioner classes.

Definition at line 881 of file operators.h.

◆ map_value_type

The data type used in counter_map.

Definition at line 223 of file enable_observer_pointer.h.

◆ map_iterator

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

The iterator type used in counter_map.

Definition at line 228 of file enable_observer_pointer.h.

Constructor & Destructor Documentation

◆ LaplaceOperator()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename VectorType , typename VectorizedArrayType >
MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::LaplaceOperator ( )

Constructor.

Definition at line 2171 of file operators.h.

Member Function Documentation

◆ compute_diagonal()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::compute_diagonal ( )
overridevirtual

The diagonal is approximated by computing a local diagonal matrix per element and distributing it to the global diagonal. This will lead to wrong results on element with hanging nodes but is still an acceptable approximation to be used in preconditioners.

Implements MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >.

Definition at line 2250 of file operators.h.

◆ set_coefficient()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::set_coefficient ( const std::shared_ptr< Table< 2, VectorizedArrayType > > &  scalar_coefficient)

Set the heterogeneous scalar coefficient scalar_coefficient to be used at the quadrature points. The Table needs to have as many rows as there are cell batches in the underlying MatrixFree object, MatrixFree::n_cell_batches(). The number of batches is related to the fact that the matrix-free operators do not work on individual cells, but instead of batches of cells at once due to vectorization. The Table can take two different numbers of columns. One case is to select it equal to the total number of quadrature points in dim dimensions, which is the dimth power of the n_q_points_1d template parameter. Here, (*scalar_coefficient)(cell,q) corresponds to the value of the coefficient on cell batch cell and quadrature point index q. The second supported variant is a Table with a single column, in which case the same variable coefficient value is used at all quadrature points of a cell.

Such tables can be initialized by

std::shared_ptr<Table<2, VectorizedArray<double> > > coefficient;
coefficient = std::make_shared<Table<2, VectorizedArray<double> > >();
{
const unsigned int n_cells = mf_data.n_cell_batches();
const unsigned int n_q_points = fe_eval.n_q_points;
coefficient->reinit(n_cells, n_q_points);
for (unsigned int cell=0; cell<n_cells; ++cell)
{
fe_eval.reinit(cell);
for (unsigned int q=0; q<n_q_points; ++q)
(*coefficient)(cell,q) =
function.value(fe_eval.quadrature_point(q));
}
}

where mf_data is a MatrixFree object and function is a function which provides the following method VectorizedArray<double> value(const Point<dim, VectorizedArray<double> > &p_vec).

If this function is not called, the coefficient is assumed to be unity.

The argument to this function is a shared pointer to such a table. The class stores the shared pointer to this table, not a deep copy and uses it to form the Laplace matrix. Consequently, you can update the table and re-use the current object to obtain the action of a Laplace matrix with this updated coefficient. Alternatively, if the table values are only to be filled once, the original shared pointer can also go out of scope in user code and the clear() command or destructor of this class will delete the table.

Definition at line 2209 of file operators.h.

◆ clear()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::clear ( )
overridevirtual

Resets all data structures back to the same state as for a newly constructed object.

Reimplemented from MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >.

Definition at line 2189 of file operators.h.

◆ get_coefficient()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename VectorType , typename VectorizedArrayType >
std::shared_ptr< Table< 2, VectorizedArrayType > > MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::get_coefficient ( )

Read/Write access to coefficients to be used in Laplace operator.

The function will throw an error if coefficients are not previously set by set_coefficient() function.

Definition at line 2230 of file operators.h.

◆ apply_add()

template<int dim, int fe_degree, int n_q_points_1d, int n_components, typename VectorType , typename VectorizedArrayType >
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::apply_add ( VectorType &  dst,
const VectorType &  src 
) const
overrideprivatevirtual

Applies the laplace matrix operation on an input vector. It is assumed that the passed input and output vector are correctly initialized using initialize_dof_vector().

Implements MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >.

Definition at line 2300 of file operators.h.

◆ local_apply_cell()

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::local_apply_cell ( const MatrixFree< dim, value_type, VectorizedArrayType > &  data,
VectorType &  dst,
const VectorType &  src,
const std::pair< unsigned int, unsigned int > &  cell_range 
) const
private

Applies the Laplace operator on a cell.

Definition at line 2401 of file operators.h.

◆ local_diagonal_cell()

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::local_diagonal_cell ( const MatrixFree< dim, value_type, VectorizedArrayType > &  data,
VectorType &  dst,
const VectorType &  ,
const std::pair< unsigned int, unsigned int > &  cell_range 
) const
private

Apply diagonal part of the Laplace operator on a cell.

Definition at line 2442 of file operators.h.

◆ do_operation_on_cell() [1/2]

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
template<int n_components_compute>
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::do_operation_on_cell ( FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_compute, value_type, VectorizedArrayType > &  phi,
const unsigned int  cell 
) const
private

Apply Laplace operator on a cell cell.

◆ do_operation_on_cell() [2/2]

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
template<int n_components_compute>
void MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::do_operation_on_cell ( FEEvaluation< dim, fe_degree, n_q_points_1d, n_components_compute, typename Base< dim, VectorType, VectorizedArrayType >::value_type, VectorizedArrayType > &  phi,
const unsigned int  cell 
) const

Definition at line 2336 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>() 
)
inherited

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 1303 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>() 
)
inherited

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 1356 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>() 
)
inherited

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 1372 of file operators.h.

◆ m()

template<int dim, typename VectorType , typename VectorizedArrayType >
Base< dim, VectorType, VectorizedArrayType >::size_type MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::m ( ) const
inherited

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

Definition at line 1226 of file operators.h.

◆ n()

template<int dim, typename VectorType , typename VectorizedArrayType >
Base< dim, VectorType, VectorizedArrayType >::size_type MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::n ( ) const
inherited

Return the dimension of the domain space.

Definition at line 1240 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
inherited

vmult operator for interface.

Definition at line 1622 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
inherited

vmult operator for interface.

Definition at line 1676 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
inherited

Matrix-vector multiplication.

Definition at line 1461 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
inherited

Transpose matrix-vector multiplication.

Definition at line 1717 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
inherited

Adding Matrix-vector multiplication.

Definition at line 1474 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
inherited

Adding transpose matrix-vector multiplication.

Definition at line 1485 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
inherited

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 1264 of file operators.h.

◆ memory_consumption()

template<int dim, typename VectorType , typename VectorizedArrayType >
std::size_t MatrixFreeOperators::Base< dim, VectorType, VectorizedArrayType >::memory_consumption ( ) const
virtualinherited

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

Definition at line 1731 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
inherited

A wrapper for initialize_dof_vector() of MatrixFree object.

Definition at line 1278 of file operators.h.

◆ 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 ( ) const
inherited

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

Definition at line 1745 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 ( ) const
inherited

Get read access to the inverse diagonal of this operator.

Definition at line 1754 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 ( ) const
inherited

Get read access to the diagonal of this operator.

Definition at line 1767 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
inherited

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 1789 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
protectedinherited

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

Definition at line 1538 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
protectedinherited

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

Definition at line 1588 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
protectedinherited

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

Definition at line 1442 of file operators.h.

◆ Tapply_add()

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

Apply transpose operator to src and add result in dst.

Default implementation is to call apply_add().

Definition at line 1778 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
privateinherited

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

Definition at line 1568 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
privateinherited

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 1496 of file operators.h.

◆ n_subscriptions()

unsigned int EnableObserverPointer::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 339 of file enable_observer_pointer.h.

◆ list_subscribers() [1/2]

template<typename StreamType >
void EnableObserverPointer::list_subscribers ( StreamType &  stream) const
inlineinherited

List the subscribers to the input stream.

Definition at line 356 of file enable_observer_pointer.h.

◆ list_subscribers() [2/2]

void EnableObserverPointer::list_subscribers ( ) const
inherited

List the subscribers to deallog.

Definition at line 199 of file enable_observer_pointer.cc.

◆ serialize()

template<class Archive >
void EnableObserverPointer::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 348 of file enable_observer_pointer.h.

◆ subscribe()

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

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

Definition at line 131 of file enable_observer_pointer.cc.

◆ unsubscribe()

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

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 151 of file enable_observer_pointer.cc.

◆ check_no_subscribers()

void EnableObserverPointer::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 enable_observer_pointer.cc.

Member Data Documentation

◆ scalar_coefficient

template<int dim, int fe_degree, int n_q_points_1d = fe_degree + 1, int n_components = 1, typename VectorType = LinearAlgebra::distributed::Vector<double>, typename VectorizedArrayType = VectorizedArray<typename VectorType::value_type>>
std::shared_ptr<Table<2, VectorizedArrayType> > MatrixFreeOperators::LaplaceOperator< dim, fe_degree, n_q_points_1d, n_components, VectorType, VectorizedArrayType >::scalar_coefficient
private

User-provided heterogeneity coefficient.

Definition at line 1013 of file operators.h.

◆ 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
protectedinherited

MatrixFree object to be used with this operator.

Definition at line 435 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
protectedinherited

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

Definition at line 441 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
protectedinherited

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

Definition at line 447 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
protectedinherited

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

Definition at line 453 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
protectedinherited

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

Definition at line 459 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
privateinherited

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

Definition at line 465 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
mutableprivateinherited

Auxiliary vector.

Definition at line 471 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
privateinherited

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

Definition at line 477 of file operators.h.

◆ counter

std::atomic<unsigned int> EnableObserverPointer::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 212 of file enable_observer_pointer.h.

◆ counter_map

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

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

Definition at line 218 of file enable_observer_pointer.h.

◆ validity_pointers

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

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

Definition at line 234 of file enable_observer_pointer.h.

◆ object_info

const std::type_info* EnableObserverPointer::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 242 of file enable_observer_pointer.h.

◆ mutex

std::mutex EnableObserverPointer::mutex
staticprivateinherited

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


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