<commit_before>// ---------------------------------------------------------------------
//
// Copyright (C) 1998 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------

#ifndef dealii__matrix_tools_h
#define dealii__matrix_tools_h


#include <deal.II/base/config.h>
#include <deal.II/base/function.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/thread_management.h>
#include <deal.II/lac/constraint_matrix.h>
#include <deal.II/dofs/function_map.h>

#include <map>

#ifdef DEAL_II_WITH_PETSC
#  include <petscsys.h>
#endif

DEAL_II_NAMESPACE_OPEN


// forward declarations
template <int dim> class Quadrature;


template<typename number> class Vector;
template<typename number> class FullMatrix;
template<typename number> class SparseMatrix;

template <typename number> class BlockSparseMatrix;
template <typename Number> class BlockVector;

template <int dim, int spacedim> class Mapping;
template <int dim, int spacedim> class DoFHandler;

namespace hp
{
  template <int> class QCollection;
  template <int, int> class MappingCollection;
  template <int, int> class DoFHandler;
}


#ifdef DEAL_II_WITH_PETSC
namespace PETScWrappers
{
  class SparseMatrix;
  class Vector;
  namespace MPI
  {
    class SparseMatrix;
    class BlockSparseMatrix;
    class Vector;
    class BlockVector;
  }
}
#endif

#ifdef DEAL_II_WITH_TRILINOS
namespace TrilinosWrappers
{
  class SparseMatrix;
  class Vector;
  class BlockSparseMatrix;
  class BlockVector;
  namespace MPI
  {
    class Vector;
    class BlockVector;
  }
}
#endif


/**
 * This namespace provides functions that assemble certain standard matrices
 * for a given triangulation, using a given finite element, a given mapping
 * and a quadrature formula.
 *
 *
 * <h3>Conventions for all functions</h3>
 *
 * There exist two versions of almost all functions, one that takes an
 * explicit Mapping argument and one that does not. The second one generally
 * calls the first with an implicit $Q_1$ argument (i.e., with an argument of
 * kind MappingQGeneric(1)). If your intend your code to use a different
 * mapping than a (bi-/tri-)linear one, then you need to call the functions
 * <b>with</b> mapping argument should be used.
 *
 * All functions take a sparse matrix object to hold the matrix to be created.
 * The functions assume that the matrix is initialized with a sparsity pattern
 * (SparsityPattern) corresponding to the given degree of freedom handler,
 * i.e. the sparsity structure is already as needed. You can do this by
 * calling the DoFTools::make_sparsity_pattern() function.
 *
 * Furthermore it is assumed that no relevant data is in the matrix. Some
 * entries will be overwritten and some others will contain invalid data if
 * the matrix wasn't empty before. Therefore you may want to clear the matrix
 * before assemblage.
 *
 * By default, all created matrices are `raw': they are not condensed, i.e.
 * hanging nodes are not eliminated. The reason is that you may want to add
 * several matrices and could then condense afterwards only once, instead of
 * for every matrix. To actually do computations with these matrices, you have
 * to condense the matrix using the ConstraintMatrix::condense function; you
 * also have to condense the right hand side accordingly and distribute the
 * solution afterwards. Alternatively, you can give an optional argument
 * ConstraintMatrix that writes cell matrix (and vector) entries with
 * distribute_local_to_global into the global matrix and vector. This way,
 * adding several matrices from different sources is more complicated and you
 * should make sure that you do not mix different ways of applying
 * constraints. Particular caution is necessary when the given constraint
 * matrix contains inhomogeneous constraints: In that case, the matrix
 * assembled this way must be the only matrix (or you need to assemble the
 * <b>same</b> right hand side for <b>every</b> matrix you generate and add
 * together).
 *
 * If you want to use boundary conditions with the matrices generated by the
 * functions of this namespace in addition to the ones in a possible
 * constraint matrix, you have to use a function like
 * <tt>ProblemBase<>::apply_dirichlet_bc</tt> to matrix and right hand side.
 *
 *
 * <h3>Supported matrices</h3>
 *
 * At present there are functions to create the following matrices:
 * <ul>
 * <li> @p create_mass_matrix: create the matrix with entries $m_{ij} =
 * \int_\Omega \phi_i(x) \phi_j(x) dx$ by numerical quadrature. Here, the
 * $\phi_i$ are the basis functions of the finite element space given.
 *
 * A coefficient may be given to evaluate $m_{ij} = \int_\Omega a(x) \phi_i(x)
 * \phi_j(x) dx$ instead.
 *
 * <li> @p create_laplace_matrix: create the matrix with entries $a_{ij} =<commit_msg>Remove a ProblemBase doc reference.<commit_after>// ---------------------------------------------------------------------
//
// Copyright (C) 1998 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------

#ifndef dealii__matrix_tools_h
#define dealii__matrix_tools_h


#include <deal.II/base/config.h>
#include <deal.II/base/function.h>
#include <deal.II/base/exceptions.h>
#include <deal.II/base/thread_management.h>
#include <deal.II/lac/constraint_matrix.h>
#include <deal.II/dofs/function_map.h>

#include <map>

#ifdef DEAL_II_WITH_PETSC
#  include <petscsys.h>
#endif

DEAL_II_NAMESPACE_OPEN


// forward declarations
template <int dim> class Quadrature;


template<typename number> class Vector;
template<typename number> class FullMatrix;
template<typename number> class SparseMatrix;

template <typename number> class BlockSparseMatrix;
template <typename Number> class BlockVector;

template <int dim, int spacedim> class Mapping;
template <int dim, int spacedim> class DoFHandler;

namespace hp
{
  template <int> class QCollection;
  template <int, int> class MappingCollection;
  template <int, int> class DoFHandler;
}


#ifdef DEAL_II_WITH_PETSC
namespace PETScWrappers
{
  class SparseMatrix;
  class Vector;
  namespace MPI
  {
    class SparseMatrix;
    class BlockSparseMatrix;
    class Vector;
    class BlockVector;
  }
}
#endif

#ifdef DEAL_II_WITH_TRILINOS
namespace TrilinosWrappers
{
  class SparseMatrix;
  class Vector;
  class BlockSparseMatrix;
  class BlockVector;
  namespace MPI
  {
    class Vector;
    class BlockVector;
  }
}
#endif


/**
 * This namespace provides functions that assemble certain standard matrices
 * for a given triangulation, using a given finite element, a given mapping
 * and a quadrature formula.
 *
 *
 * <h3>Conventions for all functions</h3>
 *
 * There exist two versions of almost all functions, one that takes an
 * explicit Mapping argument and one that does not. The second one generally
 * calls the first with an implicit $Q_1$ argument (i.e., with an argument of
 * kind MappingQGeneric(1)). If your intend your code to use a different
 * mapping than a (bi-/tri-)linear one, then you need to call the functions
 * <b>with</b> mapping argument should be used.
 *
 * All functions take a sparse matrix object to hold the matrix to be created.
 * The functions assume that the matrix is initialized with a sparsity pattern
 * (SparsityPattern) corresponding to the given degree of freedom handler,
 * i.e. the sparsity structure is already as needed. You can do this by
 * calling the DoFTools::make_sparsity_pattern() function.
 *
 * Furthermore it is assumed that no relevant data is in the matrix. Some
 * entries will be overwritten and some others will contain invalid data if
 * the matrix wasn't empty before. Therefore you may want to clear the matrix
 * before assemblage.
 *
 * By default, all created matrices are `raw': they are not condensed, i.e.
 * hanging nodes are not eliminated. The reason is that you may want to add
 * several matrices and could then condense afterwards only once, instead of
 * for every matrix. To actually do computations with these matrices, you have
 * to condense the matrix using the ConstraintMatrix::condense function; you
 * also have to condense the right hand side accordingly and distribute the
 * solution afterwards. Alternatively, you can give an optional argument
 * ConstraintMatrix that writes cell matrix (and vector) entries with
 * distribute_local_to_global into the global matrix and vector. This way,
 * adding several matrices from different sources is more complicated and you
 * should make sure that you do not mix different ways of applying
 * constraints. Particular caution is necessary when the given constraint
 * matrix contains inhomogeneous constraints: In that case, the matrix
 * assembled this way must be the only matrix (or you need to assemble the
 * <b>same</b> right hand side for <b>every</b> matrix you generate and add
 * together).
 *
 * If you want to use boundary conditions with the matrices generated by the
 * functions of this namespace in addition to the ones in a possible
 * constraint matrix, you have to use a function like
 * <tt>apply_boundary_values</tt> with the matrix, solution, and right hand
 * side.
 *
 *
 * <h3>Supported matrices</h3>
 *
 * At present there are functions to create the following matrices:
 * <ul>
 * <li> @p create_mass_matrix: create the matrix with entries $m_{ij} =
 * \int_\Omega \phi_i(x) \phi_j(x) dx$ by numerical quadrature. Here, the
 * $\phi_i$ are the basis functions of the finite element space given.
 *
 * A coefficient may be given to evaluate $m_{ij} = \int_\Omega a(x) \phi_i(x)
 * \phi_j(x) dx$ instead.
 *
 * <li> @p create_laplace_matrix: create the matrix with entries $a_{ij} =
{'fraction_non_alphanumeric': 0.09844461305007587, 'fraction_numerical': 0.0030349013657056147, 'mean_word_length': 3.633128295254833, 'pattern_counts': {'":': 0, '<': 72, '<?xml version=': 0, '>': 72, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7645543', 'n_tokens_mistral': 2918, 'n_tokens_neox': 2830, 'n_words': 1328}