deal.II version 9.7.1
\(\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
matrix_creator.h File Reference
#include <deal.II/base/config.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/function.h>
#include <deal.II/lac/affine_constraints.h>
#include <map>
#include <petscsys.h>

Go to the source code of this file.

Functions

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const hp::MappingCollection< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const hp::MappingCollection< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix (const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim - 1 > &q, SparseMatrix< number > &matrix, const std::map< types::boundary_id, const Function< spacedim, number > * > &boundary_functions, Vector< number > &rhs_vector, std::vector< types::global_dof_index > &dof_to_boundary_mapping, const Function< spacedim, number > *const weight=0, std::vector< unsigned int > component_mapping={})
template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix (const DoFHandler< dim, spacedim > &dof, const Quadrature< dim - 1 > &q, SparseMatrix< number > &matrix, const std::map< types::boundary_id, const Function< spacedim, number > * > &boundary_functions, Vector< number > &rhs_vector, std::vector< types::global_dof_index > &dof_to_boundary_mapping, const Function< spacedim, number > *const a=nullptr, std::vector< unsigned int > component_mapping={})
template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix (const hp::MappingCollection< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim - 1 > &q, SparseMatrix< number > &matrix, const std::map< types::boundary_id, const Function< spacedim, number > * > &boundary_functions, Vector< number > &rhs_vector, std::vector< types::global_dof_index > &dof_to_boundary_mapping, const Function< spacedim, number > *const a=nullptr, std::vector< unsigned int > component_mapping={})
template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix (const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim - 1 > &q, SparseMatrix< number > &matrix, const std::map< types::boundary_id, const Function< spacedim, number > * > &boundary_functions, Vector< number > &rhs_vector, std::vector< types::global_dof_index > &dof_to_boundary_mapping, const Function< spacedim, number > *const a=nullptr, std::vector< unsigned int > component_mapping={})
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const hp::MappingCollection< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const hp::MappingCollection< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix (const DoFHandler< dim, spacedim > &dof, const hp::QCollection< dim > &q, MatrixType &matrix, const Function< spacedim, typename MatrixType::value_type > &rhs, Vector< typename MatrixType::value_type > &rhs_vector, const Function< spacedim, typename MatrixType::value_type > *const a=nullptr, const AffineConstraints< typename MatrixType::value_type > &constraints=AffineConstraints< typename MatrixType::value_type >())
static ::ExceptionBaseExcComponentMismatch ()

Function Documentation

◆ create_mass_matrix() [1/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Call the create_mass_matrix() function, see above, with mapping=MappingQ<dim>(1).

◆ create_mass_matrix() [2/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const Mapping< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Assemble the mass matrix and a right hand side vector. If no coefficient is given (i.e., if the pointer to a function object is zero as it is by default), the coefficient is taken as being constant and equal to one. In case you want to specify constraints and use the default argument for the coefficient you have to specify the (unused) coefficient argument as (const Function <spacedim,number> *const)nullptr.

If the library is configured to use multithreading, this function works in parallel.

The optional argument constraints allows to apply constraints on the resulting matrix directly. Note, however, that this becomes difficult when you have inhomogeneous constraints and later want to add several such matrices, for example in time dependent settings such as the main loop of step-26.

See the general documentation of this namespace for more information.

◆ create_mass_matrix() [3/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Call the create_mass_matrix() function, see above, with mapping=MappingQ<dim>(1).

◆ create_mass_matrix() [4/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const hp::MappingCollection< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Same function as above, but for hp-objects.

◆ create_mass_matrix() [5/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Same function as above, but for hp-objects.

◆ create_mass_matrix() [6/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const hp::MappingCollection< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Same function as above, but for hp-objects.

◆ create_mass_matrix() [7/7]

template<int dim, int spacedim, typename MatrixType>
void create_mass_matrix ( const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Same function as above, but for hp-objects.

◆ create_boundary_mass_matrix() [1/4]

template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix ( const Mapping< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim - 1 > & q,
SparseMatrix< number > & matrix,
const std::map< types::boundary_id, const Function< spacedim, number > * > & boundary_functions,
Vector< number > & rhs_vector,
std::vector< types::global_dof_index > & dof_to_boundary_mapping,
const Function< spacedim, number > *const weight = 0,
std::vector< unsigned int > component_mapping = {} )

Assemble the mass matrix and a right hand side vector along the boundary.

The matrix is assumed to already be initialized with a suiting sparsity pattern (the DoFHandler provides an appropriate function).

If the library is configured to use multithreading, this function works in parallel.

  • weight: an optional weight for the computation of the mass matrix. If no weight is given, it is set to one. In case you want to specify component_mapping and use the default argument for the coefficient you have to specify the (unused) coefficient argument as (const Function <spacedim,number> *const)nullptr.
  • component_mapping: if the components in boundary_functions and dof do not coincide, this vector allows them to be remapped. If the vector is not empty, it has to have one entry for each component in dof. This entry is the component number in boundary_functions that should be used for this component in dof. By default, no remapping is applied.
Todo
This function does not work for finite elements with cell-dependent shape functions.

◆ create_boundary_mass_matrix() [2/4]

template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix ( const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim - 1 > & q,
SparseMatrix< number > & matrix,
const std::map< types::boundary_id, const Function< spacedim, number > * > & boundary_functions,
Vector< number > & rhs_vector,
std::vector< types::global_dof_index > & dof_to_boundary_mapping,
const Function< spacedim, number > *const a = nullptr,
std::vector< unsigned int > component_mapping = {} )

Call the create_boundary_mass_matrix() function, see above, with mapping=MappingQ<dim>(1).

◆ create_boundary_mass_matrix() [3/4]

template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix ( const hp::MappingCollection< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim - 1 > & q,
SparseMatrix< number > & matrix,
const std::map< types::boundary_id, const Function< spacedim, number > * > & boundary_functions,
Vector< number > & rhs_vector,
std::vector< types::global_dof_index > & dof_to_boundary_mapping,
const Function< spacedim, number > *const a = nullptr,
std::vector< unsigned int > component_mapping = {} )

Same function as above, but for hp-objects.

◆ create_boundary_mass_matrix() [4/4]

template<int dim, int spacedim, typename number>
void create_boundary_mass_matrix ( const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim - 1 > & q,
SparseMatrix< number > & matrix,
const std::map< types::boundary_id, const Function< spacedim, number > * > & boundary_functions,
Vector< number > & rhs_vector,
std::vector< types::global_dof_index > & dof_to_boundary_mapping,
const Function< spacedim, number > *const a = nullptr,
std::vector< unsigned int > component_mapping = {} )

Same function as above, but for hp-objects.

◆ create_laplace_matrix() [1/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const Mapping< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Assemble the Laplace matrix. If no coefficient is given (i.e., if the pointer to a function object is zero as it is by default), the coefficient is taken as being constant and equal to one. In case you want to specify constraints and use the default argument for the coefficient you have to specify the (unused) coefficient argument as (const Function<spacedim> *const)nullptr.

If the library is configured to use multithreading, this function works in parallel.

The optional argument constraints allows to apply constraints on the resulting matrix directly. Note, however, that this becomes difficult when you have inhomogeneous constraints and later want to add several such matrices, for example in time dependent settings such as the main loop of step-26.

See the general documentation of this namespace for more information.

◆ create_laplace_matrix() [2/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Call the create_laplace_matrix() function, see above, with mapping=MappingQ<dim>(1).

◆ create_laplace_matrix() [3/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const Mapping< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Assemble the Laplace matrix and a right hand side vector. If no coefficient is given, it is assumed to be constant one. In case you want to specify constraints and use the default argument for the coefficient you have to specify the (unused) coefficient argument as (const Function<spacedim> *const)nullptr.

If the library is configured to use multithreading, this function works in parallel.

The optional argument constraints allows to apply constraints on the resulting matrix directly. Note, however, that this becomes difficult when you have inhomogeneous constraints and later want to add several such matrices, for example in time dependent settings such as the main loop of step-26.

See the general documentation of this namespace for more information.

◆ create_laplace_matrix() [4/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const DoFHandler< dim, spacedim > & dof,
const Quadrature< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Call the create_laplace_matrix() function, see above, with mapping=MappingQ<dim>(1).

◆ create_laplace_matrix() [5/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const hp::MappingCollection< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Like the functions above, but for hp-objects.

◆ create_laplace_matrix() [6/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Like the functions above, but for hp-objects.

◆ create_laplace_matrix() [7/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const hp::MappingCollection< dim, spacedim > & mapping,
const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Like the functions above, but for hp-objects.

◆ create_laplace_matrix() [8/8]

template<int dim, int spacedim, typename MatrixType>
void create_laplace_matrix ( const DoFHandler< dim, spacedim > & dof,
const hp::QCollection< dim > & q,
MatrixType & matrix,
const Function< spacedim, typename MatrixType::value_type > & rhs,
Vector< typename MatrixType::value_type > & rhs_vector,
const Function< spacedim, typename MatrixType::value_type > *const a = nullptr,
const AffineConstraints< typename MatrixType::value_type > & constraints = AffineConstraints< typename MatrixType::value_type >() )

Like the functions above, but for hp-objects.