Reference documentation for deal.II version GIT 67d6815257 2023-03-20 17:20:01+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\}}\)
matrix_creator.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2021 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_matrix_creator_h
17 #define dealii_matrix_creator_h
18 
19 
20 #include <deal.II/base/config.h>
21 
23 #include <deal.II/base/function.h>
24 
26 
27 #include <map>
28 
29 #ifdef DEAL_II_WITH_PETSC
30 # include <petscsys.h>
31 #endif
32 
34 
35 
36 // forward declarations
37 #ifndef DOXYGEN
38 template <int dim>
39 class Quadrature;
40 
41 
42 template <typename number>
43 class Vector;
44 template <typename number>
45 class SparseMatrix;
46 
47 template <int dim, int spacedim>
48 class Mapping;
49 template <int dim, int spacedim>
50 DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>))
51 class DoFHandler;
52 
53 namespace hp
54 {
55  template <int>
56  class QCollection;
57  template <int, int>
58  class MappingCollection;
59 } // namespace hp
60 
61 #endif
62 
63 
196 namespace MatrixCreator
197 {
217  template <int dim, int spacedim, typename SparseMatrixType>
218  void
220  const Mapping<dim, spacedim> & mapping,
221  const DoFHandler<dim, spacedim> &dof,
222  const Quadrature<dim> & q,
223  SparseMatrixType & matrix,
225  nullptr,
228 
233  template <int dim, int spacedim, typename SparseMatrixType>
234  void
236  const DoFHandler<dim, spacedim> &dof,
237  const Quadrature<dim> & q,
238  SparseMatrixType & matrix,
240  nullptr,
243 
263  template <int dim, int spacedim, typename SparseMatrixType>
264  void
266  const Mapping<dim, spacedim> & mapping,
267  const DoFHandler<dim, spacedim> & dof,
268  const Quadrature<dim> & q,
269  SparseMatrixType & matrix,
273  nullptr,
276 
281  template <int dim, int spacedim, typename SparseMatrixType>
282  void
284  const DoFHandler<dim, spacedim> & dof,
285  const Quadrature<dim> & q,
286  SparseMatrixType & matrix,
290  nullptr,
293 
297  template <int dim, int spacedim, typename SparseMatrixType>
298  void
301  const DoFHandler<dim, spacedim> & dof,
302  const hp::QCollection<dim> & q,
303  SparseMatrixType & matrix,
305  nullptr,
308 
312  template <int dim, int spacedim, typename SparseMatrixType>
313  void
315  const DoFHandler<dim, spacedim> &dof,
316  const hp::QCollection<dim> & q,
317  SparseMatrixType & matrix,
319  nullptr,
322 
326  template <int dim, int spacedim, typename SparseMatrixType>
327  void
329  const hp::MappingCollection<dim, spacedim> & mapping,
330  const DoFHandler<dim, spacedim> & dof,
331  const hp::QCollection<dim> & q,
332  SparseMatrixType & matrix,
336  nullptr,
339 
343  template <int dim, int spacedim, typename SparseMatrixType>
344  void
346  const DoFHandler<dim, spacedim> & dof,
347  const hp::QCollection<dim> & q,
348  SparseMatrixType & matrix,
352  nullptr,
355 
356 
382  template <int dim, int spacedim, typename number>
383  void
385  const Mapping<dim, spacedim> & mapping,
386  const DoFHandler<dim, spacedim> &dof,
387  const Quadrature<dim - 1> & q,
389  const std::map<types::boundary_id, const Function<spacedim, number> *>
390  & boundary_functions,
391  Vector<number> & rhs_vector,
392  std::vector<types::global_dof_index> & dof_to_boundary_mapping,
393  const Function<spacedim, number> *const weight = 0,
394  std::vector<unsigned int> component_mapping = {});
395 
396 
401  template <int dim, int spacedim, typename number>
402  void
404  const DoFHandler<dim, spacedim> &dof,
405  const Quadrature<dim - 1> & q,
407  const std::map<types::boundary_id, const Function<spacedim, number> *>
408  & boundary_functions,
409  Vector<number> & rhs_vector,
410  std::vector<types::global_dof_index> & dof_to_boundary_mapping,
411  const Function<spacedim, number> *const a = nullptr,
412  std::vector<unsigned int> component_mapping = {});
413 
417  template <int dim, int spacedim, typename number>
418  void
421  const DoFHandler<dim, spacedim> & dof,
422  const hp::QCollection<dim - 1> & q,
424  const std::map<types::boundary_id, const Function<spacedim, number> *>
425  & boundary_functions,
426  Vector<number> & rhs_vector,
427  std::vector<types::global_dof_index> & dof_to_boundary_mapping,
428  const Function<spacedim, number> *const a = nullptr,
429  std::vector<unsigned int> component_mapping = {});
430 
434  template <int dim, int spacedim, typename number>
435  void
437  const DoFHandler<dim, spacedim> &dof,
438  const hp::QCollection<dim - 1> & q,
440  const std::map<types::boundary_id, const Function<spacedim, number> *>
441  & boundary_functions,
442  Vector<number> & rhs_vector,
443  std::vector<types::global_dof_index> & dof_to_boundary_mapping,
444  const Function<spacedim, number> *const a = nullptr,
445  std::vector<unsigned int> component_mapping = {});
446 
466  template <int dim, int spacedim, typename SparseMatrixType>
467  void
469  const Mapping<dim, spacedim> & mapping,
470  const DoFHandler<dim, spacedim> &dof,
471  const Quadrature<dim> & q,
472  SparseMatrixType & matrix,
474  nullptr,
477 
482  template <int dim, int spacedim, typename SparseMatrixType>
483  void
485  const DoFHandler<dim, spacedim> &dof,
486  const Quadrature<dim> & q,
487  SparseMatrixType & matrix,
489  nullptr,
492 
511  template <int dim, int spacedim, typename SparseMatrixType>
512  void
514  const Mapping<dim, spacedim> & mapping,
515  const DoFHandler<dim, spacedim> & dof,
516  const Quadrature<dim> & q,
517  SparseMatrixType & matrix,
521  nullptr,
524 
529  template <int dim, int spacedim, typename SparseMatrixType>
530  void
532  const DoFHandler<dim, spacedim> & dof,
533  const Quadrature<dim> & q,
534  SparseMatrixType & matrix,
538  nullptr,
541 
545  template <int dim, int spacedim, typename SparseMatrixType>
546  void
549  const DoFHandler<dim, spacedim> & dof,
550  const hp::QCollection<dim> & q,
551  SparseMatrixType & matrix,
553  nullptr,
556 
560  template <int dim, int spacedim, typename SparseMatrixType>
561  void
563  const DoFHandler<dim, spacedim> &dof,
564  const hp::QCollection<dim> & q,
565  SparseMatrixType & matrix,
567  nullptr,
570 
574  template <int dim, int spacedim, typename SparseMatrixType>
575  void
577  const hp::MappingCollection<dim, spacedim> & mapping,
578  const DoFHandler<dim, spacedim> & dof,
579  const hp::QCollection<dim> & q,
580  SparseMatrixType & matrix,
584  nullptr,
587 
591  template <int dim, int spacedim, typename SparseMatrixType>
592  void
594  const DoFHandler<dim, spacedim> & dof,
595  const hp::QCollection<dim> & q,
596  SparseMatrixType & matrix,
600  nullptr,
603 
608  "You are providing either a right hand side function or a "
609  "coefficient with a number of vector components that is "
610  "inconsistent with the rest of the arguments. If you do "
611  "provide a coefficient or right hand side function, then "
612  "it either needs to have as many components as the finite "
613  "element in use, or only a single vector component. In "
614  "the latter case, the same value will be taken for "
615  "each vector component of the finite element.");
616 } // namespace MatrixCreator
617 
618 
620 
621 #endif
Abstract base class for mapping classes.
Definition: mapping.h:314
Definition: vector.h:109
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:474
#define DEAL_II_CXX20_REQUIRES(condition)
Definition: config.h:162
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:475
static ::ExceptionBase & ExcComponentMismatch()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:488
@ matrix
Contents is actually a matrix.
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={})
void create_mass_matrix(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, SparseMatrixType &matrix, const Function< spacedim, typename SparseMatrixType::value_type > *const a=nullptr, const AffineConstraints< typename SparseMatrixType::value_type > &constraints=AffineConstraints< typename SparseMatrixType::value_type >())
void create_laplace_matrix(const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof, const Quadrature< dim > &q, SparseMatrixType &matrix, const Function< spacedim, typename SparseMatrixType::value_type > *const a=nullptr, const AffineConstraints< typename SparseMatrixType::value_type > &constraints=AffineConstraints< typename SparseMatrixType::value_type >())
Definition: hp.h:118
unsigned int boundary_id
Definition: types.h:141