| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2020 - 2025 by the deal.II authors |
| 5 |
// |
| 6 |
// This file is part of the deal.II library. |
| 7 |
// |
| 8 |
// Part of the source code is dual licensed under Apache-2.0 WITH |
| 9 |
// LLVM-exception OR LGPL-2.1-or-later. Detailed license information |
| 10 |
// governing the source code and code contributions can be found in |
| 11 |
// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. |
| 12 |
// |
| 13 |
// ------------------------------------------------------------------------ |
| 14 |
|
| 15 |
#ifndef dealii_vector_tools_rhs_h |
| 16 |
#define dealii_vector_tools_rhs_h |
| 17 |
|
| 18 |
#include <deal.II/base/config.h> |
| 19 |
|
| 20 |
#include <deal.II/base/template_constraints.h> |
| 21 |
#include <deal.II/base/types.h> |
| 22 |
|
| 23 |
#include <set> |
| 24 |
|
| 25 |
DEAL_II_NAMESPACE_OPEN |
| 26 |
|
| 27 |
template <typename number> |
| 28 |
class AffineConstraints; |
| 29 |
|
| 30 |
template <int dim, int spacedim> |
| 31 |
DEAL_II_CXX20_REQUIRES((concepts::is_valid_dim_spacedim<dim, spacedim>)) |
| 32 |
class DoFHandler; |
| 33 |
|
| 34 |
template <int dim, typename Number> |
| 35 |
class Function; |
| 36 |
template <int dim, int spacedim> |
| 37 |
class Mapping; |
| 38 |
template <int dim> |
| 39 |
class Quadrature; |
| 40 |
namespace hp |
| 41 |
{ |
| 42 |
template <int dim, int spacedim> |
| 43 |
class MappingCollection; |
| 44 |
template <int dim> |
| 45 |
class QCollection; |
| 46 |
} // namespace hp |
| 47 |
|
| 48 |
|
| 49 |
namespace VectorTools |
| 50 |
{ |
| 51 |
/** |
| 52 |
* @name Assembling of right hand sides |
| 53 |
*/ |
| 54 |
/** @{ */ |
| 55 |
|
| 56 |
/** |
| 57 |
* Create a right hand side vector. Prior content of the given @p rhs_vector |
| 58 |
* vector is deleted. |
| 59 |
* |
| 60 |
* See the general documentation of this namespace for further information. |
| 61 |
* |
| 62 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 63 |
*/ |
| 64 |
template <int dim, int spacedim, typename VectorType> |
| 65 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 66 |
void create_right_hand_side( |
| 67 |
const Mapping<dim, spacedim> &mapping, |
| 68 |
const DoFHandler<dim, spacedim> &dof, |
| 69 |
const Quadrature<dim> &q, |
| 70 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 71 |
VectorType &rhs_vector, |
| 72 |
const AffineConstraints<typename VectorType::value_type> &constraints = |
| 73 |
AffineConstraints<typename VectorType::value_type>()); |
| 74 |
|
| 75 |
/** |
| 76 |
* Call the create_right_hand_side() function, see above, with |
| 77 |
* <tt>mapping=MappingQ@<dim@>(1)</tt>. |
| 78 |
* |
| 79 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 80 |
*/ |
| 81 |
template <int dim, int spacedim, typename VectorType> |
| 82 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 83 |
void create_right_hand_side( |
| 84 |
const DoFHandler<dim, spacedim> &dof, |
| 85 |
const Quadrature<dim> &q, |
| 86 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 87 |
VectorType &rhs_vector, |
| 88 |
const AffineConstraints<typename VectorType::value_type> &constraints = |
| 89 |
AffineConstraints<typename VectorType::value_type>()); |
| 90 |
|
| 91 |
/** |
| 92 |
* Like the previous set of functions, but for hp-objects. |
| 93 |
* |
| 94 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 95 |
*/ |
| 96 |
template <int dim, int spacedim, typename VectorType> |
| 97 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 98 |
void create_right_hand_side( |
| 99 |
const hp::MappingCollection<dim, spacedim> &mapping, |
| 100 |
const DoFHandler<dim, spacedim> &dof, |
| 101 |
const hp::QCollection<dim> &q, |
| 102 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 103 |
VectorType &rhs_vector, |
| 104 |
const AffineConstraints<typename VectorType::value_type> &constraints = |
| 105 |
AffineConstraints<typename VectorType::value_type>()); |
| 106 |
|
| 107 |
/** |
| 108 |
* Like the previous set of functions, but for hp-objects. |
| 109 |
* |
| 110 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 111 |
*/ |
| 112 |
template <int dim, int spacedim, typename VectorType> |
| 113 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 114 |
void create_right_hand_side( |
| 115 |
const DoFHandler<dim, spacedim> &dof, |
| 116 |
const hp::QCollection<dim> &q, |
| 117 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 118 |
VectorType &rhs_vector, |
| 119 |
const AffineConstraints<typename VectorType::value_type> &constraints = |
| 120 |
AffineConstraints<typename VectorType::value_type>()); |
| 121 |
|
| 122 |
/** |
| 123 |
* Create a right hand side vector from boundary forces. Prior content of |
| 124 |
* the given @p rhs_vector vector is deleted. |
| 125 |
* |
| 126 |
* See the general documentation of this namespace for further information. |
| 127 |
* |
| 128 |
* @see |
| 129 |
* @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" |
| 130 |
* |
| 131 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 132 |
*/ |
| 133 |
template <int dim, int spacedim, typename VectorType> |
| 134 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 135 |
void create_boundary_right_hand_side( |
| 136 |
const Mapping<dim, spacedim> &mapping, |
| 137 |
const DoFHandler<dim, spacedim> &dof, |
| 138 |
const Quadrature<dim - 1> &q, |
| 139 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 140 |
VectorType &rhs_vector, |
| 141 |
const std::set<types::boundary_id> &boundary_ids = |
| 142 |
std::set<types::boundary_id>()); |
| 143 |
|
| 144 |
/** |
| 145 |
* Call the create_boundary_right_hand_side() function, see above, with |
| 146 |
* <tt>mapping=MappingQ@<dim@>(1)</tt>. |
| 147 |
* |
| 148 |
* @see |
| 149 |
* @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" |
| 150 |
* |
| 151 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 152 |
*/ |
| 153 |
template <int dim, int spacedim, typename VectorType> |
| 154 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 155 |
void create_boundary_right_hand_side( |
| 156 |
const DoFHandler<dim, spacedim> &dof, |
| 157 |
const Quadrature<dim - 1> &q, |
| 158 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 159 |
VectorType &rhs_vector, |
| 160 |
const std::set<types::boundary_id> &boundary_ids = |
| 161 |
std::set<types::boundary_id>()); |
| 162 |
|
| 163 |
/** |
| 164 |
* Same as the set of functions above, but for hp-objects. |
| 165 |
* |
| 166 |
* @see |
| 167 |
* @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" |
| 168 |
* |
| 169 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 170 |
*/ |
| 171 |
template <int dim, int spacedim, typename VectorType> |
| 172 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 173 |
void create_boundary_right_hand_side( |
| 174 |
const hp::MappingCollection<dim, spacedim> &mapping, |
| 175 |
const DoFHandler<dim, spacedim> &dof, |
| 176 |
const hp::QCollection<dim - 1> &q, |
| 177 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 178 |
VectorType &rhs_vector, |
| 179 |
const std::set<types::boundary_id> &boundary_ids = |
| 180 |
std::set<types::boundary_id>()); |
| 181 |
|
| 182 |
/** |
| 183 |
* Call the create_boundary_right_hand_side() function, see above, with a |
| 184 |
* single Q1 mapping as collection. This function therefore will only work |
| 185 |
* if the only active FE index in use is zero. |
| 186 |
* |
| 187 |
* @see |
| 188 |
* @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" |
| 189 |
* |
| 190 |
* @dealiiConceptRequires{concepts::is_writable_dealii_vector_type<VectorType>} |
| 191 |
*/ |
| 192 |
template <int dim, int spacedim, typename VectorType> |
| 193 |
DEAL_II_CXX20_REQUIRES(concepts::is_writable_dealii_vector_type<VectorType>) |
| 194 |
void create_boundary_right_hand_side( |
| 195 |
const DoFHandler<dim, spacedim> &dof, |
| 196 |
const hp::QCollection<dim - 1> &q, |
| 197 |
const Function<spacedim, typename VectorType::value_type> &rhs, |
| 198 |
VectorType &rhs_vector, |
| 199 |
const std::set<types::boundary_id> &boundary_ids = |
| 200 |
std::set<types::boundary_id>()); |
| 201 |
/** @} */ |
| 202 |
} // namespace VectorTools |
| 203 |
|
| 204 |
DEAL_II_NAMESPACE_CLOSE |
| 205 |
|
| 206 |
#endif // dealii_vector_tools_rhs_h |